Skip to content

Commit 9cea5ad

Browse files
committed
docs(skills): say ownerMayEdit does not cover emptying an optional master, and scope the master-edit rule to rows that name one
The optional-master section said emptying a master asks edit on the stored master "ownerMayEdit aside", which reads as an exception; it now says "even under ownerMayEdit". The owner-edit section's "every write needs edit access on the master" and "still need master edit" now speak of rows that name a master. ADR-0055's 2026-11-07 amendment says the 403 is for a principal who reaches the gate; one who cannot read the row meets the read door's 404 first. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAo8GHSrxa8ZR8h3qxs
1 parent 197aa7c commit 9cea5ad

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ The ruling names **update**. So the leg does not reach: an **insert** (no row to
241241

242242
The gate (`packages/plugins/plugin-security/src/security-plugin-cbp-write-gate.ts#assertControlledByParentWrite`) judges a row of an **optional** master whose master reference is empty instead of refusing it `422`:
243243

244-
- **The owner rule** (`packages/plugins/plugin-security/src/security-plugin-cbp-write-gate.ts#nullMasterRowWritable`). Such a row is written by its owner (`owner_id`, non-null, equal to the principal) and by a holder of Modify All (`modifyAllRecords`) on the detail. Everyone else, View All included, is refused `403 PERMISSION_DENIED`, leg `master_chain`, naming the row. A row with no owner (an ADR-0142 queue row), and every row of an object with no `owner_id` column, is Modify All's alone. It is the write twin of §2's null-master arm: View All reads such a row, Modify All writes it.
244+
- **The owner rule** (`packages/plugins/plugin-security/src/security-plugin-cbp-write-gate.ts#nullMasterRowWritable`). Such a row is written by its owner (`owner_id`, non-null, equal to the principal) and by a holder of Modify All (`modifyAllRecords`) on the detail. Everyone else who reaches the gate, View All included, is refused `403 PERMISSION_DENIED`, leg `master_chain`, naming the row; a principal who cannot read the row meets the read door first (`404 RECORD_NOT_FOUND`, step 2.7), as for every hidden row. A row with no owner (an ADR-0142 queue row), and every row of an object with no `owner_id` column, is Modify All's alone. It is the write twin of §2's null-master arm: View All reads such a row, Modify All writes it.
245245
- **Insert.** An insert, single or batch, that names no optional master is admitted, and its creator becomes its owner. Every master a batch's rows do name is still asked.
246246
- **By-id update and delete** of a stored null-master row, and each null-master row a predicate write (`multi: true`) selects: the owner rule.
247247
- **Setting a master** on such a row asks the row's owner rule, then edit on the new master. **Emptying one** asks edit on the stored master through the §3 walk; the 2026-10-26 opt-in (`ownerMayEdit`) does not cover a body that empties an optional master.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export default ObjectSchema.create({
7979
#### Owner edits under `controlled_by_parent` — `ownerMayEdit`
8080

8181
A `controlled_by_parent` detail inherits the master's access: reads are scoped
82-
to accessible masters and **every write needs edit access on the master**. To
82+
to accessible masters and **every write of a row naming a master needs edit on it**. To
8383
let a detail row's owner (`owner_id`) update that row with only *read* access
8484
to the master, opt in on the detail:
8585

@@ -89,7 +89,7 @@ sharing: { controlledByParent: { ownerMayEdit: true } }, // by-id update only
8989
```
9090

9191
Nothing else widens — insert, delete, predicate (`multi: true`) updates and
92-
on-behalf-of writes still need master edit; the detail's own row policies
92+
on-behalf-of writes under a master still need its edit; the detail's own row policies
9393
still AND in. Refused at parse under any other `sharingModel` (the owner
9494
already writes there) and one level up (`sharing.ownerMayEdit`).
9595

@@ -106,7 +106,7 @@ account: { type: 'master_detail', reference: 'account', required: false },
106106
A row with no master is its owner's (`owner_id`): the owner or View All on the
107107
detail reads it, the owner or Modify All writes it (no owner: View All / Modify
108108
All only). An insert naming no master is admitted. Setting a master asks edit
109-
on it; emptying one asks edit on the stored master, `ownerMayEdit` aside. A
109+
on it; emptying one asks edit on the stored master, even under `ownerMayEdit`. A
110110
chain hop with no master ends there under the same rule. Refused beside a
111111
second `master_detail` or as `readonly`/`system`; `ObjectSchema.create()` reads
112112
an omitted `required` as `true`.

0 commit comments

Comments
 (0)