Repository navigation
fix(service-record-context): get_record_context leaves out an unserved related child; both MCP doors supply queryableFieldsOf and their page cap - #37412
Conversation
…h doors supply queryableFieldsOf and their page cap Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc
…able answer and page cap, filtered parity, created_at order Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc
…nd page cap Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc
📓 Docs Drift CheckThis PR changes 4 package(s): 2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 1 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 186 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 563b0d0ab4090b1bfa9252dbf0e5a77fb2478449 && git checkout 563b0d0ab4090b1bfa9252dbf0e5a77fb2478449
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin e8740c55f0eaba7571c16a5588c833fe29e176ac a50181d4e7d5b508fad66b05a45cd3141ed58e12 && git checkout -B drift-repro e8740c55f0eaba7571c16a5588c833fe29e176ac && git merge --no-ff a50181d4e7d5b508fad66b05a45cd3141ed58e12
node scripts/docs-audit/affected-docs.mjs --json e8740c55f0eaba7571c16a5588c833fe29e176ac
|
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head a50181d · 2026-11-26T03:17Z The seat runs the at-tier contract review of this head through an isolated sub-agent; L1 is the seat's own. |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract reviewServed-tier: PR #37412 (cards #37361 and #37175), reviewed read-only: both card threads whole, the PR body, the net diff against Check-runs on the head: 58 success, 11 skipped, 0 failure once the newer run of a repeated name governs. ① Derived judgments
S1 (should-fix) — ② Semver level
③ Boundary flags
④ Design judgment
S2 (should-fix) — the direction a disclosure would ride is not pinned on the real kernel. The harness has one caller, who holds S3 (should-fix) — the N1 (nit) — a N2 (nit) — D1 says a door with a lower page cap "cuts the list at that cap"; the list is cut one row under it, to keep the probe row. A door cap of 1 gives an empty list with "more rows than the 0 given". Stated in the changeset and the docblock; an ADR bookkeeping line for the landing seat. N3 (nit) — N4 (nit) — Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 席位核对Head-sha:
|
Fixes #37361
Fixes #37175
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
ADR-0160 D3 "Object level" as amended, and its second amendment; triage row 7154563681 on #37203.
executeGetRecordContext, step 4a). The answer carries the root and every served section with the onenot_visiblenote, and names the child nowhere (D3 wins over the triage row's "names the child"). Nothing of the child is read after its object-level judgement, its published definition included: the plan reads a left-out child as having no definition, so a lookup target reached only through it is never judged either.servedObjectDefinitionOfasnull, so judging exposure first is what keeps its refusal. API-exposure andOBJECT_PACKAGE_DISABLEDrefusals still refuse the whole call withPERMISSION_DENIED, the one code ADR-0160 point 12 gives an object-level refusal. An API-exposure refusal names the child only when the caller's served schema shows it (the naming bound, unchanged). A served-definition read that throws refuses the call, unnamed; it is never read as this caller's narrowing.queryableFieldsOffrom the security service'sgetQueryableFields, for the caller each already resolves (assumption A1 holds: no new service dependency on either door)./mcp:recordContextMembersreads it from this request'ssecurityservice with the request's execution context. stdio:createStdioDataBridgereads it from thesecurityservice it already holds for the object-schema mask, with the per-call principal; its dependency type now declares the optional method.pageCap()answers the most rows onequerymay ask for. The executor cuts a list atmin(limit or row cap, pageCap - 1), reads with the probe row, and states the cut, so no door cuts or refuses a list the answer does not say was cut. Both doors answer the deployment's smaller read limit (OS_DATA_MAX_PAGE_SIZE,OS_DATA_QUERY_ROW_BUDGET), which the data door refuses past. Before, under a max page size below 21, the/mcpdoor refused the whole callMAX_RECORDS_EXCEEDEDand the stdio door read the full list (the ablation below shows both).RecordContextNoteKinddoc line now saysrelated_truncatedfires at the entry'slimit, at the row cap, or at the door's page cap. Prose only.orderByon a registry-injected field (created_at) is pinned on the service and on both doors: the executor's own-field check (the child's published definition) and both doors accept it. See the acceptance notes for the authoring lint, which does not.door.tsquery's docblock now says the door decides each expansion target's API exposure.Tests
Whole suites of every touched package, at head
a50181d4e(local, under the shared verify lock; per-package exit captured before any pipe):@objectstack/service-record-contextpnpm --filter @objectstack/service-record-context test@objectstack/mcppnpm --filter @objectstack/mcp test@objectstack/runtimepnpm --filter @objectstack/runtime test(--project local)@objectstack/specpnpm --filter @objectstack/spec testpnpm --filter X run typecheckfor the same four packages: exit 0 each.pnpm --filter @objectstack/spec check:generatedafter a spec build: all 14 generated artifacts up to date (the N1 doc line moves none).Real-kernel harness (
packages/runtime/src/mcp-record-context-tools-bridge.test.ts), every case throughboth()(same bytes on/mcpand stdio for one caller):rc_revision) in the same answer;OBJECT_PACKAGE_DISABLED, unnamed) still refuse;limit, stated);wherefield outside the security service's answer drops the section with the note, never refuses, with a served control; the field is served, readable and declares no masking rule, so the fallback would admit it;orderByon a masked field whose unmask capability the caller holds is read (the service lists it as queryable, the fallback never would);orderBy: created_atreads in that order on both doors;OS_DATA_MAX_PAGE_SIZE=3both doors cut the list at 2 and state it;pageCapandqueryableFieldsOf, and a new case pins that the door's queryable fields are the security service's answer for the caller and its cap the smaller read limit.Service (
record-context-tools.test.ts): left out with a served control and no further read of the child; a lookup target reached only through a left-out child refuses nothing; unexposed and unserved child refused unnamed; disabled-package child refused before its served definition is asked; a throwing served-definition read refuses; the door cap cuts one row under it and states it, and a cap at or above the probe, absent, zero or fractional changes nothing;orderBy: created_atreads.Ablations (each committed first, mutated with scripts/ablation-replace.mjs, dist-preflighted where the subject resolves through dist, restored to the HEAD blob)
--absentonleftOut.add(entry.object)): service suite 3 red (the left-out case, the lookup-through-left-out case, the gate-order case); runtime harness 1 red (the flipped left-out case). Restored to blobc4cd29690aa1, rebuilt, marker present again.if (false) try; dist preflight hit): runtime harness red on the API-exposure child and on the disabled-package child, which then answers left out instead of refused. This is the measurement behind A2: on the real kernel a disabled-package child reachesservedObjectDefinitionOfasnull, so only judging exposure first keeps its refusal. Service suite 6 red./mcpdoor hands over noqueryableFieldsOf; runtime source, no build): 4 red, among them the narrowed-answer case and the unmasked-serial case (the two doors' bytes differ).queryableFieldsOf; mcp rebuilt, dist preflight hit): 2 red, the same two parity cases./mcpdoor answeringMAX_RECORDS_EXCEEDEDfor the whole call where stdio read the list. The first attempt at D (replacing the cut expression) leftdoorCapunused and did not build, so it ran no test; it was redone with a mutation that builds.git checkout HEAD -- ABSOLUTE_PATH, proven by blob equal to HEAD and an emptygit status --porcelain.Acceptance notes
getReadableFields) already leaves out every computed field the read mask deletes, so the fallback andgetQueryableFieldsagree except for masked fields. There the fallback is the stricter one: it dropped a section ordered by a masked field whose unmask capability the caller holds, which this PR fixes and pins. The "excluded" direction is pinned by narrowing the real service's answer by one field with a spy.validateAiContextinpackages/lint, run byos validateand the save door) warnsai-context-field-unknownfororderBy: created_aton an object that does not declare it, saying "the list is left out of every answer", while the executor and both doors read the list (pinned here).packages/lintis not in this claim's file surface, so it is reported to the seat, not changed..describe()texts ofRecordContextRelatedListSchema.rowsand.truncatedstill say "row cap"; changing them regenerates schema artifacts, outside the N1 prose-only line. Noted, not changed.OS_DATA_MAX_PAGE_SIZEdoes not refuse there as the data door does. Forget_record_contextboth doors now cut at the same row; for other stdio reads this is an observation, not measured here.PERMISSION_DENIEDcode (unnamed), the one code ADR-0160 point 12 gives an object-level refusal; the card's acceptance line "refuses with OBJECT_PACKAGE_DISABLED" is read as naming the case, and the existing pin is kept.Verification
Two-minute check:
pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/mcp-record-context-tools-bridge.test.ts(after building the runtime's dependency closure) shows 21 passed, including "a related child this caller is not served is left out".Read first, by risk:
packages/services/service-record-context/src/record-context-tools.ts, step 4a: the reordered gates and theleftOutset feedingpublishedOf.packages/runtime/src/domains/mcp.tsandpackages/mcp/src/stdio-data-bridge.ts: the twoqueryableFieldsOf/pageCapmembers.packages/runtime/src/mcp-record-context-tools-bridge.test.ts: the narrowed-answer case (a spy on the real security service).Local gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 93 commands for this diff (treeobjectstack-ai/objectstackata50181d4e); all 93 run, each exit captured before any pipe;--ranreconciliation: 93 derived, 91 run green, 2 NOT MEASURED, 0 unrun.node scripts/check-plugin-teardown-shape.mjs --self-test(exit 3, its pinned fixture commit is outside this shallow checkout);pnpm check:dual-build-cjs-loads(exit 3, reads every package's dist, and this worktree built only the runtime closure). Both are CI's.node scripts/pm/overlap-check.mjs --branch=HEADbefore each push: VERDICT clean (origin/main merges cleanly).Seat note: the governing Claim on #37175 now names this branch (re-claim 7181502252), since the round-2 rig branch landed as PR #37350. Final-head readings (a50181d) are in the os-dev report 7181466841 on #37361.
Generated by Claude Code