Skip to content

docs(adr): ADR-0155 share-grant semi-join leaf for the sharing read scope (Proposed) - #34064

Merged
os-zhuang merged 17 commits into
mainfrom
claude/project-thread-nlsog5
Nov 16, 2026
Merged

os-zhuang merged 17 commits into
mainfrom
claude/project-thread-nlsog5

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #33899
Clause-②: no
Metadata-protocol: none

Unblocks #33787: that card is Blocked-by: #33899 (ruling record 6895275749) and stays open until the plugin-sharing switch in this record's execution plan lands.

维护者速读

  • 改了什么:新增 ADR-0155(Proposed),提议把共享记录的读权限从「先读出最多 5000 个授权 id 再拼列表」改为数据库内的子查询(引擎内部的第二种 semi-join 叶子),只有文档,没有代码。
  • 为什么改:您对 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 裁定「只做根治」;今天超过 5000 条共享授权的成员会静默失去访问(失败为关闭),而现有编译路径表达不了这个子查询,需先有 ADR。
  • 风险与回滚:纯文档、受管面,不改任何运行时行为;回滚即撤掉本 PR。执行卡要等您批准后才切(约 5–7 个 PR、二点五千到四千行)。
  • 先看:docs/adr/0155-…md 的「Questions for the maintainer」节(Q1–Q3),再看 TL;DR 与 D-0/D3/D5。
  • 两分钟验证:node scripts/adr-index.mjs --check && node scripts/check-adr-symbol-anchors.mjs,预期两者都 OK、无 0155 的发现。
  • 需要你做的:暂无。第 6 轮复审意见已在新 head 0913316313 上改完,还欠 review#2 对新 head 做一次增量复审;复审通过后再请您回答下面三问并批准本 PR(Tier H)。
    • ① 子查询是否不加租户隔离(推荐:不加,与今天读共享的方式一致)。
    • ② Mongo、OData、跨数据源对象等跑不了子查询的地方:保留 id 列表兜底,还是拒绝(推荐:按您「首先保sql」的原则不留列表;这些存储上的共享授权将不再生效并给出明确提示)。
      • 在 sys_record_share 上注册了中间件或 find hook 的宿主也归入这一问:推荐从切换卡起、启动时就拒绝,直到撤掉该注册。本仓库没有包单独在这张表上注册;但宿主若把 sys_record_share 纳入 plugin-audit 的记录查看审计,就属于这一类,撤掉该注册即放弃对共享行的查看审计。ADR 把这一类整体保留,「豁免声明跳过系统读的注册」作为另一选项留给您在这一问里定。不点名任何对象的全局注册不算这一类(与 ADR-0139 D5.2 同一条线),改为告知宿主:按表名注册在 sys_record_share 上的收窄永不被绕开,宿主得到 ② 对这一类裁定的答案;不点名对象的收窄从切换起不在共享授权读上运行。例外与代价:宿主若有不点名对象、却改了 sys_record_share 系统读的注册,切换后共享授权的行可能不同,宿主会被告知;这时「行不变」只靠告知维持,运行时不拒绝、不报告、不记日志。这条边界也请您在这一问里一并定。
      • 内存驱动(driver-memory)目前在 ADR 里定为进程内精确求值;您也可以把它一并归入这一问。
    • ③ 按条件批量更新(update)是否也允许用这个叶子(推荐:只在 update 上放开写形态,其它写动词不放)。

What changes

One new decision record, docs/adr/0155-sharing-scope-share-grants-lower-to-an-engine-internal-semi-join-leaf.md (Status: Proposed, questions ①–③ open), and its generated row in docs/adr/README.md (node scripts/adr-index.mjs; no other row moved). No code, no changeset (skip-changeset).

The record proposes that the sharing scope's share-grant arm (buildReadFilter, and buildWriteFilter for predicate update) lower to one more engine-internal, never-authorable branded comparand, provisionally SharedRecordIds, on the ADR-0147 pattern: its own brand, a fixed inner read of sys_record_share under system authority, compiled by SQL drivers as id IN (SELECT record_id FROM sys_record_share WHERE …). It revisits ADR-0139 D1 ("No second leaf") for this one leaf and answers ADR-0139 open item O4.

  • D-0 the same-set invariant: same rows up to 5,000 grants, the corrected set above, nothing else moves.
  • D1 the leaf and its brand; D2 the inner read (today's grant read, uncapped); D3 every arm stays in the same filter (approval ids become their own disjunct, the queue arm stays a sibling and never enters the subquery, delete stays owner-only).
  • D4 the engine seam and what is built once with ADR-0147; D5 the evaluator census (decided rows: driver-sql family, Turso remote, driver-memory); D6 what the switch PR must show (parity at 5,000, corrected at 5,001 and 6,000, list total and GET, SQLite and PostgreSQL, approval and queue arms, the plan and timing for a caller with no grant, the nested and delegated positions, ablated; the R9 figure quoted narrowly per 6893239331 item 3).
  • D4's recipient rule (former open item O10, now decided here): the seam admits a composed share-grant leaf only when its recipient is the reading context's user or that context's delegator; a system context is the stated exemption; any other recipient is a composition fault answered with D4's envelope. The shared seam compares every identity a composed anchor names with the reading context: for ADR-0147's anchor both its caller and its organization (the reading context's active organization); ADR-0147 takes this through its cross-reference note. The anchor check compares the leaf's anchor with the anchor the reading context itself carries, caller and organization together, never re-derived from the context's user or tenant (ADR-0147 D-a), so ADR-0147 D-c's rebuilt context for a delegated controlled-by-parent write is admitted. On the analytics native-SQL path a security item is with the owner seat; the record states the design rule only. A registration that names no object is outside the host class, on ADR-0139 D5.2's line. The ISharingService prose and the switch card's changeset tell the host one thing: a narrowing registered for sys_record_share by name is never read around and gets the second class's answer as ② is ruled; one that names no object is not run on the share arm from the switch on. D-0 states the exception: on a host with a registration that names no object and changes a system read of sys_record_share, the share arm's rows can differ after the switch, and the host is told; the price, among Q2's costs, is that D-0's same rows there rest on the telling alone. Open items are now O1-O9. O8's census, which also reads registrations that name no object, is produced by the seat that cuts the switch card, as a condition of cutting it, and recorded in that card's body.
  • Questions put, not decided: ① tenant scope of the subquery; ② what an evaluator that cannot run the leaf answers (MongoDB, OData, other-datasource objects, the analytics native-SQL compiler, the explainer), with the maintainer's standing principle quoted verbatim; ③ the leaf on a predicate update.

The record states the design and the parity rule only; on today's behaviour it repeats the card's words and adds none.

Tests

None: a docs-only diff. Anchor resolution is the test of its source readings: 55 distinct path#symbol anchors plus file-level path anchors, all resolving at the head below (rounds 1 and 2 added readable-ids.ts#ComposedReadableIds, sharing-service.ts#resolveSystemGrantOrganization, analytics-service.ts#callCtx, engine.ts#registerHook, read-audit.ts#installReadAuditWriter and security-service.ts#getReadFilter; round 3 added explain-engine.ts#resolveDelegatorContext and security-plugin-cbp-write-gate.ts#assertControlledByParentChainEditable).

Acceptance notes

  • Authoring route (deviation, declared). This thread is not served at the contract-review tier that dispatch-gates --tier mandates for docs/adr/**; per the dispatch order the record was authored by an isolated os-dev subagent pinned to that tier, on this branch, through fix round 3. Fix rounds 4 to 6 were written in the card thread at its default tier, by the seat's order; the at-tier review of those rounds is review#2's.
  • Not in this diff, owed after acceptance: dated pointer notes on ADR-0139 (D1, O4; D3 if ② is ruled L or R2), on ADR-0111 D7 (if ② is ruled R2) and a cross-reference on ADR-0147 D-a. The carrier is the governed edit that records the maintainer's rulings in this record's Status line, which also decides which notes are owed.
  • Readings that refine the card: the write scope's share arm exists on predicate update only and also covers public_read objects; plugin-security already narrows addressed predicate writes to at most 10,000 readable rows; "share rows can carry a NULL organization" holds only for ADR-0131 D1's exceptions; two callers admit ReadableIds today, not one.
  • Noted, not filed: scripts/adr-index.mjs strips underscores from identifiers in titles (ADR-0147's index row reads currentuser.orguserids), which is why this title says "record-share table".

Verification

Head 0913316313 (record 832 lines): the ADR commit 5993103131, fix round 1 066925797b (contract review 6899302526: S1-S3, N1-N13 taken), fix round 2 1f6f9718d9 (delta review 6900428326: S4-S6, N14-N17 taken), fix round 3 11d7d354ca (delta review 6901557418: M1 option 1, S7-S9 taken), fix round 4 b0b45bcc32 (delta review 6902450506: S1, N2-N4 taken in the record, N1 here), fix round 5 ea5e72ef87 (delta review 6902721135: S1 remainder, N1, N2 in the record, N3 here), fix round 6 0913316313 (delta review 6902940583: S1, N1, N2) and merges of origin/main, the last at 0d1443d0bf (merge 97210679bc).

Derived gates: 21 derived, 21 run, all exit 0; --ran reconciles 21/21, 0 NOT-MEASURED
node scripts/check-adr-links.mjs :: exit 0
node scripts/check-adr-links.mjs --self-test :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0
pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0
pnpm check:adr-anchors :: exit 0
pnpm check:adr-index :: exit 0
pnpm check:adr-symbol-anchors :: exit 0
pnpm check:ci-filter-parity :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:doc-authoring :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:pm-governed-merges :: exit 0
pnpm check:pm-prior-rulings :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:watch-hint-literal :: exit 0

check:doc-formula-expressions ran after turbo run build --filter=@objectstack/formula --filter=@objectstack/lint under os-verify-lock (VERDICT command-exit 0, 96 s).

Tier H (docs/adr/**): this PR stays draft until a GOVERNED_APPROVERS approval.

…cope (Proposed)

A new decision record, Status Proposed. The sharing scope's share-grant arm
lowers to one more engine-internal branded comparand over sys_record_share,
compiled in the id list's own position, so every grant counts and the
5000-row cap is gone rather than raised.

Three questions are put to the maintainer and are not decided by the text:
the tenant scope of the subquery, what an evaluator that cannot run the leaf
answers, and the leaf's write form on a predicate update.

The record declares and implements nothing. docs/adr/README.md gains the
record's row and the counts it implies, from `node scripts/adr-index.mjs`;
no other row moved.

Claude-Session: https://claude.ai/code/session_01ADHkmSrxgDeeJWnQpVfLcX
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet objectstack-fleet Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Nov 15, 2026
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation labels Nov 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: f3194c5140fb7e264cd50c81e3e253b303d2bc0a
Local-runs: none
Scope: docs/adr/0155-sharing-scope-share-grants-lower-to-an-engine-internal-semi-join-leaf.md, docs/adr/README.md + none

PR #34064 for card #33899: one new decision record, ADR-0155 (Status Proposed), and its index row. Reviewed in a context of its own, from the tree at this head, cards #33899 and #33787 with their comments, the PR, and the head's check-runs. Code outside the diff was read on main e71ecc1b32, the head's merge base, never reviewed.

No must-fix. Three should-fix (S1 to S3) and thirteen nits (N1 to N13), all listed under ④.

① Derived judgments

Gates on this head. 49 check-runs, all completed, none still running: 26 success, 23 skipped, 0 failed.

  • Success: Governed Surface Queue Guard; PR-body guards; Check Changeset; Check PR Size; Check Documentation Links; Auto Label; filter; Plan Test Core shards; Test Core (1/8); Test Core; Test UI; Dogfood Regression Gate; Lint & Repo Gates; Lint · docs & code guards; Lint · repo & tooling gates; Lint · CI, release & engine gates; Lint · ESLint; Lint · PM dispatch-gates; the three Lint · scoped jobs; TypeScript Type Check; Type Check · workspace, source gates, consumer gates and debt ledger.
  • Skipped: the UI, build, docs-build, live-database and opt-in jobs, the Dogfood shard matrix and Dogfood Verify CLI, both queue verdicts, the schedule gate, and a second instance each of Auto Label, Check Changeset and Check PR Size.

The diff. Net of the merge, the head differs from main in two files: the new record (+673) and docs/adr/README.md (+4/−3). The record's blob is the same at the ADR commit 5993103131 and at the head.

Claims about today's code, each read on e71ecc1b32. All hold. Four are stated loosely and are graded N1, N2, N3 and N12 under ④. Paths are under packages/.

  • The capped grant read. plugins/plugin-sharing/src/sharing-service.ts L747–756: one find of sys_record_share with fields: ['record_id', 'access_level'], limit: 5000 and context: SYSTEM_CTX. L89: const SYSTEM_CTX = { isSystem: true, positions: [], permissions: [] } as const;.
  • The cap fails closed. The ids that read returns are the only members of the share disjunct (sharing-service.ts L770: disjuncts.push({ id: { $in: grantedIds } })), and the middleware ANDs the scope into the read's where (sharing-plugin.ts L1526). A grant past the cap adds no row. On this the record repeats the card's sentence ("past 5,000 share grants a member silently loses access, failing closed") and adds none.
  • Outside the wall. The security middleware passes a system context through (plugins/plugin-security/src/security-plugin-authz-middleware.ts L667: if (opCtx.context?.isSystem)), and objectql/src/engine-driver-options.ts#driverReadScope (L424) projects no tenant scope for a system context that names no organization. No access gate reads a grant row's stamp: in sharing-service.ts, checkEdit (L1180–1191) and listShares (L2305–2310) also read under SYSTEM_CTX with no organization predicate.
  • buildWriteFilter on update. sharing-service.ts L867: if (verb === 'delete') return ownerMatch;. The update read (L869–879) adds access_level: { $in: [...WRITE_ACCESS_LEVELS] } at the same limit: 5000; access-level.ts L67: WRITE_ACCESS_LEVELS: readonly string[] = ['edit', 'full']. No approval arm; a phantom anchor answers the deny sentinel (L856). The middleware feeds it to the predicate path only (sharing-plugin.ts L1673–1691); the by-id gate reads one record (limit: 1, sharing-service.ts L1189). A permanent delete dispatches as purge, class delete; restore and the recycle-bin doors carry no AST (sharing-plugin.ts L1552). So ③ is one verb on one door, as the record says.
  • The ReadableIds leaf. spec/src/data/readable-ids.ts L88: Symbol.for('objectstack.filter.readableIds'). drivers/driver-sql/src/sql-driver-internal-helpers.ts L136–141: this.getBuilder(parent).select(this.remoteColumn(parent, 'id', 'id')), then applyTenantScope(sub, parent, options), then applyFilters(sub, leaf.scope, options). It projects the parent's id under the outer read's tenant scope and has no slot for another column. objectql/src/filter-comparand-shape.ts L130: new Set(['find', 'findOne', 'count', 'aggregate']); engine-update.ts L439 refuses a leaf in an update's predicate at the executor's entry.
  • Two admitting callers, not one. The engine door (objectql/src/filter-comparand-shape.ts L123) and the analytics merges (services/service-analytics/src/plugin.ts L1143, strategies/objectql-strategy.ts L1240 and L1785) pass admitReadableIds: true.
  • Which drivers run a subquery. Six drivers ship, and D5 names all six. driver-sql compiles (sql-driver-filter-helpers.ts L832); SqliteWasmDriver and TursoDriver extend SqlDriver; Turso's remote transport has its own compiler (remote-transport.ts L3044); driver-memory evaluates in process (memory-driver.ts L1490) and refuses tenant-scoped use (memory-tenancy-guard.ts); driver-mongodb refuses (mongodb-filter.ts L1002–1003); driver-odata refuses (odata-driver.ts L622, called at L290 and L329).
  • The evaluator census. formula/src/matches-filter.ts L716 answers false for a non-array $in comparand, which is D5's reason for its rule. That matcher's callers on main are the engine's having filter, the write tenant wall, the stored RLS check and the explainer; only the explainer is handed the sharing read filter (explain-engine.ts L2115, matched through L1720, published as rowFilter at L2309). The comment and attachment gates reach it through security.explain (comment-access-hooks.ts L820, attachment-access-hooks.ts L461). getReadFilter has no caller on main outside plugin-security, the engine's composition and the analytics service. The analytics native compiler refuses the leaf at entry (read-scope-sql.ts L843) and binds one parameter per $in member (L2199); the native strategy declines such a query (native-sql-strategy.ts L872); multi-hop is a shape the engine strategy refuses and only native SQL serves (cross-object-where.ts L88 and its header). The sharing service reads sys_record_share at six sites, and only L747 and L869 build a list for a scope. I found no evaluator the census misses.
  • The predicate-write bound. plugins/plugin-security/src/security-plugin.ts L926: PREDICATE_WRITE_READABLE_ID_CAP = MAX_BULK_PER_ROW_HOOK_ROWS; spec/src/data/bulk-write-hook-conformance.ts L282: MAX_BULK_PER_ROW_HOOK_ROWS = 10_000; security-plugin-addressed-writes.ts reads the cap plus one (L159) and throws past it (L173).
  • The update path under ③ A. drivers/driver-sql/src/sql-driver-bulk-operations.ts L323: if (query.where) this.applyFilters(builder, query.where, issueOptions);, the compiler reads use. engine-update.ts L947 reads prior rows with the same ast.
  • The refusal device. core/src/utils/readable-ids-driver-refusal.ts L208–209: code = 'INTERNAL_ERROR', status = 500, logged at error once per driver instance.
  • The table. plugins/plugin-sharing/src/objects/sys-record-share.object.ts: record_id is a text pointer (referenceVia: 'object_name', L192); indexes on (object_name, recipient_type, recipient_id) and (object_name, record_id) (L318, L321). It has no validity, status or soft-delete column, and a sys_ row's delete is permanent (spec/src/data/object.zod.ts L182). So D2's "nothing added" drops no implicit predicate of today's read.
  • The AST filter mirror (plan step 6). sharing-plugin.ts L1527 and L1691 write it; the executor boundary judges where, having and each aggregation's filter (objectql/src/engine-security-resolvers.ts), never filter.
  • The ADR-0147 seam and the corpus. ADR-0139 D1 ends "No second leaf, no EXISTS, no correlated form" and gives its read-verbs rule no reason; its O4 reads "A separate finding, not this record's". ADR-0147's Status is "Proposed — 2026-11-02"; its D-a has the leaf arrive "already composed"; its D-b says of the wall "Its only lawful effect is redundancy, and anything more changes S". OrgMemberIds has no occurrence under packages/ on main: unbuilt, as the card says. ADR-0111 D10's heading is quoted exactly. AGENTS.md Prime Directive 5 reads as Q2 quotes it. The principle in Q2, 「有的功能如果Mongo内存不支持,那就不需要支持,首先保sql,应该用最高性能的方案,而不能为了兼容而兼容」, is byte-identical to triage comment 6896032788.
  • The cards. "What it costs" matches 6893239331 item 3 in every number and limit: the scope statements alone, 1M rows, 5,000 grants, PG 21.6 → 7.0 ms, SQLite 18.3 → 12.1 ms, the line-item chain flat, not a whole-request figure. D6's pins match item 2 and ruling 6895275749. D3 follows the correction in 6895112167 ("every arm stays in the same filter").
  • Anchors and links. All 47 path#symbol anchors resolve to a definition at the head, and the file and directory anchors exist. The nine relative links and the eleven in-document fragments resolve.

The decisions against the card.

  • Allowed. D1 is card item 1 (its own brand, the ADR-0147 pattern). D2 restates today's read and leaves the tenant half to ①. D3 is item 6 as 6895112167 corrected it. D4's "Built once" answers item 5, which asked whether. D5's decided rows are the ones item 7's plan builds. D6 is the ruling's pins. Items 2, 4 and 3 are put as ①, ② and ③.
  • One reaches past the card. D4's refusal for the middleware class (S2).
  • Q1 to Q3 are open in the text. The Status line names all three as "open for the maintainer" and "not decided by this text". Each Decision sentence that depends on one says so (D-0, D1 Verbs, D2 Tenant scope and the write form, D3, D4, D5, D6). The question section opens "a recommendation is not a decision, and no execution card is cut", and Acceptance criteria hold the cards until the rulings are recorded.
  • Soundness. D-0 counts in rows, the cap's own unit, and leaves out the evaluators ② covers. D2's blank-id guard is grantedRecordIds' filter (sharing-service.ts L365–372). D3's "A union of two id sets and an OR of two memberships select the same rows" holds, and an always-present empty subquery admits nothing. D5's rule follows from the matcher line above. The inconsistencies found are S2, N4 and N11.

PR body requirements, all met. Fixes #33899 is line-initial. "Unblocks #33787: that card is Blocked-by: #33899 (ruling record 6895275749)" names #33787 as blocked by this. ## 维护者速读 lists ①, ② and ③ in Chinese, one line each, under 「需要你做的」. Neither the body nor the record carries a model identifier.

② Semver level

None. The diff is two files under docs/adr/; no released package moves, so no changeset is owed and skip-changeset is the right label (AGENTS.md Post-Task 3: the label is for a diff that publishes nothing from any released package). Check Changeset: success.

Clause-②: no and Metadata-protocol: none are both line-initial in the PR body, and both are right: the record declares and implements nothing, and no key, value or type an author can write moves. The record says each execution card declares its own Clause-②. The spec card will add a public export and, under ②'s R2 or L, a driver declaration; those cards carry the levels.

③ Boundary flags

  • Authoring route. Declared in the claim (6897091687), the PR body and the report (6898513427): the thread is served below the tier docs/adr/** mandates, so an isolated os-dev subagent pinned to that tier wrote the record on this branch. A served tier cannot be read from the tree, so this is accepted as declared, not verified. This review ran in a separate context and read neither the dispatch order nor the seat's conclusions.
  • The main merge. The head is the ADR commit 5993103131 (parent b8ac0e24) plus merge f3194c5140 of main e71ecc1b32. 40 commits came in by git rev-list --count; the report says 32. None touches a code file the record cites. ADR-0139 moved in its Status line and D6 only (PR docs(adr): ADR-0139 / ADR-0055 record the view-all unrestricted-reader chain drop (#33696 ruling) #33992, 8961c0c3), which the record does not cite. AGENTS.md moved, and Prime Directive 5 still reads as quoted. The heading "read on origin/main b8ac0e24" is true as provenance; ① re-read every claim on the merge base.
  • The index. The README change is the generated row and the counts. Both check against the tree at the head: 156 records, 151 numbers, Proposed 9, and the status rows sum to 156. scripts/adr-index.mjs plainText strips underscores (L237–243), and ADR-0147's row reads currentuser.orguserids on main. That is pre-existing, not this diff's, and rightly left alone. Whether to file it is the seat's call.
  • ADR-0139 untouched, pointer notes owed. Accepted as declared: the claim set the surface to one record and its index row, two of the five notes, and part of a third, depend on rulings not yet made, and Acceptance criteria hold the notes as owed ("O7's pointer notes land in their own governed edit"). Before acceptance the seat names the card that carries them (the report's open question 1); see N4 and N5. The PR body's "PR docs(adr): ADR-0139 / ADR-0055 record the view-all unrestricted-reader chain drop (#33696 ruling) #33992 amends its D6 and Status line in flight" is stale: that PR is in this head's base.
  • driver-memory left decided. Sound. Memory evaluates ReadableIds in process today, ADR-0139 D3 and ADR-0147 D-d both give it that row, card item 7 builds it, and D5 states the cost of moving it. The principle Q2 quotes names 内存, and neither Q2 nor the 速读 points at the row (N8). The owner seat should put that sentence in front of the maintainer with ②.
  • "50 anchors resolve". Holds by my own resolution at the head: 47 symbol anchors, each to a definition, and the path anchors exist. With docs/adr/ I count four path spans; the gate counts its own way. The gate was not re-run here.
  • Tier H. This record is the seat's contract-tier review. Landing still waits for a GOVERNED_APPROVERS approval, and the PR is draft.
  • Security. The record describes the design and the parity rule. On what happens past today's cap it repeats the card's sentence and adds none (TL;DR, "What it costs"). A security item is with the owner seat (S3).

④ Design judgment

Against its first consumer. The first consumer is the plugin-sharing switch, and it can be written from D1 to D3 as they stand. Every reader of the two builders on main has an answer in the record: the middleware's where (D3, D4), the read filter the security service hands to composed ReadableIds scopes and to analytics (D4, Q2), the explainer's record pass (Q2), the by-id gates (unchanged; they never see the leaf), and the predicate-write narrowing (a read through the read door, so it takes the read form).

Against its execution plan. Spec, engine, driver-sql and Turso remote, memory, the rest of the census, then the switch. That is card item 7 with one step added. "It lands last" is right: no producer writes the leaf until every evaluator has an answer for it. The gaps are S1, N9 and N10.

Clarity, proportion, corpus. 673 lines and 58.6 KB, against 37.5 KB for ADR-0139 and 37.9 KB for ADR-0147. The difference is the question section (146 lines) and a longer Context (102 lines), and the card's seven items asked for both. Restatement is limited to three places: the SQL in the TL;DR and in D2, the three questions summarised in the Status line and the TL;DR, and four rejections that appear under "Why no existing form serves" and again under Alternatives. ADR-0147 has the same shape. I found no padding. Header fields, anchor style and closing sections follow ADR-0147; the one departure is "Revisits" where ADR-0147 has "Amends" (N5).

The three recommendations.

  • Q1. Both options are costed. B's costs are concrete and check against the code (the driver's tenant predicate has no NULL arm; the stamp can differ from the record's organization, resolveDirectGrantOrganization, sharing-service.ts L2156–2166), and what B buys is named. Fair.
  • Q2. Three answers, a census that gives each answer's effect per evaluator, the recommended column's price "stated plainly" (on four storage rows, grants that count today stop counting), "Why not R1 alone", and L's merit said outright: "the one answer under which nothing that works today stops working". The principle is quoted, not paraphrased. Fair.
  • Q3. A, the three forms of B, and C are each costed, and the fork is real: the engine refuses a leaf on a write verb (filter-comparand-shape.ts L130, engine-update.ts L439) while buildWriteFilter feeds a predicate update. Fair; N13 is the one loose sentence.

Should-fix.

  • S1 — D6 and O3: no pin for the caller with no grant. The record makes the share disjunct universal ("As a leaf it is present on every sharing-scoped operation") and prices that in one clause of Consequences ("for a caller with no grant too"). Its one measurement is the R9 figure, taken at 5,000 grants. The statement that changes shape most is the one for a caller with no grant and no queue: today the bare owner match (sharing-service.ts L771), after the switch an $or with a subquery arm on every list page and total. What to measure is whether the planner still serves that statement from the owner index. D6 pins rows, and O3 measures the grant table's index. Add one pin, on the driver card or the switch card: plan and timing of the list page and its total for a caller with no grant, on SQLite and PostgreSQL, against today's statement. Not measured in this review.
  • S2 — D4 decides one class of ② in place. The other-datasource class is sent to ② ("what it answers is ②"). The middleware class is decided: "the seam refuses the leaf rather than read around the middleware, and every sharing-scoped operation on that host fails until the registration is removed". That is answer R1 for this class whatever ② rules, and Q2's "Why not R1 alone" names that outage as R1's price. ADR-0139 D5.2 is the precedent for the class, and there the refusal was narrower: six consumers kept a bounded probe, and the seventh refuses the one declaration that meets the class, at boot (D5's seventh-consumer note). Here it comes at read time, on every sharing-scoped operation. Under L the up-front substitution could serve the class, since the list is read through the engine and the middleware runs. Under R2 the class could be inert and not an outage. Add the class as a row of Q2's census, or say in D4 why it is decided apart and whether a boot check names the registration. The class is empty in this repository (hasObjectMiddleware counts neither a wildcard nor an unscoped registration, and none names sys_record_share on main), so the weight sits on O8's census.
  • S3 — O10, read with D1 ("It arrives composed") and D4 ("The engine's door admits this brand the same way"). A security item is with the owner seat. The ask is that O10 is decided in this record and not left to the engine card.

Nits.

  • N1 — "What this reading adds", third bullet: the sentence that names a record share among the NOT NULL rows is ADR-0131's TL;DR item 2 and D3 (L99, L386 on main), not D1.
  • N2 — "The read scope": buildReadFilter also answers null for an object with no schema (sharing-service.ts L681; buildWriteFilter L837). The list omits that arm.
  • N3 — "The table" and Q1 B: a rule-materialised grant carries its rule's organization only when the rule has one. A platform-global rule's grant "belongs where the record does" (sharing-service.ts L2108–2109).
  • N4 — The header's "Revisits" has ADR-0139 D3 move "under one answer to ②", and O7 names the answer: "only under ②'s R2". D4's table says this record consults a driver declaration "under every answer to ② but R1", and Q2's L chooses "from a declaration the driver makes". So the D3 pointer is owed under L as well.
  • N5 — O7's reason is past: PR docs(adr): ADR-0139 / ADR-0055 record the view-all unrestricted-reader chain drop (#33696 ruling) #33992 is in this head's base. ADR-0147 is still Proposed, and its pointer notes already stand on ADR-0139 (L149 and L198 on main, dated the day of its own Status line) under a header field named "Amends". If the deferral stays, O7 should name the card that carries the notes.
  • N6 — D4 "Built once", the fixed-inner-read row: "one table, one projected column, a closed set of bound equality and membership predicates". ADR-0147's compiled form also carries an outer caller arm and a form with no subquery when no organization is active (its D-a and D-c). The shared description as worded carries neither. Mark them per leaf or widen the row.
  • N7 — D4's second class names object-scoped middleware only. Today's grant read also fires beforeFind and afterFind hooks registered for sys_record_share (objectql/src/engine-find.ts L540, L603). None is registered in this repository, and ADR-0139 D5.2 draws the same line, so this is consistent with the corpus. One sentence would close it.
  • N8 — Q2 quotes a principle that names memory and never points at D5's memory row. One line in Q2 would put the decided row where the principle is quoted.
  • N9 — Execution plan step 4 gives driver-memory "the in-process evaluation" and names no update path. Step 3 names it for driver-sql and Turso ("the update path (③ as ruled)").
  • N10 — D6 pins the top-level position. D4's nested position (the leaf inside a composed ReadableIds scope, where today's list "binds once more") and D3's delegated pair have no pin named.
  • N11 — Consequences: "A sharing-scoped operation issues no grant read of its own" and the Freshness sentence about a predicate update hold only under ③ A. Neither says so.
  • N12 — "What this reading adds", second bullet: "It does not evaluate the share arm" reads as if the narrowing knew nothing of shares. The narrowing is a read through the read door (security-plugin-addressed-writes.ts L155–165), so the read scope's share arm is in it. What it leaves out is the write scope's arm.
  • N13 — Q3: "each meets a ruling already made". The first form of B is set against a seat constraint (6893239331 item 1), not a ruling. Say which ruling it meets, or call it a constraint.

Implemented-by: claude/project-thread-nlsog5
Reviewed-by: session_01ADHkmRxXmVQ41fqnaTPGAv

VERDICT: PASS

…pin, middleware row

A text-only round on the record after its at-tier contract review. The
record stays Proposed, and its three maintainer questions stay open.

D4 decides the seam's recipient rule. The seam admits a composed
share-grant leaf only when its recipient is the user of the context the
operation runs under, or that context's delegator. A system context is
the stated exemption. Any other recipient is a composition fault,
answered with D4's refusal envelope. The reason is the one ADR-0139
already acts on: a composed scope is trusted only for the principal it
was composed for. ADR-0147's anchor takes the same rule, because the
seam is built once for both leaves. The open item that asked this
question is removed.

D6 gains two pins: the nested and the delegated positions, and the plan
and timing of the list page and its total for a caller with no grant,
on SQLite and on PostgreSQL, against today's statement.

The middleware class D4 recognises becomes a row of Q2's census, with
what each of the three answers does to it and a recommendation of its
own. D4 no longer decides it in place.

D5 keeps only the in-process matcher's answer for an `$in` whose
comparand is not an array.

The Revisits line and O7 say the ADR-0139 D3 pointer is owed under L as
well as R2, name the card that carries the ADR-0139 notes, and drop a
reason that no longer holds. Q2 points at D5's driver-memory row, which
the maintainer may move under the same question.

One-line corrections from the same review: the read scope's null
answers, the organization stamp of a rule-materialised grant, the
ADR-0131 citation, what a leaf compiles to outside its subquery, find
hooks on the grant table, the update path on the driver-memory card,
the seat constraint Q3's first form meets, and the statements that hold
only under one answer to the third question.

No other record is edited, and the index row is unchanged.

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

Copy link
Copy Markdown
Contributor Author

domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 1911c3251906baa8d7b9401a506dc9dd9763c993
Local-runs: none
Scope: docs/adr/0155-sharing-scope-share-grants-lower-to-an-engine-internal-semi-join-leaf.md, docs/adr/README.md + none

PR #34064 for card #33899: ADR-0155 (Status Proposed) and its index row. This record is the delta on fix round 1. The at-tier record on f3194c5140 is comment 6899302526 (PASS, S1 to S3, N1 to N13); this head adds one fix commit and two merges of main. Reviewed in a context of its own, from the tree at this head, the PR and its comment, card #34102 and its comments, and this head's check-runs. Code outside the diff was read on main f81e4b6c47, the head's merge base, never reviewed.

No must-fix. S1 to S3 and N1 to N13 are each taken. The round's new text carries three should-fix (S4 to S6) and four nits (N14 to N17), all listed under ④.

① Derived judgments

Gates on this head. 48 check-runs, all completed, none still running: 26 success, 22 skipped, 0 failed.

  • Success: Governed Surface Queue Guard; PR-body guards, in both of its runs (the push, and the body edit after it); Check PR Size; Check Documentation Links; Auto Label; filter; Plan Test Core shards; Test Core (1/8); Test Core; Test UI; Dogfood Regression Gate; Lint & Repo Gates; Lint · docs & code guards; Lint · repo & tooling gates; Lint · CI, release & engine gates; Lint · ESLint; Lint · PM dispatch-gates; the three Lint · scoped jobs; TypeScript Type Check; Type Check · workspace, source gates, consumer gates and debt ledger.
  • Skipped: Check Changeset in both of its runs, by the job's own label condition (.github/workflows/pr-automation.yml L309: the event payload already shows skip-changeset); the UI, build, docs-build, live-database and opt-in jobs; the Dogfood shard matrix and Dogfood Verify CLI; both queue verdicts; the schedule gate; a second instance each of Auto Label and Check PR Size.
  • The runs on the fix commit 066925797b that a newer push cancelled are superseded by these and were not read as verdicts.

The head. 1911c32519 merges the fix commit 066925797b with main f81e4b6c47. The fix commit sits on 617f298c4a, which merges the reviewed head f3194c5140 with main 27c2f1ea32. The record's blob is the same at f3194c5140 and 617f298c4a, and the same at 066925797b and this head. The README's blob is the same at all four. So neither merge authored a line of either file, and the round is the fix commit alone: one file, +125/−70, 673 to 728 lines. Net of the merges the head differs from main in the same two files: the record (+728) and docs/adr/README.md (+4/−3).

What moved under the record. Ten commits reached main between the first record's base e71ecc1b32 and f81e4b6c47. None touches docs/adr/ or any of the 32 files the record cites, so every reading in the first record stands on this base, and 603 of the record's lines are carried unchanged. This round read the added lines against main, in the sections they sit in. AGENTS.md moved in its governed-surface paragraph. Prime Directive 5 still reads as Q2 quotes it, and the principle in Q2 is still byte-identical to triage comment 6896032788. Main has since moved three more commits, to 385ea1cce5, which this head has not merged. None touches docs/adr/. One cited file is among them, objectql/src/engine-update.ts, changed in three lines about currency codes; the refusal the record reads there is unchanged.

Round 1's findings against the text. Each is taken, and each fix was checked on main f81e4b6c47. Paths are under packages/.

  • S1. D6 has the pin, "The caller with no grant": the list page and its total, plan and timing, on SQLite and on PostgreSQL, "against today's statement", and "whether the planner still serves it from the owner index". Plan step 3 owes it ("D6's reading for a caller with no grant"), and Consequences points at it ("D6 pins that statement's plan and timing"). Today's shape is as the pin says: plugins/plugin-sharing/src/sharing-service.ts L771 returns the owner match alone when it is the only disjunct.
  • S2. The middleware class is a row of Q2's census with its own L, R1 and R2 and its own recommendation, "R1, at boot", priced in the cost list as "an outage by choice". D4 sends the class to ② ("each is a row of Q2's census"). The TL;DR, D5's list, the Recommendation and plan step 5 follow. The precedent the row cites holds: ADR-0139 D5's seventh-consumer note has the boot refuse the same class and a later registration meet the refusal at read, and objectql/src/plugin.ts L1394–1402 is that refusal ("no request is served by a deployment this rejects"). What the row leaves open is S4.
  • S3. O10 is gone (O1 to O9), and D4 decides it as "The recipient rule". Its soundness is under ④.
  • D5. The sentence now cites only the matcher's false for an $in whose comparand is not an array, which holds (formula/src/matches-filter.ts L716).
  • N1 to N3. ADR-0131's TL;DR item 2 and D3 are cited (L97–99 and L385–387 on main). The read scope's null answers gain "an object with no registered schema" (sharing-service.ts L681, L837). The rule-materialised stamp reads "or the record's where the rule is platform-global and has none", anchored at resolveSystemGrantOrganization (L2115–2125), and Q1 B follows.
  • N4, N5. "Revisits" and O7 owe the ADR-0139 D3 note "under ②'s L or R2" and the ADR-0111 D7 note "only under R2", which agrees with D4's table. The past reason is gone and a carrier is named. The carrier is S5.
  • N6 to N9. The built-once table has a row for "What a leaf compiles to outside its subquery", and it matches ADR-0147 D-a (L167) and D-c (L192–200). D4 states that today's grant read runs the table's find hooks and the subquery runs none, and O8's census looks for both (objectql/src/engine-find.ts L540, L603); N15 is what that leaves. Q2 points at D5's driver-memory row, and the 速读 carries it as a sub-bullet. Plan step 4 names the update path.
  • N10 to N13. D6 pins "The nested and the delegated positions". Consequences conditions its Positive and Freshness sentences on ③'s A; N16 is the remainder. The addressed-write narrowing is restated as "a read through the read door". Q3 calls 6893239331 item 1 a seat constraint.

Anchors and links. 49 path#symbol anchors, each resolving to a definition at this head. The two new ones are spec/src/data/readable-ids.ts#ComposedReadableIds (L186) and sharing-service.ts#resolveSystemGrantOrganization (L2115). The path spans exist, and the nine relative links and eleven in-document fragments resolve. No O10 and no #33992 remain in the record. The body's count of 52 is the gate's, and the gate was not re-run here.

PR body requirements, all met. Fixes #33899 is line-initial. "Unblocks #33787: that card is Blocked-by: #33899 (ruling record 6895275749)" names #33787 as blocked by this. ## 维护者速读 lists ①, ② and ③ in Chinese, one line each; ② carries two sub-bullets of one line each, for the host class and for driver-memory. 「需要你做的」 says a delta review is owed first, then the three answers and the approval. The stale sentence and the commit count are gone, Verification names this head, and neither the body nor the record carries a model identifier. One remark, not graded: the host-class sub-bullet reads 「在对象上注册了中间件的宿主」 and names no table, while the repository does register object-scoped middleware on other objects (ADR-0139 D5.2 lists them). Name sys_record_share there before the maintainer reads it.

② Semver level

None, unchanged. The diff is still two files under docs/adr/; no released package moves, no changeset is owed, and skip-changeset is the right label. Clause-②: no and Metadata-protocol: none are line-initial in the body and right: the round changes the record's text, and no key, value or type an author can write. The recipient rule adds a refusal to the engine card's contract, and that card declares its own level.

③ Boundary flags

  • Authoring route. As the body declares it: the thread is not served at the tier docs/adr/** mandates, so an isolated os-dev subagent pinned to that tier wrote the record on this branch. Accepted as declared for the fix commit as for the first, not verified. This review ran in a separate context. It was handed the thread's list of what the round changed and checked each item against the text and main; it read neither the dispatch order nor the seat's conclusions.
  • The merges. Two merges of main, at 27c2f1ea32 and f81e4b6c47, and neither authored a line under docs/adr/ (① has the blobs). Provenance now says the round's sentences "were read on origin/main 27c2f1ea"; nothing the record cites moved between that commit and this base.
  • The index. docs/adr/README.md is byte-identical to the reviewed head's, and main's did not move. Its counts still check against this tree: 156 records, 151 numbers, Proposed 9.
  • Other records. ADR-0139, ADR-0111 and ADR-0147 are still untouched. O7 holds their notes as owed after acceptance, now under the right conditions (N4). The card named to carry them is closed (S5).
  • A neighbouring record. D4 gives ADR-0147's anchor a rule at the shared seam and says it changes "neither what the anchor carries nor where it is captured". That is a proposal about a Proposed record, held to a cross-reference note in O7, and within this record's remit as D4 frames it. S6 is its open edge.
  • Tier H. Main now reads an add-only note on an existing record as Tier S, under conditions (scripts/pm/check-governed-merges.mjs, the ADR leg: "no record created, renamed or deleted"). This PR creates a record, so it stays Tier H: landing waits for a GOVERNED_APPROVERS approval, and the PR is draft.
  • Security. The round's new text is design text. The recipient rule, its one exemption and its reason are stated as rules of the seam, with no account of misuse, in the record and in the body's paragraph on it. On what happens past today's cap the record still repeats the card's sentence and adds none. A security item is with the owner seat (S6, N15).

④ Design judgment

The recipient rule (S3), against the code it rests on.

  • It matches the producer. The sharing middleware builds a scope for the operation context's user and, on a delegated operation, a second one with userId: exec.onBehalfOf.userId and onBehalfOf cleared: on reads at plugins/plugin-sharing/src/sharing-plugin.ts L1489 and L1508–1512, on predicate writes at L1673 and L1676–1680. So "Those are the two identities D3 writes a leaf for" holds, and a leaf the producer writes always passes.
  • Its reason is main's own. spec/src/data/readable-ids.ts L172–177: a composed leaf is built only at the engine's executor boundary, "no door admits it", and one handed in from outside is "never trusted as a scope someone else already resolved". The engine's door refuses a composed ReadableIds leaf wherever it meets one (objectql/src/filter-comparand-shape.ts L205). "ReadableIds keeps that by construction" is that mechanism, and a check is the right device for a leaf that arrives composed.
  • The exemption is sound. That door needs none, because the engine composes for every caller. This leaf's producer writes a system context no leaf at all (sharing-service.ts L2561–2565), and a system context reads every row already, so a scope it chooses to carry can only narrow its own read.
  • No flow read here meets the refusal. Consequences says so ("no flow read in this repository meets it"), and it holds at every runtime call site on main. The two builders have six: the four in the sharing middleware; the security service's sharing read filter (plugins/plugin-security/src/security-plugin-sharing-verdicts.ts L155), which passes on the context it is handed; and the explainer's (security-plugin-explain-access.ts L475), an in-process judge that reaches no seam, as D4 says. The security service's read filter is asked from two places outside its plugin, the engine's composition (objectql/src/engine-readable-ids-permission-formula.ts L264) and the analytics bridge (services/service-analytics/src/plugin.ts L716), each with the context of the operation the scope then serves. On a delegated read the composed scope carries the principal's leaf and the delegator's, the second built with userId: delegatorContext.userId and onBehalfOf cleared (security-plugin-read-filter.ts L241–247). Those are the rule's two identities.
  • ADR-0147's anchor. In the delegated flow that record's D-c describes, the anchor's caller is the live principal and the read runs under the live principal's context, so the rule as worded admits it. What the rule leaves unsaid about that anchor is S6.
  • It compares and replaces nothing. That keeps D1's "No seam and no driver re-derives it" intact, and plan step 2 pins the rule's four cases.

The middleware row (S2). Each of the three answers is costed for the class, and the recommendation is put, not decided: the row sits in Q2, the cost list says what the host loses, and the 速读 carries it to the maintainer. The comparison the recommendation rests on is fair: a storage row "leaves the host no remedy", and this row's condition is "one registration the host can remove". L, R2 and the seam's refusal alone stay available, row by row.

Against its execution plan. The new pieces land where they belong: the recipient rule and its four cases on the engine card (step 2), D6's plan reading on the driver card (step 3), the update path on the memory card (step 4). One piece is out of order (S4).

Clarity, proportion. 728 lines, 55 more than the reviewed head. The growth is where the findings asked for text: D4 (48 to 66 lines), D6 (13 to 23) and Q2 (70 to 80). The round restates nothing the first record had not already counted, and I found no padding.

Should-fix.

  • S4 — Execution plan step 5, read with O8 and Q2's cost list. Step 5 lands "the middleware row's answer (the boot check, under the recommended one)", one card before the switch. Until the switch no producer writes the leaf: today's grant read still passes through the middleware, and nothing reads around it. So as ordered, a host in the class is refused its boot one card before the change the refusal exists for, and before the census that says whether such a host exists. O8 has the switch card owe that census ("The switch card owes that census before it lands"), and the cost list leans on it ("O8's census says whether a host outside it is in the class"). The record already times the other tightening to the switch ("under R2 the inert arm and its report land here, at the moment those grants stop counting"). Its precedent is keyed on the consumer too: ADR-0139's boot refuses a detail whose declaration would have the leaf written over such a master, not the middleware by itself. Put the boot check on the switch card, or say that it refuses only where a producer writes the leaf, and have the census precede the first card that can refuse a boot.
  • S5 — The header's "Revisits", O7 and Acceptance criteria name ADR-0139: pointer notes for ADR-0155 (share-grant semi-join leaf) once the maintainer rules its three questions #34102 as the carrier (O7: "carries the ADR-0139 notes once this record lands and ①, ② and ③ are ruled"), and the PR body repeats it. Triage closed that card as not planned on first touch (comment 6899543045, 18:56Z), 13 minutes before the fix commit named it (19:09Z), and it was still closed when this record was written. The seat's later comment widening its scope (6899914726) sits on the closed card. Triage's note reads "Reopen it if that changes". As the text stands, an acceptance criterion rests on a card that is not planned. Either the card is reopened once the rulings land, which is triage's and the seat's to settle, or the record names a carrier that exists by its own terms: the Tier H edit that records the rulings in this record's Status line. The first acceptance criterion already requires that edit, and the same rulings decide which notes are owed.
  • S6 — D4, the recipient rule's last sentence ("ADR-0147's anchor takes the same rule for its caller") and the built-once table's seam row ("the caller of ADR-0147's anchor"). A security item is with the owner seat. The ask is that the record either states in full what the shared seam checks on ADR-0147's anchor, or leaves that anchor's rule to ADR-0147's cross-reference note (O7) and says so.

Nits.

  • N14 — D4: "It is the seam's rule alone". Under ②'s recommended answer the analytics native-SQL compiler is the one evaluator with no seam in front of it ("it compiles the leaf"). It compiles the scope its own strategy context asked the security service for, for the same request (services/service-analytics/src/plugin.ts L716, services/service-analytics/src/strategies/native-sql-strategy.ts L1663–1672), so the seam's position, verb and recipient checks hold there by construction. One sentence in D4 or in Q2's row would say so.
  • N15 — D4 and O8: the census now looks for "a find hook" on the grant table as well as a middleware. No sentence says what a hook found there leads to: a row of ② beside the middleware row, or an acceptance with its reason. D-0's "Below the cap nothing changes" rests on that answer for such a host. A security item is with the owner seat.
  • N16 — Consequences, Positive: "under B the write side keeps a list" names B and not C. Under C the write side still reads the grants on the candidate ids for each operation, so "issues no grant read of its own" does not hold there either.
  • N17 — Consequences names the kind change for ISharingService alone. The rule also gives a precondition to the documented use of the security service's read filter, which hands the scope to engine.find (spec/src/contracts/security-service.ts L608–610): with the rule, that read must run under the context the scope was asked for, under one acting on that user's behalf, or under a system context. Say so beside the kind change, for the spec card's prose, and have O8's census read which context each outside reader runs its read under.

Implemented-by: claude/project-thread-nlsog5
Reviewed-by: session_01ADHkmRxXmVQ41fqnaTPGAv

VERDICT: PASS

… identity check at the shared seam

A text-only round on the record after its delta contract review. The
record stays Proposed, and its three maintainer questions stay open.

The host row's boot check moves to the switch card. Until a producer
writes the leaf, today's grant read still runs a registration on the
grant table and nothing reads around it, so no card before the switch
refuses a boot. The census of hosts and outside readers is read before
the switch card is cut. The TL;DR, Q2's row, its cost list, its
recommendation, the open item and the execution plan say the same.

D4 states in full what the shared seam checks on ADR-0147's anchor. One
rule holds for both leaves: every identity named by a leaf that arrives
composed is compared with the reading context. This record's leaf names
its recipient. ADR-0147's anchor names its caller and its organization,
and the organization must be the reading context's active organization.
A system context is the one exemption, and any mismatch is the
composition fault D4 already answers. ADR-0147 takes this through its
cross-reference note, which lands with this record's other pointer
notes.

The class D4 recognises second covers a find hook registered for the
grant table by name as well as an object-scoped middleware. The census
looks for both kinds, and the boot check names either.

The pointer notes land with the governed edit that records the
maintainer's rulings in this record's Status line, which the first
acceptance criterion already requires. The record names no other
carrier.

D4 also says why the seam's position, verb and recipient checks hold
by construction on the analytics native-SQL path, which has no seam in
front of it. Consequences names option C beside B for the write side,
and the precondition the recipient rule gives the documented use of
the security service's read filter. The spec card's prose list and the
Consumers field name that contract.

No other record is edited, and the index row is unchanged.

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

Copy link
Copy Markdown
Contributor Author

domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 1f6f9718d9177cad93d000114711e7a6b4de21bb
Local-runs: none
Scope: docs/adr/0155-sharing-scope-share-grants-lower-to-an-engine-internal-semi-join-leaf.md, docs/adr/README.md + none

PR #34064 for card #33899: ADR-0155 (Status Proposed) and its index row. This record is the delta on fix round 2. The earlier records are 6899302526 (on f3194c5140) and 6900428326 (on 1911c32519); this head adds one merge of main and one fix commit. Reviewed in a context of its own, from the tree at this head, card #33899 and its comments, card #34102, the PR and its two records, and this head's check-runs. Code outside the diff was read on main b29f2dd117, never reviewed.

One must-fix (M1). S4, S5, S6 and N14 to N17 are each taken in the text. The round's new text carries M1 and three should-fix (S7 to S9), all under ④. No nit.

① Derived judgments

Gates on this head. 48 check-runs, all completed: 26 success, 22 skipped, 0 failed.

  • Success: Governed Surface Queue Guard; PR-body guards, in both of its runs; Check PR Size; Check Documentation Links; Auto Label; filter; Plan Test Core shards; Test Core (1/8); Test Core; Test UI; Dogfood Regression Gate; Lint & Repo Gates; Lint · docs & code guards; Lint · repo & tooling gates; Lint · CI, release & engine gates; Lint · ESLint; Lint · PM dispatch-gates; the three Lint · scoped jobs; TypeScript Type Check; Type Check · workspace, source gates, consumer gates and debt ledger.
  • Skipped: Check Changeset in both of its runs (the skip-changeset label condition); the UI, build, docs-build, live-database and opt-in jobs; the Dogfood shard matrix and Dogfood Verify CLI; both queue verdicts; the schedule gate; a second instance each of Auto Label and Check PR Size.
  • pnpm check:adr-symbol-anchors is a step of "Lint · docs & code guards", which is green.

The head. 1f6f9718d9 is the fix commit on ae96980963, which merges the reviewed head 1911c32519 with main 385ea1cce5. The record's blob (d6b12dbe) and the README's (1c1a3a78) are the same at 1911c32519 and at ae96980963, so the merge authored no line under docs/adr/. The round is the fix commit alone: one file, +82/−58, 728 to 752 lines. Net of the merges the head differs from its base in two files: the record (+752) and docs/adr/README.md (+4/−3).

Against current main. git merge-tree --write-tree of main b29f2dd117 and this head is clean (exit 0). Main is three commits past the head's base 385ea1cce5: #33897, #34056 and #34072. None touches docs/adr/ or AGENTS.md. Four files the record cites moved: objectql/src/engine-readable-ids-permission-formula.ts, objectql/src/engine.ts and plugins/plugin-security/src/security-plugin.ts (#33897), and drivers/driver-turso/src/remote-transport.ts (#34056, Server-Timing counts). Every anchor the record cites in them still resolves on main, and what the record says of them holds: the composition still asks the parent's read filter with the read's own context (composeReadableIdsChain, chain.context), and #33897 drops a leaf only over a master whose answered scope is unrestricted, so a sharing-scoped parent keeps its leaf and D4's nested position stands.

Round 2's findings against the text. Paths are under packages/.

  • S4, taken. Plan step 5 ends "⛔ No card up to here refuses a boot". Step 6: "Each tightening lands here, at the moment it takes effect: under R2 the inert arm and its report, when those grants stop counting, and under the host row's recommended answer the boot check, when a producer first writes the leaf." Q2's host row: "So the check lands with the switch (plan step 6) and refuses only where a producer writes the leaf: until then today's grant read still runs the registration, and nothing reads around it." The cost list: "no card before the switch refuses a boot". The TL;DR and the Recommendation say "from the switch on". Step 2 keeps the seam's own refusal, which is a refusal at read and meets no leaf before step 6.
  • S5, taken. Header: "they land with the governed edit that records the maintainer's rulings in this record's Status line". O7: "They land with the governed edit that records the maintainer's rulings in this record's Status line. The first acceptance criterion already requires that edit, and the same rulings decide which notes are owed." Acceptance: "O7's pointer notes land with that edit". 34102 occurs nowhere in the record at this head and nowhere in the PR body. Card ADR-0139: pointer notes for ADR-0155 (share-grant semi-join leaf) once the maintainer rules its three questions #34102 is still closed as not planned.
  • S6, taken as text. D4 has its own bullet, "The same rule on ADR-0147's anchor, in full": "ADR-0147's anchor names two, and the seam checks both: its caller, which like a recipient must be the reading context's user or that context's delegator, and its organization, which must be the reading context's active organization. A system context is the same one exemption, and any mismatch is the same composition fault". The built-once table's seam row and plan step 2 follow. Whether the rule is right is ④ (a): its caller half is M1.
  • N14, taken. D4: "the seam's position, verb and recipient checks hold there by construction: one strategy context, built per request (…/analytics-service.ts#callCtx), asks for the scope under the request's context and issues the statement that carries it." What it leaves open is S7.
  • N15, taken. D4's second class is now "a registration made for sys_record_share by name", with "two kinds, treated alike": the middleware and "a find hook, beforeFind or afterFind". Q2's host row, the TL;DR and O8 name both kinds, so a hook found there has the row's answer.
  • N16, taken. Consequences: "under B the write side keeps a list, and under C it still reads grants per operation."
  • N17, taken. Consequences: "that read must run under the context the scope was asked for, under one acting on behalf of that context's user, or under a system context. The spec card says both in the contracts' prose." The Consumers field and plan step 1 name the ISecurityService prose, and O8's census reads "for each outside reader the context it runs its read under". The documented use is as cited (spec/src/contracts/security-service.ts L608–610, the member at L629).

Anchors. 53 distinct path#symbol anchors, the body's count. The four new ones each resolve to a definition at this head: services/service-analytics/src/analytics-service.ts#callCtx (L1900), objectql/src/engine.ts#registerHook (L704), plugins/plugin-audit/src/read-audit.ts#installReadAuditWriter (L437) and spec/src/contracts/security-service.ts#getReadFilter (L629). The gate's verdict is the green check-run above.

PR body requirements, all met. Fixes #33899, Clause-②: no and Metadata-protocol: none are line-initial. The 速读's host sub-bullet now names sys_record_share. Verification names this head. No model identifier in the body or the record. One sentence of the 速读 is touched by S8 (「本仓库目前没有这样的宿主」).

② Semver level

None, unchanged. The diff is two files under docs/adr/; no released package moves, no changeset is owed, and skip-changeset is the right label. Clause-②: no and Metadata-protocol: none are right: the round changes the record's text, and no key, value or type an author can write. The full identity check and the ISecurityService precondition are contracts of the engine and spec cards, and each card declares its own level.

③ Boundary flags

  • Authoring route. As the body declares it: the thread is not served at the tier docs/adr/** mandates, so an isolated os-dev subagent pinned to that tier wrote the record on this branch. Accepted as declared for this fix commit as for the others, not verified. This review ran in a separate context and read neither a dispatch or fix order nor the seat's conclusions.
  • The merge. One merge of main at 385ea1cce5. It authored no line under docs/adr/ (① has the blobs). Provenance says the round's sentences were read on 385ea1cc, which is the head's base.
  • The index. docs/adr/README.md is byte-identical to the reviewed head's, and main's did not move.
  • Other records. ADR-0139, ADR-0111 and ADR-0147 are untouched. O7 holds their notes as owed, on a carrier that exists by the record's own terms (S5).
  • A neighbouring record. D4 now states a rule on ADR-0147's anchor in full and says it "changes neither what the anchor carries nor where it is captured (its D-a and D-c)". The caller half does not agree with that record's D-c (M1).
  • Tier H. check-governed-merges --pr 34064: both paths hit docs/adr/**, landing tier H. The low-risk arm does not apply: the record is added, and the README is not an add-only note. Landing waits for a GOVERNED_APPROVERS approval, and the PR is draft.
  • SQL push-down. Nothing in the round adds an id materialisation or an in-app join; the record removes one.
  • Security. The round's text is design text and adds no account of misuse. A security item is with the owner seat (S7).

④ Design judgment

(a) The full rule on ADR-0147's anchor, against main. Every context main builds that carries the membership list, which ADR-0147 D-e moves to the anchor:

  • The request path (core/src/security/resolve-authz-context.ts L855–882): the list is resolved for the context's user in the vetted organization, and a dropped claim deletes ctx.tenantId (L867–868) before the list is re-resolved. Both halves hold.
  • Hook seeding (objectql/src/engine-scoped-context.ts L150–164), automation runs (services/service-automation/src/plugin.ts L2564–2580, run-resume.ts L254–275; an identity switch deletes the list, L395), the mention gate (plugins/plugin-audit/src/mention-recipient-gate.ts L256–267), the storage resolver (services/service-storage/src/storage-service-plugin.ts L1495–1510) and the explain API (plugins/plugin-security/src/security-plugin-explain-access.ts L228–241): each resolves the list for the context's own user in the organization the context then carries. Both halves hold.
  • The delegator's rebuilt context (plugins/plugin-security/src/explain-engine.ts#resolveDelegatorContext, L945–980): built for the delegator (userId the delegator's, no delegation link), in the live organization (L972), and then L973 overwrites its list with the live principal's. This is the context ADR-0147 D-c names: it "carries the live principal's list under the delegator's userId", and D-c rules "The caller is the anchor's, ⛔ never the compiling context's userId". D-e has this inheritance "carry the anchor wherever they carry the array today". So after ADR-0147 this context's anchor names the live principal as caller while its user is the delegator and it has no delegator of its own.
  • The same pair by spread (security-plugin-read-filter.ts L244, security-plugin-explain-access.ts L381, plugins/plugin-sharing/src/sharing-plugin.ts L1508–1512): handed to the sharing service's builders and gates only, which compile no RLS. No leaf of ADR-0147 is written from them.

The organization half refuses no lawful read. In every context above the anchor's organization is the organization the context carries, the delegator's rebuilt context included.

The caller half refuses a lawful read. The delegator's rebuilt context is a reading context on main. On a delegated write to a controlled_by_parent detail the master-write gate runs once per principal (security-plugin-authz-middleware.ts L1543–1550, and the served member at security-plugin-cbp-write-gate.ts L407–408), and its delegator pass reads the master under that context: security-plugin-cbp-write-gate.ts L929 to L1032 to security-plugin-addressed-writes.ts L222 (findOne(object, { where: { id }, context })), and L1288. Main's own comment at L926–927: "On an on-behalf-of write the gate runs once per principal, so each is asked the read under its own context". Where the master's row scope names current_user.org_user_ids, that read compiles ADR-0147's leaf from the context's anchor: caller the live principal. The reading context's user is the delegator and it has no delegator. D4's caller half then answers a composition fault, status 500, on a read main issues today and answers. This record's own leaf is not affected on that read: its recipient is taken from the reading context's user.

In the delegated read flow the rule does hold: the delegator pass compiles under the rebuilt context (security-plugin-read-filter.ts L252), the statement runs under the live principal's context, and the anchor's caller is that context's user.

(b) The native-SQL argument. It holds for what it names. callCtx (L1900) is built per request, resolves each object's scope through the security service with the request's context (services/service-analytics/src/plugin.ts L716) and hands the same strategy the statement to issue (strategies/native-sql-strategy.ts L1273). It does not cover the two classes D4 has the seam recognise before the driver call. The native statement runs on the datasource of the object it scopes (plugin.ts L527–545), the strategy declines federated objects only (native-sql-strategy.ts L696–706), and its middleware question is asked of the objects the query reads (L854), never of the grant table, and never of a hook. Neither D4 nor Q2's native-SQL row says what that compiler does for an object in either class (S7).

(c) The plugin-audit sentence: keep. It is true as written. The record-view hook is an afterFind registered by object name for the opted-in objects (plugins/plugin-audit/src/read-audit.ts L732), and sys_record_share is not on that plugin's exclusion list, so a host that opts the table in is in the class by the class's definition. Striking it would leave "No package in this repository names the table" standing over a case a shipped plugin makes one configuration line away. It needs its consequence stated (S8).

(d) The census. O8 now reads "It is owed before the switch card is cut", and step 6 "O8's census is read before this card is cut". Both are passive. The round took the census away from the switch card, which owed it before, and gave it to no one (S9).

Against its execution plan. S4's reordering is right: the boot check, the inert arm and its report all land at the switch, where each takes effect, and the plan now says so in one sentence. The remaining gap is the analytics card of step 5 (S7).

Clarity, proportion. 752 lines, 24 more than the reviewed head, all in the places the findings named. No padding found.

Must-fix.

  • M1 — D4, "The same rule on ADR-0147's anchor, in full", with the built-once table's seam row and plan step 2's last sentence. The caller half ("must be the reading context's user or that context's delegator") refuses a read main issues lawfully: the delegator pass of the master-write gate, under the very context ADR-0147 D-c describes and D-e keeps as a carrier. The record says of this rule that it "changes neither what the anchor carries nor where it is captured (its D-a and D-c)"; as worded it turns D-c's context into a fault wherever that context reads. State the caller half so that it admits that context: compare what the leaf names with the anchor the reading context itself carries, both fields at once, which keeps ADR-0147 D-a's "⛔ never re-derived from the reading context's userId or tenantId" and still covers the organization. Or take the other branch S6 offered and leave the anchor's rule to ADR-0147's cross-reference note, saying so. Either way plan step 2 names D-c's context among the cases the later card pins. The recipient rule for this record's own leaf stands as written.

Should-fix.

  • S7 — D4's native-SQL sentence and Q2's native-SQL row ("Neither: it compiles the leaf. It is SQL, and the leaf needs no composition"). A security item is with the owner seat. The ask: both say that the native compiler compiles the leaf only where the seam would hand it to a driver, and that for an object in either of D4's two classes it declines the query to the engine strategy before anything compiles, so the seam gives that class the answer ② rules, at boot or after it. The row states the price (the shapes only native SQL serves are refused for those objects and hosts), and plan step 5's analytics card carries the two recognitions.
  • S8 — D4's plugin-audit sentence, with Q2's host row and its cost bullet. Keep the sentence and carry it through. Q2's row still says "No package in this repository names the table in one" and prices the class as "one registration the host can remove". For this host the registration is the read-audit opt-in, and removing it gives up record-view audit of share rows. The hook also does nothing on the grant read: it returns on a system read (read-audit.ts L688), and the grant read is a system read that pins no id. Say in D4 whether "treated alike" still holds for a registration that provably skips system reads, and put the answer and its price in Q2's row and cost list, so the maintainer rules ② on it. The 速读's 「本仓库目前没有这样的宿主」 then needs the same qualifier.
  • S9 — O8, plan step 6 and Acceptance criteria. Name who produces the census and where it is recorded. It reads the cloud repository's packages and hosts, it now precedes the cutting of the switch card, so no execution card can owe it, and the cost list rests the recommended R1 on it ("says whether a host outside it is in the class"). Either the seat that cuts the switch card owes it as a condition of cutting, or it is a card of its own in the plan, before step 6. Acceptance criteria should carry it beside the other conditions.

Implemented-by: claude/project-thread-nlsog5
Reviewed-by: session_01ADHkmRxXmVQ41fqnaTPGAv

VERDICT: FAIL

…own anchor, native compiler returns classed objects to the engine

A text-only round on the record after its second delta contract review.
The record stays Proposed, and its three maintainer questions stay open.

D4 states the shared seam's rule for ADR-0147's anchor against what the
reading context itself carries. The seam compares the leaf's anchor with
the anchor the context carries, caller and organization together, and
admits the leaf only when both are equal. Nothing is re-derived from the
context's userId or tenantId, as ADR-0147 D-a rules. ADR-0147 D-c's
context, the delegator's rebuilt one, reads under the anchor it carries
and is admitted. The built-once table says the same, plan step 2 lists
the cases the later card pins, and Consequences keeps its "no flow"
sentence to this record's own leaf. The recipient rule of this record's
leaf is unchanged.

The analytics native-SQL compiler compiles the leaf only where the seam
would hand it to a driver. Where either class D4 recognises applies, it
declines the query to the engine strategy before anything compiles, so
the class gets the answer question 2 rules. Q2's row states the price,
and plan step 5 names the card that carries the recognition.

A registration on the grant table that skips system reads stays in the
host class: the engine reads registrations and not handlers. For a host
whose registration is its opt-in to record-view auditing, removing it
gives up that auditing of share rows. D4, Q2's host row and its cost
list say so, price the other answer, an exemption on a declaration the
engine enforces, and put the choice to the maintainer under question 2.

The seat that cuts the switch card produces the census of hosts and
outside readers as a condition of cutting it, and records it in that
card's body. O8, plan step 6 and the acceptance criteria say the same.

No other record is edited, and the index row is unchanged.

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

Copy link
Copy Markdown
Contributor Author

domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv

Contract-review-handoff: review#2 — CONTRACT_REVIEW_TIER unavailable (maintainer quota limit on the review tier, 2026-11-15T22:14Z) · head 7a87d58

The maintainer limited use of the review tier at 2026-11-15T21:53Z and routed contract reviews to the review seat. Owed: a delta review of fix round 3 against the round-2 delta record 6901557418 (FAIL on 1f6f9718: M1, S7, S8, S9); the earlier records are 6899302526 and 6900428326. The fix commit is 11d7d354; 7a87d589 merges main on top. ADR-0155 only, Tier H, draft. A security item is with the owner seat; the seat holds the detail for the reviewer on request.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head 7a87d58 · 2026-11-15T22:20Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 7a87d589f6bf8fa988f0a697719759f9df612c75
Local-runs: none
Scope: docs/adr/0155-sharing-scope-share-grants-lower-to-an-engine-internal-semi-join-leaf.md, docs/adr/README.md + none

Read at 2026-11-15T22:30Z. Delta review of this head against FAIL 6901557418 at 1f6f971; claim: comment 6902327812; lane request 6902291082 on mailbox #33873 (the lane's at-tier reviewer was unavailable). Independence: implemented in an os-steve project thread, dispatched by domain:skills#2 (os-steve); reviewed by os-tesla.

PR #34064 for card #33899: ADR-0155 (Status Proposed) and its index row. The earlier records are 6899302526, 6900428326 and 6901557418. I read the record whole at this head (790 lines), the fix commit 11d7d354, the card, the three records and the hand-off 6902271326, and the code the record cites, on the head's tree. I adopted no earlier conclusion: each id below is judged from the text and the code.

No must-fix. One should-fix (S1, new), four nits. M1, S7, S8 and S9 of 6901557418 are each closed.

① Derived judgments

Gates on this head. 48 check-runs, all completed: 26 success, 22 skipped, 0 failed, 0 running. Test Core was still running at my first reading and has since completed green. Success includes Governed Surface Queue Guard, both PR-body guard runs, Check Documentation Links, the six Lint jobs and the three scoped ones (the ADR index and symbol-anchor gates are steps of "Lint · docs & code guards"), the four Type Check jobs, Test Core and Test UI. Skipped: Check Changeset in both runs (skip-changeset), the build, UI, live-database and opt-in jobs, both queue verdicts, the schedule gate.

The head and the merge. 7a87d589 merges main 86350e12 onto 11d7d354. Both files under docs/adr/ are byte-identical at 11d7d354 and at this head (README blob 1c1a3a78), so the merge authored no line of the record or its row. The merge brought 27 files (checklist areas, scripts/pm, the marketplace UI, one changeset); none is a file the record cites. Main is 86350e12, the head's own merge base: the head is 0 behind. Net of merges the PR is two files: the record (+790) and the README (+4/−3).

The index and the number. Main holds no 0155; 0153 and 0154 are the last two. The README change is the count line (155 to 156 records, 150 to 151 numbers), Proposed 8 to 9, the total, and one appended row whose status cell reads "Proposed — 2026-11-15; questions ①–③ are open". No other row moved. The record's Status line is Proposed, and ADR-0139, ADR-0111 and ADR-0147 are untouched; their dated notes are held as owed in O7.

Anchors. 55 distinct packages/…#symbol anchors at this head (53 at 1f6f9718; the round added explain-engine.ts#resolveDelegatorContext and security-plugin-cbp-write-gate.ts#assertControlledByParentChainEditable). Each names a symbol present in its file at this head; the gate's own verdict is the green job above. The PR body still says 53 (N1).

The prior ids, by id.

  • M1 — closed. D4's bullet "The same rule on ADR-0147's anchor, in full" no longer compares the anchor's caller with the reading context's user. It now reads: "The seam compares the two anchors, caller and organization together, and admits the leaf only when both are equal. Nothing is re-derived from the reading context's userId or tenantId (ADR-0147 D-a)." It names the context the old wording refused, the delegator's rebuilt one, says it is a reading context on a delegated write to a controlled_by_parent detail, and concludes "A leaf compiled under that context carries the same anchor, and the seam admits it." The built-once table's seam row says the same, plan step 2 lists the cases the later card pins (the context's own anchor; D-c's context; a system context; a differing caller or organization, or no anchor, each refused), and Consequences confines "no flow read in this repository meets it" to this record's own leaf. Against the code: resolveDelegatorContext builds the delegator's context with no delegation link and overwrites its org_user_ids with the live principal's (explain-engine.ts L945–980), which is the pair ADR-0147 D-c describes and D-e has carry the anchor; the master-write gate asks "the read under its own context" once per principal (security-plugin-cbp-write-gate.ts L926–927). A leaf compiled under that context and read under it compares equal, so the lawful read is admitted. In the delegated read flow the delegator pass's leaf carries the live principal's anchor and the statement runs under the live principal's context: equal again. The recipient rule of this record's own leaf is unchanged, as M1 asked.
  • S7 — closed. D4: "That compiler compiles the leaf only where the seam would hand it to a driver. Where either of the two classes below applies, it declines the query to the engine strategy before anything compiles, so the class gets the answer ② rules, at boot or from the seam after it." Q2's native-SQL row repeats it and states the price ("for those objects and hosts the shapes only native SQL serves are refused"), and plan step 5 gives the recognition to the native compiler's card. The record states the design rule only. A remainder is N2.
  • S8 — closed. D4 answers the question put: "Treated alike" holds for a registration that skips system reads, because "the seam and the boot check read a registration by the object it names, and nothing the engine holds says what a handler does on a system read". Q2's host row and a cost bullet of its own carry the price (removing the opt-in "gives up record-view auditing of share rows") and the other answer with its price (a declaration on hook registration that the engine enforces), and put the choice to the maintainer under ②. The code agrees: the record-view hook is registered for the opted-in objects and returns on a system read (read-audit.ts L688, L732). The PR body's 速读 carries the same qualifier.
  • S9 — closed. O8: "The seat that cuts the switch card produces the census, as a condition of cutting that card, and records it in the card's body: each tree it read, named by repository and commit, and what it found there." Plan step 6 and Acceptance criteria say the same ("The card is not cut without it"). The census it names is too narrow in one respect (S1).

The card's seven items. Each is ruled or put: the leaf and its brand (D1), the tenant wall (D2, Q1), write verbs (Q3), the evaluators (D5, Q2), the shared seam (D4), the arms (D3), the plan. Q1 to Q3 are put with options, costs and a recommendation, and the Status line says they are not decided.

② Semver level

None. Two files under docs/adr/; no released package moves, no changeset is owed and skip-changeset is right. Clause-②: no and Metadata-protocol: none are right: the record changes no key, value or type an author can write, and each execution card declares its own level. CI on this head is complete and green (①), so this verdict does not rest on a running check.

③ Boundary flags

  • Tier H. Both paths are docs/adr/**. ADR text is Tier H and lands only on the maintainer's word: a GOVERNED_APPROVERS approval, with Q1 to Q3 ruled. This record's PASS is a review, not that approval, and the PR is draft.
  • Authoring route. As the body declares: written by an isolated subagent pinned to the tier docs/adr/** mandates. Accepted as declared, not verified.
  • Other records. None is edited. The record revisits ADR-0139 D1 for one leaf and answers its O4, and the notes on ADR-0139, ADR-0111 D7 and ADR-0147 D-a are owed on a named carrier (O7, first acceptance criterion). It states a rule on ADR-0147's anchor while that record is still Proposed; it says so and routes the rule into ADR-0147 by the cross-reference note.
  • SQL push-down. The record removes an id materialisation and adds no in-app join. driver-memory's row is that driver's only way to answer, and the record says the maintainer may move it under ②.
  • Security. Rule layer only in the record and in this review. The hand-off says a security item is with the owner seat; I do not hold it and did not guess it. S1 below is stated as the rule the record must keep; its detail is with the seat, not here.
  • No model identifier in the record, the body or this review.

④ Design judgment

Is the leaf exactly the read it replaces. Read against sharing-service.ts at this head. Today's grant read is one find of sys_record_share on object_name, recipient_type: 'user' and recipient_id, under a system context, at limit: 5000 (L747–756); the update scope adds the write levels (L869–879). D-0's set G and D2's subquery restate it predicate for predicate, with the blank-id filter of grantedRecordIds and the limit gone.

  • Owner, depth, queue, approval. Untouched and still siblings in one filter (D3). The approval ids leave the union for a disjunct of their own, which selects the same rows; the phantom-anchor answers are kept; delete keeps the owner match alone.
  • Manual and rule shares, groups, roles, territories. Only user rows are written and enforced, and rule materialisation expands the rest into per-user rows, so one predicate covers them, as today.
  • Revoked, expired, deleted. The table declares no expiry, status or soft-delete column and today's read filters on none, so "No validity, status or source filter" is parity, not an omission. A revoke is a deleted row, seen at statement time.
  • Read against edit. The read form admits every level, as today's read does; the write form carries WRITE_ACCESS_LEVELS from the producer.
  • Tenant wall. The outer statement's wall is unchanged. The inner read's scope is Q1, put with the parity answer recommended and the narrowing answer priced.
  • The recipient rule. I read every caller of buildReadFilter and of the security service's read filter in this tree: the sharing middleware, plugin-security's two read filters, the ReadableIds composition (the read's own context), the analytics scope resolver (the context its caller hands it, which D4 says is the request's) and the explainer (in process, no seam). None composes for one user and reads under another non-system context, so the rule refuses nothing I read.

Composition with ADR-0139. The nested position is stated (D1, D4: the checks descend into composed scopes, and driver-sql compiles a composed scope with the same compiler). ADR-0139 D5.3 already keeps a parent on the gated object's datasource, and this record's first class adds the grant table's. ADR-0139's amendment of the same date (the dropped parent chain for an unrestricted reader) is not disturbed: a sharing-scoped parent answers a restricted scope before the switch and after it. The verb rule and D5's rule ("evaluates the leaf exactly, or refuses it loudly") cover the in-process matcher.

Against its first consumer and its plan. The switch lands last, every tightening lands with it, no card before it refuses a boot, and D6 pins parity at 5,000 and the corrected answer at 5,001 and 6,000 on two dialects, the nested and delegated positions, and the plan of the statement that changes shape most. No cap is added; the approval list's ceiling is recorded as unmeasured (O4).

Should-fix.

  • S1 (should-fix) — D4's second class, Q2's host row and O8's census: say what holds for a registration that reaches the grant read without naming the table. New; it does not continue a prior id (it is the boundary of the class N15 and S8 shaped). The class is "a registration made for sys_record_share by name", and the record's rule is "⛔ The seam never reads around either." The engine also runs registrations that name no object on today's grant read, and it cannot recognise them by object. The record is silent on them, so D-0's "Nothing else moves" is not shown for a host that has one, and O8's census "looks for both kinds", both by name. In this repository I found none that changes a system read of that table. The rule to keep: a share-scoped read answers the same rows before and after the switch on every host, or the host is told. State the class's boundary and its reason in D4 (ADR-0139 D5.2 draws the same line for its leaf), have O8's census read such registrations as well, say in the contract prose of plan step 1 what a host must do for a narrowing of the grant table to be honoured, and put it to the maintainer with Q2's host row.

Nits.

  • N1 (nit) — PR body, Tests: "53 distinct anchors" is the count at 1f6f9718; the head has 55, and the same sentence lists the two the round added.
  • N2 (nit) — continues S7. D4 and Q2 define the native compiler's decline by reference to the seam ("only where the seam would hand it to a driver"). The built-once table lists what is built once and does not list the recognition of the two classes. Add it there, so the compiler asks the seam's recognition and restates none.
  • N3 (nit) — D4, "…/read-audit.ts#installReadAuditWriter, #recordView": the second is a bare fragment naming a local of the first, not a path#symbol anchor. Write it in prose or drop it.
  • N4 (nit) — two places where the record states a fact and not the rule its card holds. O2 answers an outer key of another type with "the same rows or a loud refusal"; the refusal branch is a narrowing of D-0 on such an object and belongs in Q2's census or under D-0. Consequences, Freshness, under ③'s A: the prior-row read and the write each evaluate the arm; name on plan step 3 what the update card pins about the rows of the two statements.

Implemented-by: claude/project-thread-nlsog5
Reviewed-by: session_01L9qibxTeW8xHnxoHxWNHWW

VERDICT: PASS

…istration that names no object

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

Copy link
Copy Markdown
Contributor Author

domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv

Contract-review-handoff: review#2 — CONTRACT_REVIEW_TIER unavailable (maintainer quota limit on the review tier, 2026-11-15T22:44Z) · head 44cb185

Owed: the delta review of fix round 4 against record 6902450506 (PASS on 7a87d589 with S1 and N1–N4). The fix commit is b0b45bcc; the head merges main on top. Round 4 was written in the card thread below the authoring tier docs/adr/** mandates, declared in the PR body's Acceptance notes, because the maintainer limited use of that tier. ADR-0155 only, Tier H, draft.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head 44cb185 · 2026-11-15T22:46Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 44cb18566da3950b60a70fed58a166a74580cd36
Local-runs: none
Scope: docs/adr/0155-sharing-scope-share-grants-lower-to-an-engine-internal-semi-join-leaf.md, docs/adr/README.md + none

Read at 2026-11-15T22:52Z. Delta review of this head against PASS 6902450506 at 7a87d58; claim: comment 6902649034; lane request 6902634012 on mailbox #33873 (the lane's at-tier reviewer was unavailable). Independence: implemented in an os-steve project thread, dispatched by domain:skills#2 (os-steve); reviewed by os-tesla.

PR #34064 for card #33899: ADR-0155 (Status Proposed) and its index row. The earlier records are 6899302526, 6900428326, 6901557418 and 6902450506. I read the fix commit b0b45bcc whole (one file, +37/−9), the record at this head (818 lines) in every section the commit touches or points at (D-0, D4, the built-once table, Q2 and its cost list, Consequences, O2, O8, Acceptance criteria, the plan), the PR body, the hand-off 6902628274, and the code the new text cites, on the head's tree. Each prior id is judged from the text and the code, not from the body's claim that it was taken.

No must-fix. One should-fix (S1, the residue of the prior S1), three nits. The prior S1 is closed as asked, with that residue; the prior N1, N2, N3 and N4 are each closed.

① Derived judgments

Gates on this head. 48 check-runs, all completed: 26 success, 22 skipped, 0 failed, 0 running. Success includes Governed Surface Queue Guard, both PR-body guard runs, Check Documentation Links, the six Lint jobs and the three scoped ones (the ADR index, link and symbol-anchor gates are steps of "Lint · docs & code guards"), the four Type Check jobs, Test Core and Test UI. Skipped: Check Changeset in both runs (skip-changeset), the build, UI, live-database and opt-in jobs, both queue verdicts, the schedule gate. This verdict does not rest on a running check.

The range since 7a87d589. Four commits: the merge 60449b92 of main e9fb0987, the fix b0b45bcc, and the merge 44cb1856 of main b0e8f6b8. Under docs/adr/ the range changes one file, the record, and b0b45bcc is its only author: the two merges authored no line of it. docs/adr/README.md is byte-identical at 7a87d589 and at this head (blob 1c1a3a78). The merges brought 35 other files (plugin-auth, the PM scripts, one skill, the console and chatbot UI, changesets, the lockfile). None is one of the 37 packages/ files the record cites, and none is a record the ADR cites. Main has moved 7 commits past the head's merge base; those touch no file under docs/adr/ and no cited file, and main still holds no 0155.

The index and the number. Unchanged from the last record and still right: the count line (155 to 156 records, 150 to 151 numbers), Proposed 8 to 9, the total, and one appended row whose status cell reads "Proposed — 2026-11-15; questions ①–③ are open". The fix round changed neither the title nor the Status line, so the row owes no regeneration. No section or open item was added or renumbered: open items are still O1 to O9, the plan still has six steps, and every cross-reference the round wrote ("D4's boundary", "Q2's host row", "plan step 1", "plan step 6", "O2", "D-0") names a place that exists.

Anchors. 55 distinct packages/…#symbol anchors, the count at 7a87d589. The round added no new one: engine.ts#hasObjectMiddleware was cited already and is the method at L1894 of that file, whose body counts a registration only when it names the object. The one new path, packages/plugins/organizations/src/organizations-plugin.ts, is a file-level citation and the file is there.

The prior ids, by id.

  • S1 — closed, with a residue (S1 below). Each of the four things asked is in the text. (a) D4 has a bullet of its own, "The class's boundary: a registration that names no object": a middleware registered with no object or with '*', and a find hook registered for no object, "are outside the second class, on the line ADR-0139 D5.2 draws for its leaf", with the reason ("A registration keyed to no object says nothing the engine can read about one table") and the cost of the other line ("a class that took them in would refuse every host that runs such a plugin"). (b) O8 now reads "nor any registration that names no object and changes a system read of that table (D4's boundary). The census reads all three". (c) Plan step 1: "The ISharingService prose says what a host does for a narrowing of reads of sys_record_share to be honoured by the share arm", and step 6 adds the same to the switch card's changeset. (d) Q2's host row: "The boundary is ruled with this row", with both lines named. Against the code: the engine's recognition counts object-named registrations only, ADR-0139 D5.2 is worded "an object-scoped read middleware (…#registerMiddleware with an object)", so the line is the same line; and the organizations plugin does register middleware with no object, so the stated cost of the other line is true of this repository's own plugins.
  • N1 — closed. The PR body's Tests line reads 55, which is the head's count.
  • N2 — closed. The built-once table has the row "The recognition of D4's two classes | once, in the seam. The analytics native compiler asks the seam's recognition before it compiles and restates none".
  • N3 — closed. The bare fragment is gone: "…/read-audit.ts#installReadAuditWriter, through its record-view handler".
  • N4 — closed, both halves. D-0 gains "An outer key of another type answers the same rows … A refusal there would narrow this invariant on that object, so it is no driver card's to choose: a card that cannot keep the same rows stops, and the case goes to the maintainer under ②", and O2 now ends "with the same rows (D-0)". Plan step 3 gains "Under ③'s A the update card pins the rows each of a predicate update's two statements answers, the prior-row read and the write". A wording remainder is N2 below.

"None was found in this repository." The new D4 text rests that sentence on my last record. I re-read it at this head and did not adopt it: every middleware registration in non-test source that names no object or names '*' (the organizations plugin, plugin-auth, plugin-security, plugin-sharing, the runtime's app plugin, the verify harness), and the one find-hook registration, which is object-listed. None changes a system read of the grant table. plugin-auth's file changed in the merge; its two registrations are as before. Detail is with the seat, not here. See N1.

② Semver level

None. Two files under docs/adr/; no released package moves, no changeset is owed and skip-changeset is right. Clause-②: no and Metadata-protocol: none are right: the record changes no key, value or type an author can write, and each execution card declares its own level. CI on this head is complete and green (①); nothing is still running.

③ Boundary flags

  • Tier H. Both paths are docs/adr/**. ADR text is Tier H and lands only on the maintainer's word: a GOVERNED_APPROVERS approval, with Q1 to Q3 ruled, and now the class's boundary ruled with Q2's host row. This record's PASS is a review, not that approval, and the PR is draft.
  • Authoring route, a declared deviation. The body says rounds 1 to 3 were written by an isolated subagent pinned to the tier docs/adr/** mandates, and that round 4 "was written in the card thread at its default tier, by the seat's order". The hand-off 6902628274 gives the reason: the maintainer limited use of that tier. So 37 added lines of Tier H text were authored below the mandated tier, and this at-tier review is the only at-tier reading they have had. Declared, not hidden; whether it is accepted is the maintainer's.
  • Other records. None is edited. The new bullet reads ADR-0139 D5.2 and changes nothing in it; the pointer notes stay owed on O7's carrier.
  • Published contract text. Plan step 1 now fixes a sentence of the ISharingService prose in advance. That prose is a public contract's, written on the spec card under its own Clause-②; S1 is about what this record tells that card to write.
  • Security. Rule layer only in the record and in this review. The hand-off says a security item on the analytics native-SQL path is with the owner seat; I do not hold it and did not guess it. S1 is stated as the rule the record must keep; its detail is with the seat.
  • No model identifier in the record, the body or this review.

④ Design judgment

Is the new boundary sound. Yes as a line, and it is the only line the engine can draw. The engine holds registrations and their objects, not what a handler does, so a class that took in every registration naming no object would refuse every host at boot, the platform's own plugins being among the registrants. ADR-0139 D5.2 already stands on the same line for ReadableIds, so the two leaves share one recognition and the built-once row for it holds. The census now looks where the gap is, as a condition of cutting the switch card, and the boundary is put to the maintainer with both lines and not decided by the text.

Does it keep "Nothing else moves". Not by a mechanism, and the record no longer claims one: for this case it replaces "the same rows" by "or the host is told". That is an honest rule and the maintainer's to accept. What the record owes in return is that the telling be exact and its price be on the page. It is not yet, on two points (S1).

Against its first consumer and its plan. The order is unchanged: the switch lands last, every tightening lands with it, no card before it refuses a boot, the census precedes the card that can. The two tellings sit on the right cards (the spec card's prose, the switch card's changeset, "in the release where the subquery starts"). Acceptance criteria were not touched and need not be: the census criterion covers the widened census by reference to O8.

Should-fix.

  • S1 (should-fix) — D4's boundary bullet, plan steps 1 and 6, Q2's cost list, and the body's 速读: what the host is told does not match the answer the record recommends, and the recommended line's price is not stated. Continues the prior S1. Two parts.
    First, D4 says a narrowing "is honoured for the share arm only when it is registered for that table by name, which places it in the second class", plan step 1 has the ISharingService prose say the host "registers the narrowing for that table by name", and step 6 has the changeset tell the host to do so. But the second class's recommended answer is Q2's host row: "R1, at boot", a host that "does not start until it removes the registration"; the alternative R2 switches record sharing off. Only L keeps the narrowing on the grant read. So under the answer this record recommends, a host that follows the instruction is refused at boot, and no host has its narrowing applied to the share arm. "Honoured" is then true only as "never read around". The body's 速读 puts the two sentences side by side. Say it as ruled: registered by name, the narrowing is never read around, and the host gets the answer ② rules for the second class; have steps 1 and 6 write their sentence "as ② is ruled", so a published contract does not promise what the ruling withholds.
    Second, Q2's host row prices the other line ("refuses at boot every host that has one") and gives the recommended line no price. Its price is that on a host with such a registration D-0's same-rows statement is kept by a notice and by nothing at run time: a host that does not act on the notice gets an answer that can differ from today's, with no refusal, report or log. Put that in Q2's cost list in one bullet, beside the host class's two, and point D-0 at it, so the maintainer rules the boundary with both prices in front of them.

Nits.

  • N1 (nit) — D4's boundary bullet: "none was found in this repository at the review of record 6902450506". A record rests a fact on its own reading at a named commit, as its Provenance does for every other sentence, not on a reviewer's record. Name the tree read (e9fb0987, which Provenance already gives for this round) and drop the citation.
  • N2 (nit) — continues the prior N4. Plan step 3 says "the update card pins"; the plan has no card of that name, and step 3 is itself the card that carries the update path. Write "this card". In the same commit one line of D4's boundary bullet overruns the file's wrap and one line of step 6 is cut short ("boundary). The middleware also").
  • N3 (nit) — PR body, the recipient-rule bullet under What changes ends mid-sentence: "Open items are now O1-O9; O8's census, which also reads". Finish it or cut it.

Implemented-by: claude/project-thread-nlsog5
Reviewed-by: session_01L9qibxTeW8xHnxoHxWNHWW

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head ea5e72e · 2026-11-15T23:04Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: ea5e72ef8704a9812a9504278d6602c885ca11b7
Local-runs: none
Scope: docs/adr/0155-sharing-scope-share-grants-lower-to-an-engine-internal-semi-join-leaf.md, docs/adr/README.md + none

Read at 2026-11-15T23:09Z. Delta review of this head against PASS 6902721135 at 44cb185; claim: comment 6902871424; lane request 6902864855 on mailbox #33873 (the lane's at-tier reviewer was unavailable). Independence: implemented in an os-steve project thread, dispatched by domain:skills#2 (os-steve); reviewed by os-tesla.

PR #34064 for card #33899: ADR-0155 (Status Proposed) and its index row. The earlier records are 6899302526, 6900428326, 6901557418, 6902450506 and 6902721135. I read the fix commit ea5e72ef whole (one file, +29/−22), the record at this head (825 lines) in every section the commit touches or points at (Provenance, D-0, D4, Q2's host row and cost list, O8, Acceptance criteria, the plan), the PR body, the hand-off 6902859250, and the code the changed text rests on, on the head's tree. Each prior id is judged from the text and the code, not from the body's claim that it was taken.

No must-fix. One should-fix (S1, a scoping remainder of the prior S1), two nits. The prior S1 is closed on both parts as asked; the prior N1, N2 and N3 are each closed.

① Derived judgments

Gates on this head. 48 check-runs, all completed: 26 success, 22 skipped, 0 failed, 0 running. Success includes Governed Surface Queue Guard, both PR-body guard runs, Check Documentation Links, the six Lint jobs and the three scoped ones (the ADR index, link and anchor gates are steps of "Lint · docs & code guards"), the four Type Check jobs, Test Core and Test UI. Skipped: Check Changeset in both runs (skip-changeset), the build, UI, live-database and opt-in jobs, both queue verdicts, the schedule gate. This verdict does not rest on a running check.

The range since 44cb1856. Two commits: the merge 1ea1f352 of main ea6de745, and the fix ea5e72ef. Under docs/adr/ the range changes one file, the record, and ea5e72ef is its only author: the merge authored no line under docs/. docs/adr/README.md is byte-identical at 44cb1856 and at this head (blob 1c1a3a78). The merge brought 56 other files (service-automation, the console and app-shell UI, locales, patches, two scripts). Checked by path: none is one of the 37 packages/ files the record cites, none is a record the ADR cites, and none is a file that registers a middleware or a find hook. One is a gate that reads this record, scripts/check-adr-anchors.mjs (a declared-population marker and a self-test floor moved by one); it is not cited by the record, and the job that runs it is green on this head. Main stands at ea6de745, the head's merge base, and holds no 0155.

The index and the number. Unchanged and still right: the fix round changed neither the title nor the Status line, so the row owes no regeneration. No section, question row or open item was added or renumbered: open items are still O1 to O9, the plan still has six steps, Q2's census has the same rows, and its cost list gains one bullet. Every cross-reference the round wrote names a place that exists: "D4's boundary", "among Q2's costs", "plan step 1", "plan step 6", "the host row", "D-0", "(Provenance)".

Anchors. 55 distinct packages/…#symbol anchors, the count at 44cb1856 and the count the body states. The round added no anchor and no path.

The prior ids, by id.

  • S1 — closed, both parts; a scoping remainder is S1 below. First part: D4's boundary bullet no longer says "honoured". It reads "a narrowing of reads of sys_record_share registered for that table by name is never read around, and the host gets the answer ② rules for the second class; a narrowing that names no object is not run on the share arm", and it says the prose of plan step 1 and the changeset of plan step 6 "tell it one thing". Step 1 now has the ISharingService prose say the narrowing "is never read around and gets the second class's answer, as ② is ruled", and step 6 has the changeset tell "what plan step 1's prose tells it", in the same words. No sentence of the record now tells a host to register by name as a remedy, so the published contract no longer promises what the recommended ruling withholds. The body's 速读 carries the same single telling. Second part: Q2's cost list has the bullet "On a host with a registration that names no object, D-0's same rows rest on the telling alone", which says that under the recommended line "nothing at run time refuses, reports or logs such a registration", that a host which does not act "can get an answer that differs from today's", and what the other line costs. It sits beside the host class's two bullets. D-0's "Nothing else moves" points at it, and D4 points at it too. The maintainer now rules the boundary with both prices on the page.
  • N1 — closed. The reviewer's record is no longer the footing: "this record's own reading at e9fb0987 (Provenance) found none in this repository", and Provenance gives e9fb0987 as the tree the round-four sentences were read on. I did not adopt the sentence; I re-checked it at this head. The registration sites in non-test source are the same 41 lines as at 44cb1856, and the merge touched no file among them, so the result I read last round stands here.
  • N2 — closed, all three halves. Plan step 3 reads "this card pins". No line of D4's boundary bullet overruns the wrap (the lines over 120 columns at this head are the ones at 44cb1856 less that one, tables and link lines). Step 6 is rewrapped whole, with no short line.
  • N3 — closed. The body's recipient-rule bullet ends in full sentences: "Open items are now O1-O9. O8's census, which also reads registrations that name no object, is produced by the seat that cuts the switch card, as a condition of cutting it, and recorded in that card's body."

② Semver level

None. Two files under docs/adr/; no released package moves, no changeset is owed and skip-changeset is right. Clause-②: no and Metadata-protocol: none are right: the record changes no key, value or type an author can write, and each execution card declares its own level. CI on this head is complete and green (①); nothing is still running, so the seat has no check to wait for.

③ Boundary flags

  • Tier H. Both paths are docs/adr/**. ADR text is Tier H and lands only on the maintainer's word: a GOVERNED_APPROVERS approval, with Q1 to Q3 ruled, and the class's boundary ruled with Q2's host row. This record's PASS is a review, not that approval, and the PR is draft.
  • Authoring route, a declared deviation. The body says rounds 1 to 3 were written by an isolated subagent pinned to the tier docs/adr/** mandates, and that "Fix rounds 4 and 5 were written in the card thread at its default tier, by the seat's order". So this round's 29 added lines, like round four's 37, are Tier H text authored below the mandated tier, and this at-tier review is the only at-tier reading they have had. Declared, not hidden; whether it is accepted is the maintainer's.
  • Other records. None is edited. The pointer notes stay owed on O7's carrier.
  • Published contract text. Plan step 1 fixes in advance what the ISharingService prose tells a host. It now defers to the ruling ("as ② is ruled"), which is right for a public contract written on a later card under its own Clause-②. N1 below is about when that sentence becomes true.
  • Security. Rule layer only in the record and in this review. The body says a security item on the analytics native-SQL path is with the owner seat; I do not hold it and did not guess it. S1 is stated as the rule the record must keep; its detail is with the seat.
  • No model identifier in the record, the body or this review.

④ Design judgment

Does the round hold against the code it cites. Yes. The one fact about code in the changed text is the reason the recommended line has no run-time signal: "the seam and the boot check read a registration by the object it names, and this one names none". That is how the engine's recognition reads a registration today (engine.ts#hasObjectMiddleware counts a registration only when it names the object), and ADR-0139 D5.2 stands on the same line. The census sentence holds at this head (① N1).

Is the telling now exact, and is the price on the page. The telling is exact: by name, never read around, and the answer is whatever ② rules for the class; with no object named, not run on the share arm. Both lines of the boundary are priced, in one place, and the text does not decide between them. That was the substance of the prior S1 and it is met. What is left is the reach of the sentence that states the price (S1).

Against its first consumer and its plan. The order is unchanged: the switch lands last, every tightening lands with it, no card before it refuses a boot, the census precedes the card that can. Acceptance criteria were not touched. Their last line, "At every step D-0 holds on every evaluator that evaluates the leaf", now reads against a D-0 that names one case where the same rows are kept by a notice; S1 is what keeps that line testable.

Should-fix.

  • S1 (should-fix) — D-0's "Nothing else moves" and Q2's new cost bullet: the case is scoped wider than it is, and "holds" says more than the record keeps. Continues the prior S1, second part. Both sentences open "On a host with a registration that names no object". D4's own bullet says platform plugins register such middleware, and the sharing plugin's own enforcement middleware is one (packages/plugins/plugin-sharing/src/sharing-plugin.ts registers it for '*'). So, read as written, the sentence covers every host that enforces sharing: D-0 then says its invariant is kept "by telling the host, not by a check" everywhere, and Q2 prices the recommended line as if every host were exposed. The case the record means is the one O8 already words exactly: a registration that names no object and changes a system read of sys_record_share. On every other host the same rows are kept in fact, and D6's pins show it. Use O8's wording in both places. In the same edit, state D-0's sentence as the exception it is: on such a host the share arm's rows can differ after the switch and the host is told (D4's boundary), not "this holds by telling". The second phrase follows the wording of my last record ("kept by a notice"), so that half is mine to own; the scoping is the part that matters, because it is the reach of an exception to the invariant every card is accepted against, and the size of a price the maintainer is asked to weigh.

Nits.

  • N1 (nit) — plan step 1. The ISharingService prose is to say a narrowing that names no object "is not run on the share arm". The spec card lands before the switch (step 6), and until the switch today's grant read still runs such a registration. Give the sentence its tense, as D4's bullet has it: "from the switch on".
  • N2 (nit) — Provenance lists the tree each fix round's sentences were read on, through the third delta review. The round after the fourth delta review (6902721135) has no entry. It added no reading of code, so one clause saying so, or naming ea6de745, keeps the list whole.

Implemented-by: claude/project-thread-nlsog5
Reviewed-by: session_01L9qibxTeW8xHnxoHxWNHWW

VERDICT: PASS

… registration that changes the grant read

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

Copy link
Copy Markdown
Contributor Author

domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv

Contract-review-handoff: review#2 — CONTRACT_REVIEW_TIER unavailable (maintainer quota limit on the review tier, 2026-11-15T23:20Z) · head 0913316

Owed: the delta review of fix round 6 against record 6902940583 (PASS on ea5e72ef with the scoping S1 and N1–N2). Written in the card thread below the authoring tier, declared in the PR body. ADR-0155 only, Tier H, draft.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head 0913316 · 2026-11-15T23:22Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 0913316313f149bfda68774c486323fa4f5e9a2d
Local-runs: none
Scope: docs/adr/0155-sharing-scope-share-grants-lower-to-an-engine-internal-semi-join-leaf.md, docs/adr/README.md + none

Read at 2026-11-15T23:27Z. Delta review of this head against PASS 6902940583 at ea5e72e; claim: comment 6903107220; lane request 6903082324 on mailbox #33873 (the lane's at-tier reviewer was unavailable). Independence: implemented in an os-steve project thread, dispatched by domain:skills#2 (os-steve); reviewed by os-tesla.

PR #34064 for card #33899: ADR-0155 (Status Proposed) and its index row. The earlier records are 6899302526, 6900428326, 6901557418, 6902450506, 6902721135 and 6902940583. I read the fix commit 09133163 whole (one file, +19/−12), the record at this head (832 lines) in every section the commit touches or points at (Provenance, D-0, D4's boundary, Q2's host row and cost list, O8, Acceptance criteria, plan steps 1 and 6), the PR body, and the code the changed text rests on, on the head's tree. Each prior id is judged from the text and the code, not from the body's claim that it was taken.

No must-fix, no should-fix. Two nits. The prior S1, N1 and N2 are each closed.

① Derived judgments

Gates on this head. 48 check-runs, all completed: 26 success, 22 skipped, 0 failed, 0 running. Success includes Governed Surface Queue Guard, both PR-body guard runs, Check Documentation Links, the six Lint jobs and the three scoped ones (the ADR index, link and anchor gates are steps of "Lint · docs & code guards"), the four Type Check jobs, Test Core and Test UI. Skipped: Check Changeset in both runs (skip-changeset), the build, UI, live-database and opt-in jobs, both queue verdicts, the schedule gate. This verdict does not rest on a running check.

The range since ea5e72ef. Two commits: the merge 97210679 of main 0d1443d0, and the fix 09133163. Under docs/adr/ the range changes one file, the record, and 09133163 is its only author: the merge authored no line under docs/adr/ (its one path under docs/ is a QA scenario file). docs/adr/README.md is byte-identical at ea5e72ef and at this head (blob 1c1a3a78), and against the merge base it differs by this record's row and the three counts only.

The merge, by path. It brought 97 files. Checked against the 37 packages/ files and the one script the record cites: one is cited, packages/plugins/plugin-sharing/src/sharing-service.ts, which the record anchors eleven symbols in. So the brief's "touched nothing the ADR cites" does not hold as a statement about cited files, and I read the change (#34031) instead of adopting it. It changes no line of the grant read, of either scope builder, of the by-id check or of the organization stamps, and all eleven anchored symbols are present at this head. Each sentence the record writes about that file still holds: the mechanism section, D2's "no validity, status or source filter", and the set semantics ("one per source, one per rule"). The merge also touched one file that registers engine middleware, packages/plugins/plugin-auth/src/auth-manager.ts, in code unrelated to registration. The registration sites in non-test source are line-for-line the same at ea5e72ef and at this head, so D4's census sentence ("found none in this repository") stands here on my own reading, not on the record's.

Main since the merge base. Main stands three commits past 0d1443d0. None touches docs/adr/, and main holds no 0155 (its highest record is 0154). One cited file moved there, packages/objectql/src/engine.ts, by two lines outside the three symbols the record anchors. That is not on this head; the anchor gate reads it at the next merge.

The index and the number. Unchanged and still right: the round changed neither the title nor the Status line, so the row owes no regeneration. No section, question row or open item was added or renumbered: open items are O1 to O9, the plan has six steps, Q2's census has the same rows and its cost list the same bullets. Every cross-reference the round wrote names a place that exists: "D4's boundary", "among Q2's costs", "the host row", "plan steps 1 and 6", "(Provenance)".

Anchors. 55 distinct packages/…#symbol anchors, the count at ea5e72ef and the count the body states. The round added no anchor and no path, and every cited path exists at this head.

The prior ids, by id.

  • S1 — closed, both halves. The scoping: all three places now carry O8's wording. D-0 reads "on a host with a registration that names no object and changes a system read of sys_record_share"; D4's boundary reads "on a host whose registration names no object and changes a system read of the table"; Q2's cost bullet opens with the same condition. A host that runs a platform plugin registering for no object is no longer inside the sentence, so the reach of the exception and the size of the price are the ones the record means. Q2's bullet also keeps the two lines apart: the recommended line's price falls on the narrow case, and "the other line refuses at boot every host with a registration that names no object", which is what the host row says of it. The phrase: D-0 no longer says the invariant "holds by telling". It says "One exception: … the share arm's rows can differ after the switch, and the host is told (D4's boundary; the price is among Q2's costs)". That is an exception stated as one. The body's 速读 and D4 summary carry the same scoping.
  • N1 — closed. Plan step 1: the ISharingService prose says a narrowing which names no object "is not run on the share arm from the switch on", the tense D4's bullet has. Step 6's changeset lands at the switch, so its sentence needs none.
  • N2 — closed. Provenance: "The sentences changed after its fourth delta review (6902721135) and its fifth (6902940583) add no new code reading." I checked the claim against both rounds' diffs: neither adds an anchor, a path or a statement about code that an earlier round had not already made; the census sentence both lean on names e9fb0987 as its tree.

② Semver level

None. Two files under docs/adr/; no released package moves, no changeset is owed and skip-changeset is right. Clause-②: no and Metadata-protocol: none are right: the record changes no key, value or type an author can write, and each execution card declares its own level. CI on this head is complete and green (①); nothing is still running, so the seat has no check to wait for.

③ Boundary flags

  • Tier H. Both paths are docs/adr/**. ADR text is Tier H and lands only on the maintainer's word: a GOVERNED_APPROVERS approval, with Q1 to Q3 ruled, and the class's boundary ruled with Q2's host row. This record's PASS is a review, not that approval, and the PR is draft.
  • Authoring route, a declared deviation. The body says rounds 1 to 3 were written by an isolated subagent pinned to the tier docs/adr/** mandates, and that "Fix rounds 4 to 6 were written in the card thread at its default tier, by the seat's order". So this round's 19 added lines, like those of rounds four and five, are Tier H text authored below the mandated tier, and this at-tier review is the only at-tier reading they have had. Declared, not hidden; whether it is accepted is the maintainer's.
  • Other records. None is edited. The pointer notes stay owed on O7's carrier.
  • Published contract text. Plan step 1 fixes in advance what the ISharingService prose tells a host; it defers to the ruling ("as ② is ruled") and now carries its tense. Right for a public contract written on a later card under its own Clause-②.
  • A cited file moved under the record. sharing-service.ts changed on main between this record's readings and this head (①). No sentence is made stale by it, and Provenance names the tree of each reading, so nothing is owed; it is flagged so the maintainer knows the check was made by path and by reading, not assumed.
  • Security. Rule layer only in the record and in this review. The body says a security item on the analytics native-SQL path is with the owner seat; I do not hold it and did not guess it. Main's record rules carry no line this record would owe for it.
  • No model identifier in the record, the body or this review.

④ Design judgment

Does the round hold against the code it cites. Yes. The round states no new fact about code. The one it re-scopes around, that the seam and the boot check read a registration by the object it names, is how the engine's recognition reads a registration at this head (engine.ts#hasObjectMiddleware, unchanged by the merge), and ADR-0139 D5.2 stands on the same line. The condition it now writes, "changes a system read of sys_record_share", is a property of a handler, which nothing the engine holds can read; the record says so in D4 and draws the right consequence, that under the recommended line the case is told and not checked, and it prices that in Q2. The text does not decide between the two lines.

Is the exception exact and is it the same in every place. Yes. D-0, D4's boundary, Q2's cost bullet, O8 and the body state one condition in one wording, and O8's census is the instrument that says whether any tree meets it. This repository does not (①).

Against its first consumer and its plan. The order is unchanged: the switch lands last, every tightening lands with it, no card before it refuses a boot, the census precedes the card that can. Acceptance criteria were not touched. Their last line, "At every step D-0 holds on every evaluator that evaluates the leaf", now reads against a D-0 that names its one exception as an exception and scopes it to a case a card can state, so the line stays testable: a switch card shows the same rows on every host outside that case, and inside it shows that the host was told.

No must-fix, no should-fix.

Nits.

  • N1 (nit) — Q2's cost list, the bullet this round rewrote. Its last line runs 137 columns ("line refuses at boot every host with a registration that names no object (the host row). The maintainer rules which, with the host row."). The record wraps prose at 120, and this is the one prose line the round put over it. New this round; it follows from the fix of the prior S1.
  • N2 (nit) — D-0. The exception sits at the end of "Nothing else moves", whose list is the arms other than the share arm, while what it excepts is the bullet two above it: "Below the cap nothing changes … every read and every predicate update answers the same rows before and after the switch", which still reads without a qualifier. The section is exact read whole, and the acceptance criterion reads it whole. A clause in that bullet pointing at the exception, or the exception moved to it, makes each bullet true read alone. Continues the prior S1 (placement only; its scoping and its wording are closed).

Implemented-by: claude/project-thread-nlsog5
Reviewed-by: session_01L9qibxTeW8xHnxoHxWNHWW

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv

维护者速读

  • 改了什么:新增 ADR-0155(Proposed)及其索引行,只有文档。提议把共享记录读权限的「授权」分支从「先读出最多 5000 个授权 id 再拼列表」改为数据库内子查询(引擎内部第二种 semi-join 叶子,沿用 ADR-0147 的模式),并回答 ADR-0139 的 O4。
  • 为什么改:您对 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 裁定「只做根治」;今天超过 5000 条共享授权的成员会静默失去访问,现有编译路径表达不了这个子查询,需先有 ADR。
  • 风险与回滚:纯文档、受管面,不改任何运行时行为;回滚 = 撤掉本 PR。执行卡要等您批准后才切(约 5–7 个 PR)。
  • 先看:docs/adr/0155-…md 的「Questions for the maintainer」(Q1–Q3),再看 TL;DR 与 D-0/D3/D4/D5。
  • 两分钟验证:node scripts/adr-index.mjs --check && node scripts/check-adr-symbol-anchors.mjs,两者 OK、无 0155 的发现。
  • 需要你做的:回答 Q1–Q3(① 子查询不加租户隔离?② 跑不了子查询的存储与「不点名对象的注册」宿主怎么答?③ 叶子是否放开到按条件 update?各问推荐见 PR 正文),然后批准本 PR(Tier H)。PR 正文里「需要你做的:暂无…还欠 review#2」一句已过时,以本条为准:review#2 对新 head 的增量复审已 PASS。
  • 席位意见:可以合;合并时请把三问的裁定写进状态行(该受管修订同时决定 ADR-0139/0111/0147 欠的指针注记)。

席位核对

Verdict: ACCEPT, held for the maintainer · head 0913316313f149bfda68774c486323fa4f5e9a2d · card #33899 · at-tier contract reviews 6899302526 → 6900428326 → 6901557418 → 6902450506 → 6902721135 → 6902940583 → delta 6903166086 (review#2, PASS on this head: no must-fix, no should-fix, prior S1/N1/N2 closed) · read 2026-11-15T23:29Z.

  • Shape: draft → main, Fixes #33899. Two files: the new record (832 lines) and its generated row in docs/adr/README.md. skip-changeset. GOVERNED, Tier H (docs/adr/**). Clause-②: no; Metadata-protocol: none. Mergeable against base 0d1443d0; main's three later commits touch nothing under docs/adr/.
  • Gates: CI on this head 48 check-runs, all complete: 26 success, 22 skipped, 0 failed. Dev on the head: 21 derived, 21 exit 0, --ran reconciles.
  • Nits left open, accepted by the seat: 6903166086 N1 (one prose line in Q2's cost list runs 137 columns) and N2 (D-0's exception sits under "Nothing else moves" rather than the below-cap bullet; the section is exact read whole). Neither changes meaning; both are fit for the governed edit that records the rulings.
  • Accepted deviations: rounds 1–3 authored by a subagent pinned to CONTRACT_REVIEW_TIER; rounds 4–6 written in the card thread below that tier by the seat's order, each read at tier by review#2 (declared in the body). Whether that is accepted is the maintainer's.
  • Security: a security item is with the owner seat; the record states the design rule only.
  • Landing: Tier H. The seat does not flip this PR ready or enqueue it. It needs the maintainer's rulings on Q1–Q3 and a GOVERNED_APPROVERS approval. Card 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 stays Blocked-by: #33899 until the switch in the record's plan lands.

@os-zhuang
os-zhuang added this pull request to the merge queue Nov 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 43829628939 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Dogfood Regression Gate (1/3) — 失败步骤: Boot example apps and exercise real user flows

    @objectstack/dogfood:test:  FAIL   isolated  test/field-unique-rest-refusal.dogfood.test.ts > records-forms.field-unique-enforcement — the unique refusal at the REST doors > acceptance[0], negative[0]
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: expected { …(6) } to deeply equal { …(5) }
    @objectstack/dogfood:test:  FAIL   isolated  test/field-unique-rest-refusal.dogfood.test.ts > records-forms.field-unique-enforcement — the unique refusal at the REST doors > acceptance[0], negative[0]
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: expected { …(6) } to deeply equal { …(5) }
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 23 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv

Queue eject read 2026-11-16T08:33Z: build 43829628939 failed on test/field-unique-rest-refusal.dogfood.test.ts (Dogfood Regression Gate 1/3, assertion on the REST unique refusal shape). This pull touches docs/adr/0155-…md and docs/adr/README.md only, so the red is not this diff's: the same signature ejected #34304 and #34322 from the same speculative stack, and the anchor is #34342. Head 09133163 is unchanged and the seat's ACCEPT stands. Tier H: the seat does not re-enqueue; it needs an approver to enqueue again once #34342 is settled or the stack ahead has cleared. pm:awaiting-merge stays.

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/l skip-changeset PR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ADR: an engine-internal share-grant semi-join leaf for the sharing read scope (second exception to ADR-0139 D1; fixes #33787)

3 participants