Repository navigation
feat(mcp): query_records says truncated: true on a capped page, and the stdio door counts its total - #35185
Conversation
…he stdio door counts its total Claude-Session: https://claude.ai/code/session_01JQwxbYRqkDAGuse5Wqbohi Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbYRqkDAGuse5Wqbohi Co-authored-by: Claude <noreply@anthropic.com>
…nNotice Claude-Session: https://claude.ai/code/session_01JQwxbYRqkDAGuse5Wqbohi Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check4 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 12 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 7fc680e827bba18c18f8f791885323e72ca8a55f && git checkout 7fc680e827bba18c18f8f791885323e72ca8a55f
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 910306b632bfeb4a6d12a03d6ab489fd1a3d6128 c56f66f4efc04d4e00411e35f0ff6e02463e962a && git checkout -B drift-repro 910306b632bfeb4a6d12a03d6ab489fd1a3d6128 && git merge --no-ff c56f66f4efc04d4e00411e35f0ff6e02463e962a
node scripts/docs-audit/affected-docs.mjs --json 910306b632bfeb4a6d12a03d6ab489fd1a3d6128 |
|
repo:objectstack#1 · os-warren · session_01JQwxbYRqkDAGuse5Wqbohi Contract review brief handed to the isolated reviewer (TIER_DEFAULT, declaration face), posted beside its record: Contract review brief — PR #35185 @
|
|
repo:objectstack#1 · os-warren · session_01JQwxbYRqkDAGuse5Wqbohi Contract reviewServed-tier: Inputs: brief 6976945886; card #35138 (body and all 10 comments, among them claim 6975089907, W0 decisions 6975318215 and os-dev report 6976907593); PR #35185 (body and comments); the full diff against merge-base Face: the committed file list is one changeset and six files under ① Derived judgments
Findings:
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-warren · session_01JQwxbYRqkDAGuse5Wqbohi Final head for L1 · 2026-11-18T11:37ZHead-sha: |
|
repo:objectstack#1 · os-warren · session_01JQwxbXKtHccbeakAgquNs9 L1 review (#35138, PR 1) · 2026-11-18T11:42ZL1: ACCEPT Fixes vs Part of. This is PR 1 of the W0 plan. The body says Claim file surface. Amendment 1 gives PR 1
Each changeset sentence against the diff. The changeset is new, and
Tests. The new file holds four cases per door: capped, exact limit, last page, and probe refused. It also holds three stdio page-fact cases: counted total, failed count, and unpaged. The two preservation pins move by the probe row only. The census gains Clause-②: yes (widening). TIER_DEFAULT record 6977056472 is PASS on this same head, and its N1 to N4 are nits. I agree with its N2: no pin carries a Governance. CI at this head, from check-runs: 37 success and 16 skipped, with none failed or in progress. The PR is mergeable Must-fixNone. Should-fixNone. Notes
|
|
repo:objectstack#1 · os-warren · session_01JQwxbYRqkDAGuse5Wqbohi Landing · 2026-11-18T11:43Z
Open findings: record nits N1 (an uncounted fallback State: ready + auto-merge armed by area o1-B (lease Dev-effort: medium · Rounds: 1 |
Requested by Warren · project thread
Refs #35138 (item capped)
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
query_records在一页被行数上限截断时多答一个truncated: true;stdio 通道的total改为真实计数,不再拿本页行数冒充总数。packages/mcp/src/mcp-http-tools.ts(servedQueryPage/queryPageProbeFits与query_records处理器);packages/mcp/src/stdio-data-bridge.ts(query末尾的计数);packages/mcp/src/query-records-truncated.test.ts。pnpm --filter @objectstack/mcp exec vitest run src/query-records-truncated.test.ts,预期 11 条全绿。What changes
query_records(packages/mcp/src/mcp-http-tools.ts, this handler only) asks the bridge for one row more than the page. When that row comes back, the tool serves the page and addstruncated: true. The member is present only when true: a page holding every matching row, exactlylimitrows included, answers as before. Where the bridge answershasMore, it is restated from the probe, because the door counted it against the widened read.OS_DATA_MAX_PAGE_SIZEor pastOS_DATA_QUERY_ROW_BUDGET(packages/types/src/query-read-limits.tsplanQueryReadWindow). Where the probe row would cross either, the page is read as asked and the door's countedhasMoredecidestruncated. Without this, a host withOS_DATA_MAX_PAGE_SIZEequal to the MCP page cap would refuse every full-pagequery_records.truncatedpage must not be summed, counted or ranked as if whole: read on withoffset, or useaggregate_recordswhere it is offered.query(packages/mcp/src/stdio-data-bridge.ts) answered{ object, records, total: records.length }with nohasMore(origin/main7d8dcf693a, line 1378), so a capped stdio page claimed to be the whole set. The HTTP door goes throughcallData('query')(packages/runtime/src/action-execution.ts858-867) intofindData, which counts (packages/metadata-protocol/src/protocol-data-crud.ts761-822). The stdio bridge now answers the same page facts: a paged read is counted under the samewhere, as the caller (engine.count(object, { where }, { context })).totalis the match total andhasMoresays whether rows remain. If the count fails,totalis left out andhasMoreanswers from the page alone, as the data door's$count=falsearm does. An unpaged read keepstotal: records.lengthandhasMore: false, and no count runs.packages/mcp. The spec types only thesourceblock ofquery_records' result (packages/spec/src/ai/object-query-source.zod.ts), not the result itself, so nothing enterspackages/spec(ADR-0149 M1).aggregate_recordsand itstotalGroups/truncatedare untouched.Tests
packages/mcp/src/query-records-truncated.test.tsdrivesquery_recordsthroughregisterObjectToolsover an in-memory MCP client on both doors. The HTTP door uses a bridge answeringfindData's counted page facts. The stdio door usescreateStdioDataBridgeover a stand-in engine. Pins per door: a capped page answerstruncated: truewith the page only, and the probe asks forlimit + 1. A page of exactlylimitrows answers notruncated. The last page of a paged read is not capped. UnderOS_DATA_MAX_PAGE_SIZEequal to the page, no probe is sent andhasMoredecides. Pins on the stdio bridge itself: a capped page answers the counted total, not the page length. A failing count states no total. An unpaged read runs no count.mcp-http-tools.unknown-argument-keys.test.ts(limit 3 becomes 4) andmcp-server-runtime.http.test.ts(5 becomes 6). The page served is unchanged.stdio-data-bridge.stored-metadata-body.test.ts: the engine-read census names the newcount(object)site. It is a number, never a row, counted under thewherethat the stored-body and hash refusals already judged.Ablations (scripts/ablation-replace.mjs, each restored to the HEAD blob, git diff HEAD empty)
truncatedmember deleted fromservedQueryPage: 4 failed, 7 passed (both doors' capped and read-window pins).records.length > pagemutated to>=: 2 failed, 9 passed (both doors' exact-limit pins).total: records.length: 5 failed, 6 passed (the stdio door's capped, exact-limit, last-page and read-window pins, and the counted-total pin).Acceptance notes
findDatafalls back to a page-localtotalwhenengine.countthrows (packages/metadata-protocol/src/protocol-data-crud.ts804-808). That is a total the HTTP door did not count. It is outside this PR's file surface, so it is noted here and not changed.bridge.querynow runs oneengine.count. That includesdelete_records' selection read, which goes through the same bridge member.Verification
All readings below were taken at head
d85434872f.Local runs
pnpm --filter '@objectstack/mcp^...' build(under the verify lock): VERDICT command-exit 0.pnpm --filter @objectstack/mcp test: Test Files 72 passed (72), Tests 1281 passed (1281).pnpm --filter @objectstack/mcp typecheck: tsc clean;check:test-typecheckOK, 6 files / 53 errors / 8 pinned signatures held, unchanged.dispatch-gates --commands: 68 derived families. 67 exited 0.pnpm check:dual-build-cjs-loadsexited 3, PREREQUISITE NOT MET (it reads every package'sdist/, and only the mcp dependency closure is built here). NOT MEASURED locally; CI's Lint and Repo Gates runs it.--ranreconciliation: 68 derived, 67 run, 1 NOT-MEASURED, 0 UNRUN.overlap-check.mjs: clean against origin/main, 0 open PR heads share a file.Generated by Claude Code