Skip to content

feat(spec,objectql,service-analytics): IObjectQLEngine.fixedReadLeafClassOf, wired into the analytics native path (ADR-0155 D4) - #35954

Merged
objectstack-fleet[bot] merged 13 commits into
mainfrom
claude/issue-35946-fixed-read-leaf-engine-member
Nov 21, 2026
Merged

objectstack-fleet[bot] merged 13 commits into
mainfrom
claude/issue-35946-fixed-read-leaf-engine-member

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #35946

Clause-②: yes
Metadata-protocol: none

Stacked on #35945 (ADR-0155 step 5). This pull request's base is claude/project-thread-thptm0, at 74cac04849 since the round-1 rebase, so its diff is only this card's change. GitHub retargets it to main when #35945 merges. Round 1 (head e117d86d44) answers the L2 record 7053241461: S1, N1 and N2.

维护者速读

  • 用户能看到什么变化:用户无感。分析服务在走原生 SQL 之前,先问数据引擎这条共享过滤条件能不能直接编译。引擎说可以,就走原生路径;否则交给引擎路径。
  • 为什么做:属于“共享记录权限下沉到引擎”这条工作线(ADR-0155 第 5 步的收尾)。按你选的方案 A,在引擎接口上加一个可选方法,供分析服务提问。
  • 出错会怎样:只影响带共享过滤条件的分析查询走哪条路径。引擎没回答、回答不合约定或出错时,一律交给引擎路径,结果始终正确,最多是变慢;可以直接撤回。
  • 要你做什么:无。

What changes

  • Contract (packages/spec/src/contracts/objectql-engine.ts). A new OPTIONAL member IObjectQLEngine.fixedReadLeafClassOf(leaf), typed (leaf: FixedReadLeaf) => EngineFixedReadLeafClass | null. It is the engine seam's ADR-0155 D4 class recognition for a SharedRecordIds leaf. It answers 'other-datasource' or 'registration-by-name' with what names it, and null when neither class applies. It throws TypeError on a value that is not a fixed-read leaf (fixedInnerReadOf), and its one consumer reads a throw as a decline. Because "neither" is null and never undefined, engine.fixedReadLeafClassOf?.(leaf) carries the consumer's whole three-state answer: a class means decline, null means compile, and undefined from an engine without the member means it cannot say, so decline. The answer type EngineFixedReadLeafClass restates objectql's FixedReadLeafClass. Its docblock says ObjectQL implements IObjectQLEngine checks one direction only: the seam's answer must be assignable to the contract's type. The header's list of members optional by ruling now names it (ruling 7051956587).
  • Engine (packages/objectql/src/engine.ts). ObjectQL.fixedReadLeafClassOf(leaf) is a one-line forward to fixedReadLeafClassAnswerOf(this, leaf). IObjectQLEngine is imported from @objectstack/spec/contracts instead of through @objectstack/core's re-export, and that import line also names EngineFixedReadLeafClass. The reason was measured. objectql is CommonJS and core is ESM. Through core, the contract's branded FixedReadLeaf resolved to spec's .d.mts chunk, while engine.ts's own import resolved to the .d.ts chunk. The tsup DTS build then failed the implements check with TS2416.
  • New file packages/objectql/src/fixed-read-leaf-engine-answer.ts. fixedReadLeafClassAnswerOf(engine, leaf) returns fixedReadLeafClassOfEngine(engine, leaf) ?? null. It is the seam's own recognition, with "neither" spelled null. It lives outside engine.ts because the facade gate allows only a one-line forwarding call there, and ?? null is an operator. fixed-read-leaf-seam.ts, which is feat(service-analytics, plugin-security, driver-odata): compile, resolve at the record, and refuse the SharedRecordIds leaf (ADR-0155 step 5) #35945's file, is untouched.
  • Analytics plugin (packages/services/service-analytics/src/plugin.ts). It wires AnalyticsServiceConfig.fixedReadLeafClassOf, which feat(service-analytics, plugin-security, driver-odata): compile, resolve at the record, and refuse the SharedRecordIds leaf (ADR-0155 step 5) #35945 left unwired. It resolves the engine from the "data" service on each call, as it does for hasObjectMiddleware, and returns svc.fixedReadLeafClassOf?.(leaf) as the engine gave it. This plain optional call is fail-closed by construction. When there is no engine or getService throws, the hook answers undefined. An engine without the member also answers undefined, and the plugin says so once at warn. NativeSQLStrategy declines every answer except null, so it also declines a class, a throw, and a member that does not keep the contract (one that answers undefined for neither). DataEngineLike's Pick now includes the member. Neither D4 class is restated in analytics.
  • Facade ceiling (scripts/facade-delegation-registry.json, the engine.ts row). Before: baseLines 6754 @ 63db7240aa, maxLines 6854, ruling 6897467376. After: baseLines 6853 @ 170ca481f0 (origin/main, measured), maxLines 6857, ruling 7051956587. engine.ts goes from 6853 to 6856 lines, and round 1 added no line to it. The raise is 3, inside the ruled 3–5. fix(objectql)!: a multi-row insert reads a parent's formula fields over the roll-ups its rows move; fold follow-ups #35773 has since merged to main (+1 net). A merge-tree of this head with origin/main 7de1bad gives engine.ts 6857 lines, which is at the ceiling with 0 left. The row needs no change for that merge.
  • Generated files: packages/spec/api-surface/contracts.json and packages/spec/export-origins/contracts.json (the new type export).
  • Changeset: .changeset/35946-fixed-read-leaf-engine-member.md, patch for @objectstack/spec, @objectstack/objectql and @objectstack/service-analytics. It states the round-1 semantics.

Why

Maintainer ruling A on #35946 (comment 7051956587) has analytics ask the engine seam's D4 recognition through an optional IObjectQLEngine member, with no new package dependency on objectql. ADR-0155 D4 says the recognition lives once, in the seam, and that the analytics native compiler "restates none". Without the wiring, once step 6 (#33787) starts writing the leaf, every sharing-scoped analytics query would leave native SQL. Round 1 (S1) makes "neither" null, so that an absent member and an answered "neither" can no longer be confused.

Tests

The pin is a describe named [#35946] AnalyticsServicePlugin asks the data engine's fixedReadLeafClassOf. It sits in the leaf's existing live-SQLite harness fixed-read-leaf-native-compile.test.ts, because a new pin for a component with a shared harness goes into that file. The "data" engine is a plain object over the live engine's members, so the pin tests the plugin's structural wiring and the engine's own answers.

  • (a) Member present, object in neither class. engine.fixedReadLeafClassOf(leaf) is null. The raw-SQL seam runs once, the statement carries IN (SELECT "record_id" FROM "sys_record_share", and the rows equal the case set's expected rows.
  • (b) Member present, object in a D4 class (a beforeFind hook registered for sys_record_share). The engine answers { class: 'registration-by-name', table: 'sys_record_share' }. The raw-SQL seam is never called, and the engine's seam refuses with INTERNAL_ERROR / 500.
  • (c) Member absent. The raw-SQL seam is never called, the engine path answers the expected rows, and the plugin warns once.
  • (d) A member that answers undefined instead of the contract's null. The raw-SQL seam is never called, the engine path answers the expected rows, and nothing warns.

Ablations, round 1, at 99ebe34bbd, all through scripts/ablation-replace.mjs. The service-analytics vitest config aliases @objectstack/objectql to its source, so no dist/ sits in the path. Every restore was verified as blob == HEAD with git diff HEAD empty. The rebase onto 74cac04849 touched none of the mutated files, and the pins were re-run green after it.

A1  wiring removed (the plugin config's fixedReadLeafClassOf line commented out)   blob cfbe857fb5a5 -> af53e0d322c9
    x (a)  AssertionError: expected "vi.fn()" to be called 1 times, but got 0 times
    x (c)  AssertionError: expected [] to have a length of 1 but got +0
    Tests  2 failed | 2 passed | 31 skipped (35)
A2  fail-open mutant: return svc.fixedReadLeafClassOf?.(leaf);  ->  return svc.fixedReadLeafClassOf?.(leaf) ?? null;
    blob cfbe857fb5a5 -> 58076b1ce810
    x (c)  AssertionError: expected "vi.fn()" to not be called at all, but actually been called 2 times   (line 384)
    x (d)  AssertionError: expected "vi.fn()" to not be called at all, but actually been called 1 times   (line 393)
    Tests  2 failed | 2 passed | 31 skipped (35)
A3  the engine's null mapping removed (fixed-read-leaf-engine-answer.ts: "?? null" dropped)   blob f10e0250db15 -> b6a1d16c5757
    x (a)  AssertionError: expected undefined to be null
    Tests  1 failed | 3 passed | 31 skipped (35)

A2 is the ruling's original spelling. On the shipped plain ?.(), pins (c) and (d) prove the wiring fails closed. Round 0's fail-open record (comment 7052875195) used the same mutant against the round-0 code.

Package runs, all under scripts/pm/os-verify-lock.sh:

  • The pin file passed 35 of 35 at 99ebe34bbd, and again at e117d86d44 after rebuilding the dependency closure.
  • typecheck for @objectstack/spec, @objectstack/objectql and @objectstack/service-analytics exits 0 at 99ebe34bbd; service-analytics exits 0 again at e117d86d44.
  • eslint --no-inline-config on the five edited source files exits 0 at e117d86d44.
  • The full suites last ran at round 0's e5dff0f186: service-analytics had 221 of 221 test files pass (5646 tests passed, 345 skipped); objectql had 625 of 625 files and 14183 of 14183 tests pass. They were not re-run in round 1, and CI runs them.

Acceptance notes

Verification

Files to read first, by risk:

  1. packages/services/service-analytics/src/plugin.ts: the fixedReadLeafClassOf bridge, a plain optional call that must stay fail-closed.
  2. packages/objectql/src/fixed-read-leaf-engine-answer.ts together with the member in packages/spec/src/contracts/objectql-engine.ts: the null for "neither".
  3. scripts/facade-delegation-registry.json: the engine.ts ceiling row.

Two-minute check: run pnpm --filter @objectstack/service-analytics exec vitest run --maxWorkers=2 src/__tests__/fixed-read-leaf-native-compile.test.ts -t 35946 and expect 4 passed.

Local gates at 99ebe34bbd, each exiting 0:

  • facade and repo checks: check:facade-delegation-only (engine.ts 6856 of 6857), check:engine-double-contract, check:nul-bytes, check:doc-authoring, check:test-source-alias, check:cross-package-test-inputs, check:adr-anchors, check:issue-citations, check:closed-ceremony-text;
  • runtime checks: check:startup-registry-verdict, check:durability-log-level, check:optional-error-sink, check:logger-receiver-detach, check:undeclared-dep-imports, check:spec-docblock-symbol-anchors, check:scripts-symbol-anchors, check:slot-lookup, check:init-service-contract;
  • changeset checks: check-empty-changeset, check-changeset-no-major, check-adr-0087-registration, check:changeset-gate-self-tests;
  • spec checks: check:api-surface, check:export-origins, check:dual-source-exports, check:exported-any, check:entry-nameability, and check:generated ("All 14 generated artifacts are up to date");
  • build and docs checks: check:dts-closure, check:published-files, and the docs-audit check-drift-comment and check-affected-docs.

Re-run at e117d86d44, each exiting 0: check:facade-delegation-only, check:nul-bytes, spec check:api-surface and check:export-origins, check:test-source-alias, check:engine-double-contract and check-empty-changeset.

overlap-check reports VERDICT clean (exit 0) against 74cac04849 and against origin/main 7de1bad. The local runs are a declared narrowing: dispatch-gates --commands derives 115 families against origin/main, including #35945's files, and CI runs the full set.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 4. One issue, one branch off an up-to-date main, one pull request. (Stacked on feat(service-analytics, plugin-security, driver-odata): compile, resolve at the record, and refuse the SharedRecordIds leaf (ADR-0155 step 5) #35945 by the dispatch claim; see Acceptance notes.)
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.

Generated by Claude Code

…lves it at the record, OData refuses it (ADR-0155 step 5)

- service-analytics: the native read-scope compiler compiles a placed
  read-form leaf to its sys_record_share subquery, built from the leaf's
  fixedInnerReadOf description with every value bound, and refuses any
  other leaf in D4's envelope (INTERNAL_ERROR / 500, logged once). The
  native strategy declines a leaf scope unless the host answers
  fixedReadLeafClassOf with null for each leaf on a known dialect. The
  engine-bound merges admit the brand, the /analytics/sql echo prints the
  subquery, and a leaf in a query's where is refused in either spelling.
- plugin-security: explain resolves each leaf in the sharing read filter
  at the judged record, one sys_record_share read per batch, so the
  published rowFilter is [recordId] in the share arm or leaves it out,
  and never carries the leaf.
- driver-odata: find and count refuse the leaf before any request.
- spec: parseFilterAST refuses a leaf in an array-form in / nin with
  INTERNAL_ERROR / 500 instead of INVALID_FILTER / 400.
- objectql: export fixedReadLeafClassOfEngine and
  driverEvaluatesFixedReadLeaf from the seam module.

Claude-Session: https://claude.ai/code/session_01L9qibyXo4gSy8DJPNz4ANz
Co-authored-by: Claude <noreply@anthropic.com>
…ord the explainer test's engine double

check:logger-receiver-detach read sink.log as a log channel passed as a
callback; the field holds a logger object, so it is named logger.
check:engine-double-contract asked the ledger to record the findOne double
that explain-fixed-read-leaf.test.ts pins.

Claude-Session: https://claude.ai/code/session_01L9qibyXo4gSy8DJPNz4ANz
Co-authored-by: Claude <noreply@anthropic.com>
…class answer in this release

The analytics bullet now says the shipped default: AnalyticsServicePlugin
wires no fixedReadLeafClassOf answer, so on every host today the native
path declines a scope carrying the leaf and the engine path answers.

Claude-Session: https://claude.ai/code/session_01L9qibyXo4gSy8DJPNz4ANz
Co-authored-by: Claude <noreply@anthropic.com>
… explainer's wire check pins of their own

An ablation of the where guard left the array-form in spelling refused by
parseFilterAST, so each spelling is now its own test and names the where
face's evaluator. The unbranded array-form 400 and the explainer's
no-leaf-on-the-wire check move out of the tests whose earlier assertions
failed first under ablation.

Claude-Session: https://claude.ai/code/session_01L9qibyXo4gSy8DJPNz4ANz
Co-authored-by: Claude <noreply@anthropic.com>
…dmit it in the explainer by role

parseFilterAST moved only the shape door's refusal of a condition carrying
a fixed-read leaf to D4's envelope. A leaf as an in / nin list member, or as
a scalar operator's comparand (!=, > and the rest), passed the shape door
and met the type door outside the try: INVALID_FILTER / 400, with a message
printing the head of the leaf's JSON. Either door's refusal of such a
condition is now INTERNAL_ERROR / 500, naming the leaf and its table only.
An unbranded copy keeps 400. The jsdoc and the message no longer claim the
leaf is refused in every position (an array-form = is passed on by
reference, as before).

The explainer admitted a leaf by the key it sat under: any $in under a key
named id, at any depth, inside a relation condition or a composed
ReadableIds scope too. It now walks roles, as the engine's seam and the
analytics compiler do: only an operator map's $in under id, in the
explained object's own filter, holds a leaf it resolves; any other leaf is
refused in D4's envelope.

Pins: spec, a list member and two scalar operators at 500 and their
unbranded copies at 400; objectql, both through the engine's find; the
explainer, a leaf inside a relation condition and inside a composed scope.

Claude-Session: https://claude.ai/code/session_01L9qibyXo4gSy8DJPNz4ANz
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/objectql, @objectstack/service-analytics, @objectstack/spec, touching 12 documentable anchor(s). ⚠️ 2 changed file(s) yielded no anchor (packages/spec/api-surface/contracts.json, packages/spec/export-origins/contracts.json), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/kernel/contracts/data-engine.mdx (via IObjectQLEngine (symbol, a top-level interface; a top-level type))
  • content/docs/kernel/contracts/metadata-service.mdx (via getObject (literal, a string literal in DataEngineLike))
  • content/docs/plugins/packages.mdx (via AnalyticsServicePlugin (symbol, a top-level class))

⛔ 2 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-5.mdx (via IObjectQLEngine (symbol, a top-level interface; a top-level type), judgeFilter (literal, a string literal in DataEngineLike))
  • content/docs/releases/v17/17-6.mdx (via AnalyticsServicePlugin (symbol, a top-level class), hasObjectMiddleware (literal, a string literal in DataEngineLike))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 2 changed file(s) yielded no anchor (packages/spec/api-surface/contracts.json, packages/spec/export-origins/contracts.json) — pages documenting those are invisible to this run
  • 1 anchor(s) matched too much of the corpus to be a work list: ObjectQL (symbol, 81 pages)
  • 2 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 176 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 523ada4cc0cf4308616249fd3364c630875a9c6e → packageMentionDocs.

Which tree this was computed on

This run read content/docs from a8003f81090313cb468e6de661f173d5f7705fe7 — the merge of head 978b92727c5c37b2618b2dd1c035ff3b3db3532a into base 523ada4cc0cf4308616249fd3364c630875a9c6e, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin a8003f81090313cb468e6de661f173d5f7705fe7 && git checkout a8003f81090313cb468e6de661f173d5f7705fe7
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 523ada4cc0cf4308616249fd3364c630875a9c6e 978b92727c5c37b2618b2dd1c035ff3b3db3532a && git checkout -B drift-repro 523ada4cc0cf4308616249fd3364c630875a9c6e && git merge --no-ff 978b92727c5c37b2618b2dd1c035ff3b3db3532a

node scripts/docs-audit/affected-docs.mjs --json 523ada4cc0cf4308616249fd3364c630875a9c6e

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 523ada4cc0cf4308616249fd3364c630875a9c6e → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…g lands, whichever release that is

The clause said the platform's analytics plugin wires no answer "in this
release". The wiring is being built now and may ship in the same release,
so the clause now states what this change ships (the hook unwired, the
native path declining, the engine path answering) and that it holds until
the wiring lands.

Claude-Session: https://claude.ai/code/session_01L9qibyXo4gSy8DJPNz4ANz
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH

L1: ACCEPT at 40fdd4e94ec293ccb75729fb90c3dcca70b4d87b (2026-11-20T23:06Z), with one ablation record owed and two landing conditions

Scope. Five commits, 8 files against the stacked base 81da4605fa (#35945's head), +202 / −14. The card is #35946, under ruling A 7051956587. The claim is 7052034983 and the dev report is 7052756244.

What I checked

  • The contract row (objectql-engine.ts).
    • fixedReadLeafClassOf?(leaf: FixedReadLeaf): EngineFixedReadLeafClass | undefined is optional. The interface docblock now lists five optional-by-ruling members, the new one citing 7051956587.
    • EngineFixedReadLeafClass has the same two variants as the seam's FixedReadLeafClass, and ObjectQL implements IObjectQLEngine keeps them equal on every build.
    • api-surface and export-origins are regenerated.
    • patch, Clause-②: yes, Metadata-protocol: none: a new optional member is a widening, and AGENTS.md gives none a patch.
    • ✔
  • The engine (engine.ts). It is a one-line delegation to fixedReadLeafClassOfEngine(this, leaf), which is read-only. The file is 6,856 lines against the new maxLines of 6,857. The ruling allowed "about 3 to 5 lines"; this raises the limit by 3, which leaves fix(objectql)!: a multi-row insert reads a parent's formula fields over the roll-ups its rows move; fold follow-ups #35773's +1. The registry row cites 7051956587. ✔
  • Deviation (b). IObjectQLEngine is now imported from @objectstack/spec/contracts, not through core. Core's export at index.ts:279 is the same spec type re-exported, so nothing diverges. Importing it from spec avoids the dual-chunk TS2416 error. Accepted. ✔
  • Deviation (a): the wiring fails closed, and the ruling's literal form would not.
    • engine.fixedReadLeafClassOf?.(leaf) ?? null turns an absent member into null, which means "neither class", so the native path would compile what it cannot see.
    • The plugin instead checks typeof svc.fixedReadLeafClassOf === 'function', maps the engine's undefined to null, and answers undefined ("cannot say", which declines) when there is no "data" service, the lookup throws, or the member is absent. It warns once.
    • The contract docblock carries the same ⛔.
    • This is the right reading of the ruling's intent. Accepted. ✔
  • Pins. All three run on the live SQLite harness:
    • (a) The member answers neither class: the native path runs once with the subquery and returns the expected rows.
    • (b) A real D4 class (beforeFind on sys_record_share): native declines, and the engine refuses 500.
    • (c) The member is absent: native declines, the engine path answers, and one warning is logged.
    • The wiring ablation (the config line removed) turns (a) and (c) red and leaves (b) green, as it should. ✔
  • Seat addendum: commits and hooks.
    • All five commits carry only Co-authored-by: Claude <noreply@anthropic.com> and Claude-Session: …session_01L9qibwJEh7hMPPvagWM1g7. No model name appears, and none of the messages has a closing keyword (617f75327c's "resolves in" names no issue).
    • So the trailers are what the pre-push hook enforces. Check Changeset and the PR-body guards pass at this head, and so does Lint · PM dispatch-gates.
    • I cannot see from GitHub whether a hook ran locally. I can only confirm that nothing a hook enforces is missing.
    • The remaining lint lanes (ESLint, CI/release/engine, repo/tooling, docs/code guards, and the scoped lanes) were still running at my read. They re-run the same checks, so their green on this head closes the question.

Owed (a record, no new head)

  • The fail-open mutant. Deviation (a) is the PR's key safety argument, so pin (c) needs a positive control against exactly that form. Replace the plugin's typeof branch with return svc.fixedReadLeafClassOf?.(leaf) ?? null;. Pin (c) should go red: the native path compiles on an engine with no member. Post the red result and the clean restore.

Landing conditions

  1. Deviation (c), a contradiction between two changesets. feat(service-analytics, plugin-security, driver-odata): compile, resolve at the record, and refuse the SharedRecordIds leaf (ADR-0155 step 5) #35945's changeset says "AnalyticsServicePlugin wires no answer in this release ([Decision] ADR-0155 step 5: how the analytics native compiler asks the engine seam which objects decline the share-grant leaf #35946)". I asked for that clause in REWORK 7051798358, and it is true only if this PR ships in a later release.
  2. CI green on 40fdd4e94e (24 checks in progress at my read). The dev ran 88 of 115 derived gate families locally and left the rest to CI.
  3. The CONTRACT_REVIEW_TIER L2 PASS, same head (packages/spec/src/contracts/**).

Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

Contract-review-claim: session_01L9qibwJEh7hMPPvagWM1g7 · head 40fdd4e · 2026-11-20T23:07Z

The L2 is owed on the packages/spec/src/contracts/** face: a new optional IObjectQLEngine member, fixedReadLeafClassOf, and its answer type EngineFixedReadLeafClass. It runs at CONTRACT_REVIEW_TIER as an isolated Fable reviewer on this head. The L1 is ACCEPT 7052812138.

@objectstack-fleet objectstack-fleet Bot added the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Nov 20, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7
os-dev ablation record: the fail-open mutant, owed by L1 ACCEPT 7052812138

Head stays at 40fdd4e94e. Nothing was committed or pushed. This ran in a fresh detached worktree at 40fdd4e94ec293ccb75729fb90c3dcca70b4d87b. I built the service-analytics dependency closure first (lock VERDICT command-exit 0). The test reads ../plugin.js from source, so no dist sits between the mutation and the run.

The mutant. In packages/services/service-analytics/src/plugin.ts I replaced the fixedReadLeafClassOf bridge's typeof branch with the spelling the contract's TSDoc warns against:

-      if (typeof svc.fixedReadLeafClassOf === 'function') return svc.fixedReadLeafClassOf(leaf) ?? null;
+      return svc.fixedReadLeafClassOf?.(leaf) ?? null;

The edit went through scripts/ablation-replace.mjs, with one anchor hit as declared:

ablation-replace: anchor   x1 -> x0
ablation-replace: replace  "      return svc.fixedReadLeafClassOf?.(leaf) ?? null;"  x0 -> x1
ablation-replace: ok mutation landed: anchor 1 -> 0, blob 7e68473192b7 -> da473e2d8ff4

Red: pin (c), member absent (vitest run … fixed-read-leaf-native-compile.test.ts -t "the member absent"). On an engine without the member, the native path compiled both queries:

       x the member absent: the native path declines, the engine path answers, and the plugin says so once 21ms
AssertionError: expected "vi.fn()" to not be called at all, but actually been called 2 times
 ❯ src/__tests__/fixed-read-leaf-native-compile.test.ts:373:26      (expect(rawSql).not.toHaveBeenCalled())
 Test Files  1 failed (1)
      Tests  1 failed | 33 skipped (34)
ablation-replace: command exited 1

Restore (the tool's own verification, on disk):

ablation-replace:   blob after restore  7e68473192b7cb037b95eaf5f3d9e81f83099d92
ablation-replace:   blob at HEAD        7e68473192b7cb037b95eaf5f3d9e81f83099d92
ablation-replace:   git diff HEAD       empty
ablation-replace: ok restored: blob == HEAD (7e68473192b7) and `git diff HEAD` is empty

After the restore, git status --porcelain was empty and the HEAD of the worktree was still 40fdd4e94e. Pin (c), re-run on the restored tree: Tests 1 passed | 33 skipped (34), and the lock reported VERDICT command-exit 0. The remote branch head is still 40fdd4e94ec293ccb75729fb90c3dcca70b4d87b (git ls-remote). The worktree is removed right after this record is posted.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 40fdd4e94ec293ccb75729fb90c3dcca70b4d87b
Local-runs: none
Scope: packages/spec/src/contracts/objectql-engine.ts + packages/objectql/src/engine.ts, packages/services/service-analytics/src/plugin.ts

PR #35954, card #35946, ruling 7051956587 (option A). The PR is stacked: its base is claude/project-thread-thptm0 at 81da4605fa (#35945's head, unmerged), which is also the merge-base, so the card's change is the 8-file diff 81da4605fa..40fdd4e94e (+202 / -14). The diff against main also carries #35945's files; they were read as context and are not judged here. The rest of this diff (the test pin, the two generated spec baselines, the changeset, scripts/facade-delegation-registry.json) is the lane seat's ACCEPT at TIER_DEFAULT.

① Derived judgments

  • IObjectQLEngine.fixedReadLeafClassOf?(leaf) (new optional member): a widening of the public contract. Optional, so no implementer and no test double breaks. Right, and it is the member the ruling names.
  • EngineFixedReadLeafClass (new exported type, @objectstack/spec/contracts): a new public export. api-surface/contracts.json and export-origins/contracts.json each gain exactly that one row. Right.
  • ObjectQL.fixedReadLeafClassOf (new public method): additive. A one-line delegation to the seam's fixedReadLeafClassOfEngine(this, leaf), the same recognition passFixedReadLeaves runs at the executor boundary (fixed-read-leaf-seam.ts). Right.
  • engine.ts now reads IObjectQLEngine from @objectstack/spec/contracts, not through @objectstack/core: no change to what objectql publishes; core's re-export is untouched. Right.
  • AnalyticsServicePlugin accept set: on a host whose "data" engine has the member, a read scope carrying a SharedRecordIds leaf outside both classes now takes the native SQL path (it declined on every host at the base). An engine without the member, no engine, a class answer and a throw decline as before. This is the widening the ruling orders, and nothing writes the leaf before step 6 (plugin-sharing: a member with more than 5000 share grants on one object silently loses access to the grants past 5000 (list misses rows, GET answers 404) #33787). Right.
  • DataEngineLike: its optional pick of IObjectQLEngine members gains this one; internal type, no surface. Right.
  • Facade ceiling (facade-delegation-registry.json): maxLines 6854 to 6857, a raise of 3, inside the ruled "about 3 to 5". Measured: engine.ts is 6853 lines at 170ca481f0, at main and at the base, and 6856 at the head. The row cites ruling 7051956587. Right.
  • Metadata protocol: nothing an author can write changes. Metadata-protocol: none is right.

② Semver level

patch on @objectstack/spec, @objectstack/objectql and @objectstack/service-analytics, the three packages the diff moves. Clause-②: yes is correct (a public surface widens: one optional contract member, one exported type, one engine method) and it stands on a line of its own in both the PR body and the changeset, with Metadata-protocol: none beside it. AGENTS.md: none takes patch, and a non-protocol widening ships patch. No BREAKING banner is owed: the member is optional and nothing is removed. The level matches what the diff publishes.

Check-runs on the head, all converged: every run is success or skipped, none failed and none is pending. Among them: both Check Changeset runs, Build Core (the DTS build that the engine.ts import move answers), Type Check · workspace, Type Check · consumer gates, Type Check · source gates, Type Check · debt ledger, every Lint · job (CI, release & engine gates, repo & tooling gates, PM dispatch-gates among them), Test Core 10 of 10 shards, Governed Surface Queue Guard, Spec property liveness and Dogfood Regression Gate.

③ Boundary flags

open_questions in the dev report (7052756244) is empty. The dev's declared deviations and out-of-scope findings, each answered:

SQL push-down (Prime Directive 5): no new id materialisation and no in-app join. The change does the opposite: it lets the share-grant leaf stay one IN (SELECT …) subquery in the native statement where the host could not previously answer.

④ Design judgment

packages/spec/src/contracts/objectql-engine.ts (hits), against ruling 7051956587, ADR-0155 D4 and its first consumer.

Read against the live tree, the TSDoc holds sentence by sentence:

  • "the engine seam's own recognition (fixedReadLeafClassOfEngine), the one the executor boundary runs": true. passFixedReadLeaves calls the same fixedReadLeafClassOf(host, leaf) over securityResolversHost.
  • Both class descriptions match the seam's code (datasource binding of the leaf's object against the inner table's; hasObjectMiddleware(table) or a beforeFind / afterFind hook naming the table).
  • "Read-only … calls no driver and logs nothing": true. resolveDatasourceBinding reads the registry, the mapping and the driver map; hasObjectMiddleware and the hook map are reads.
  • "compiles only on undefined, and declines … on a class": true through the plugin's mapping to null.
  • The header's "Five members are optional by ruling" list is correct for the member it adds.

D4's "restates none" holds: neither class is re-derived in spec or in analytics. Only the answer's type is stated in spec.

S1 (should-fix) — the member's "neither" answer is undefined, the same value an absent member gives through ?.(), so the contract's two opposite answers are indistinguishable in the type and at run time for any caller that does not probe first.

  • "Neither class" means "you may compile around the engine". "No member" means "cannot say, decline". These are the fail-open and fail-closed ends of a sharing-scope decision, and ql.fixedReadLeafClassOf?.(leaf) types both as EngineFixedReadLeafClass | undefined.
  • The contract knows this: it carries a ⛔ against the natural spelling, and the ruling's own text wrote that spelling. A rule that the maintainer's ruling tripped on is one the next consumer trips on too.
  • A second break: an engine that is not ObjectQL and implements the member as a stub returning nothing answers "neither", and the plugin compiles.
  • With null for "neither" (EngineFixedReadLeafClass | null), ql.fixedReadLeafClassOf?.(leaf) is exactly the consumer hook's own three-state FixedReadLeafClassAnswer (class, null, undefined), the optional call is fail-closed by construction, a stub declines, and the ⛔ and the plugin's ?? null both go.
  • The stated reason for undefined is the facade gate's grammar in engine.ts. That is solved one file down (the seam's public face, or a sibling of it, answers null; engine.ts stays a one-line forward at the same line count). A tooling grammar should not set the shape of a published contract.
  • Why now: the member is unreleased and has one consumer. After a release, changing the answer type is a breaking change to a published contract.
  • Not a must-fix: the one consumer in this diff is correct and pinned, and the trap is documented.

N1 (nit) — EngineFixedReadLeafClass's docblock says "ObjectQL implements IObjectQLEngine holds the two equal on every build". implements checks one direction only: the seam's answer must be assignable to the contract's. A class the seam adds fails the build (the direction that matters); a variant present only in spec, or a field the seam adds to a variant, passes. "Holds the seam's answer assignable to this type" is the accurate sentence. No effect on correctness.

N2 (nit) — the member's TSDoc does not say that it throws on a value that is not a fixed-read leaf (fixedInnerReadOf throws TypeError). The parameter is typed and the one consumer reads a throw as a decline, so nothing depends on it.

packages/objectql/src/engine.ts (implementing). The member is return fixedReadLeafClassOfEngine(this, leaf), a forward and nothing else, so the contract's "the seam's own recognition" is literally true. Its return type is the seam's FixedReadLeafClass, checked against the contract by implements. The import move is type-only. Agrees with the contract as written. S1's fix touches this line's target, not its shape.

packages/services/service-analytics/src/plugin.ts (implementing). Read against the contract and against NativeSQLStrategy.readScopeCarriesUncompilableFixedReadLeaf, which compiles only on === null:

  • member present, answer undefined: null, compile. Member present, class: passed through, decline. Agrees.
  • no "data" service, getService throws, member absent: undefined, decline. Fail-closed, as the contract's OPTIONAL paragraph requires.
  • The member is called as a method on the service, so this is the engine; ObjectQLPlugin registers the ObjectQL instance itself as "data" (objectql/src/plugin.ts), so the production path reaches the member rather than the warn.
  • A wrapper registered as "data" that does not forward the member, or one on which the host lookup throws, declines. A non-conforming answer (false, a promise) is not null and declines.
  • The engine is resolved per call, like hasObjectMiddleware, so plugin order does not matter.
  • The warn is once per plugin and names the remedy. It fires for an engine without the member, not when there is no engine at all; the changeset says the former, the PR body's sentence is broader than the code. The tree is right.
  • No copy of either class. Agrees with D4.

The pin's three cases cover present-neither, present-class and absent through the plugin's real init. It reads the member through a plain object, so it pins the wiring and not ObjectQL's method; the implements check and the delegation's single line cover that side.

Implemented-by: claude/issue-35946-fixed-read-leaf-engine-member
Reviewed-by: session_01L9qibwJEh7hMPPvagWM1g7

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

The brief handed to the isolated Fable reviewer for the record above, filled from record-recognisers.mjs --brief-template --paths …:

Contract review brief — PR #35954 @ 40fdd4e94ec293ccb75729fb90c3dcca70b4d87b (card #35946)

You review at CONTRACT_REVIEW_TIER. Render ONE ## Contract review record on this head — its shape is
node scripts/pm/record-recognisers.mjs --template --paths packages/spec/src/contracts/objectql-engine.ts — with a PASS or FAIL verdict, and WRITE it (do not post) to the scratch file below; the seat posts it

Inputs — these and nothing else:
· card #35946: its body and EVERY comment (rulings and earlier records included)
· PR #35954: its body, its file list, and the net diff against main at 40fdd4e94ec293ccb75729fb90c3dcca70b4d87b
· the check-runs on 40fdd4e94ec293ccb75729fb90c3dcca70b4d87b: their conclusions ARE the gate verdicts
⛔ Not the dispatch order, ⛔ not the dispatching seat's own conclusions — this brief is adversarial by design.

Scope — the paths reviewFace returns as hits on this PR's file list: packages/spec/src/contracts/objectql-engine.ts;
plus every file IN THIS DIFF that directly implements or enforces them — the gate that enforces a rule, the code
a jsdoc or schema line describes, the validator a skill teaches — reviewed for agreement with the contract.
Widen it freely, ⛔ never below hits; the record's Scope: line names the implementing files apart from hits.
The rest of the diff (tests, unrelated modules, lockfiles, generated output, changesets) is the lane seat's
ACCEPT at TIER_DEFAULT, exactly as a standalone PR of those files.
④ judges the hits files and those implementing files ONLY:
lockfiles, generated output, changesets and prose elsewhere in the PR are not reviewed;
code outside the diff is READ to judge them, never reviewed.

⛔ READ-ONLY. No worktree, no checkout, no build, no test run, no gate re-run, no ablation: the check-runs
on the head already answered every derived gate family, and a local run costs more than it returns.
If ONE probe is unavoidable, the record's Local-runs: line says probe — REASON; otherwise none.
Scratch space is /tmp/claude-0/-home-user/02d159c0-e99a-5933-b5ee-a68cdd014232/scratchpad/pr-35954/ alone; nothing there you did not write this round is read.

Judge, in the record's own sections:
① Derived judgments — every accept-set and public-surface change the diff implies, each named right or wrong.
② Semver level — the changeset (or skip-changeset) matches what the diff publishes, and the Clause-②: line.
③ Boundary flags — every dev flag and every open_questions entry answered, or escalated.
On every face, SQL push-down: a new id materialisation or in-app join where SQL could push down is a
finding unless a reason is given (AGENTS.md, Prime Directive 5: SQL first).
④ Design judgment — for EVERY hits file: does the change hold against the code it cites and the
scenario it is accepted against? A skill file against the card's eval prompt and the spec it teaches
on main; a schema file against the ruling or ADR it implements and its first consumer; an ADR
against its first consumer and its execution plan. For EVERY implementing file in the diff: does the
code agree with the contract, sentence by sentence? Read the cited code in the live tree, and try to
break the design.
Grade each finding must-fix, should-fix or nit — a nit has no effect on correctness or the contract.
A must-fix is a FAIL; a must-fix or should-fix earns a delta review of its fix; nits alone end the round.
Spell a must-fix or should-fix with its id and grade, S1 (should-fix) — …, and a clean round as
No must-fix, no should-fix.: the queue guard reads a graded finding as OPEN on this head and
refuses the record; the delta record names those it closes by id alone, S1: closed.
A nit is fixed only on the prose faces, or left as an accepted deviation or a follow-up card: a fix
anywhere else moves the head, and this record no longer covers it.
⛔ Judge the tree, never the PR body's account of it.
Sign Implemented-by: with the dev's branch and Reviewed-by: with your session id — the value is the FIRST
thing after each colon.

…lassOf, wired into the analytics plugin's native-path hook (ADR-0155 D4)

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7
…af type resolves in one module mode; ceiling 6857

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7
…: compiles on a plain engine's neither, declines on a class and on absence

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7
… analytics wiring

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7
…ll for neither, so the optional call is fail-closed by construction

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7
@os-tesla
os-tesla force-pushed the claude/issue-35946-fixed-read-leaf-engine-member branch from 99ebe34 to e117d86 Compare November 20, 2026 23:58
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH

L1 delta: ACCEPT at e117d86d446bd1eaeec02b0ba25102b93d49eb5b (2026-11-21T00:01Z). Two records are owed and CI is not yet green

This follows my ACCEPT 7052812138 at 40fdd4e94e. The branch is rebased onto #35945's 74cac04849, and this round answers delta L2 S1 7053241461, N1 and N2. The dev report is #35946 comment 7053675868.

What I checked

  • "Neither" is now null, and the optional call fails closed by construction.
    • The contract member returns EngineFixedReadLeafClass | null. Its TSDoc spells out the three states: a class; null, which compiles; and undefined from an engine that lacks the member, which declines.
    • ObjectQL.fixedReadLeafClassOf stays a one-line forward to the new fixedReadLeafClassAnswerOf, which is fixedReadLeafClassOfEngine(engine, leaf) ?? null.
    • The plugin hands on svc.fixedReadLeafClassOf?.(leaf) and warns once when the member is absent.
    • On the consumer side, NativeSQLStrategy#readScopeCarriesUncompilableFixedReadLeaf declines unless the answer is !== null, including on a throw and when there is no hook. So undefined, a class, a throw and a member that breaks the contract all decline. ✔
  • The fail-open control I asked for is in.
    • A2 restores the old ?? null spelling in the plugin. Pins (c) (member absent) and (d) (member answers undefined) go red, so a native compile ran where it must not.
    • A1 (wiring removed) turns (a) and (c) red.
    • A3 (the engine's ?? null mapping dropped) turns (a) red.
    • Each restore was blob-equal. The rebase touched none of the mutated files, and the pins were re-run green afterwards. ✔
  • engine.ts is 6,856 of 6,857 lines. With fix(objectql)!: a multi-row insert reads a parent's formula fields over the roll-ups its rows move; fold follow-ups #35773 now on main, the merge reaches 6,857 with no headroom left, which is within the ruling. ✔
  • The changeset describes the three states, the TypeError for a non-leaf, and the decline on every answer but null. It matches the code. ✔
  • CI at e117d86d44: 8 success, 8 skipped, 18 in progress, 0 failed at my read.

Owed (records, no new head)

  1. A claim amendment on [Decision] ADR-0155 step 5: how the analytics native compiler asks the engine seam which objects decline the share-grant leaf #35946 for packages/objectql/src/fixed-read-leaf-engine-answer.ts. The claim (7052034983) names only engine.ts in objectql. The new file exists because the facade allows engine.ts a one-line forward and nothing more.
  2. The PR body. The dev reports that its "What changes" and "Acceptance notes" still describe round 0: undefined for neither, and the ruling-spelling deviation. The seat is refreshing it, so update it to this round before landing.

Before landing


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: e117d86d446bd1eaeec02b0ba25102b93d49eb5b
Local-runs: none
Scope: packages/spec/src/contracts/objectql-engine.ts + packages/objectql/src/engine.ts, packages/objectql/src/fixed-read-leaf-engine-answer.ts, packages/services/service-analytics/src/plugin.ts

Delta review of PR #35954 (card #35946, ruling 7051956587), after the record at 40fdd4e94e (PASS, S1 open, N1 and N2). The dev's round-1 report is card comment 7053675868.

What moved: #35945's head went from 81da4605fa to 74cac04849, and this branch was rebased onto it. git range-diff 81da4605fa..40fdd4e94e 74cac04849..e117d86d44 shows the five reviewed commits unchanged (=) and one new commit, e117d86d44. That commit is the delta judged here: 6 files, +88 / -38. The base's two new commits touch filter.zod.ts, plugin-security and a changeset; they touch no file of this card, and native-sql-strategy.ts is the same as reviewed. The card's whole diff is now 9 files against 74cac04849.

① Derived judgments

  • IObjectQLEngine.fixedReadLeafClassOf? now answers EngineFixedReadLeafClass | null (was | undefined). The member is unreleased, so this is a change inside the same widening, not a narrowing of anything published. Right.
  • ObjectQL.fixedReadLeafClassOf returns EngineFixedReadLeafClass | null and forwards to the new fixedReadLeafClassAnswerOf(this, leaf). Still one line; engine.ts is 6856 lines at this head. Right.
  • packages/objectql/src/fixed-read-leaf-engine-answer.ts (new, internal): one function, the seam's fixedReadLeafClassOfEngine(engine, leaf) ?? null. It is not exported from index.ts, so objectql's public surface gains nothing beyond the method. Right.
  • The seam is untouched: fixedReadLeafClassOfEngine still answers undefined and is still the package export; the executor boundary (passFixedReadLeaves) still reads the seam's inner fixedReadLeafClassOf(host, leaf) through recognised?.class. Nothing but engine.ts imports the new file, so nothing else depends on its null. Right.
  • Analytics accept set: unchanged from the reviewed head in every case but one, which narrows toward safety: a present member that answers undefined used to compile and now declines. Right.
  • Generated spec baselines: unchanged by the delta; the exported names did not move. Right.

② Semver level

Unchanged: patch on the three packages, Clause-②: yes, Metadata-protocol: none. The changeset's three bullets were rewritten to the null semantics and match the tree (answers null for neither, throws TypeError on a non-leaf, the optional call is the whole answer, a member answering anything but null declines).

Check-runs on this head: all converged; every run is success or skipped, none failed and none is pending. Among them: Build Core, Type Check · workspace, Type Check · consumer gates, Type Check · source gates, Type Check · debt ledger, both Check Changeset runs, every Lint · job (CI, release & engine gates and repo & tooling gates among them, which carry the facade gate over the new one-line forward), Test Core 10 of 10 shards, Governed Surface Queue Guard and Spec property liveness. A cancelled run on the superseded head 99ebe34bbd names another commit and is not read.

③ Boundary flags

SQL push-down (Prime Directive 5): no new id materialisation and no in-app join.

④ Design judgment

S1: closed

Verified in the tree, not from the report:

  • Contract: fixedReadLeafClassOf?(leaf): EngineFixedReadLeafClass | null. The OPTIONAL paragraph now states the three-state answer of ql.fixedReadLeafClassOf?.(leaf): a class, null (compile), undefined from an engine without the member (decline). The ⛔ against the old spelling is gone because the trap is gone.
  • Engine: the answer file maps the seam's undefined to null and nothing else; engine.ts forwards in one line. "The seam's own recognition" in the contract stays literally true.
  • Plugin: returns svc.fixedReadLeafClassOf?.(leaf) with no mapping. Its type is now exactly the hook's FixedReadLeafClassAnswer.
  • Strategy (native-sql-strategy.ts, read, not in the diff): classOf.call(ctx, leaf) !== null declines, and a throw declines. So every answer that is not null is a decline.

Attempts to break the three-state answer, each of which declines:

  • member absent: undefined, plus the one warn.
  • a stub member answering undefined (the break named in S1): undefined, declines. Pinned by the new case (d), which also asserts no warn fires.
  • a member answering false, 0, '', a promise or any object that is not a class: none is null.
  • fixedReadLeafClassOf present but not a function: the warn fires and the optional call throws TypeError; the strategy's catch declines.
  • no "data" service, or getService throws: undefined.
  • a wrapper as "data" on which the host lookup throws: the catch declines.
    The only path to a native compile is a function member that returns exactly null. The fail-open reading now needs a caller to write ?? null by hand against a type that shows three states.

N1: closed as to the first record's point; the docblock no longer claims equality and says implements checks one direction. See N3 for its new last sentence.

N2: closed. The member's TSDoc names the TypeError and fixedInnerReadOf, and says the consumer declines on a throw.

N3 (nit) — EngineFixedReadLeafClass's new last sentence reads "A member this type adds, or a member the seam drops, is caught; a member the seam adds is not." It is true of a FIELD inside a variant. For a union member (a class) it is the reverse: a class the seam adds is caught, and a class only this type has, or one the seam drops, is not. "Member" on a union type reads most naturally as the second. Saying "field" and adding the variant direction would settle it. Prose only; no effect on correctness or on the contract's shape. It can stay as an accepted deviation or go to a follow-up; a fix here moves the head.

No must-fix, no should-fix.

fixed-read-leaf-engine-answer.ts (implementing, new). Its header says what the code does: the seam's recognition with "neither" spelled null, read-only, TypeError on a non-leaf. It imports ObjectQL as a type only, as the seam does, so it adds no runtime cycle. Agrees with the contract.

Pins (lane seat's, read for agreement). (a) now also asserts the live engine answers null; (b) asserts the registration-by-name class with table: 'sys_record_share'; (c) unchanged; (d) new, as above. They match the contract's three states.

Implemented-by: claude/issue-35946-fixed-read-leaf-engine-member
Reviewed-by: session_01L9qibwJEh7hMPPvagWM1g7

VERDICT: PASS

@objectstack-fleet objectstack-fleet Bot removed the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Nov 21, 2026
Base automatically changed from claude/project-thread-thptm0 to main November 21, 2026 00:52
#35945 merged as a squash, so the stacked base's add of the shared test
file met main's add. Main's copy equals the stack base's, so the branch's
copy is kept. The PR's own delta is unchanged (patch-id 4593e0103a).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

Regen-provenance: 7054168410 · e117d86d446bd1eaeec02b0ba25102b93d49eb5b → 978b92727c5c37b2618b2dd1c035ff3b3db3532a · git diff <merge-base> <head> | git patch-id --stable → (empty difference)

Head move at 2026-11-21T00:55Z: a merge-forward of main only, after #35945 merged as squash 0a3dd40863 and GitHub retargeted this pull request to main. 978b92727c is one merge commit, with parents e117d86d44 and main at 523ada4cc0.

It resolved one add/add conflict, in packages/services/service-analytics/src/__tests__/fixed-read-leaf-native-compile.test.ts. The cause is the squash: the stack base 74cac04849 and main both add that file from merge base 17ed9e7bfd. Main's copy is blob d8802db2e8, the same as the stack base's, so the branch's copy 864041fd5a was kept. No other file conflicted.

The PR's own net diff is unchanged. Its patch-id is 4593e0103afb485a7586736c0d9042b5bea63627 on both sides:

  • old head, against the stack base 74cac04849;
  • new head, against main 523ada4cc0.

The new head is 9 files, +252/−14. packages/objectql/src/engine.ts is 6857 lines, at the registry's maxLines 6857, as the PR body predicted. So L1 delta ACCEPT 7053701936 and the Fable delta L2 PASS 7054168410 carry to 978b92727c. CI on this head is pending.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

Landing: PR #35954 (#35946) at 978b92727c5c37b2618b2dd1c035ff3b3db3532a, 2026-11-21T00:56Z

Marking ready and arming auto-merge.

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 Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Decision] ADR-0155 step 5: how the analytics native compiler asks the engine seam which objects decline the share-grant leaf

2 participants