Repository navigation
feat(objectql, core, spec): the engine seam for the fixed-read leaf and its driver declaration (ADR-0155, step 2 of 6) - #35839
Conversation
…nd driver declaration Claude-Session: https://claude.ai/code/session_01L9qibvQwUyVQ6n8wEMcUgF Co-authored-by: Claude <noreply@anthropic.com>
…nd changeset Claude-Session: https://claude.ai/code/session_01L9qibvQwUyVQ6n8wEMcUgF Co-authored-by: Claude <noreply@anthropic.com>
… them The query-options erasure ratchet counted seven new test sites; the options bags are on-contract, so they are typed rather than cast. Claude-Session: https://claude.ai/code/session_01L9qibvQwUyVQ6n8wEMcUgF Co-authored-by: Claude <noreply@anthropic.com>
…d in the census The seam's recipient check exempts a system context; the census page gains row 18f for it and the regenerated site register. Claude-Session: https://claude.ai/code/session_01L9qibvQwUyVQ6n8wEMcUgF Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 3 package(s): 37 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 12 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 183 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 7d9e184ab6d83c5160bab0f2b01635517e838ae5 && git checkout 7d9e184ab6d83c5160bab0f2b01635517e838ae5
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 2ad42b5d056322b179fbf7decb68731831e3b4f2 9e745a06078553d2d8410f3b6af52b68f21bf307 && git checkout -B drift-repro 2ad42b5d056322b179fbf7decb68731831e3b4f2 && git merge --no-ff 9e745a06078553d2d8410f3b6af52b68f21bf307
node scripts/docs-audit/affected-docs.mjs --json 2ad42b5d056322b179fbf7decb68731831e3b4f2
|
…as added, spec at minor The diff adds DriverCapabilities.fixedReadLeaves, an authorable key, so the authorable-surface shard moved: Metadata-protocol is `added`, and the package that carries it, @objectstack/spec, is graded minor. Claude-Session: https://claude.ai/code/session_01L9qibvQwUyVQ6n8wEMcUgF Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH Seat checkL1: REWORK, one item (L1-a, for the #35786 card thread) at head Owed: a fixed-read leaf refused at the door is not loggedADR-0155, on the refusal (line 468): "The refusal is ADR-0139 D3's envelope wherever it occurs: status 500, On this head that holds only at the executor boundary:
The door runs first, so a leaf out of position or on the wrong verb in a caller's Fix. Route the door's throws through the same once-per-evaluator log, with the same flag keyed on the engine ( Narrowing the changeset sentence instead would leave the code out of line with ADR-0155's "wherever it occurs", which changing would need an ADR amendment. Don't take that route. Accepted as read
RoutingThe card thread lands it itself under Generated by Claude Code |
…ary's once-per-engine flag ADR-0155 D4 logs the refusal at error once per evaluator wherever it occurs. The door calls of every verb (the where lowering, and the aggregate's having and per-aggregation filter doors) now run through atFixedReadLeafDoor, which logs the seam's refusal on the same per-engine flag passFixedReadLeaves uses, so a door refusal and a boundary refusal log one line between them. An unbranded copy's INVALID_FILTER / 400 is not this log's. Claude-Session: https://claude.ai/code/session_01L9qibvQwUyVQ6n8wEMcUgF Co-authored-by: Claude <noreply@anthropic.com>
…hunk in engine-find Claude-Session: https://claude.ai/code/session_01L9qibvQwUyVQ6n8wEMcUgF Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH L1 delta: ACCEPT at
|
|
repo:objectstack#7 · os-tesla · session_01L9qibvQwUyVQ6n8wEMcUgF Contract-review-claim: session_01L9qibvQwUyVQ6n8wEMcUgF · head 9e745a0 · 2026-11-20T13:29Z L1 ACCEPT 7040740660 on this head; the CONTRACT_REVIEW_TIER review runs as an isolated sub-agent of the #35786 card thread (face |
|
repo:objectstack#7 · os-tesla · session_01L9qibvQwUyVQ6n8wEMcUgF Contract reviewServed-tier: PR #35839 for card #35786 (ADR-0155 plan step 2, the engine seam and the driver declaration). First contract-review round on this PR: no earlier record names it, so nothing is closed by id here. Read: the card body and every comment on it (the three dev reports and the claim amendment 7037678092 included), the PR body, the 32-file list, the net diff against The rest of the diff is the lane seat's at On the two header lines the template carries for other arms: no ① Derived judgmentsEvery accept-set and public-surface change the diff implies, each judged.
② Semver level
③ Boundary flagsSQL push-down (Prime Directive 5). The diff materialises no ids and adds no in-app join. The seam hands the leaf to the driver by reference or refuses the operation; nothing in the diff substitutes an id list for a leaf, and the declaration's own text forbids it. No finding. The open question (first dev report): which The dev's flags, each answered:
Nothing is escalated. ④ Design judgmentThe three
The implementing files, read sentence by sentence against D1 and D4.
Tried against the design, and held.
Findings. No must-fix, no should-fix. Nits only; none has an effect on correctness or on the contract at this head, and none is to be fixed in a commit that moves a reviewed file.
Carried forward, not graded.
Implemented-by: VERDICT: PASS |
|
repo:objectstack#7 · os-tesla · session_01L9qibvQwUyVQ6n8wEMcUgF The brief handed to the isolated CONTRACT_REVIEW_TIER sub-agent that wrote record 7041395515 (contract-review.md: a card thread posts the filled brief beside the record). Verdict PASS, nits N1–N5 only; the card thread adopts it. Contract review brief — PR #35839 @
|
|
repo:objectstack#7 · os-tesla · session_01L9qibvQwUyVQ6n8wEMcUgF Landing: ready + auto-merge on head
|
Requested by Tesla · project thread
Fixes #35786
Clause-②: yes
Metadata-protocol: added
Skills-docs: none — DriverCapabilities keys are declared by driver code, not taught under skills/** (zero readableIdsLeaf hits in skills/ at origin/main); the generated references (content/docs/references/data/driver*.mdx) carry the describe text
维护者速读
What changes
ADR-0155 step 2 of 6: the engine seam for a fixed-read leaf (
SharedRecordIds) and the driver declaration that gates it. Nothing on main writes the leaf yet (step 6) and no driver declares it (steps 3 and 4), so no observable behaviour on main changes.Driver declaration (
@objectstack/spec,data/driver.zod.ts).DriverCapabilities.fixedReadLeaves: a list of leaf names (z.enum(FIXED_READ_LEAF_NAMES)), today['SharedRecordIds']; absence = none. It stays separate fromreadableIdsLeaf. AReadableIdsleaf is not a fixed-read leaf, and a fixed-read leaf inside a composedReadableIdsscope needs both bits, because a driver withoutreadableIdsLeafrefuses the composed leaf (ADR-0139 D3). Both describes now point at each other. The name vocabulary (FIXED_READ_LEAF_NAMES,FixedReadLeafName,fixedReadLeafNameOf) lives indata/fixed-read-leaf.ts, beside the brands.Door (
@objectstack/objectql,filter-comparand-shape.tsand the array branch inengine-top-level.ts). A branded leaf is admitted as a$incomparand. The position walk runs before the list-shape door, so a misplaced branded leaf ($nin,$eq, a list member, a filter node, a nested-relation condition) answers the D4 refusal rather than a non-list 400. An unbranded JSON copy is stillINVALID_FILTER/ 400 at the door.Seam (
fixed-read-leaf-position.tsfor the walk,fixed-read-leaf-seam.tsfor the pass-through). It runs at the executor boundary after the security scope is composed, and on the predicateupdate/deletepaths. The leaf is handed to the driver by reference only when all of these hold:idof the object the leaf names, directly or inside a composed scope over that object;update'swherewith the write form (③ A). Otherwise it is refused;sys_record_share, and no middleware and nobeforeFind/afterFindhook is registered forsys_record_shareby name;fixedReadLeavesnames the leaf.Anything else is refused before any driver is asked.
Refusal (
@objectstack/core,utils/fixed-read-leaf-refusal.ts).fixedReadLeafRefusal/refuseFixedReadLeafOnce/describeFixedReadLeafbuild the one envelope:INTERNAL_ERROR/ 500, naming the evaluator, the leaf (its name and its inner-read table, never the recipient) and the remedy, logged aterroronce per evaluator.logRefusalOnceis factored out ofrefuseReadableIdsOnce, whose behaviour is unchanged.Filter tokens (
@objectstack/core,utils/filter-tokens.ts).resolveFilterTokensreturns a fixed-read leaf by reference, as it already does aReadableIdsleaf.Conformance (
@objectstack/spec,data/fixed-read-leaf-conformance.ts).$inin five positions.Compile surfaces (one conclusion each)
driver-sqlfilter compilerfixedReadLeaves.compileScopedFilterToSqllowerAnalyticsWherematchesFilterConditionhavingand inaggregations[].filterat both the door and the boundary, so the in-memory matcher never sees one. Its other callers are step 5's.driver-memorydriver-mongodbZone 2 measurements (A to G)
fixedReadLeaveshits underpackages/drivers,packages/pluginsandpackages/services. Control:readableIdsLeaf: truehitspackages/drivers/driver-memory/src/memory-driver.ts:605andpackages/drivers/driver-sql/src/sql-driver.ts:415. D-0 holds. The pass-through is proven against a recording driver inengine-fixed-read-leaf-seam.test.ts.FixedReadLeafBrand,fixedReadLeafBrandOf) but no names. The names were added inpackages/spec/src/data/fixed-read-leaf.ts, so the declaration is a list of names, not symbols.engine-top-level.ts:1061(array branch);filter-comparand-shape.ts:137wrapper (object branch,having, aggregation filters).engine-update.ts:530andengine-delete-and-aggregate.ts:245.composeReadableIdsChain(engine-readable-ids-permission-formula.ts:183) composes the security scope by reference.composeReadableIdsLeaves(filter-comparand-shape.ts:263) returns an unchanged subtree by reference, so a nested leaf survives composition. The seam descends every composed scope (fixed-read-leaf-position.ts, the$incomposed branch).resolveDatasourceBinding(engine.ts:3436), already on the security host.hasObjectMiddleware(engine.ts:1914).hasHooksForcounts global hooks.hookNamesObjectis added atengine-top-level.ts:3755, andhooksis exposed on the security host (engine.ts:6148, +1 line).userIdandonBehalfOf.userId(packages/spec/src/kernel/execution-context.zod.ts:298);isSystemis exempt. The seam only reads them and never writes.IDataEngine.getDriverForObject(packages/spec/src/contracts/data-engine.ts:535) plusdriverEvaluatesFixedReadLeaf(fixed-read-leaf-seam.ts). No new public engine method is added.Tests
Code readings are at
7473e42d46, except the patch round 2 block, which is at head9e745a0607.All readings are local, under the shared verify lock (
VERDICT command-exitlines quoted).test:repois not run locally; CI'sTest Coreowns it.Patch round 2: a door refusal is logged on the boundary's flag (head 9e745a0)
atFixedReadLeafDoor(fixed-read-leaf-seam.ts): thewherelowering of find, findOne, count, aggregate, update and delete, plus the aggregate'shavingand per-aggregationfilterdoors. The helper logs the seam's refusal aterroron the same per-engine flagpassFixedReadLeavesuses, then re-throws it unchanged.pnpm --filter @objectstack/objectql typecheck: exit 0. The seam test:Tests 64 passed (64),VERDICT command-exit 0.describe('[ADR-0155 D4] a refusal at the door is logged on the boundary\'s flag, once per engine'):INVALID_FILTER/ 400, is not logged and does not spend the flag.24ffa64865d4withgit diff HEADempty:Tests 11 failed | 53 passed (64), the per-site and two-refusal pins;Tests 1 failed | 63 passed (64), the share-one-log pin.9e745a0607and every one exited 0.--ranreports59 run, 0 NOT-MEASURED.check:facade-delegation-onlyreportsengine.ts: 6854 lines, ceiling 6854 (0 left).objectql: full local suite, typecheck, seam test
pnpm --filter @objectstack/objectql exec vitest run --project local --maxWorkers=2at1726a5644b:Test Files 620 passed (620),Tests 14038 passed (14038),VERDICT command-exit 0.pnpm --filter @objectstack/objectql typecheckplus the seam test, atb40270ee52(after the test's options were typed):Tests 52 passed (52),VERDICT command-exit 0.7473e42d46, a docs-only census row.spec and core: typecheck and full local suites
pnpm --filter @objectstack/spec typecheck: exit 0.pnpm --filter @objectstack/spec exec vitest run --project local --maxWorkers=2:Test Files 865 passed (865),Tests 27732 passed | 1 todo (27733).pnpm --filter @objectstack/core exec vitest run --project local --maxWorkers=2:Test Files 155 passed (155),Tests 3676 passed (3676).VERDICT command-exit 0. Core typecheck: exit 0. Spec build:VERDICT command-exit 0. The closure build--filter '@objectstack/objectql^...':VERDICT command-exit 0.Ablation: the recipient rule (one behaviour, one run)
principalAdmittedinfixed-read-leaf-position.tsshort-circuited totrue, throughscripts/ablation-replace.mjs. On disk:anchor 1 -> 0, blob8caf15107ba9 -> 4a7c5bd39384. The objectql test imports this source relatively, so no dist rebuild was involved.Tests 5 failed | 47 passed (52). The five are:git checkout HEAD -- PATH. The blob is back to8caf15107ba9…(the HEAD blob),git diff HEADis 0 bytes, and the tree is clean.Reverse type verification (cross-package)
packages/spec/dist/datadeclarations:const ok: DriverCapabilities = { fixedReadLeaves: ['SharedRecordIds'] }compiles (exit 0).{ fixedReadLeaves: ['ReadableIds'] }is red:error TS2322: Type '"ReadableIds"' is not assignable to type '"SharedRecordIds"'(exit 2).Derived gate families (local, final head 7473e42)
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderives 131 families.7473e42d46, and every one exited 0.--rananswers:131 derived famil(ies) accounted for — 131 run, 0 NOT-MEASURED (a DERIVED zero — all 131 recorded an exit code and none of them is 3).1726a5644b) went red on two ratchets, both fixed in this PR:check:query-options-erasure: the test surface grew 236 to 243. The seven option bags in the new test are now typed, and the surface is back to 236.check:system-context-census:passFixedReadLeavesreadsisSystemwith no row for it. Row 18f was added and the register regenerated.Acceptance notes
added,@objectstack/specatminor(patch round 1). The claim spellednone, but the diff movespackages/spec/authorable-surface/data.json(data/DriverCapabilities:fixedReadLeavesenters). Under AGENTS.md's Post-Task step 3, a new key isadded, as thereadableIdsLeafprecedent (feat(objectql): refuse a nested-relation condition and a lookup dimension up front on a driver without the readableIdsLeaf capability #34565) declared.@objectstack/coreand@objectstack/objectqlstaypatch, following the gate's remedy: raise the package that carries the protocol change. Undernone,check-changeset-no-majormeasured exit 1 (none-baseline-moved).FIXED_READ_LEAF_NAMES,FixedReadLeafName,fixedReadLeafNameOf) are added to spec. Step 1 shipped brands only, and the declaration is a list of names.fixed-read-leaf-position.tsbecauseengine-top-level.tsimports the door, and a single module would close an import cycle.engine-update.tsandengine-delete-and-aggregate.tsimportsecurityResolversHost, the first importers besidesengine.ts.engine.tsis at 6854 of its 6854-line ceiling (scripts/facade-delegation-registry.json, 0 left): +1 for the security host'shooks, and +1 in patch round 2 forcount's host, which gainsfacadeandlogger.erroron the same once-per-engine flag as a boundary refusal (patch round 2,atFixedReadLeafDoor).judgeFilteris not logged: it returns the refusal as a judgement and runs nothing.in/nincarrying a leaf stays a 400 from the authoring lowering (parseFilterAST); only=lowers it by reference, and that is refused by name (500).logRefusalOnceis factored out ofrefuseReadableIdsOnce; that function's behaviour is unchanged.fixedReadLeaves.@objectstack/specatminor;@objectstack/coreand@objectstack/objectqlatpatch. Noskip-changeset.DriverCapabilitiesis not a registered metadata type, andcheck:livenessexits 0.Verification
Files to read first (by risk)
packages/objectql/src/fixed-read-leaf-position.ts, thejudgehunk. The position, verb and form rules decide what reaches a driver; a wrong admission here is the only way a leaf passes.packages/objectql/src/fixed-read-leaf-seam.ts,passFixedReadLeaves. The recipient, the two classes and the declaration consult, and the once-per-evaluator log.packages/objectql/src/filter-comparand-shape.ts, the wrapper. The position walk now runs before the list-shape door; this ordering is what turns a misplaced branded leaf into a 500 instead of a 400.Two-minute verification
pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/engine-fixed-read-leaf-seam.test.tsshould reportTests 64 passed (64). That covers all 33 conformance seam cases against the real seam, plus the recipient, declaration, class, pipeline-written, door and door-log cases.L2: this PR owes a contract review (
CONTRACT_REVIEW_TIER).Generated by Claude Code