Repository navigation
feat(spec, plugin-security): a controlled_by_parent detail can let read access on its master suffice for insert, update and delete (writeRequiresMasterRead) - #33369
Conversation
…write opt-in Claude-Session: https://claude.ai/code/session_01FEkQ5mmtu9Aih9i3fVmmve Co-Authored-By: Claude <noreply@anthropic.com>
…master for every write of a controlled_by_parent detail Claude-Session: https://claude.ai/code/session_01FEkQ5mmtu9Aih9i3fVmmve Co-Authored-By: Claude <noreply@anthropic.com>
…ose and docs for writeRequiresMasterRead Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mmtu9Aih9i3fVmmve
…t for writeRequiresMasterRead Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mmtu9Aih9i3fVmmve
📓 Docs Drift CheckThis PR changes 4 package(s): 46 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 16 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 175 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 4abed176b7ad68cdbd7c7e9b94705b5a013c61e8 && git checkout 4abed176b7ad68cdbd7c7e9b94705b5a013c61e8
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d3f3f4abf9f392a49fecf77f2175424fe1680bef b012326f35cb828c16c6bb0907062cfc374dbdbc && git checkout -B drift-repro d3f3f4abf9f392a49fecf77f2175424fe1680bef && git merge --no-ff b012326f35cb828c16c6bb0907062cfc374dbdbc
node scripts/docs-audit/affected-docs.mjs --json d3f3f4abf9f392a49fecf77f2175424fe1680bef
|
|
domain:spec#1 · os-project-manager · session_01FEkQ5mswnWm181XgYcCUag Contract reviewServed-tier: Inputs read: card #33250 body and all six comments (triage 6880118668, hold 6880158095, analysis 6880272329, ruling record 6880588685, claim 6880627606, dev report 6881619847); PR #33369 body, its 40-file list and the net diff against merge-base Check-runs at render (69 total): 29 success, 11 skipped, 29 still in progress, 0 failed. Concluded green: Check Changeset, Spec property liveness, Governed Surface Queue Guard, PR-body guards, Lint and Repo Gates and all Lint shards, PM dispatch-gates, Type Check source gates and debt ledger, Build Docs, Dogfood Regression Gate, Live E2E UI. No conclusion yet: Test Core 1/8 to 8/8, Test UI 1/16 to 16/16, Build Core, Type Check workspace, Type Check UI, Lint UI, Build and E2E UI. This verdict is the design judgment; those runs are the test verdicts and the seat reads them before enqueue. ① Derived judgments
② Semver levelChangeset Clause-②: yes (widening), on the PR body and in the changeset, with ③ Boundary flags
④ Design judgment
Findings:
No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
domain:spec#1 · os-project-manager · session_01FEkQ5mswnWm181XgYcCUag ACCEPT · PR #33369 (#33250, p1) · head
|
…d in the controlled_by_parent rules (objectstack-ai#33427) <!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XGTRqkadkLaQzmJ9NBj9UKs)_ Fixes objectstack-ai#33374 domain:skills#1 · os-project-manager · session_01FEkQ5pfprxUTKxctsoaYzF Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:`objectstack-data` 技能的关系规则(`rules/relationships.md`)原来只教「明细的每次写入都要主记录的编辑权,唯一开关是 `ownerMayEdit`」,现在补上第二个开关 `writeRequiresMasterRead`:打开后,能读主记录的人按明细对象自己的权限、行级与字段级安全新增、修改、删除;默认不变。同时写明三处拒绝(与 `ownerMayEdit: true` 同时声明、非 `controlled_by_parent` 对象、写在上一层)、所有权底线仍约束批量写与代他人写、相关 lint 在该明细上不报。eval 新增第 17 例。 - 为什么改:PR objectstack-ai#33369 已在 `main` 上线这个键,技能文字却仍说「每次写入都要主记录编辑权」,AI 作者照着写会错过这个开关,或把它写到非明细对象上被拒。 - 风险与回滚:纯技能文字与 eval,不动 schema 与运行时;`relationships.md` token 4127 到 4127(上限 4127,零余量),新增文字由删去 lookup 与多对多示例里的两段样板父对象付账;回滚即还原本 PR。 - 先看:`skills/objectstack-data/rules/relationships.md` 的「Writes under `controlled_by_parent` — two opt-ins」一节;再看 eval 文件末尾第 17 例。 - 两分钟验证:`node scripts/check-skills-token-ratchet.mjs`,预期 exit 0、`relationships.md is 4127 tokens (ceiling 4127; headroom 0)`。 - 需要你做的:受管面 Tier H(`skills/**`):请批准或合并。 ## What changes - **`skills/objectstack-data/rules/relationships.md`, the rule's home.** The section "Owner edits under `controlled_by_parent` — `ownerMayEdit`" becomes "Writes under `controlled_by_parent` — two opt-ins". By default every write needs edit on the master. `ownerMayEdit: true` keeps its old meaning (the row owner's by-id update only). `writeRequiresMasterRead: true` is new: whoever reads the master inserts, updates and deletes the detail under the detail's own object permissions, RLS and FLS, re-points and each opted-in chain hop too; on behalf of another user, both users must read the master. The ownership floor (rows the caller created) still binds predicate and on-behalf-of updates and deletes (N3). Refused beside `ownerMayEdit: true`, off a `controlled_by_parent` object, and one level up (`sharing.KEY`). The lint `security-controlled-by-parent-owner-policy-without-opt-in` is silent on such a detail. The code example shows the new key with "or ownerMayEdit" so the refused pair is never copied as one literal. - Same file, two sentences the new key made incomplete: the relationship table's Sharing cell ("owner opt-in `ownerMayEdit`" to "read-on-master opt-ins (below)"), and the optional-master paragraph (setting or emptying a master asks read under `writeRequiresMasterRead`, edit even under `ownerMayEdit`). - **Paid in the same file** (token ratchet headroom 0 before): the lookup example's parent `account` object and the junction example's two side objects (`project`, `employee`), each a name-only `ObjectSchema.create`, are replaced by one comment naming them. They taught nothing the surrounding prose and the child objects do not. - **`skills/objectstack-data/evals/objects-fields-relationships.json` eval 17.** Order lines anyone who can see the order may add, change or remove: `controlled_by_parent` with `writeRequiresMasterRead: true`, not `ownerMayEdit`, not one level up. `must_contain`: `controlled_by_parent`, `master_detail`, `controlledByParent`, `writeRequiresMasterRead: true`; `must_not_contain`: `sharing: { writeRequiresMasterRead`. The set already covered the master-edit rule (eval 2, `ownerMayEdit`), so the order's condition for adding one holds. - **`.changeset/33374-skills-teach-write-requires-master-read.md`**: `'@objectstack/skills': patch`, both declaration lines. - Not touched, after reading each on `origin/main`: `skills/objectstack-data/SKILL.md` (its `controlled_by_parent` row says "inherited from the master record", still true), `references/lint-rules.md` (does not list the owner-policy lint), `skills/objectstack-ui/rules/record-page.md` (an `os:check` example, no write rule stated). No restatement outside the rule's home. ## Why Read on `origin/main` b462444 (PR objectstack-ai#33369 merged), not from the card's summary: - **Key and refusals**: `packages/spec/src/data/object.zod.ts:3162-3195` (`refuseControlledByParentWriteRequiresMasterReadMisplaced`: refused off `controlled_by_parent`, refused beside `ownerMayEdit: true` with "Delete ownerMayEdit; writeRequiresMasterRead already admits the owner"), `:4244-4246` (strict `sharing` block's guidance for the key one level up), `:4210-4216` (read on the master is the master question for every write; absent or `false`, master edit). - **Per hop and every write path**: PR objectstack-ai#33369's body and changeset `.changeset/33250-controlled-by-parent-write-requires-master-read.md` (insert single and batch, by-id and predicate update and delete, re-point and emptying, each hop whose detail opted in; on-behalf-of asks each context). The body-named master goes through the same chain walk (`security-plugin-cbp-write-gate.ts:540-553`, `askBodyNamedMaster` calls `assertControlledByParentChainEditable`). - **Ownership floor (N3)**: PR objectstack-ai#33369 Acceptance notes ("Predicate (multi-row) update/delete keep the platform ownership floor ... only by-id writes hand that floor to the master gate"); the delegated path keeps it (`security-plugin-authz-middleware.ts:740-746`, `delegatorOwnWriteFloorOptions`). Confirmed identical with the objectstack-ai#33373 ADR-0055 amendment thread (branch `claude/project-thread-mllmvl`). - **Lint**: the changeset's `@objectstack/lint` paragraph (no new rule; the owner-policy arm stands down on a declaring detail). - **N1**: no "byte for byte" wording; the text says "by default". Ruling: Leehom 2026-11-14, A+ (record 6880588685 on objectstack-ai#33250): 「开关打开后,能读主记录的人按子对象自己的授权新增、修改、删除,默认不变。」 ## Acceptance notes - **Eval id 17 collides with PR objectstack-ai#33394** (objectstack-ai#32392, awaiting merge), which also appends eval 17 to the same file. Whichever lands second merges `origin/main` and renumbers to 18; the order expected this. - **Heading anchor changed**: `#owner-edits-under-controlled_by_parent--ownermayedit` is gone. `git grep` over the whole tree finds no link to it. - **Not stated in the skill, on purpose**: the refusal shapes for a non-reader (insert and re-point `403 PERMISSION_DENIED`, by-id update and delete `404 RECORD_NOT_FOUND`) and the lifecycle verbs. They live in the ADR amendment (objectstack-ai#33373) and the permissions docs; the file has no headroom for them. ## Verification Head `4629a84a`, base `origin/main` b462444. <details><summary>Line and token budget (skills/**)</summary> - `skills/objectstack-data/rules/relationships.md`: 419 to 399 lines, 16505 to 16508 bytes; token ratchet 4127 to 4127 (ceiling 4127, headroom 0). Paid by deleting three boilerplate parent objects; no ceiling moved, no re-wrap counted as payment. First wording measured +14 tokens over and was shortened. - `skills/objectstack-data/evals/objects-fields-relationships.json`: 296 to 313 lines, 17850 to 19199 bytes (eval fixture, measured, not ratcheted). - Whole package, all `skills/*/SKILL.md`: 4602 to 4602 lines (no SKILL.md touched). - `node scripts/pm/check-skill-line-ratchet.mjs`: exit 0. `node scripts/check-skills-token-ratchet.mjs`: exit 0. </details> <details><summary>Derived gates: 44 derived, 42 run green, 2 NOT MEASURED</summary> `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 44 families for the three paths. Each was run on head `4629a84a` with its exit code captured before any pipe, after building `@objectstack/formula` and `@objectstack/lint` under the verify lock (VERDICT command-exit 0, 104s): - 42 exit 0, among them `check-skills-token-ratchet` (scan and `--self-test`), `check-empty-changeset` (scan and `--self-test`), `check-changeset-no-major`, `check-adr-0087-registration`, `@objectstack/lint check:doc-formula-expressions`, `check:doc-authoring`, `check:nul-bytes`, `check:pm-governed-merges`, `check:published-files`, `check:skill-compatibility`, `check:skill-frame-sync`, `check:skill-identifier-liveness`, `check:skill-links`, `check:dts-closure`, `check:sourcemap-no-sources-content`. - NOT MEASURED, exit 3 PREREQUISITE NOT MET (each reads every package's `dist/`): `check:dual-build-cjs-loads`, `check:lean-entry-closure`. No package source is touched; CI builds and runs them. - `--ran` reconciliation: "44 derived famil(ies) accounted for — 42 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3)". - `check:skill-examples` is not derived and not run: no `os:check` block is touched. - CI families are read from this PR's check-runs, not re-run here. </details> <details><summary>Tier and governed readings</summary> - `dispatch-gates --tier`: MANDATORY contract-review tier, both `skills/**` paths under clause ① (the published catalog); no one-line exit for this surface. This thread ran at the claim's default model; the seat's in-seat contract review is the owed record. - `node scripts/pm/check-governed-merges.mjs --branch claude/project-thread-jqd53n`: exit 3, GOVERNED, landing tier H (人合). 2 of 3 paths hit the register (`skills/**` x2); the changeset is not on it. Size +47 / -40, under the 3000 threshold. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01FEkQ5pfprxUTKxctsoaYzF <!-- signed: domain:skills#1 · os-project-manager · session_01FEkQ5pjSPT7ui2EUcunaVb --> Co-authored-by: Claude <noreply@anthropic.com>
…ead — read on the master is enough to write, by opt-in (objectstack-ai#33425) <!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XNsNaHavSiFyrF5kwaQpi6F)_ Fixes objectstack-ai#33373 domain:skills#1 · os-project-manager · session_01FEkQ5mjPb2TvhBS1yQezQF Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:ADR-0055 补记 2026-11-14 修订「读主记录即可写(按对象开关)」:状态区新增一行修订横幅,`:6`(ownerMayEdit 横幅)与 §3 规则处加⚠️ 指向;2026-10-26 修订里「方案 2 未采纳」两处只对声明了开关的对象解除(原文保留、不改史);2026-11-07 修订里「清空主记录问主记录编辑权」那句加注;文末新增完整修订节。 - 为什么改:PR objectstack-ai#33369 已按 Leehom 裁定 A+ 上线 `writeRequiresMasterRead`,而 ADR 仍写着「方案 2 的门保持关闭」,与运行时相反;后来的评审会照 ADR 把行为「修回去」。 - 风险与回滚:只改一个 ADR 文件(+52/−1),不动代码、schema、技能;回滚即还原本 PR。 - 先看:`docs/adr/0055-master-detail-controlled-by-parent.md` 文末「Amendment (2026-11-14, objectstack-ai#33250)」节,重点是「两个席位裁量点」(链上非声明子对象、生命周期动词)与「不变式」两段。 - 两分钟验证:`git diff origin/main -- docs/adr/0055-master-detail-controlled-by-parent.md`,预期只见新增横幅/⚠️ 注与文末新节,原有句子仅 `:6` 一行在行尾追加⚠️ 注。 - 需要你做的:受管面 Tier H(`docs/adr/**`):请批准或合并。 ## What changes One file, `docs/adr/0055-master-detail-controlled-by-parent.md` (+52 / −1; the −1 is the `:6` banner line, kept verbatim with a⚠️ note appended). - **Status block.** A new `· **Amended** (2026-11-14, objectstack-ai#33250 / PR objectstack-ai#33369, ruling A+ 6880588685)` line after the 2026-11-07 line, and a⚠️ note at the end of the `:6` `ownerMayEdit` banner (its "every other caller … keeps the master-edit rule" no longer holds on a detail that declares the new key). - **§3 (`:69`).** A third⚠️ line under the rule: a detail that declares `writeRequiresMasterRead` is asked read on its master; the rule stands at its own hop for every detail that does not. - **2026-10-26 amendment (`:172`, `:188`).** A⚠️ paragraph after each "Option 2 … was not chosen" / "Option 2's door … stays closed" line, lifting them for opted-in objects only. The 2026-10-25 ruling's text is not rewritten. - **2026-11-07 amendment (`:247`).** A⚠️ line under "Setting a master … Emptying one asks edit on the stored master": on an opted-in detail both masters are asked read through the same walk; the null-master row's owner rule still runs first. - **New section "Amendment (2026-11-14, objectstack-ai#33250): read on the master is enough to write, by opt-in"**: the ruling quoted verbatim; spec key, reader and both parse refusals; the gate's one swap point; every write shape that reaches it; what decides afterwards, with the ownership floors said in plain words (N3); on-behalf-of; the 404 / 403 answers and the served member's legs; the null-master row; the lint stand-down; the two seat calls for the veto window (contract review 6881744779 ① items 5 and 6); the precise invariant instead of "byte for byte" (N1); fail-closed boundaries; proof; what is unchanged. ## Acceptance notes Every claim in the new text was read from the code on `origin/main` (`b4624440`, which contains PR objectstack-ai#33369 as `df9fe946`): | Claim | Read from | |---|---| | key, reader, fail-closed `=== true` | `packages/spec/src/data/object.zod.ts` (`writeRequiresMasterRead`, `controlledByParentWriteRequiresMasterRead`) | | two parse refusals, their paths and the fix text | `object.zod.ts#refuseControlledByParentWriteRequiresMasterReadMisplaced` | | relation carries the opt-in | `security-plugin-cbp-relation.ts#resolveCbpRelation`, `security-plugin.ts` `CbpRelation.writeRequiresMasterRead` | | one swap point; read hop ends the walk | `security-plugin-cbp-write-gate.ts#assertControlledByParentChainEditable` (`if (hopRel.writeRequiresMasterRead) { … break; }`) | | read asked of the read door; `object_permission` / `row_level_security`; store fault propagates | `security-plugin-cbp-write-gate.ts#assertMasterRowReadable`, `readUnlessRefused` | | verb-blind gate; once per principal | `security-plugin-authz-middleware.ts` step 2.8 (`['insert','update','delete','transfer','restore','purge']`, delegator pass) | | by-id floor handed over; delegated keeps both floors | `security-plugin-authz-middleware.ts` step 2.7 (`masterGateCoversThisWrite = !delegatorSets`), `platform-ownership-policies.ts` (`OWNERSHIP_FLOOR_PREDICATE`, `masterGateCoversOperation`) | | predicate write keeps the floor; by-id admits a row the caller did not create | `controlled-by-parent-owner-may-edit.test.ts` `[objectstack-ai#33250]` "the opt-in" describe (by-id rows seeded by REP, predicate rows created by the caller) | | 404 for a by-id non-reader, 403 "requires read access" for insert / re-point | `[objectstack-ai#33250]` "without read on the master" describe (`expectHiddenRow`, `expectMasterReadRefusal`); PR objectstack-ai#33369 Acceptance notes | | null-master row keeps the owner rule | `security-plugin-cbp-write-gate.ts` (stored null-master branch: `nullMasterRowWritable`, then `askBodyNamedMaster`) | | chains, non-opted detail under opted master | `[objectstack-ai#33250]` "chains" describe; contract review 6881744779 ① item 5 | | explain prose only | `explain-engine.ts#chainAsksMasterRead`, `MASTER_DENIAL_LEG_DETAIL_WITH_READ` | | lint stand-down | `packages/lint/src/validate-security-posture.ts` (`masterReadSuffices`) | - The wording of the rule was compared with the objectstack-ai#33374 skills thread (branch `claude/project-thread-jqd53n`); the facts they state match. - Contract review N2 (stale "asks EDIT" comments in the gate) and N4 (emptying and lifecycle verbs unpinned under the opt-in) are code follow-ups, outside this docs card; N4 is named in the new Proof paragraph. - No ADR index line: `pnpm check:adr-index` is green with the README row unchanged. ## Verification <details><summary>Derived gates on head 5647b9f (21 of 21 exit 0)</summary> `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 21 commands; each ran with its exit captured before any pipe. `--ran`: "21 derived famil(ies) accounted for — 21 run, 0 NOT-MEASURED". `check:doc-formula-expressions` ran after `turbo run build --filter=@objectstack/formula --filter=@objectstack/lint` under the lock (VERDICT command-exit 0). ``` 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 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 pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0 ``` </details> <details><summary>Tier and governed-merge verdicts</summary> - `dispatch-gates --tier`: MANDATORY contract-review tier for `docs/adr/**` (no one-line exit). This card thread ran on the claim's default tier; named as a deviation in the report, and the seat's in-seat contract review at tier is the owed record. - `check-governed-merges.mjs --branch claude/project-thread-mllmvl`: exit 3, GOVERNED, landing tier H (人合), `docs/adr/** ×1`; 53 changed lines, under the 3000 threshold. - Changeset: `skip-changeset` (`docs/adr/**` ships in no package). </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01FEkQ5mjPb2TvhBS1yQezQF)_ <!-- signed: domain:skills#1 · os-project-manager · session_01FEkQ5pjSPT7ui2EUcunaVb --> Co-authored-by: Claude <noreply@anthropic.com>
…MasterRead reviews (objectstack-ai#34075) <!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9B6XCSGFtBWMTfzkHVAwJSu)_ Fixes objectstack-ai#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 objectstack-ai#33992 (objectstack-ai#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 (objectstack-ai#33250 / PR objectstack-ai#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 objectstack-ai#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>
Requested by Leehom · project thread
Fixes #33250
Clause-②: yes (widening) —
ObjectSchemaaccepts one new optional boolean,sharing.controlledByParent.writeRequiresMasterRead; two parse refusals ship with it (the key off acontrolled_by_parentdetail; the key besideownerMayEdit: true), both on declarations that did not parse before. An object that does not declare the key answers byte-for-byte as onmain.Metadata-protocol: added
Skills-docs: follow-up owed — skills/** (the controlled_by_parent authoring guidance)
维护者速读
sharing.controlledByParent.writeRequiresMasterRead。打开后,controlled_by_parent子对象的新增、修改、删除只问"能否读主记录",之后由子对象自己的对象权限、行级安全和字段级安全决定;不声明的对象行为不变。packages/plugins/plugin-security/src/security-plugin-cbp-write-gate.ts的链式循环(hopRel.writeRequiresMasterRead分支与assertMasterRowReadable),再看packages/spec/src/data/object.zod.ts的两条解析拒绝。pnpm --filter @objectstack/plugin-security exec vitest run src/controlled-by-parent-owner-may-edit.test.ts(43 绿;去掉读分支后 21 红)。skills/**指南由席位另立卡。What changes
@objectstack/specsharing.controlledByParent.writeRequiresMasterRead: z.boolean().optional()(strict sub-object, besideownerMayEdit), exported readercontrolledByParentWriteRequiresMasterRead(schema)from@objectstack/spec/data, object-form toggle "Read on master is enough to write", liveness ledger childlive.trueunder anysharingModelbutcontrolled_by_parentis refused atsharing.controlledByParent.writeRequiresMasterRead;truebesideownerMayEdit: trueis refused atsharing.controlledByParent.ownerMayEditwith the fix "Delete ownerMayEdit; writeRequiresMasterRead already admits the owner."ISecurityService.checkControlledByParentWrite,ControlledByParentWriteOutcome,ControlledByParentWriteDenialLeg: prose only. No type or union changes: a refusal of the read question reusesobject_permission(master object not readable) androw_level_security(master row hidden).@objectstack/plugin-securitycheckControlledByParentWriteandos explain(explain-engine.ts,chainAsksMasterRead) give the same answer as the gate, naming the read question.@objectstack/lint:security-controlled-by-parent-owner-policy-without-opt-instays silent on a detail that declares the new key (its own policies decide there). No new rule.i18n, docs: the toggle's label and help text authored in all ten shipped locales (
platform-objectsgenerated bundles, source hashes dropped) and the Studio zh-CN label; generated references; hand-written pagespermissions-matrix,sharing-rules,rls,error-handling,error-catalog.Tests
packages/plugins/plugin-security/src/controlled-by-parent-owner-may-edit.test.ts:[#33250]describes on a rig with an opted-in detail, a two-level chain (opted-in under opted-in; not-opted-in under opted-in), RLS on the detail, delegation, and an undeclared CONTROL. 43/43 green. Red onmain: 21 failed / 22 passed (the delete by a master reader answered403 requires edit access to its master record (no edit permission on master 'omd_contract')).explain-controlled-by-parent-write.test.ts: 4 new pins (87 green).packages/spec/src/data/controlled-by-parent-owner-may-edit.test.ts: key, reader, both refusals (26 green).packages/lint/src/validate-security-posture-owner-may-edit.test.ts: 4 new pins (40 green).scripts/ablation-replace.mjs, mutation proved on disk, restored to HEAD blob):checkControlledByParentWritepins);chainAsksMasterRead→false→ 3 explain pins red;Acceptance notes
404 RECORD_NOT_FOUND, not 403. The detail row's own read derives from its master, so the read door hides the row before the write gate runs. That is the platform's hidden-row rule (readRowByIdswallows engine failures intonull, so a store outage is indistinguishable from an absent row at every gate that probes with it #7505), unchanged here. Insert and re-point answer403 PERMISSION_DENIED("requires read access to its master record").checkControlledByParentWriteanswersdenyon the legs above for all of them.created_by == current_user.id) exactly as onmain; only by-id writes hand that floor to the master gate. The predicate pins seed rows created by another user to prove the opt-in admits them.docs/adr/**) andskills/**guidance, carried by the seat.Verification
On head
b012326f:@objectstack/spec840 files / 26844 tests green;@objectstack/plugin-security267 / 6641 green (45 skipped, as on main);@objectstack/lint208 / 8890 green;@objectstack/platform-objects122 / 1957 green; app-shellmetadata-form-i18n.test.ts22 green.check:test-typecheck, heap 8192), plugin-security, lint, platform-objects exit 0.node scripts/pm/dispatch-gates.mjs --ran: 123 derived, 122 run with exit 0, 1 NOT MEASURED (check:dual-build-cjs-loadsexit 3, needs every package's dist; CI runs it). Three gates re-run after their prerequisite:check-plugin-teardown-shape --self-test(fetched its pinned fixture commit),check:skill-examples(built client-react),spec check:generated(test-typecheck at heap 8192).node scripts/check-i18n-bundles.mjsexit 0 (10 packages in sync).Generated by Claude Code