Skip to content

Commit b51cb18

Browse files
docs(adr-0055,skills-data): wording follow-ups from the writeRequiresMasterRead reviews (#34075)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9B6XCSGFtBWMTfzkHVAwJSu)_ Fixes #33432 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:ADR-0055 补 5 处措辞(7 Sep 链式写入条与 7 Nov 状态行加 ⚠️ 指向 11-14 修订、"every refusal" 收窄为 "every master-gate refusal"、裁决原文补上末句「HotCRM 的设计授权全部兑现。」、补一句"读不到主记录的人按条件批量写入时什么都不写");data 技能 relationships.md 两处措辞、对应 eval 加 3 条 must_not_contain。 - 为什么改:两次契约复审留下的措辞尾巴。旧措辞会让读者以为开了 writeRequiresMasterRead 后设置主记录仍要编辑权,从而给主记录多授编辑权。 - 风险与回滚:纯文字,无代码、无契约改动;技能文件 token 数不变(4232/4232),棘轮行未动。回滚即 revert 本 PR。 - 先看:docs/adr/0055-master-detail-controlled-by-parent.md(第 10、141、273、286、298 行),skills/objectstack-data/rules/relationships.md(第 85–91、110–111 行)。 - 两分钟验证:`node scripts/check-skills-token-ratchet.mjs && pnpm check:adr-symbol-anchors && pnpm check:adr-index`,预期全部 exit 0,relationships.md 显示 4232 / 4232。 - 需要你做的:批准本 PR(受管面 Tier H,docs/adr/** 与 skills/**)。 ## What changes **`docs/adr/0055-master-detail-controlled-by-parent.md`** (review 6883816828, nits 1 to 5; every nit re-read on main `e71ecc1b`, none already settled, so none dropped). The 2026-11-15 notes from PR #33992 (#33696) are untouched. 1. The 2026-09-07 amendment's **Write** bullet ("running the same three master-edit legs … on every hop") keeps its sentence and gains an in-place `⚠️ Amended 2026-11-14 (#33250 / PR #33369)` note: a hop that declares `writeRequiresMasterRead` asks read and ends the walk (`security-plugin-cbp-write-gate.ts#assertControlledByParentChainEditable`), pointing to the 2026-11-14 amendment. 2. The 2026-11-07 status line ("setting a master asks edit on it, emptying one asks edit on the stored master") gains a ⚠️ note in the form the 2026-10-26 line already carries: on an opted-in detail the new and the stored master are each asked read; the null-master owner rule is unchanged. `scripts/adr-index.mjs --json` output is byte-identical before and after (`cmp` exit 0): its status reader reads only the `**Status**:` line. 3. "### The invariant": "every refusal still says 'requires edit access'" → "every master-gate refusal …" (the 2026-11-07 null-master owner refusal never said that; the code agrees: `masterGateRefusalUserCopyOf` answers `undefined` for it). 4. The ruling quote is called verbatim and now is: the record 6880588685's last sentence 「HotCRM 的设计授权全部兑现。」 is added, byte-identical to the record's option text (141 bytes each), and the English gloss covers it. 5. "What a refusal answers" gains the predicate case: a predicate (`multi: true`) update or delete by a caller who cannot read the master selects none of that master's rows, judges no master for them and writes none of them, with no refusal, as on a detail that does not opt in. Verified by reading main: `security-plugin-addressed-writes.ts#readableRowsScopeForPredicateWrite` narrows the matched set to readable rows, and `security-plugin-cbp-write-gate.ts#controlledByParentPredicateWriteMasters` judges the masters of those rows only; the opt-in never touches the read side (zero `writeRequiresMasterRead` hits in the read filter, addressed-writes and authz middleware). Worded per master, because one predicate can also select rows under masters the caller does read. **`skills/objectstack-data/rules/relationships.md`** (review 6883930925): - N1: "(even under `ownerMayEdit`; read under `writeRequiresMasterRead`)" → "(both even under `ownerMayEdit`; read for both under `writeRequiresMasterRead`)": setting and emptying a master both ask read under the key. - N2: the ownership floor now binds on-behalf-of updates and deletes "for both users" (ADR-0055 2026-11-14: a delegated by-id write keeps both principals' floors, ADR-0090 D10). - Paid by one cut in the same section (standing ruling 「A:先削重复,余额按实测提高」): the `ownerMayEdit` bullet's list "insert, delete, predicate (`multi: true`) updates and on-behalf-of writes still need master edit" → "every other write, on-behalf-of included, still needs master edit". Surviving homes: the section's own default two lines above ("by default, every write needs edit on the master") with the bullet's "only"; the `multi: true` gloss lives in `references/data-hooks.md` and `rules/security.md`. No re-wrap pays for anything. **`skills/objectstack-data/evals/objects-fields-relationships.json`**: the `writeRequiresMasterRead` case (found by content, `id: 17`) gains three `must_not_contain` strings: both orders of `ownerMayEdit: true` beside the key, and the key on the `master_detail` field (`required: true, writeRequiresMasterRead`). None occurs in the case's own `expected_output`; all four `must_contain` strings do. No other case changes (JSON compare against the base). **`.changeset/33432-cbp-write-opt-in-wording.md`**: `@objectstack/skills` patch, carrying both declaration lines. ### Token readings (`ceil(utf8 bytes / 4)`, `node scripts/check-skills-token-ratchet.mjs`) | Reading | Before | After | |---|---|---| | `rules/relationships.md` (ceiling 4232) | 4232 (16925 bytes) | 4232 (16925 bytes), headroom 0, row unchanged | | `evals/objects-fields-relationships.json` (not ratcheted) | 5466 | 5511 | | Whole `skills/objectstack-data` package | 52950 | 52995 | | Sum of all `SKILL.md` | 59218 | 59218 | | Bundle total (whole shipped tree) | 246388 | 246433 | The +45 is the eval file alone. ## Why Authors and agents read ADR-0055 and the data skill to decide which grant a detail write asks. A stale bullet or an open-scoped parenthetical tells some readers that setting a master still asks edit under the opt-in, and they over-grant edit on the master to get a write through. ## Acceptance notes - **Authoring tier (deviation, declared).** `dispatch-gates --tier` makes the contract-review tier MANDATORY for `docs/adr/**` and `skills/**`; the card thread is served below it, so the text was authored and committed by an isolated os-dev subagent pinned to that tier on this branch. The thread merged main, ran the gates, opened this PR and wrote the report. - Observation, nothing filed: the 2026-11-07 "Chains" bullet ("a chain hop with no master of its own ends the chain under the same rule") carries no 2026-11-14 note; the 2026-11-14 Gate bullet covers it in general terms. Not one of the five nits. - Carrier #33696: once its code lands, one reader class reads a required master's empty or dangling rows; the 404 sentence and the new predicate sentence both rest on "a detail row's read derives from its master (§2)" and will need that card's note. - Eval limits: the three strings catch single-line spellings only. The case's `expected_output` still says the floor "binds predicate and on-behalf-of updates and deletes" (true, not refined to "both users"); left, since only `must_not_contain` was in scope. - Forced test edits: none. ## Verification Head `e84ff32f` (base `fb79d47c` + merge of main `e71ecc1b`). `node scripts/pm/dispatch-gates.mjs --commands` derived 51 commands; each run with its exit captured before any pipe, then reconciled with `--ran`. <details><summary>Gate readings</summary> Run on head `e84ff32f`, 51/51 exit 0. `check:dual-build-cjs-loads` first answered exit 3 (PREREQUISITE NOT MET: needs every package dist); after `turbo run build --filter='./packages/**'` under `os-verify-lock` (VERDICT command-exit 0, 5m47s) it answered exit 0. `--ran` reconciliation: "51 derived famil(ies) accounted for — 51 run, 0 NOT-MEASURED (a DERIVED zero)". Also exit 0 on the authored head `c5cc5319`: `pnpm check:skill-eval-tokens` (ui), `pnpm --filter @objectstack/spec check:skill-docs`, `check:skill-refs`, `check:skill-examples`, `node scripts/adr-index.mjs --check`, `check-skills-token-ratchet.mjs --self-test` (104 cases). ```text node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0 node scripts/check-adr-0087-registration.mjs --self-test :: exit 0 node scripts/check-adr-links.mjs :: exit 0 node scripts/check-adr-links.mjs --self-test :: exit 0 node scripts/check-changeset-no-major.mjs --base origin/main :: 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/check-doc-route-spelling.mjs --advisory :: exit 0 node scripts/check-doc-route-spelling.mjs --self-test :: exit 0 node scripts/check-dts-emitted.mjs --self-test :: exit 0 node scripts/check-empty-changeset.mjs --base origin/main :: exit 0 node scripts/check-empty-changeset.mjs --self-test :: exit 0 node scripts/check-skills-token-ratchet.mjs :: exit 0 node scripts/check-skills-token-ratchet.mjs --self-test :: exit 0 node scripts/ci/assert-turbo-remote-cache.mjs --self-test :: exit 0 node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0 node scripts/ci/prune-turbo-cache.mjs --self-test :: exit 0 node scripts/ci/snapshot-next.mjs --self-test :: exit 0 node scripts/pm/check-governed-queue-guard.mjs --self-test :: exit 0 node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0 node scripts/release-pending-publish.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:agent-test-spelling :: exit 0 pnpm check:changeset-gate-self-tests :: exit 0 pnpm check:ci-filter-parity :: exit 0 pnpm check:closed-ceremony-text :: exit 0 pnpm check:corpus-claim-drift :: 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:dts-closure :: exit 0 pnpm check:dual-build-cjs-loads :: exit 0 pnpm check:gitlink-declared :: exit 0 pnpm check:lean-entry-closure :: exit 0 pnpm check:nul-bytes :: exit 0 pnpm check:pm-governed-merges :: exit 0 pnpm check:pm-prior-rulings :: exit 0 pnpm check:pm-skill-id-lint :: exit 0 pnpm check:published-files :: exit 0 pnpm check:refd-timer-probe :: exit 0 pnpm check:role-word :: exit 0 pnpm check:skill-compatibility :: exit 0 pnpm check:skill-frame-sync :: exit 0 pnpm check:skill-identifier-liveness :: exit 0 pnpm check:skill-links :: exit 0 pnpm check:sourcemap-no-sources-content :: exit 0 pnpm check:watch-hint-literal :: exit 0 ``` </details> ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (not touched) - [x] 2. Every name I added uses the casing for its kind. (no names added) - [x] 3. No formatter ran; `pnpm lint` passes. (no code changed; `pnpm lint` was not run locally, CI runs it) - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. (not touched) - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. --- _Generated by [Claude Code](https://claude.ai/code/session_01ADHkmSuNnnr3JQjtkn1a28)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9e0bc61 commit b51cb18

4 files changed

Lines changed: 25 additions & 11 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): `objectstack-data` states what `writeRequiresMasterRead` asks when a master is set or emptied, and whose ownership floor binds an on-behalf-of write
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
objectstack-data's `rules/relationships.md` is more exact about a `controlled_by_parent` detail's two write opt-ins. Under `sharing.controlledByParent.writeRequiresMasterRead`, setting a master on a row and emptying one both ask read (the sentence read as if only emptying did), and both still ask edit under `ownerMayEdit`. On an on-behalf-of update or delete the ownership floor binds for both users, not one. The `ownerMayEdit` bullet now says "every other write, on-behalf-of included, still needs master edit" where it listed the writes, which pays for the added words: the file is the same size. The eval case for the key also fails an answer that writes `ownerMayEdit: true` beside it, in either order, or puts the key on the `master_detail` field.

‎docs/adr/0055-master-detail-controlled-by-parent.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
· **Amended** (2026-10-26, #25760, ruling `6398566164`) — **§3 gains one per-object opt-in**: `sharing.controlledByParent.ownerMayEdit: true` lets the OWNER of a detail row (its `owner_id`) pass the write gate on a by-id `update` of that row with **read** access to the master; every other caller, and every insert, delete, predicate update and on-behalf-of write, keeps the master-**edit** rule. The default is unchanged. See **"Amendment (2026-10-26, #25760): the owner of a detail row may update it with read on the master, by opt-in"** at the end. ⚠️ **Amended 2026-11-14 (#33250 / PR #33369)** — that "every other caller … keeps the master-edit rule" no longer holds on a detail that declares the second opt-in, `writeRequiresMasterRead`: there every write asks **read** on the master. The two opt-ins are refused together. See the 2026-11-14 line below.
88
· **Amended** (2026-10-27, #26591 / PR #26658) — **the 2026-10-26 amendment's Lint bullet is narrowed in place**: the lint prescribes the opt-in only for an `owner_id`-keyed `update` / `all` policy on a `controlled_by_parent` detail that carries `owner_id` and has not opted in; any other caller-keyed update policy is flagged in both states with the `owner_id` remedy, never the opt-in. The gate, the spec and the lint are unchanged by this note. See the note under **Lint** in "What the opt-in does, exactly".
99
· **Amended** (2026-11-06, #30905, maintainer ruling 「A」) — **§1 admits an optional master and §2 gains a null-master arm**: a `controlled_by_parent` object whose only `master_detail` is declared `required: false` derives an OPTIONAL master. A detail row that names its master is read through it, unchanged; a row whose master reference is empty is read by its owner (`owner_id`) and by View All on the detail, through a second arm OR-ed with the master arm inside the one read chokepoint, `computeControlledByParentFilter`. §3 (the write gate) is unchanged by this note: a write that leaves the reference empty is still refused. ⚠️ **Amended 2026-11-07 (#30906 / PR #31082)** — that §3 sentence no longer holds; see the next line. See **"Amendment (2026-11-06, #30905): an optional master, and the null-master row its owner reads"** at the end.
10-
· **Amended** (2026-11-07, #30906 / PR #31082, the same ruling 「A」) — **§3 judges the null-master row by an owner rule**: a row of an optional master whose reference is empty is written by its owner (`owner_id`) and by Modify All on the detail, everyone else `403`; an insert naming no master is admitted; setting a master asks edit on it, emptying one asks edit on the stored master (the 2026-10-26 opt-in does not cover it); a chain hop with no master of its own ends the chain under the same rule. A required master is unchanged. See **"Amendment (2026-11-07, #30906): the null-master row its owner writes"** at the end.
10+
· **Amended** (2026-11-07, #30906 / PR #31082, the same ruling 「A」) — **§3 judges the null-master row by an owner rule**: a row of an optional master whose reference is empty is written by its owner (`owner_id`) and by Modify All on the detail, everyone else `403`; an insert naming no master is admitted; setting a master asks edit on it, emptying one asks edit on the stored master (the 2026-10-26 opt-in does not cover it); a chain hop with no master of its own ends the chain under the same rule. A required master is unchanged. See **"Amendment (2026-11-07, #30906): the null-master row its owner writes"** at the end. ⚠️ **Amended 2026-11-14 (#33250 / PR #33369)** — that "setting a master asks edit on it, emptying one asks edit on the stored master" no longer holds on a detail that declares `writeRequiresMasterRead`: there the new master and the stored master are each asked **read**. The owner rule of the null-master row is unchanged. See the 2026-11-14 line below.
1111
· **Amended** (2026-11-14, #33250 / PR #33369, ruling A+ `6880588685`) — **§3 gains a second per-object opt-in, and for the objects that declare it the 2026-10-26 amendment's "Option 2 … was not chosen" line is lifted**: `sharing.controlledByParent.writeRequiresMasterRead: true` makes **read** on the master the master question for every write of the detail (insert, update and delete, by id or by predicate, and the lifecycle verbs); the detail's own object permissions, row-level security, field-level security and the platform ownership floors decide the rest. The default is unchanged: a write's answer moves only if its own object, or a `controlled_by_parent` master on its chain, declares the key. See **"Amendment (2026-11-14, #33250): read on the master is enough to write, by opt-in"** at the end.
1212
· **Amended** (2026-11-15, #33696, ruling 「只对管理员去掉」 `6893666857`) — **for one reader class the parent chain over a REQUIRED master is dropped, and that class alone reads that master's detail rows whose reference is empty or dangling**: a reader who holds View All on the detail AND whose every master hop answers unrestricted (the engine's per-hop scope, not `hasSuperuserReadBypass`) sees those rows — naming no master, or a master that does not exist — inside its own tenant wall. That is consistent with the 2026-11-06 ruling 「A」, whose reader of a row with no master, beside its owner, is View All on the detail. Every other reader, members included, keeps the chain unchanged. An optional master's two arms are outside the ruling, and §3 (the write gate) is not amended by this note. The ruling lifts ADR-0139 D6's ⛔ ("interim removal of the predicate for an unrestricted master scope") for that class only, and [ADR-0139](./0139-engine-internal-semi-join-leaf-readable-parent-ids.md) D6 as amended 2026-11-15 carries the ruling's binding bullets verbatim. This is the "ADR-0055's 10-22 note in step" the ruling orders, and it precedes the code: #33696's change lands only after it. See the note under **"The rules the read keeps"** in the 2026-11-06 amendment.
1313
**Deciders**: ObjectStack Protocol Architects
@@ -138,6 +138,7 @@ So a two-level chain was enforced at level one and open at level two, under meta
138138
- **Read.** `packages/plugins/plugin-security/src/security-plugin.ts#computeControlledByParentFilter` AND-composes the master's **own** `controlled_by_parent` derivation as a third layer, resolved through **that same method**, so the recursive answer cannot drift from the top-level one. The master set is therefore point-for-point equal to what a direct read of the master returns **at every level** — the equality §2 established for one.
139139
⚠️ **Amended 2026-10-22 (#24932).** The derivation no longer composes the master's layers itself: it answers the `ReadableIds` leaf over the master, and the **engine** composes the master's scope by asking this plugin's public doors — `canReadObject(master)` and `getReadFilter(master)`, the latter being this same derivation for a master that is itself `controlled_by_parent`, so the chain composes recursively, one nested subquery per hop, inside one statement (ADR-0139 D6 as amended). The equality holds for the same reason, one level up: the scope the engine composes IS the scope a direct read of the master runs under.
140140
- **Write.** `packages/plugins/plugin-security/src/security-plugin.ts#assertControlledByParentWrite` walks the chain hop by hop, running the same three master-edit legs — extracted verbatim as `packages/plugins/plugin-security/src/security-plugin.ts#assertMasterRowEditable` — on every hop until it reaches a master that governs its own rows. Each added refusal keeps the `403 PERMISSION_DENIED` envelope named for the **caller's own** object and operation, never for an ancestor the caller never asked about.
141+
⚠️ **Amended 2026-11-14 (#33250 / PR #33369).** "On every hop" no longer holds for a hop whose detail declares `writeRequiresMasterRead`: there the walk (`packages/plugins/plugin-security/src/security-plugin-cbp-write-gate.ts#assertControlledByParentChainEditable`) asks whether the principal can **read** the master row in place of the three edit legs, and ends at that hop; the read door answers for the chain above it. A hop that does not declare the key runs the edit legs as before. See the 2026-11-14 amendment at the end.
141142

142143
**Cost.** The per-request resolution cost booked under Consequences is now paid **per hop** — one extra master-id query per `controlled_by_parent` object on the chain, bounded as below.
143144
⚠️ **Amended 2026-10-22 (#24932).** No extra query per hop: each hop is one nested subquery inside the detail's one statement, and the depth bound caps the statement's nesting, not a count of queries. The write gate's per-hop master-row probe is unchanged.
@@ -270,7 +271,7 @@ Every `controlled_by_parent` object with a required master, byte for byte: its e
270271

271272
## Amendment (2026-11-14, #33250): read on the master is enough to write, by opt-in
272273

273-
**Ruling.** objectstack-ai/objectstack#33250, maintainer ruling A+ (Leehom, 2026-11-14T16:21:29Z; ruling record `6880588685`), verbatim: 「开关打开后,能读主记录的人按子对象自己的授权新增、修改、删除,默认不变。」 (With the switch on, whoever can read the master record inserts, updates and deletes the detail under the detail's own grants; the default is unchanged.) PR #33369 implements it (merged 2026-11-14). For an object that declares the key it lifts the 2026-10-26 amendment's "Option 2 … was **not** chosen" line and its "Option 2's door … stays closed" line; for every other object both stand, and neither is rewritten. The ruling left the key's name, the paths the swap covers, its relation to `ownerMayEdit` and the lint arm to the seat. This section records what shipped; the two seat calls the contract review (`6881744779`, ① items 5 and 6) named for the maintainer's veto window are under **The two seat calls** below.
274+
**Ruling.** objectstack-ai/objectstack#33250, maintainer ruling A+ (Leehom, 2026-11-14T16:21:29Z; ruling record `6880588685`), verbatim: 「开关打开后,能读主记录的人按子对象自己的授权新增、修改、删除,默认不变。HotCRM 的设计授权全部兑现。」 (With the switch on, whoever can read the master record inserts, updates and deletes the detail under the detail's own grants; the default is unchanged. HotCRM's designed grants are all honoured.) PR #33369 implements it (merged 2026-11-14). For an object that declares the key it lifts the 2026-10-26 amendment's "Option 2 … was **not** chosen" line and its "Option 2's door … stays closed" line; for every other object both stand, and neither is rewritten. The ruling left the key's name, the paths the swap covers, its relation to `ownerMayEdit` and the lint arm to the seat. This section records what shipped; the two seat calls the contract review (`6881744779`, ① items 5 and 6) named for the maintainer's veto window are under **The two seat calls** below.
274275

275276
### What the opt-in does, exactly
276277

@@ -283,7 +284,7 @@ Every `controlled_by_parent` object with a required master, byte for byte: its e
283284
- A **predicate** update or delete keeps the floor, as before: among the rows it selects it touches only those the caller created.
284285
- A **delegated** (on-behalf-of) by-id update or delete keeps **both** principals' floors, the ADR-0090 D10 exclusion, unchanged.
285286
- **On behalf of.** Step 2.8 runs the gate once per principal, the agent and then the delegator, each asked the read under its own context: either one unable to read the master refuses the write, and both able admit it, subject to the floors above.
286-
- **What a refusal answers.** A by-id update or delete by a caller who cannot read the master answers `404 RECORD_NOT_FOUND`, not `403`: the detail row's own read derives from its master (§2), so the read door (`callerCannotReadAddressedRow`, step 2.7) hides the row before the gate runs. That is the hidden-row rule (#7505), the same answer a detail that does not opt in gives. An insert or a re-point answers `403 PERMISSION_DENIED`, named for the caller's object and verb, "requires read access to its master record". `ISecurityService.checkControlledByParentWrite` answers `deny` for all of them, on `object_permission` (the master read is refused) or `row_level_security` (the master row is not returned); the closed leg union is not widened. `os explain` (`packages/plugins/plugin-security/src/explain-engine.ts#chainAsksMasterRead`) chooses prose that names the read question; its verdict still comes from the served member.
287+
- **What a refusal answers.** A by-id update or delete by a caller who cannot read the master answers `404 RECORD_NOT_FOUND`, not `403`: the detail row's own read derives from its master (§2), so the read door (`callerCannotReadAddressedRow`, step 2.7) hides the row before the gate runs. That is the hidden-row rule (#7505), the same answer a detail that does not opt in gives. An insert or a re-point answers `403 PERMISSION_DENIED`, named for the caller's object and verb, "requires read access to its master record". `ISecurityService.checkControlledByParentWrite` answers `deny` for all of them, on `object_permission` (the master read is refused) or `row_level_security` (the master row is not returned); the closed leg union is not widened. `os explain` (`packages/plugins/plugin-security/src/explain-engine.ts#chainAsksMasterRead`) chooses prose that names the read question; its verdict still comes from the served member. A predicate (`multi: true`) update or delete by a caller who cannot read the master selects none of that master's rows, so it judges no master for them, writes none of them and answers no refusal, as on a detail that does not opt in: its matched set is narrowed to the rows the caller can read (`packages/plugins/plugin-security/src/security-plugin-addressed-writes.ts#readableRowsScopeForPredicateWrite`), a detail row's own read deriving from its master (§2), and the gate judges the masters of those rows only (`packages/plugins/plugin-security/src/security-plugin-cbp-write-gate.ts#controlledByParentPredicateWriteMasters`).
287288
- **The null-master row.** A row of an optional master whose reference is empty has no master to read: on an opted-in detail the 2026-11-07 owner rule (`nullMasterRowWritable`) still decides it, and setting a master on it asks that rule, then read on the new master.
288289
- **Lint.** `security-controlled-by-parent-owner-policy-without-opt-in` stands down, both branches, on a detail that declares the key (`packages/lint/src/validate-security-posture.ts`): there a caller-keyed update policy decides among master readers as authored, whichever user field it keys. No rule is added.
289290

@@ -294,7 +295,7 @@ Every `controlled_by_parent` object with a required master, byte for byte: its e
294295

295296
### The invariant
296297

297-
A write's answer moves only if its own object, or a `controlled_by_parent` master on its chain, declares `writeRequiresMasterRead`. In a stack where no object declares it, every hop runs the edit legs and every refusal still says "requires edit access". The "What is unchanged" lists of the earlier amendments read as of their dates: where one says a detail is answered as before, that holds for a detail whose chain declares no `writeRequiresMasterRead`.
298+
A write's answer moves only if its own object, or a `controlled_by_parent` master on its chain, declares `writeRequiresMasterRead`. In a stack where no object declares it, every hop runs the edit legs and every master-gate refusal still says "requires edit access". The "What is unchanged" lists of the earlier amendments read as of their dates: where one says a detail is answered as before, that holds for a detail whose chain declares no `writeRequiresMasterRead`.
298299

299300
### Fail-closed boundaries
300301

‎skills/objectstack-data/evals/objects-fields-relationships.json‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,10 @@
305305
"writeRequiresMasterRead: true"
306306
],
307307
"must_not_contain": [
308-
"sharing: { writeRequiresMasterRead"
308+
"sharing: { writeRequiresMasterRead",
309+
"ownerMayEdit: true, writeRequiresMasterRead: true",
310+
"writeRequiresMasterRead: true, ownerMayEdit: true",
311+
"required: true, writeRequiresMasterRead"
309312
]
310313
}
311314
},

‎skills/objectstack-data/rules/relationships.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ sharingModel: 'controlled_by_parent',
8282
sharing: { controlledByParent: { writeRequiresMasterRead: true } }, // or ownerMayEdit
8383
```
8484

85-
- `ownerMayEdit: true` widens only the row owner's (`owner_id`) by-id update; insert,
86-
delete, predicate (`multi: true`) updates and on-behalf-of writes still need master edit.
85+
- `ownerMayEdit: true` widens only the row owner's (`owner_id`) by-id update; every
86+
other write, on-behalf-of included, still needs master edit.
8787
- `writeRequiresMasterRead: true`: whoever reads the master inserts, updates and
8888
deletes the detail under its own object permissions, RLS and FLS (re-points and
8989
each opted-in chain hop too; on-behalf-of, both users must read the master). The
90-
ownership floor (rows you created) still binds predicate and on-behalf-of updates
91-
and deletes. Refused beside `ownerMayEdit: true`, which it covers. Lint
90+
ownership floor (rows you created) still binds predicate and, for both users, on-behalf-of
91+
updates and deletes. Refused beside `ownerMayEdit: true`, which it covers. Lint
9292
`security-controlled-by-parent-owner-policy-without-opt-in` is silent here.
9393

9494
The detail's own row policies AND in under both. Each is refused at parse under any
@@ -107,8 +107,8 @@ account: { type: 'master_detail', reference: 'account', required: false },
107107
A row with no master is its owner's (`owner_id`): the owner or View All on the
108108
detail reads it, the owner or Modify All writes it (no owner: View All / Modify
109109
All only). An insert naming no master is admitted. Setting a master asks edit
110-
on it, emptying one edit on the stored master (even under `ownerMayEdit`; read
111-
under `writeRequiresMasterRead`). A
110+
on it, emptying one edit on the stored master (both even under `ownerMayEdit`;
111+
read for both under `writeRequiresMasterRead`). A
112112
chain hop with no master ends there under the same rule. Refused beside a
113113
second `master_detail` or as `readonly`/`system`; `ObjectSchema.create()` reads
114114
an omitted `required` as `true`.

0 commit comments

Comments
 (0)