Skip to content

fix(runtime): callData('query') fallback serves the caller's query instead of dropping it - #4390

Merged
os-zhuang merged 1 commit into
mainfrom
claude/calldata-query-fallback-b44637
Jul 31, 2026
Merged

fix(runtime): callData('query') fallback serves the caller's query instead of dropping it#4390
os-zhuang merged 1 commit into
mainfrom
claude/calldata-query-fallback-b44637

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Fixes #4386 (found during the #4371 call-site survey).

The bug

callData's action === '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) where qlOpts is only { context }. The caller's where/orderBy/limit never 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 sibling get/update/delete fallbacks all build a proper where; query was the only verb whose fallback forgot the request.

The fix

  • The query is built once (params.query or the params rest) and both paths serve the same request.
  • The fallback forwards the canonical QueryAST keys both possible recipients execute — where, fields, orderBy, limit, offset. (ql here 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 own query tool constructs exactly these keys.)
  • A caller-supplied context is dropped — server-derived only, matching findData's unconditional delete options.context.
  • Anything the fallback cannot reproduce without the protocol layer is refused with 501, naming the keys and the served set: wire spellings needing fold/lowering (sort/select/skip/populate — folding here would re-implement the protocol's lowering per reader, the [P2] protocol.ts implements 4 of the 5 documented RPC alias precedences backwards — and disagrees with http-dispatcher.ts on 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.
  • Protocol path unchanged — it keeps accepting wire spellings verbatim (pinned).

Tests

14 pins in action-execution-calldata-query.test.ts: canonical keys + server context forwarded; bare-params extraction (same source as the protocol path); caller context dropped; each of sort/select/skip/populate/search/expand/$filter refused 501 before ql.find; refusal names keys and served set; empty query still lists; null withdrawal; protocol-present path forwards wire spellings verbatim.

Local: runtime 70 files / 1015 tests green.

🤖 Generated with Claude Code

…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>
@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
objectstack Ignored Ignored Jul 31, 2026 10:42am

Request Review

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling labels Jul 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/runtime.

20 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/api/client-sdk.mdx (via packages/runtime)
  • content/docs/api/index.mdx (via @objectstack/runtime)
  • content/docs/api/wire-format.mdx (via @objectstack/runtime)
  • content/docs/automation/hook-bodies.mdx (via @objectstack/runtime)
  • content/docs/concepts/metadata-lifecycle.mdx (via @objectstack/runtime)
  • content/docs/concepts/north-star.mdx (via packages/runtime)
  • content/docs/data-modeling/drivers.mdx (via @objectstack/runtime)
  • content/docs/deployment/index.mdx (via @objectstack/runtime)
  • content/docs/deployment/production-readiness.mdx (via @objectstack/runtime)
  • content/docs/deployment/single-project-mode.mdx (via @objectstack/runtime)
  • content/docs/deployment/vercel.mdx (via @objectstack/runtime)
  • content/docs/getting-started/your-first-project.mdx (via @objectstack/runtime)
  • content/docs/kernel/cluster.mdx (via @objectstack/runtime)
  • content/docs/permissions/authentication.mdx (via @objectstack/runtime)
  • content/docs/permissions/authorization.mdx (via packages/runtime)
  • content/docs/plugins/packages.mdx (via @objectstack/runtime)
  • content/docs/protocol/kernel/http-protocol.mdx (via @objectstack/runtime)
  • content/docs/protocol/kernel/index.mdx (via @objectstack/runtime)
  • content/docs/protocol/kernel/lifecycle.mdx (via @objectstack/runtime)
  • content/docs/releases/implementation-status.mdx (via @objectstack/runtime)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

@os-zhuang
os-zhuang merged commit fce14ab into main Jul 31, 2026
17 checks passed
@os-zhuang
os-zhuang deleted the claude/calldata-query-fallback-b44637 branch July 31, 2026 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P3] executeDataAction 'query' fallback drops the entire query — where/sort/limit ignored, full table returned

1 participant