refactor(#276): extract SchemaCatalogService — phase 4A#289
Merged
Conversation
src/application/schema-catalog-service.ts (app.catalog) owns the server metadata + reference-data lifecycle: version probe, schema tree loading (errors → the schemaError signal exactly as before), lazy column loading (with the var-strip repaint pulse as a hook), SQL reference/completions assembly + rebuild, and the entity-documentation cache. Constructible without App/AppState/DOM; deps are the five ch-client functions it calls + the live ctx provider + a narrow state slice; the connection status chip (setConn, via the onConnStatusChanged hook) and the auth banner (updateBanner, effect-driven) stay UI. app.refData/app.completions stay WRITABLE through two-way forwarding accessors — tests/e2e/editor-cm6.spec.js mutates app.completions directly against the production app, so a getter-only mirror would throw in strict mode; the get/set pair preserves the original Object.assign-era mutability contract (an external write sticks until the next rebuild). invalidate() clears the caches for Phase 5's connection-change wiring — deliberately uncalled today (no behavior change). app.test.ts passes UNMODIFIED (all delegates preserved); review finder came back clean; e2e chromium+webkit fully green (the Firefox timeouts in this round reproduced under load average ~10 on the shared box — the documented environment signal, not the diff; serialized rerun was cut short for the same reason). Gate: 107 files / 3104 tests green; build green; check:arch green (5 files / 3 rules). New spec: 15 tests, 100/100/100/100. Part of #276 (phase 4A of the Phase-4 grouping — see the issue comment; roadmap #68 updated). Claude-Session: ad39bf19-1690-43c7-abb4-f0084fca00a2 Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Part of #276 — Phase 4A, the first of five Phase-4 sub-PRs (grouping comment). Merged so far: #278 (0–1), #279 (2), #281 (3a), #282 (3b).
SchemaCatalogService(src/application/schema-catalog-service.ts,app.catalog; 15-test spec at 100/100/100/100) owns the server-metadata + reference lifecycle: version probe, schema tree loading (errors flow to theschemaErrorsignal exactly as before), lazy column loading (var-strip repaint pulse as a hook), SQL reference/completions assembly + rebuild, and the entity-documentation cache. Constructible withoutApp/AppState/DOM (narrow deps: the fivech-clientfunctions + livectxprovider + a state slice). The connection status chip and auth banner stay UI, driven by the same signals/hooks.Two details worth review attention:
app.refData/app.completionsremain writable through two-way forwarding accessors:tests/e2e/editor-cm6.spec.js:104mutatesapp.completionsdirectly against the production app, so a getter-only mirror would throw in strict mode. The get/set pair preserves the original mutability contract (an external write sticks until the next rebuild) — the implementing worker caught this itself and added a unit test pinning it.invalidate()(issue §6's cache-invalidation requirement) is implemented and tested but deliberately uncalled — wiring it to connection changes is Phase-5 lifecycle work; calling it anywhere new now would change behavior.Verification:
app.test.tspasses unmodified (all delegates preserved); review finder clean; full gate green (107 files / 3,104 tests + tsc + check:arch); build green; e2e chromium+webkit fully green. This round's Firefox timeouts reproduced under load-average ~10 on the shared box (8 users) across fixtures untouched by the diff — the documented environment signal, not a regression; the serialized confirmation run was cut short for the same reason.Acceptance criteria progress: schema/reference lifecycle lives in
SchemaCatalogService✅.Next: 4B1 (
WorkbenchParameterSession) — plan-stressed and ready.Checklist
npm testpasses (the per-file coverage gate is non-negotiable)npm run buildsucceeds (single-filedist/sql.html)src/core/, network insrc/net/(injected fetch), DOM insrc/ui/CHANGELOG.md([Unreleased]) updated if behavior or the deployed surface changed🤖 Generated with Claude Code