fix(server): say why a storage serve fell back, not just what failed - #1094
Merged
Merged
Conversation
The fallback logged the compiler's error, which names the symbol it could not resolve. That symptom is shared by both reasons a source is missing from the serve shape -- it carries no `#@ persist`, or the freshness gate withheld it -- so "Reference to undefined object 'x'" reads identically whether the model is wrong or the table is merely stale, and neither is recoverable from the package definition after the fact. Both sets are already known at that point. Report them: `shapeSources` is what the shape offered, `staleSources` is what was bound and withheld. A name the query wants that appears in neither is not materialized at all. Signed-off-by: James Estes <james.estes@credibledata.com>
sagarswamirao
approved these changes
Sep 3, 2026
housejester
enabled auto-merge (squash)
September 3, 2026 15:09
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.
When a
storage=query cannot compile against the serve shape, Publisher serves live and logs the compiler's error. That error names the symbol it could not resolve — a symptom shared by the two quite different reasons a source can be absent from the shape:#@ persist, so it was never materializedBoth print
Reference to undefined object 'x'. Nothing downstream distinguishes them, and neither is recoverable from the package definition afterwards — the fresh subset is computed per query.What this changes
Two fields on the existing line. No behaviour change, no new log.
Nothing stale, and the wanted name is in neither set → it is not materialized. The
#@ persistis on a different source than the one being queried.Bound, withheld, serving live because that is what its freshness fallback asks for. Working exactly as configured.
Why it is worth the two fields
Both messages above are real, from one afternoon on one deployment. Two engineers read the first as a serve-path regression and the second as the same bug; they are unrelated, and one of them is not a bug at all. Reaching that took reading the binding set off a live pod and running probe queries against individual sources — the log alone could not separate "the model does not say what you think" from "the table is older than you think".
The sets are free at that point:
serveBindingsis the package's,freshServeBindingswas just computed for the gate.Shape
The set computation is a pure exported function,
serveShapeDiagnostics, rather than inline in the catch — so the tests exercise the code the caller runs instead of a copy of its logic. Both fields are mutation-checked: pinningstaleSourcesto[](the pre-change state) and wideningshapeSourcesto all bindings each turn the same two assertions red.The pair is asserted together in one test on purpose. Either field alone still leaves the two failures indistinguishable, which is the state this replaces.
bun test src/service— 2473 pass, 0 fail.tsc --noEmitandeslintclean.