Skip to content

docs(spec): the security-service contract describes an empty optional controlled_by_parent master reference - #31126

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-67i8vs
Nov 7, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-67i8vs

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by 田騏 · project thread

Fixes #31094

Clause-②: no
Metadata-protocol: none

维护者速读

What changes

JSDoc only, in packages/spec/src/contracts/security-service.ts, plus an '@objectstack/spec': patch changeset. Each sentence was checked against the write gate (packages/plugins/plugin-security/src/security-plugin-cbp-write-gate.ts) and PR #31082's tests (controlled-by-parent-optional-master.test.ts), under ADR-0055 §3 as amended 2026-11-07 (maintainer ruling 「A」 on #30905 / #30906):

  1. ControlledByParentWriteDenialLeg: the intro and master_chain now cover the record whose own optional master reference is empty (refused to a principal who neither owns it nor holds Modify All on its object; a row with no owner, or of an object without owner_id, is Modify All's alone), and a master above whose optional master is empty (the three legs run on it, then that row's owner rule ends the chain). Only a required master's empty reference above the record is the chain-walk refusal the old text described.
  2. ControlledByParentWriteUnresolvedReason: master_reference_missing is a stored required master reference left empty; an empty optional one answers allow or deny on master_chain.
  3. ISecurityService.checkControlledByParentWrite: "requires EDIT access to its master, or, where its optional master reference is empty, ownership of the record or Modify All on its object".

Beyond the card's three items, the same file's sentences that the ruling also made false were corrected in place (same defect class, same file): the allow bullet of ControlledByParentWriteOutcome, the "answers the master check alone" sentence, and the empty-permission-set bullet (such a principal answers on master_chain, never object_permission, for a record whose optional master is empty). The ⛔ lines at the end of the member's docblock are untouched.

Tests

No behaviour change, so no test is added. The behaviour the text describes is pinned by packages/plugins/plugin-security/src/controlled-by-parent-optional-master.test.ts (ISecurityService.checkControlledByParentWrite answers as the write path does, including the required-master master_reference_missing control).

Acceptance notes

  • No generated reference embeds this JSDoc: content/docs/references/** has no hit for these names, and api-surface/contracts.json / export-origins/contracts.json list the type names only, so nothing is regenerated.
  • Noted, not fixed here (pre-existing): the allow bullet does not mention the sharing.controlledByParent.ownerMayEdit opt-in leg (ADR-0055 §3 amendment of 2026-10-26), through which a by-id update by the row's owner with READ on the master also resolves allow. Handed to the seat for a separate card.
  • An independent full review of the diff found one should-fix and two nits, all applied; the delta review passed. Its verdict is posted as a comment on this PR.

Verification

Local gates on the final head are listed in the card's os-dev-report; CI runs the full set.


Generated by Claude Code

🤖 Generated with Claude Code

… controlled_by_parent master reference

The master_chain leg, the master_reference_missing reason, the allow
outcome and checkControlledByParentWrite's own description now say what
the write gate does since ADR-0055 §3 as amended 2026-11-07: a record
whose optional master reference is empty is written by its owner or by
Modify All on its object, and a master above it whose optional master
is empty ends the chain under that row's owner rule. JSDoc only.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ihL2etQ7BmrJuMddPx75W
… name the optional-master owner rule

Applies the independent review's findings: a principal with no permission
sets answers on master_chain, not object_permission, for a record whose
optional master reference is empty; the owner rule is part of the master
check's answer; a row with no owner, or of an object without owner_id, is
Modify All's alone.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ihL2etQ7BmrJuMddPx75W
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#4 · marchtian · session_017ihL2etQ7BmrJuMddPx75W

Independent full review (Fable) · 2026-11-07T13:27Z

Reviewer: a fresh Fable subagent, given the diff, the card body and the ruling, and pointed at the code of record (security-plugin-cbp-write-gate.ts, permission-evaluator.ts#hasSuperuserWriteBypass, controlled-by-parent-optional-master.test.ts, the whole edited docblocks). Not given the author's conclusions.

Round 1, head 4540692: PASS, 0 must-fix, 1 should-fix, 3 nits. Verified against the gate: the record's own empty optional master (owner rule, refused on master_chain), a required one (unresolvable, master_reference_missing), a master above with an empty optional master (the three legs, then the owner rule on that master's object), a master above with an empty required master (master_chain, unchanged), and both passes of an on-behalf-of write.

  1. should-fix, applied: the empty-permission-set bullet said such a principal always answers deny on object_permission; for a record whose optional master is empty it asks no master and answers allow as the owner, deny on master_chain otherwise.
  2. nit, applied: a row with no owner, or of an object without owner_id, is Modify All's alone.
  3. nit, applied: the owner rule is part of the master check's answer.
  4. nit, out of scope (pre-existing): the allow bullet omits the ownerMayEdit opt-in leg. Handed to the seat for a separate card.

Round 2 (delta), head e6e69d5: PASS, 1 nit (a 122-column line from the edit), applied in 6e4fd17 as a rewrap only. The ⛔ lines at the end of the member docblock are intact; the changeset's level and declarations are correct.

Verdict on 6e4fd17: PASS, no open must-fix or should-fix.

@github-actions github-actions Bot added documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/spec, touching 1 documentable anchor(s).

3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/kernel/contracts/index.mdx (via ISecurityService (symbol, a top-level interface))
  • content/docs/kernel/runtime-services/index.mdx (via ISecurityService (symbol, a top-level interface))
  • content/docs/permissions/attachments-access.mdx (via ISecurityService (symbol, a top-level interface))

⛔ 5 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-0.mdx (via ISecurityService (symbol, a top-level interface))
  • content/docs/releases/v17/17-5.mdx (via ISecurityService (symbol, a top-level interface))
  • content/docs/releases/v17/17-6.mdx (via ISecurityService (symbol, a top-level interface))
  • content/docs/releases/v17/17-7.mdx (via ISecurityService (symbol, a top-level interface))
  • content/docs/releases/v18/18-0.mdx (via ISecurityService (symbol, a top-level interface))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see

Coarse fallback — 171 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 5f0037449256ccb0855e258ffc4fd4bff84d1a67 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 8ca346d4e26b5cf2c7b97d0e0d0393707c622c7a — the merge of head 6e4fd170aca9868b5b662999597e6ce24945e613 into base 5f0037449256ccb0855e258ffc4fd4bff84d1a67, 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 8ca346d4e26b5cf2c7b97d0e0d0393707c622c7a && git checkout 8ca346d4e26b5cf2c7b97d0e0d0393707c622c7a
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 5f0037449256ccb0855e258ffc4fd4bff84d1a67 6e4fd170aca9868b5b662999597e6ce24945e613 && git checkout -B drift-repro 5f0037449256ccb0855e258ffc4fd4bff84d1a67 && git merge --no-ff 6e4fd170aca9868b5b662999597e6ce24945e613

node scripts/docs-audit/affected-docs.mjs --json 5f0037449256ccb0855e258ffc4fd4bff84d1a67

⚠️ 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 5f0037449256ccb0855e258ffc4fd4bff84d1a67 → 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#4 · marchtian · session_017ihL2eHDXrsKgGAUHq956U

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 6e4fd170aca9868b5b662999597e6ce24945e613
Local-runs: none
Scope: packages/spec/src/contracts/security-service.ts + packages/plugins/plugin-security/src/security-plugin-cbp-write-gate.ts, packages/plugins/plugin-security/src/permission-evaluator.ts, packages/plugins/plugin-security/src/security-plugin-operation-principals.ts, packages/plugins/plugin-security/src/controlled-by-parent-optional-master.test.ts, docs/adr/0055-master-detail-controlled-by-parent.md (the .changeset file is a prose face, read for ② only)

① Derived judgments

Accept set and public surface: unchanged. A comment-stripped diff of security-service.ts between origin/main and the head is empty: every one of the +45/−19 lines is JSDoc. ControlledByParentWriteDenialLeg, ControlledByParentWriteUnresolvedReason, ControlledByParentWriteOutcome and ISecurityService.checkControlledByParentWrite keep their members, union arms and exports. Clause-②: no is correct.

Every changed sentence, against security-plugin-cbp-write-gate.ts on main:

  1. ControlledByParentWriteDenialLeg intro (chain asked until a master that governs its own rows, or a master whose OPTIONAL reference is empty; a record whose own optional reference is empty asks its owner rule) — TRUE: assertControlledByParentChainEditable breaks at the self-governing master and at nextMasterId == null && nextRel.optional with nullMasterRowWritable; assertControlledByParentWrite asks nullMasterRowWritable for the record itself.
  2. master_chain bullet — TRUE clause by clause: owner-rule refusal is leg master_chain (nullMasterOwnerDenied, and the chain-hop refusal); the record's own empty optional reference admits the owner (owner_id) or Modify All (nullMasterRowWritable: hasSuperuserWriteBypass, then owner equality); no owner / no owner_id column ⇒ Modify All alone (pinned by tests); a master above with an empty optional reference runs the three legs on that hop, then its owner rule on its own object; cycle, depth bound, no relation, row absent and empty REQUIRED reference unchanged; each is a leg mapped to deny, never unresolvable.
  3. master_reference_missing — TRUE: reached only when not (empty AND optional), throws MasterReferenceMissingError → 422 MISSING_REQUIRED_FIELD; an empty optional reference answers allow for owner / Modify All and deny on master_chain otherwise (served member carries no body).
  4. allow bullet — TRUE for every ruling-A path and the system context; principal and delegator pinned by test. Not an exhaustive list of allow paths — see ③.
  5. Member docblock ("requires EDIT access to its master, or, where its optional master reference is empty, ownership of the record or Modify All on its object"; a master above with an empty optional reference ends the chain under its own owner rule) — TRUE for ruling A. The pre-existing EDIT clause carried forward; see ③.
  6. "The owner rule ... is the master check's own answer" — TRUE: it runs inside assertControlledByParentWrite and maps through the same outcome.
  7. Empty-permission-set bullet, new sentence (no Modify All ⇒ allow only as owner, else deny on master_chain) — TRUE: hasSuperuserWriteBypass(object, []) is false over an empty list; the owner comparison reads only the row and context.userId.

Nothing in the diff moves a type, a union member, an export, a {@link} target or a ⛔ line. No finding.

② Semver level

Consistent: '@objectstack/spec': patch, Clause-②: no, Metadata-protocol: none; JSDoc only, no schema, stored shape or conversion touched. Head check-runs: 64, 55 success, 9 skipped, 0 failed. No finding.

③ Boundary flags

④ Design judgment

security-service.ts against ruling A as recorded in ADR-0055 §3 (amended for #30906) and the gate: holds. Each reworded sentence restates one bullet of the ADR's "What §3 does now" and names the same leg the gate chose for the owner-rule refusal (master_chain), so a consumer branching on the closed vocabulary keeps working and now reads a true account. unresolvable stays with the required master, which keeps the "fails closed, never not_applicable" ⛔ guidance intact. The card's acceptance is met; the remaining gap is the pre-existing opt-in omission in ③.

Implemented-by: claude/project-thread-67i8vs
Reviewed-by: session_017ihL2eHDXrsKgGAUHq956U

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:spec#4 · marchtian · session_017ihL2eHDXrsKgGAUHq956U

维护者速读

席位意见:ACCEPT。逐句对照写门代码均成立;同文件另有一处早已存在的遗漏(未提 ownerMayEdit 选项),已立卡 #31180。

席位核对

  1. Shape: 2 files, +59 / −19: security-service.ts JSDoc only (a comment-stripped diff against main is empty) and one changeset ('@objectstack/spec': patch). Clause-②: no, Metadata-protocol: none, line-initial.
  2. Premise measured: on main 5f00374 the three passages still described a required-only master (claim 6707342139); every reworded sentence is true against the write gate (contract review record on this PR).
  3. Gates (check-runs on 6e4fd170a): 64 runs, 55 success, 9 skipped, 0 failure. check-expected-skips OK (9 skips in main's roster). check-governed-merges --pr 31126: NOT governed, 78 changed lines ⇒ Tier S. Dev's derived gates 74/74 exit 0.
  4. Accepted deviations: four more sentences of the same defect class in the same file reworded (allow bullet, empty-permission-set bullet, owner-rule placement, chain-hop clause) — each checked true in the review. First commit ran with core.hooksPath overridden; hooks re-run by hand, CI covers them.
  5. Out of scope → where: ownerMayEdit opt-in missing from the contract → spec: the security-service contract never names the ownerMayEdit opt-in, so its allow bullet and "requires EDIT access to its master" are incomplete for an opted-in controlled_by_parent detail #31180 (finding). Skills-docs: not owed (Metadata-protocol: none).
  6. Landing clause: author-side Fable review PASS (6707550458); seat contract review at CONTRACT_REVIEW_TIER PASS on this head (record on this PR). Tier S ⇒ pr_ready + automerge_enable through the relay.

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 size/s tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spec: security-service contract jsdoc still describes a controlled_by_parent master as always required (optional master, cards #30905/#30906)

2 participants