Skip to content

feat(spec, plugin-security): a controlled_by_parent detail can let read access on its master suffice for insert, update and delete (writeRequiresMasterRead) - #33369

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-gkpv0o
Nov 14, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-gkpv0o

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

Fixes #33250

Clause-②: yes (widening) — ObjectSchema accepts one new optional boolean, sharing.controlledByParent.writeRequiresMasterRead; two parse refusals ship with it (the key off a controlled_by_parent detail; the key beside ownerMayEdit: true), both on declarations that did not parse before. An object that does not declare the key answers byte-for-byte as on main.
Metadata-protocol: added
Skills-docs: follow-up owed — skills/** (the controlled_by_parent authoring guidance)

维护者速读

  • 改了什么:新增按对象开关 sharing.controlledByParent.writeRequiresMasterRead。打开后,controlled_by_parent 子对象的新增、修改、删除只问"能否读主记录",之后由子对象自己的对象权限、行级安全和字段级安全决定;不声明的对象行为不变。
  • 为什么改:Leehom 2026-11-14 裁定 A+:「开关打开后,能读主记录的人按子对象自己的授权新增、修改、删除,默认不变。HotCRM 的设计授权全部兑现。」
  • 风险与回滚:只放宽声明了开关的对象;未声明对象零差异(全量 plugin-security 6641 绿)。回滚即 revert 本 PR;已声明该键的元数据届时会在解析时被拒为未知键。
  • 先看: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 红)。
  • 需要你做的:无。ADR-0055 修订与 skills/** 指南由席位另立卡。

What changes

@objectstack/spec

  • New key sharing.controlledByParent.writeRequiresMasterRead: z.boolean().optional() (strict sub-object, beside ownerMayEdit), exported reader controlledByParentWriteRequiresMasterRead(schema) from @objectstack/spec/data, object-form toggle "Read on master is enough to write", liveness ledger child live.
  • Parse refusals: true under any sharingModel but controlled_by_parent is refused at sharing.controlledByParent.writeRequiresMasterRead; true beside ownerMayEdit: true is refused at sharing.controlledByParent.ownerMayEdit with 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 reuses object_permission (master object not readable) and row_level_security (master row hidden).

@objectstack/plugin-security

  • The §3 chain walk asks, per hop, READ on the master when that hop's detail opted in, and ends the walk there; a hop that did not opt in asks EDIT as before (so a non-opted detail under an opted master asks edit on its master, then read above).
  • That covers insert (single and batch), by-id update and delete, predicate update and delete, re-point (new master and the one it leaves) and emptying an optional master.
  • On-behalf-of (ADR-0090 D10): the gate runs once per context, so the agent and the delegator must each read the master. Measured: either one unable to read it refuses the write; both able admits it.
  • checkControlledByParentWrite and os 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-in stays 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-objects generated bundles, source hashes dropped) and the Studio zh-CN label; generated references; hand-written pages permissions-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 on main: 21 failed / 22 passed (the delete by a master reader answered 403 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).
  • Ablations (scripts/ablation-replace.mjs, mutation proved on disk, restored to HEAD blob):
    • gate read branch off → 21 red (every admit, the read-refusal shapes, delegation and both checkControlledByParentWrite pins);
    • chainAsksMasterRead → false → 3 explain pins red;
    • lint stand-down deleted → 2 red;
    • off-detail refusal off → 4 red;
    • pair refusal off → 1 red.

Acceptance notes

  • By-id update/delete by someone who cannot read the master answers 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 (readRowById swallows engine failures into null, so a store outage is indistinguishable from an absent row at every gate that probes with it #7505), unchanged here. Insert and re-point answer 403 PERMISSION_DENIED ("requires read access to its master record"). checkControlledByParentWrite answers deny on the legs above for all of them.
  • Predicate (multi-row) update/delete keep the platform ownership floor (created_by == current_user.id) exactly as on main; 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.
  • Not in this PR: the ADR-0055 amendment text (docs/adr/**) and skills/** guidance, carried by the seat.

Verification

On head b012326f:

  • Full suites: @objectstack/spec 840 files / 26844 tests green; @objectstack/plugin-security 267 / 6641 green (45 skipped, as on main); @objectstack/lint 208 / 8890 green; @objectstack/platform-objects 122 / 1957 green; app-shell metadata-form-i18n.test.ts 22 green.
  • Typecheck: spec (incl. 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-loads exit 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.mjs exit 0 (10 packages in sync).

Generated by Claude Code

…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
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 4 package(s): @objectstack/lint, @objectstack/platform-objects, @objectstack/plugin-security, @objectstack/spec, touching 33 documentable anchor(s). ⚠️ 4 changed file(s) yielded no anchor (packages/spec/api-surface/data.json, packages/spec/export-origins/data.json, packages/spec/liveness/object.json, …), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

46 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json d3f3f4abf9f392a49fecf77f2175424fe1680bef.

⛔ 16 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 4 changed file(s) yielded no anchor (packages/spec/api-surface/data.json, packages/spec/export-origins/data.json, packages/spec/liveness/object.json, …) — pages documenting those are invisible to this run
  • 1 cross-cutting symbol(s) contributed no route anchor: recordId (4 routes)
  • 7 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 175 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json d3f3f4abf9f392a49fecf77f2175424fe1680bef → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 4abed176b7ad68cdbd7c7e9b94705b5a013c61e8 — the merge of head b012326f35cb828c16c6bb0907062cfc374dbdbc into base d3f3f4abf9f392a49fecf77f2175424fe1680bef, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# 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

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs d3f3f4abf9f392a49fecf77f2175424fe1680bef → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#1 · os-project-manager · session_01FEkQ5mswnWm181XgYcCUag

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: b012326f35cb828c16c6bb0907062cfc374dbdbc
Local-runs: none
Scope: packages/spec/src/contracts/security-service.ts, packages/spec/src/data/object.form.ts, packages/spec/src/data/object.zod.ts + packages/plugins/plugin-security/src/security-plugin-cbp-write-gate.ts, packages/plugins/plugin-security/src/security-plugin-cbp-relation.ts, packages/plugins/plugin-security/src/security-plugin.ts, packages/plugins/plugin-security/src/explain-engine.ts, packages/lint/src/validate-security-posture.ts, packages/lint/src/rule-explanations.ts

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 24f2f401; check-runs on the head. Code outside the diff was read on the head tree, not reviewed (step 2.7 and 2.8 in security-plugin-authz-middleware.ts, readRowById, readUnlessRefused, assertMasterRowEditable, the attachment and comment gates).

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

  1. Accept-set of ObjectSchema: one new optional boolean, sharing.controlledByParent.writeRequiresMasterRead, inside the strict sub-object. Widening. Right.
  2. Two parse refusals, both on declarations that did not parse on main (the key was unknown): true off a controlled_by_parent object, at sharing.controlledByParent.writeRequiresMasterRead; true beside ownerMayEdit: true, at sharing.controlledByParent.ownerMayEdit. Neither narrows anything main accepted. false is accepted everywhere, as the sibling key is. Right.
  3. New public export controlledByParentWriteRequiresMasterRead from @objectstack/spec/data (api-surface and export-origins rows present). Right.
  4. ISecurityService: prose only. ControlledByParentWriteDenialLeg is not widened; a refused read maps to object_permission, an unreadable master row to row_level_security, and the jsdoc says record_sharing is never the leg of a read hop. An exhaustive consumer switch is unaffected. Right (see ③ for the dev's flag).
  5. Runtime answers move toward admit only for a write whose chain reaches a hop that declares the key. That includes one case the summary sentences do not name: a detail that does NOT declare the key, under a controlled_by_parent master that does (omd_line under omd_milestone in the tests). It asks the edit legs on its master, then that master's own hop asks read, so it is written by someone who cannot edit the top master. Judged right: the walk has always asked "may this principal edit the master", and the master's declaration now defines that; the master's object-level update grant and its authored update policies still run on that hop (assertMasterRowEditable, floor handed over exactly as step 2.7 does for the master's own by-id write). It is named here because it is the one place "an object that does not declare the key is unchanged" is not literally true (finding N1).
  6. The swap is verb-blind: the gate runs for insert, update, delete, transfer, restore and purge (step 2.8), so on an opted-in detail the lifecycle verbs ask read too. Consistent with the gate's one-question-for-every-verb rule and with the schema text "every write"; the detail's own grants for those verbs still decide. Right.
  7. Lint: security-controlled-by-parent-owner-policy-without-opt-in stands down, both branches, on a detail that declares the key. Fewer warnings, no new rule. Right: on such a detail a caller-keyed update policy decides among master readers as authored, whichever field it keys.
  8. A stack in which no object declares the key takes no new branch: hopRel.writeRequiresMasterRead is false on every hop, refusal sentences keep "requires edit access", the MASTER_DENIAL_QUESTION map is never written. Acceptance 3 holds.

② Semver level

Changeset .changeset/33250-controlled-by-parent-write-requires-master-read.md: @objectstack/spec minor (new authorable key, new export), @objectstack/plugin-security minor (new admitted behaviour), @objectstack/lint patch (an existing rule stands down, no rule added), @objectstack/platform-objects patch and @object-ui/app-shell patch (labels). Matches what the diff publishes. Check Changeset concluded success.

Clause-②: yes (widening), on the PR body and in the changeset, with Metadata-protocol: added. Correct: the accept-set grows by one key and the two refusals fall only on declarations that carry the new key.

③ Boundary flags

  • Dev deviation, by-id update or delete without master read answers 404 RECORD_NOT_FOUND, not the card's "403": accepted. Read in the tree: step 2.7 (callerCannotReadAddressedRow) runs before step 2.8, and a detail row's read derives from its master, so the row is hidden before the gate is reached. That is the hidden-row rule (readRowById swallows engine failures into null, so a store outage is indistinguishable from an absent row at every gate that probes with it #7505) and main answers the same for a non-opted detail; answering 403 would tell a caller who cannot read the row that it exists. Acceptance 2's intent (the write is refused) holds; insert and re-point answer 403 asking read; the served member answers deny for all of them. The card's wording was loose, the code is right.
  • Dev deviation, PR body Verification section mangled at create: the body on the head now reads whole and carries the seat's signature. Closed.
  • Dev flag, denial legs reused rather than widening the closed union: confirmed, see ① item 4.
  • Dev flag and analysis gap 3, on-behalf-of: confirmed against ADR-0090 D10 rule 1 (intersection, never union). Step 2.8 calls the gate once with the agent's context and once with the delegator's, and each pass asks the read door under its own context; either one unable to read refuses. The delegated by-id path also keeps both platform floors, as before. An agent never exceeds its delegator. The 2026-10-26 amendment kept delegation out of the owner leg because that relief is keyed on one identity; this one is not.
  • Ruling coverage: ruling record 6880588685 (A+, Leehom, 2026-11-14T16:21:29Z) rules insert, update and delete by opt-in, default unchanged, and lifts the "Option 2 was not chosen" line of 6398566164 for opted-in objects. Key name, covered paths, relation to ownerMayEdit and the lint arm were left to the seat; ① items 5 and 6 are the two seat calls the veto window should see.
  • open_questions: none filed.
  • Owed at landing, not in this diff by the claim's own bar (docs/adr/** and skills/** are carriers): the ADR-0055 amendment and the skills/** teaching (acceptance 5's second half; PR body carries Skills-docs: follow-up owed). The code, the schema .describe() and the jsdoc already cite "ADR-0055 §3 as amended for controlled_by_parent: per-object opt-in so read on the master is enough to insert and update the detail under the detail's own grants (ownerMayEdit covers owner update only; HotCRM Order to Cash blocked) #33250", and ADR-0055 on main still says "Option 2's door stays closed". The PR says Fixes #33250, so the card closes on merge: the seat files both carriers at landing, as the ruling record says, so the ADR does not stay narrower than the runtime (the hazard ADR-0055's own chain amendment describes).

④ Design judgment

packages/spec/src/data/object.zod.ts — holds. The key sits in the strict controlledByParent block; the reader is fail-closed (=== true only) and does not read sharingModel, the same shape as its sibling. The refusal runs in the same superRefine as the sibling's. Both messages name the fix. The pair refusal is sound: with read as the master question for every principal, the owner leg admits no one more; at a door that does not parse, both keys together behave as the wider one, so nothing depends on the refusal for safety. The sharing guidance map gains the misplacement hint. The .describe() and jsdoc agree with the gate hop by hop.

packages/spec/src/contracts/security-service.ts — holds. Each added sentence was checked against the gate: read in place of the three edit legs on a declaring hop and the walk ends there (assertControlledByParentChainEditable, the break after assertMasterRowReadable); object_permission on a refused read, row_level_security on a row not returned (readUnlessRefused); agent then delegator (checkControlledByParentWrite, same two calls as step 2.8). The existing sentence "It answers the master check alone" matters more now: for an opted-in detail allow means "reads the master", so a consumer must still compose the record's own grants. The shipped attachment and comment gates do (they ask explain's record-grained update verdict and use this member only where no explain is served).

packages/spec/src/data/object.form.ts — holds. One boolean toggle in the existing block; help text states the default, the effect and the pair rule.

security-plugin-cbp-write-gate.ts, security-plugin-cbp-relation.ts, security-plugin.ts — the code agrees with the contract. Attempts to break it:

  • Widening without opt-in: none in a stack that does not declare the key. The one cross-object effect is ① item 5, judged right.
  • Chain hops: an opted detail under a non-opted controlled_by_parent master asks read on that master and stops; the read door composes the chain above (ADR-0139 D6), so a hidden top master hides the middle one and refuses (pinned: omd_step, blind caller, row_level_security). Cycle and depth guards are not bypassed in a way that matters: the read hop terminates the walk and the read derivation carries its own bound.
  • Re-point and emptying: the stored master and the body-named master are both asked through the same walk, so both get the detail's question. A master reader can move a row between two masters they read, or detach it from an optional master; each is no more than the delete plus insert the ruling already admits.
  • Predicate writes: every master of the selected rows is asked through the walk; the platform ownership floor on the detail stays for predicate writes, as on main.
  • Delegation: see ③.
  • The read probe: readRowById(master, id, context) is ql.findOne under the principal's own context, the same probe the owner leg has used since feat(spec,plugin-security,lint): sharing.controlledByParent.ownerMayEdit — a detail row's owner updates it with read on the master #26005; a declared 4xx is a refusal, a null row is hidden-or-absent (one answer), a store fault propagates. No system-context read decides access (the two system reads only fetch a foreign key, as before).
  • Refusal wording: the question (edit or read) travels beside the error in a weak map, so the envelope is unchanged and a caller who cannot read the master reference still gets the generic sentence, now with the right verb.

explain-engine.ts — agrees. The verdict still comes from checkControlledByParentWrite; chainAsksMasterRead only chooses prose, and the prose it chooses states both questions a leg can answer.

validate-security-posture.ts, rule-explanations.ts — agree. The stand-down reads the key through the spec's one reader, raw or parsed.

Findings:

  • N1 — nit. Three summary sentences say an object that does not declare the key is unchanged "byte for byte": the gate's file header ("A detail that does not declare it is answered byte for byte as before"), the PR body's Clause-② line and the changeset's first paragraph. Not literally true for a non-declaring detail under a declaring controlled_by_parent master (① item 5). The precise invariant is: a write's answer moves only if its own object, or a controlled_by_parent master on its chain, declares the key. The contract text itself (schema jsdoc, .describe(), the changeset's hop bullet) states the hop rule correctly, so nothing a consumer relies on is wrong. Fix on the PR body sentence, or carry the wording into the ADR-0055 amendment; leave the code comment as an accepted deviation.
  • N2 — nit. Comments in the gate that predate the key still say unconditionally that a body which empties an optional master, or names a new one, "asks EDIT" (the askBodyNamedMaster docblock and the fifth owner-leg condition). On an opted-in detail it asks read, as the new header says. Comment drift only; follow-up.
  • N3 — nit. .describe() says a write on behalf of another user is admitted "when both can read the master". A delegated by-id update or delete also keeps both platform ownership floors (pre-existing D10 exclusion, pinned in the new delegated-update test), and a predicate write keeps the floor too. The sentence is covered by "as the detail's own ... row-level security ... allow" only if the reader knows the floor is a platform policy. The ADR amendment and the skill should say it in plain words.
  • N4 — nit, follow-up pins. Two shapes are covered by construction and not pinned under the opt-in: an update that empties an optional master, and the lifecycle verbs (transfer, restore, purge). Tests are the lane seat's accept; named here because the PR body lists emptying among the covered paths.
  • Observation, outside the diff (read, not reviewed). The fallback branch of the attachment and comment gates (a security service that serves checkControlledByParentWrite but no explain) admits on allow alone. The shipped SecurityPlugin always serves explain, so the branch is not reached in a shipped kernel; with a third-party security service and an opted-in detail it would admit any master reader. Worth one line in the carrier that documents the member.

No must-fix, no should-fix.

Implemented-by: claude/project-thread-gkpv0o
Reviewed-by: session_01FEkQ5mswnWm181XgYcCUag

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#1 · os-project-manager · session_01FEkQ5mswnWm181XgYcCUag

ACCEPT · PR #33369 (#33250, p1) · head b012326f35cb828c16c6bb0907062cfc374dbdbc · 2026-11-14T18:13Z

席位核对

  • 形态: 40 files, +1006/−47 (read with get_files, not the report): the key sharing.controlledByParent.writeRequiresMasterRead, its reader and two parse refusals in packages/spec/src/data/object.zod.ts / object.form.ts; prose on ISecurityService (packages/spec/src/contracts/security-service.ts); the per-hop read branch in packages/plugins/plugin-security/src/security-plugin-cbp-write-gate.ts, relation resolution, explain-engine.ts; the lint stand-down; i18n bundles, generated references, hand-written pages; tests; changesets (spec and plugin-security minor; lint, platform-objects, app-shell patch). No governed path (docs/adr/** and skills/** are carried by cards), under 3000 lines: Tier S, seat lands. PR body rewritten by the seat (the dev's ## Verification was mangled at create; same head).
  • 前提实测: the ruling this implements is Leehom's A+ 「开关打开后,能读主记录的人按子对象自己的授权新增、修改、删除,默认不变。」 (2026-11-14T16:21:29Z, ruling record 6880588685). Key name, covered paths, relation to ownerMayEdit and the lint arm were the seat's to set (record 6880588685).
  • 门禁 check-runs: on this head 72 runs: 61 success, 11 skipped, 0 failed. Dev's NOT-MEASURED check:dual-build-cjs-loads is answered by CI.
  • 契约复审: CONTRACT_REVIEW_TIER PASS on this head, record 6881744779 (isolated reviewer; Ruling-ref 「你有 fable ,车道契约复审可以自己做」 2026-11-07). Four nits, no must-fix or should-fix. The two seat calls the record names (① 5: a non-opted detail under an opted master is writable by a reader of the top master, the master's own update grant and policies still running on its hop; ① 6: lifecycle verbs ask read on an opted detail) are inside the ruling's "增改删 by the detail's own grants" and are accepted; they are written into the ADR-0055 amendment card.
  • 接受的偏差: the dev's 404-vs-403 deviation (a by-id update/delete by a non-reader answers 404 RECORD_NOT_FOUND because the read door runs first, readRowById swallows engine failures into null, so a store outage is indistinguishable from an absent row at every gate that probes with it #7505, as on main; insert and re-point answer 403); N1 wording "byte for byte" left in the code comment and changeset. Clause-②: yes (widening) / Metadata-protocol: added on PR body and changesets.
  • 范围外去向: ADR-0055 amendment — card ADR-0055: record the 2026-11-14 amendment, writeRequiresMasterRead (read on the master is enough to write, by opt-in) #33373 (domain:skills, p2, Tier H; N1 and N3 wording added); skills/** guidance (Skills-docs: follow-up owed) — card skills: teach sharing.controlledByParent.writeRequiresMasterRead in the controlled_by_parent authoring guidance #33374 (domain:skills, p2, Tier H); N2 stale "asks EDIT" comments and N4 missing pins (emptying a master, lifecycle verbs) — card plugin-security: pin emptying a master and the lifecycle verbs under writeRequiresMasterRead; fix the gate's stale "asks EDIT" comments #33381 (domain:server, p3). Reviewer's observation on the attachment/comment gates' fallback branch — dropped — unreachable in a shipped kernel (SecurityPlugin always serves explain), read not reviewed.
  • 落地条款: ready + auto-merge now under the maintainer's standing order 「按照 pm-dispatch 规则复核过的都授权」 (2026-10-25T11:35Z) and 「你应该使用 pm-dispatch 技能审核和落地pr」 (2026-11-07T16:59Z). K = 7 commits on main past the run's affected-set base d3f3f4ab, below 15: no merge of main owed.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 14, 2026 18:13
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 14, 2026
Merged via the queue into main with commit df9fe94 Nov 14, 2026
73 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-gkpv0o branch November 14, 2026 19:06
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…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>
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…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>
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation protocol:data size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

1 participant