fix(runtime): callData('query') fallback serves the caller's query instead of dropping it - #4390
Merged
Merged
Conversation
…stead of dropping it (#4386) The protocol-unavailable fallback passed only { context } to ql.find — the caller's where/orderBy/limit never left the function, and the ENTIRE table came back as an ordinary-looking { records, total }. The sibling get/update/ delete fallbacks all built a proper where; query was the only verb whose fallback forgot the request. Forward the canonical QueryAST keys both possible recipients execute (where/fields/orderBy/limit/offset — engine option bag and raw-driver QueryAST are aligned by design), drop caller-supplied context (server-derived only, matching findData's unconditional delete), and refuse 501 on anything the fallback cannot reproduce without the protocol layer: wire spellings needing fold/lowering (sort/select/skip/populate — folding here would re-implement the protocol's lowering per reader, the #3795 condition) and capabilities a raw driver would silently drop (search/expand). A fallback that cannot reproduce the query's semantics must not pretend to serve it (route-ownership rule 3). Protocol path unchanged. Fixes #4386. Found during the #4371 call-site survey. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 20 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
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.
Fixes #4386 (found during the #4371 call-site survey).
The bug
callData'saction === 'query' || 'find'branch, on the ObjectQL fallback path (protocol service unavailable — lean assemblies, MCP multi-env with a raw driver):ql.find(params.object, qlOpts)whereqlOptsis only{ context }. The caller'swhere/orderBy/limitnever left the function, and the response was an ordinary-looking{ records, total }of the entire table — silently returning more than was asked, plus an unbounded scan. The siblingget/update/deletefallbacks all build a properwhere;querywas the only verb whose fallback forgot the request.The fix
params.queryor the params rest) and both paths serve the same request.where,fields,orderBy,limit,offset. (qlhere is the engine, or on the MCP multi-env path a raw driver reading a QueryAST; the canonical keys are aligned by design. The MCP bridge's ownquerytool constructs exactly these keys.)contextis dropped — server-derived only, matchingfindData's unconditionaldelete options.context.sort/select/skip/populate— folding here would re-implement the protocol's lowering per reader, the [P2]protocol.tsimplements 4 of the 5 documented RPC alias precedences backwards — and disagrees withhttp-dispatcher.tson three of them #3795 condition) and capabilities a raw driver would silently drop (search/expand). A fallback that cannot reproduce the query's semantics must not pretend to serve it (route-ownership rule 3).null-valued keys stay withdrawals.Tests
14 pins in
action-execution-calldata-query.test.ts: canonical keys + server context forwarded; bare-params extraction (same source as the protocol path); callercontextdropped; each ofsort/select/skip/populate/search/expand/$filterrefused 501 beforeql.find; refusal names keys and served set; empty query still lists;nullwithdrawal; protocol-present path forwards wire spellings verbatim.Local: runtime 70 files / 1015 tests green.
🤖 Generated with Claude Code