Skip to content

Commit 64ccf6b

Browse files
docs(adr): ADR-0155 accepted with the maintainer's answers to Q1–Q3 (#34735)
Part of #33787 Clause-②: no Metadata-protocol: none ## 维护者速读 - **改了什么**:ADR-0155(共享授权改走引擎内半连接子查询,去掉 5000 条上限)状态从 Proposed 改为 Accepted,把你对三问的裁决(Q1 A · Q2 推荐列逐行 · Q3 A)写进状态行、决策各句、三问各节、Consequences 与执行计划;ADR 索引随之重新生成;并按 ADR-0155 验收条件第 2 条,在 ADR-0139(D1、D3、O4)、ADR-0111(D7)、ADR-0147(D-a)各追加一条带日期的指针注记。不改任何代码。 - **为什么改**:你已在 #33787 的决策卡上选了「三问都按 ADR 推荐」(裁决记录 6942854600),ADR 规定裁决写进记录、合入之后才能切执行卡;本 PR 就是这一步。 - **风险与回滚**:纯文档,零运行时影响;回滚即还原这五个文件(ADR-0155、索引 README,以及 ADR-0139、ADR-0111、ADR-0147 上新增的注记)。唯一风险是措辞把裁决写偏,请对照下面"先看"核对。ADR-0139 的 D3 注记与在途 PR #34565 的 D3 修订并存:已做三方合并核对,无冲突、互不重述。 - **先看**:① `docs/adr/0155-…md` 的 Status 行(三问答案的总述);② 同文件 Q2 末尾新增的 "Ruled: the recommended column, row by row" 一段(宿主类 R1 启动拒收、不设"跳过系统读"豁免、不指名对象的注册留在类外并告知宿主);③ `docs/adr/0139-…md` 的 D1、D3、O4 三条注记(每条写明仅记录决策、由 ADR-0155 执行卡实现,main 上 5000 截断在切换卡落地前仍在)。 - **两分钟验证**:`git diff origin/main -- docs/adr/0155-*.md | grep -c 'ruled'` 有大量命中;打开 ADR-0155 读 Status 行与 Questions 一节开头的 "Ruled, all three" 段,应与裁决记录 6942854600 的 Q1 A · Q2 推荐列 · Q3 A 一致。 - **需要你做的**:审批并合并本 PR(Tier H,只能由你落地)。 ## What changes ADR-0155 moves from **Proposed** to **Accepted — 2026-11-17**, recording the maintainer's answers from ruling record [`6942854600`](#33787 (comment)) (verbatim option: 「三问都按 ADR 推荐」), read against routing analysis `6938582405` and the earlier ruling `6895275749`: - **Q1 → A**: the subquery carries no tenant scope (parity with today's grant read, D-0). - **Q2 → the recommended column, row by row**: no capped id list anywhere; the four storage rows take R2 with R1 behind it; the host class (a registration naming `sys_record_share` by name) takes R1 at boot from the switch on, with the seam's refusal behind it, the class kept whole, with **no** exemption for a registration declaring it skips system reads; a registration naming no object stays outside the class and the host is told (D4's boundary); the analytics native compiler compiles the leaf, the engine strategy's merge admits the brand, the explainer resolves at the record. `driver-memory` stays as D5 states it (the ruling did not move it). - **Q3 → A**: the leaf's write form is admitted in the `where` of a predicate `update` only. Where the text changed, in `docs/adr/0155-sharing-scope-share-grants-lower-to-an-engine-internal-semi-join-leaf.md`: - **Status line** rewritten (Accepted, date, ruling link, the three answers); a Provenance bullet names the ruling record and the routing analysis. - **Header bullets**: Revisits states the three governed sentences that now move (ADR-0139 D1 read-verbs, ADR-0139 D3 capability bit, ADR-0111 D7); Leaves unchanged names R2 as the ruled answer that moves the by-id gates on the storage rows. - **TL;DR**: "proposes" becomes "decides"; the three bullets state the rulings. - **Decision**: every sentence that said it depended on a question now states the answer (D-0, D1, D2, D3, D4 including the second class, its boundary and the built-once table, D5, D6). No decision the ruling did not answer was changed. - **Questions for the maintainer**: a "Ruled, all three" paragraph opens the section; Q1, Q2 and Q3 each end with a **Ruled** paragraph citing the record; the options, costs and recommendations are kept as history. The Q2 host-row cell and two cost bullets that said "the maintainer rules which" now say what was ruled. - **Consequences**: the predicate-update and Freshness bullets state ③ A; the "evaluators under ②" bullet states the ruled outcome; a bullet names the three governed sentences elsewhere that move. - **Open items**: the conditional phrases in O1, O6, O7 and O8 state the ruled answer (O7 now lists exactly the notes owed). No item was removed. - **Execution plan**: every "as ruled" step names the answer; no card was cut or removed. `docs/adr/README.md` is regenerated by `node scripts/adr-index.mjs` (Accepted 134 → 135, Proposed 9 → 8, the ADR-0155 row's status column). No changeset and `skip-changeset`: the diff is `docs/adr/**` only, a fast-track path that publishes nothing from any package. ## Tests Docs-only diff: no package is touched, so no build closure, unit test or typecheck is owed. The gate families derived for these paths were run locally (below). ## Acceptance notes - **ADR-0155 Acceptance criterion 2 is met in this PR.** O7's five pointer notes land in the same governed edit as the rulings, each dated 2026-11-17, append-only, and citing ADR-0155 and ruling record `6942854600`: ADR-0139 D1 (one more leaf; the read-verbs sentence revisited for that leaf alone, ③ A), ADR-0139 O4 (answered), ADR-0139 D3 (that leaf's driver declaration under ② R2; R1 is the bullet's own envelope), ADR-0111 D7 (R2's inert-grant arm, `SHARING_NOT_ENABLED` / 422, effective at the plugin-sharing switch and not before), and a cross-reference from ADR-0147 D-a (the shared seam's recipient rule on that record's anchor). ADR-0155 O7 records that they landed. No decision in those three records moves beyond the note each names, and no Status line outside ADR-0155 is edited. Against `main` the three records take additions only (ADR-0139 +28, ADR-0147 +12, ADR-0111 +2, no deletions). - **Decided, not built.** ADR-0139 is Accepted and implemented, so each of its three notes (D1, D3, O4) says it records a decision that ADR-0155's execution cards will implement; O4 adds that the capped grant read stands until the plugin-sharing switch under #33787 lands, and not before, matching the ADR-0111 note's wording (review record 6944283386, S1). The D3 note names the refusal envelope it means (status 500, `INTERNAL_ERROR`) and marks ADR-0147 as Proposed (N2), and ADR-0155 O7 keeps the authoring diff's history apart from the landing of the notes (N1). - **Overlap with open PR #34565** (head `779d1aa3`, Tier H), which adds an `Amended` Status line and a #33876 amendment note under ADR-0139 D3. The new D3 note sits after D3's last bullet: it neither restates nor contradicts that amendment, and says it moves nothing D3 says about `ReadableIds`. A three-way `git merge-file` of ADR-0139 (base `62d9d0d9`, the merge base; ours `ee8b666a`) exits 0 with no conflict markers, and the merged text carries both amendments. ADR-0139 is the only file both PRs touch (it has no merge driver). The repository is shallow, so a whole-tree `merge-tree` in a driver-free bare clone could not fetch the refs; GitHub's mergeability check is the authority. - The README Date column for ADR-0155 stays 2026-11-15: the index reads the record's `Date` bullet, which is the authoring date, and the acceptance date lives in the Status line. ## Verification Gates run on head `ee8b666a`, the final commit (the derived set of 21 is identical to the one on every earlier head). <details><summary>Derived gate families — 21 of 21, all exit 0</summary> `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 21 commands for the five paths; each was run with its exit code captured before any pipe: ```text 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:pm-governed-merges :: exit 0 pnpm check:nul-bytes :: exit 0 pnpm check:pm-prior-rulings :: exit 0 pnpm check:refd-timer-probe :: exit 0 pnpm check:watch-hint-literal :: exit 0 ``` Reconciliation: `dispatch-gates --ran` — "21 derived famil(ies) accounted for — 21 run, 0 NOT-MEASURED (a DERIVED zero — all 21 recorded an exit code and none of them is 3)". Selected verdict lines: `check-adr-links: 1150 relative link destination(s) under docs/adr/ resolve`; `check-adr-symbol-anchors: 3728 anchors across 158 records resolve`; `adr-index --report: OK — docs/adr/README.md is current, every record parsed, self-test 60 assertions green`. The first run of `check:doc-formula-expressions` exited 3 (PREREQUISITE NOT MET, `@objectstack/formula` and `@objectstack/lint` unbuilt in a fresh worktree); after `pnpm exec turbo run build --filter=@objectstack/formula --filter=@objectstack/lint` under the verify lock (VERDICT command-exit 0) it exited 0. </details> <details><summary>Not measured locally</summary> The families dispatch-gates places outside the derived set (artifact rosters, whole-tree populations, the type-check lanes and the path-scheduled Plan Test Core shards job) are CI's; their verdicts are this PR's check-runs. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01ADHkmSLi1reMd27fT62jJ3)_ <!-- signed: repo:objectstack#2 · os-steve · session_01ADHkmSLi1reMd27fT62jJ3 --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9c70c16 commit 64ccf6b

5 files changed

Lines changed: 220 additions & 104 deletions

‎docs/adr/0111-record-share-management-authority-and-verb-boundary.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ Three write-time refusals so a persisted share always means something:
139139
2. **`grant()` validates the object is in an enforcing posture** — `effectiveSharingModel` is `private` or `read` **and** the object has an `owner_id` field. Otherwise → **422** (`SHARING_NOT_ENABLED`): a share on a public / bypass / owner-less object enforces nothing. `controlled_by_parent` is refused explicitly (Salesforce parity — a detail record is not independently shareable; its access follows the master).
140140

141141
*Amended 2026-10-24 (ruling 6377844010 on objectstack-ai/objectstack#25549, letter A; landed in #25591).* An external principal meets an owner-only floor on every object (ruling 6355206139, letter B), so a share row on a public object IS consulted for that population. On an object whose effective model is `public` and whose `owner_id` is real (not a federated phantom anchor), `grant()` therefore admits a `user` recipient whose `sys_member.role` in the record's organization is exactly `external`; every other recipient keeps the 422. The verdict reads the object and the recipient's population, never the granter. A sharing rule materialises rows for its external recipients only and reports the skipped half in one line. `controlled_by_parent` stays refused for every recipient.
142+
143+
*Amendment note 2026-11-17 ([ADR-0155](./0155-sharing-scope-share-grants-lower-to-an-engine-internal-semi-join-leaf.md), Accepted; ruling record [`6942854600`](https://github.com/objectstack-ai/objectstack/issues/33787#issuecomment-6942854600) on #33787, its ② ruled R2).* This rule gains one more arm. A share on an object whose evaluator cannot run ADR-0155's share-grant leaf (`driver-mongodb`, `driver-odata`, a driver this repository does not ship that does not declare it evaluates the leaf, or an object bound to another datasource than `sys_record_share`) enforces nothing, so `grant()` and the sharing-rule save door refuse it as inert with the same **422** (`SHARING_NOT_ENABLED`), and no gate consults existing grants on that object; owner, queue and approval access is unchanged. The arm takes effect with ADR-0155's plugin-sharing switch, with the boot report and changelog entry D10 asks for, and not before. Nothing else in D7 moves.
142144
3. **Manual and rule shares coexist by `source`.** The upsert key becomes `(object, record, recipient, source)` so a manual grant no longer clobbers a `source: 'rule'` row and vice versa. When multiple rows grant the same recipient, the widest `access_level` wins (Salesforce's RowCause model — grants are additive, never subtractive).
143145

144146
### D8 — Share-link re-share semantics are made explicit

‎docs/adr/0139-engine-internal-semi-join-leaf-readable-parent-ids.md‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,16 @@ any position but a `$in` comparand, the engine refuses it loudly. ⛔ No second
164164
> `FIELD in current_user.org_user_ids` names, under its own brand, never as a mode of `ReadableIds`. "No `EXISTS`, no
165165
> correlated form" stands. So does everything this D1 says about `ReadableIds`.
166166
167+
> **Amendment note (2026-11-17, [ADR-0155](./0155-sharing-scope-share-grants-lower-to-an-engine-internal-semi-join-leaf.md) — ruling record [`6942854600`](https://github.com/objectstack-ai/objectstack/issues/33787#issuecomment-6942854600) on #33787).**
168+
> ADR-0155 (Accepted) revisits "No second leaf" for **one** more leaf and nothing else: the record ids that
169+
> `sys_record_share` grants one user on one object (provisionally `SharedRecordIds`), under its own brand, never as a
170+
> mode of `ReadableIds` or of ADR-0147's leaf. It is the second record to do so, and a new leaf still needs a Tier H
171+
> record of its own. It also revisits this D1's read-verbs sentence for that leaf alone (its ③, ruled A): the leaf's
172+
> write form is legal in the `where` of a predicate `update`, and nowhere else. For `ReadableIds`, for ADR-0147's leaf
173+
> and on `delete`, the sentence stands as written. "No `EXISTS`, no correlated form" stands. This note records a
174+
> decision that ADR-0155's execution cards will implement: until they land, `main` admits no such leaf, and this D1
175+
> holds as written for every verb.
176+
167177
### D2 — ObjectQL composes the scope, once per parent object per request, fail closed
168178

169179
At the engine's executor boundary — on the final AST, after ingress parsing, the comparand doors, the middleware chain
@@ -227,6 +237,17 @@ restriction".
227237
- The leaf joins the per-driver conformance case-sets, so a driver that compiles it is measured and one that refuses
228238
is recorded as refusing.
229239

240+
> **Amendment note (2026-11-17, [ADR-0155](./0155-sharing-scope-share-grants-lower-to-an-engine-internal-semi-join-leaf.md) — ruling record [`6942854600`](https://github.com/objectstack-ai/objectstack/issues/33787#issuecomment-6942854600) on #33787).**
241+
> The refusal bullet's "⛔ No `DriverCapabilities` bit returns" is revisited for ADR-0155's leaf alone, as ADR-0147
242+
> (Proposed) revisits it for its own. Under ADR-0155's ②, ruled R2 for the storage that cannot run that leaf, a driver declares
243+
> whether it evaluates such leaves, and the declaration is read up front: on an object whose evaluator does not
244+
> declare it, the producer writes no share arm and share grants are refused as inert (ADR-0111 D7, as noted there).
245+
> A leaf that still reaches a driver that cannot run it is refused in the refusal bullet's envelope (status 500,
246+
> `INTERNAL_ERROR`, logged at `error` once per driver; ADR-0155's R1). The declaration's name is ADR-0155's O1, and
247+
> where ADR-0147's declaration is the same one, it is built once (ADR-0155 D4). This note moves nothing this section
248+
> says about `ReadableIds`. It records a decision that ADR-0155's execution cards will implement: until they land,
249+
> `main` has no such declaration and no such leaf.
250+
230251
### D4 — The six consumers emit one leaf per parent object, and no pre-scan
231252

232253
- **The activity stream and the compliance ledger** keep
@@ -400,6 +421,13 @@ change is #33696's, and by the ruling it lands only after this amendment merges.
400421
- **O3** — `driver-mongodb`: the cost of a pipeline form is unprototyped; it refuses until measured.
401422
- **O4** — `packages/plugins/plugin-sharing/src/sharing-service.ts` reads a caller's record-share grants at
402423
`limit: 5000` with no warning; that scope rides into the subquery unchanged. A separate finding, not this record's.
424+
**Answered** (2026-11-17): [ADR-0155](./0155-sharing-scope-share-grants-lower-to-an-engine-internal-semi-join-leaf.md)
425+
(Accepted; ruling record
426+
[`6942854600`](https://github.com/objectstack-ai/objectstack/issues/33787#issuecomment-6942854600) on #33787) decides
427+
that the share arm will lower to its own engine-internal semi-join leaf over `sys_record_share`, with no cap, so
428+
every grant counts. The amendment notes under D1 and D3 say what that record revisits here. This records a decision
429+
that ADR-0155's execution cards will implement: the capped read above stands until the plugin-sharing switch under
430+
#33787 lands, and not before.
403431
- **O5** — whether `controlled_by_parent`'s id set becomes a seventh consumer (D6). **Answered** (2026-10-21): the
404432
ruling is recorded verbatim in D6, as amended.
405433

‎docs/adr/0147-membership-scoped-rls-lowers-to-an-engine-internal-org-member-semi-join-leaf.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,18 @@ when the read runs, where the array was read when the request was resolved ([Con
167167
With no active organization the leaf composes to the plain `$in: [caller]`, and no subquery is issued.
168168
- **The name.** `OrgMemberIds` is the proposed name, a new export of `@objectstack/spec` beside `ReadableIds` (O1).
169169

170+
> **Amendment note (2026-11-17, [ADR-0155](./0155-sharing-scope-share-grants-lower-to-an-engine-internal-semi-join-leaf.md) — ruling record [`6942854600`](https://github.com/objectstack-ai/objectstack/issues/33787#issuecomment-6942854600) on #33787).**
171+
> ADR-0155 (Accepted) adds a third leaf over `sys_record_share`, and the executor seam that passes an
172+
> arrives-composed leaf through is built once for both leaves (its D4, "Built once"). That seam holds one recipient
173+
> rule for both: every identity a composed leaf names is compared with what the reading context itself carries. For
174+
> this record's leaf it compares the anchor's caller and organization, together, with the anchor the reading context
175+
> carries (D-e), and admits the leaf only when both are equal; a system context is exempt; a mismatch, or a reading
176+
> context that carries no anchor, is a composition fault refused in ADR-0139 D3's envelope. Nothing is re-derived from
177+
> the context's `userId` or `tenantId`, and the delegator's rebuilt context of D-c carries the live principal's anchor
178+
> and is admitted under it. The rule checks the anchor; it changes neither what the anchor carries nor where it is
179+
> captured (this D-a and D-c), and nothing else in this record moves. Its cases are pinned on the card that adds this
180+
> leaf to the seam (ADR-0155 plan step 2).
181+
170182
### D-b — The inner filter: exactly today's read
171183

172184
The subquery is the resolver's own read, restated as SQL, with nothing added:

0 commit comments

Comments
 (0)