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 5 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 — 188 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 d8aa8a6e092741c53fcc15548446116eedd799a7 && git checkout d8aa8a6e092741c53fcc15548446116eedd799a7
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f9dd03315030d5ef5edd491d5f0ea7211824b729 88a1447c951570e533ee1cb7c4b21be8e44a5f53 && git checkout -B drift-repro f9dd03315030d5ef5edd491d5f0ea7211824b729 && git merge --no-ff 88a1447c951570e533ee1cb7c4b21be8e44a5f53
node scripts/docs-audit/affected-docs.mjs --json f9dd03315030d5ef5edd491d5f0ea7211824b729
|
|
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:
|
…, exact citations - @objectstack/types exports resolveQueryReadPageCap(); both MCP doors answer pageCap from it instead of two local copies. - door.ts cites ADR-0160 D3 "Object level" for the unexpanded-lookup sentence. - The related list's rows/truncated describes name the entry's limit and the door's page cap; reference docs regenerated. - Real-kernel harness: a second caller without rc_unmask; an orderBy on the masked serial drops the section with not_visible on both doors, with the rc_unmask caller as control. - Changeset declares the widening and the types bump. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CbeF2saT6wUBV4E9uc
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract reviewServed-tier: Delta review of PR #37412 (cards #37361 and #37175) after its rework: one commit, Check-runs on the head: 62 success, 12 skipped, 0 failure. ① Derived judgments
S1: closed. The PR body and the changeset both read ② Semver level
③ Boundary flags
④ Design judgment
S2: closed. The direction a disclosure would ride is now pinned on the real kernel, on both doors with equal bytes: as S3: closed. The N3: closed. See ①. N4: closed. See ①. N1 (nit) — open, unchanged. A N2 (nit) — open, unchanged. ADR-0160 D1 says a door "cuts the list at that cap"; the list is cut one row under it. An ADR bookkeeping line for the landing seat. N5 (nit) — new. The seat note that closes the PR body still says "Final-head readings (a50181d) are in the os-dev report 7181466841". The body's own readings are at Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 席位核对Head-sha:
|
|
repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc Landing: ACCEPT 7183165768 (delta L2 PASS 7183158602) at head
Status: ready + auto-merge (merge queue). On MERGED, #37361 and #37175 close by |
Fixes #37361
Fixes #37175
Clause-②: yes (widening)
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..describe()texts ofRecordContextRelatedListSchema.rowsand.truncated(what a model reads in the tool's output schema) now name the entry'slimitand the door's page cap, not the row cap alone. Generated reference docs regenerated withcheck:generated --fix(content/docs/references/ai/record-context-tools.mdx, 2 rows twice).@objectstack/typesexportsresolveQueryReadPageCap(), the smaller ofOS_DATA_MAX_PAGE_SIZEandOS_DATA_QUERY_ROW_BUDGET,undefinedwhen neither is set; both doors answerpageCapfrom it, and their two local copies are gone.deleteRecordsCapis not changed.Clause-②: yes (widening). The published surface widens by optional members only:RecordContextDoor.pageCap?(),StdioDataBridgeDeps.securitymay carrygetQueryableFields, and the newresolveQueryReadPageCapexport. Precedent mcp: query_records and get_record say which fields field-level security withheld, so an answer says "not visible to you", not "blank" #35137. The level stayspatch(now also on@objectstack/types);Metadata-protocol: nonestands.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. Rework S3: the sentence, which ships in the.d.ts, cites ADR-0160 D3 "Object level" (its last paragraph: a lookup whose target the caller may not read is left unexpanded); the earlier "(ADR-0160 D3, amendment 4)" named an ADR amendment that does not exist.Tests
Whole suites of every touched package, at head
88a1447c9(local, under the shared verify lock; per-package exit captured before any pipe):@objectstack/typespnpm --filter @objectstack/types test@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 typecheckfor the same five packages: exit 0 each.pnpm --filter @objectstack/spec check:generated --fixafter a spec build: 1 of 14 artifacts stale (content/docs/references/**, the N3 texts), regenerated, re-checked green.Real-kernel harness (
packages/runtime/src/mcp-record-context-tools-bridge.test.ts), every case throughboth()(same bytes on/mcpand stdio for one caller), 22 cases:rework S2, new: a second caller,
usr_plain, the same key's door but withoutrc_unmask(the baseline set no longer carries it;usr_memberholds it through its own grant ofrc_unmasker, resolved by the realresolveAuthzContext). Forusr_plainanorderByon the maskedserialdrops the section with the onenot_visiblenote on both doors: no refusal, norelatedkey, nothing ofrc_stepin the text,getQueryableFieldslacksserialfor it. Control leg in the same case: the same pack asusr_memberreads[s4, s2, s3, s1]. The stdio door re-resolves the key's owner per call, and the case asserts it read asusr_plain;flipped: the case titled "[today; ADR-0160 as amended says left out and stated]" now pins left out and stated, with a served control child (
rc_revision) in the same answer;unchanged and green: the API-exposure child (named) and the disabled-package child (
OBJECT_PACKAGE_DISABLED, unnamed) still refuse;new: the where/orderBy/limit parity case (filtered, ordered, cut at
limit, stated);new: a
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;new: an
orderByon a masked field whose unmask capability the caller holds is read (the service lists it as queryable, the fallback never would);new:
orderBy: created_atreads in that order on both doors;new: under
OS_DATA_MAX_PAGE_SIZE=3both doors cut the list at 2 and state it;the door-member unit case now lists
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.served.has(n) || queryable.has(n); committed first at88a1447c9, service rebuilt, anchor counts 1/0 on disk, dist preflight hit): runtime harness 2 red. The new second-caller case turns red with the whole call refused (isErrortrue: the engine guard refuses the masked sort), and the spy-narrowedwherecase answers the dropped section. Restored to blobc4cd29690aa1,git diff HEADempty, rebuilt, preflight--absentgreen.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.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 22 passed, including "a related child this caller is not served is left out" and "an orderBy on a masked field whose rule is NOT lifted for the caller drops the section".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 second caller (keyOwner,plainCaller,bothAsPlain) and the narrowed-answer case (a spy on the real security service).Local gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 117 commands for this diff (treeobjectstack-ai/objectstackat88a1447c9); all 117 run, each exit captured before any pipe;--ranreconciliation: "117 derived, 115 run, 2 NOT-MEASURED, 0 UNRUN".pnpm --filter @objectstack/spec run check:skill-examplesfirst answered exit 3 (client-react not built); after building@objectstack/client-reactand its closure it answered exit 0 ("351 prose examples type-check across 3 surface(s)").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 and mcp closures). Both are CI's.node scripts/check-dev-prereqs.mjs: exit 1, "the workspace is not built" (35 of 110 packages,ui/**among them, unbuilt in this worktree); a reading about this checkout, not the diff.node scripts/pm/overlap-check.mjs --branch=HEADbefore each push: VERDICT clean (origin/main merges cleanly); not merged, as ordered.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