Repository navigation
Conversation
A declared index name nothing serves used to be treated exactly like a resolver answering null: every declarer was touched. Correct but silent, so a typo cost speed and told nobody. A dispatcher built with requireResolvers refuses such a declaration in add with UnknownIndexError naming the index and the resolvers it does have. The check runs before the entry is re-indexed, so a refusal leaves the dispatcher and the entry's previous indexing untouched. The subscription registry sets the flag from its existing dev gate, so a development build fails at subscribe time while a production build keeps the conservative breadth. A served resolver answering null still touches every declarer (#961).
… from (#1006) Review follow-ups on the unknown-index refusal: - `UnknownIndexError` carries the subscription key, and the registry re-states the refusal with it, so the author is told which query to go and fix rather than only which index name. `createChangeDispatcher` indexes an opaque entry, so the key can only come from the registry. - The refused-declaration rollback in `depend` captures one snapshot instead of six loose locals, and says in the comment why a key-only move restores the claim bookkeeping too. - `UnknownIndexError` is exported: it escapes `subscribe` and `depend`, so a caller opening reads programmatically can catch it. That makes the change a minor bump, not a patch. - The tests assert the error's fields instead of pinning the registry's whole resolver inventory and order into a message regex.
✅ Deploy Preview for ebbjs-www ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
ADR 0006 landed on main (#1027). It makes That supersedes this PR's split (throw in development for unserved names, keep the The valuable parts should move into #1025: |
|
Closing this unmerged rather than rebasing it onto ADR 0006. The branch stays ( Dropped with it: the The one finding that outlived the PR is tracked as #1028: |
Summary
An index name that no resolver serves is now author error, refused where the author wrote it. An index that has a resolver which answers
nullfor a change keeps #961's declarer breadth, untouched.The failure mode, and why this one. The issue left it open (throw vs. a loud one-time diagnostic). Throwing at registration wins because the mistake is made at authoring time and the only person who can fix it is the author, at the line where they wrote the index name. A diagnostic puts the correction behind whoever reads logs later, and a per-subscription warning would need to survive coalescing to honour "one report per offending subscription" — machinery to keep a message nobody is looking for. The cost of throwing is that a shipped app could crash on a name it cannot serve, so the throw is gated on the existing
devWatchdog(): production keeps the conservative breadth rather than failing to open a read. Hand-built dispatchers (tests, the benchmark) pass no flag, so they stay lenient — which is what keeps a test-only dispatcher usable.The check lives in
dispatcher.add, the single seam bothopenanddependroute through, not in each resolver.Two consequences the issue did not anticipate, argued rather than hidden:
relation:typo/typo— the issue's own example — is served, not a typo.relation:*,exists:*andscopeare registered namespace names, so anyrelation:<as>/<type>is answerable. Only a whole-family name (existence:todo/due,relations:…) is catchable today. The tests say so explicitly and use a catchable name at the registry seam; the issue's literal example can only be refused on a hand-built dispatcher with a narrower resolver set. Widening the check to validate<as>/<type>against the schema is a different change — it needs the schema at the dispatcher, which the registry does not pass.dependnow snapshots what the move overwrites and restores it; a refusedopenremoves the entry and marks it terminal.UnknownIndexErroris exported because it escapessubscribeanddepend.Evidence
null— every declarer touched, silent. Covered by the pre-existingtreats a declared index with no resolver as unresolvable, left unchanged and still green.pnpm --filter @ebbjs/client test→ 71 files, 1258 tests pass (was 1251 before this branch). Typecheck clean,pnpm lint0 errors,pnpm fmt:checkclean.packages/client/src/benchmark/replica-read-model.tsnot touched, sopnpm client:benchmarkwas not re-run and its previously reported sections stand.dependency-index.test.ts:refuses a declared index no resolver serves when the resolver set is complete,accepts a declared index a namespace resolver serves,keeps the declarer breadth when a served resolver answers nullsubscriptions.test.ts(subscription registry: an index no resolver serves (#1006)):refuses the declaration in development,keeps what the entry held when a later declaration is refused,leaves no subscription behind when opening is refused,keeps the fallback in a production buildMerge Danger
Door: two-way — additive
requireResolversoption and a new exported error class; no existing signature changed, and the changeset is aminorbump for@ebbjs/clientprecisely because the error is newly exported.Blast Radius: narrow — one dispatcher option, one registry gate, one error type.
Development builds now throw where they previously degraded silently. That is the point, but it can surface a latent typo'd index in an app that has been shipping with one; the message names the index, the known indices, and the subscription key that declared it. A production bundle is unaffected.
Issue #1006 is referenced, not autoclosed.