Skip to content

refactor(#276): extract SchemaCatalogService — phase 4A#289

Merged
BorisTyshkevich merged 1 commit into
mainfrom
refactor/schema-catalog-276
Jul 17, 2026
Merged

refactor(#276): extract SchemaCatalogService — phase 4A#289
BorisTyshkevich merged 1 commit into
mainfrom
refactor/schema-catalog-276

Conversation

@BorisTyshkevich

Copy link
Copy Markdown
Collaborator

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 the schemaError signal exactly as before), lazy column loading (var-strip repaint pulse as a hook), SQL reference/completions assembly + rebuild, and the entity-documentation cache. Constructible without App/AppState/DOM (narrow deps: the five ch-client functions + live ctx provider + 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.completions remain writable through two-way forwarding accessors: tests/e2e/editor-cm6.spec.js:104 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 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.ts passes 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 test passes (the per-file coverage gate is non-negotiable)
  • Tests added/updated in the same change as the code
  • npm run build succeeds (single-file dist/sql.html)
  • Layers kept honest: pure logic in src/core/, network in src/net/ (injected fetch), DOM in src/ui/
  • No new runtime dependency (or it's a deliberate, justified addition — see CONTRIBUTING)
  • README / CHANGELOG.md ([Unreleased]) updated if behavior or the deployed surface changed
  • Reconciled affected tracked work (roadmap Roadmap to 1.0.0 #68, the issue body, ADR/CHANGELOG) if this change reshaped it

🤖 Generated with Claude Code

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>
@BorisTyshkevich
BorisTyshkevich merged commit 5166e0d into main Jul 17, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant