Skip to content

fix(plugin-security)!: a predicate update or delete of a controlled_by_parent detail writes the rows its by-id writes do - #36282

Merged
os-zhuang merged 5 commits into
mainfrom
claude/issue-35802-predicate-write-floor-cbp
Nov 22, 2026
Merged

os-zhuang merged 5 commits into
mainfrom
claude/issue-35802-predicate-write-floor-cbp

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

Fixes #35802
Ruling-ref: 7073030861 — maintainer Leehom, 「A 批量与逐条一致」, answered by tap at 2026-11-22T02:37Z, recorded in comment 7073030861 on the card
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: follow-up #36285

维护者速读

What changes

The ruling's line, quoted: 「A 批量与逐条一致」 — 「有权编辑主记录的人批量改删明细时,改到逐条能改的全部行;其中一行被规则拦下就整次拒绝。升级后现有流程会多改到别人创建的行。一个PR。」

On a controlled_by_parent detail, an addressed predicate update or delete (multi: true) by a caller who is not acting on another user's behalf no longer keeps the platform ownership floor (owner_only_writes / owner_only_deletes) once the master gate has passed every master the write reaches. The rows it writes are the rows a by-id write of each would write for the same caller.

  • The vouch (security-plugin-authz-middleware.ts, step 2.8). Straight after the caller's own pass of the master gate returns, the middleware takes the gate's record of the rows it judged. That record is the coverage vouch for the predicate path, as step 2.7's position above the gate is for a by-id write. A delegated write, a nested or referential write, and a shape the gate does not judge take none and keep the floor.
  • The row scope (step 3). The write composes its Layer 1 with masterGateCoversThisWrite, and it is scoped to the gate's own row list instead of asking the read question a second time. This answers premise P3 of the ruling by reusing one id list: no row is written under the handed-over floor without its master having been judged.
  • The per-row check (step 3.6). A predicate update's stored-image check is composed on the same decision.
  • The gate (security-plugin-cbp-write-gate.ts). judgeControlledByParentWrite records, at the end of a predicate pass that refused nothing, the ids of the rows whose master reference it read. No verdict of the gate moves.
  • Text. ADR-0055 gains one dated amendment (a status line, one pointer under the superseded sentence of the 2026-11-14 amendment, and the section at the end); the older amendments are not rewritten. The RlsFilterOptions.masterGateCoversThisWrite docblock's "must not … a separate decision" bullet is replaced. content/docs/permissions/permissions-matrix.mdx, sharing-rules.mdx and rls.mdx say the new rule. One new changeset on the narrowing arm, and one release-note correction of the earlier sharing-half changeset (see DELIBERATE CORRECTION).

No spec change, no new key, switch or response member: Metadata-protocol: none. The arm is narrowing by the ruling's item 5: a predicate write applies to all of its matched rows or to none, so a newly matched row that a row-level check, a validation rule, a hook or a restrict relation refuses now refuses a write that used to answer success.

An app-authored row-level write policy on the detail now bounds a predicate write alone. Where an app authors an update or delete policy with a using on a controlled_by_parent detail, a predicate write used to compose the platform floor beside that policy as one more OR term, so it also wrote the rows the caller created that the policy does not admit. With the floor handed to the master gate (security-plugin-rls-filter.ts, the floor filter), the authored policy alone bounds the write and those rows are left unwritten. A by-id write of such a row was already refused, so this is by-id parity (ruling item 1). A write made on another user's behalf keeps the floor. The changeset states this case; rls.mdx already says it.

Premises, checked before any code

  • P1 holds, measured on origin/main a5a5312ff4 with the new pins against the unchanged source (real SecurityPlugin, ObjectQL, SQL driver, SharingService): 16 of the new cases red. The master's owner changed r1 and r3 by predicate (the two rows they created) against all 4 by id; the Modify All manager and the member with an edit share on the master changed none against all 4; a master reader on a writeRequiresMasterRead detail changed 2 against 4; the owner of null-master rows changed 1 against 2.
  • P2 holds, read at a5a5312ff4: the vouch was set by step 2.7, by the chain walk's master-edit leg and by security/explain only, and the gate judges every master of the rows a predicate write selects before step 3 composes Layer 1.
  • P3 did not hold as it stood, and is closed in this PR: the gate's row read and the write's readable-row scope were two reads of one question, so a row inserted between them, under a master the caller reads and may not edit, would have been written with no master judged once the floor is gone. The write now uses the gate's list. Pinned, and ablated red.

Tests

Head 2ba103da71.

plugin-security suite, typecheck and build

pnpm --filter @objectstack/plugin-security typecheck && pnpm --filter @objectstack/plugin-security build && pnpm --filter @objectstack/plugin-security exec vitest run --maxWorkers=2 under the verify lock: Test Files 287 passed (287), Tests 7238 passed | 45 skipped (7283), VERDICT command-exit 0.

The new pins

predicate-write-floor-deferral.test.ts, a new top-level describe on the file's own rig. Each case runs the predicate write on one seeded copy and by-id writes on a second, and asserts equal sets row for row and the named set. Each of these, for predicate update and for predicate delete:

  • the master's owner: all 4 rows;
  • a member holding an edit share on the master who created none of the rows: all 4;
  • the Modify All manager: all 4;
  • a member who may not edit one of the masters: refused whole with PERMISSION_DENIED / 403, nothing written (by id: the 3 rows under the editable master);
  • a member who only reads the master: refused whole;
  • a detail declaring writeRequiresMasterRead, a master reader: all 4;
  • a detail declaring ownerMayEdit: the master's owner writes all 4; the row owner who only reads the master is refused whole (unchanged; by id they update their 2 rows and delete none);
  • null-master rows: their owner writes the 2 they own, the Modify All manager all 4;
  • a delegated write: only the rows the agent created (both floors kept).

Plus: a newly matched row a beforeDelete hook refuses refuses the whole delete; and a row inserted after the gate's read is not written.

controlled-by-parent-detail-write-authority.test.ts: the §3 RESIDUAL pin is flipped and its stale comment corrected. The composed predicate carries no floor where the gate admitted an addressed predicate write, the write is refused whole when it reaches a master the caller may not edit, and the floor stays on a write the gate does not judge.

controlled-by-parent-every-master-edit.test.ts and controlled-by-parent-write-shape-master-edit.test.ts pinned the superseded outcome for a member's selecting write (the rows it created); they now expect every selected row, and keep the delegated case on the floor.

Ablations, each committed first, each restored and proved by blob hash

Through scripts/ablation-replace.mjs (anchor 1 to 0, blob changed, restore blob equal to HEAD and git diff HEAD empty on every leg), over the four test files above. The tests import source, so there is no dist hop.

  1. The vouch set to null: 22 failed, 107 passed. Every equality pin, the hook case, the late-row case, the flipped pin and the two write-shape suites.
  2. The delegated exclusion removed: 2 failed, 127 passed. The delegated update and delete wrote all 4 rows.
  3. The gate's row list replaced by a second read: 1 failed, 128 passed. The late row was written.
  4. The per-row check left on the floor: 13 failed, 116 passed. The predicate updates were refused whole; the deletes stayed green, as expected.
Dogfood battery

Run once, on the final head 2ba103da71, with CI's command: the closure built first (pnpm --filter '@objectstack/dogfood^...' build, VERDICT command-exit 0), then pnpm --filter @objectstack/dogfood test under the verify lock, no shard and no path. Test Files 484 passed | 3 skipped (487), Tests 4107 passed | 68 skipped (4175), VERDICT command-exit 0. No failure.

Acceptance notes

  • Files outside the dispatched surface, edited under the bounded in-place rule and named here. packages/plugins/plugin-security/src/security-plugin-rls-filter.ts: one comment that said the bulk path "does not and must not" vouch, which this change makes false (comment only). content/docs/permissions/rls.mdx: one sentence that said a predicate write on a detail keeps the floor, a published statement this change makes false. The two write-shape test files above pinned the superseded outcome. scripts/pm/overlap-check.mjs at this head: VERDICT clean, no open PR shares any of the 14 files at 2ba103da71. At the current head the PR has 15 files, +576/−59: the two later rounds changed only the two changeset files.
  • Not updated here: skills/objectstack-data/rules/relationships.md still says the ownership floor binds a predicate update or delete on a writeRequiresMasterRead detail. It is a published skill and belongs to a skills PR; see the Skills-docs: line.
  • The earlier changeset for the sharing half (.changeset/35802-predicate-write-floor-deferral.md) said a controlled_by_parent detail keeps the floor on a predicate write. It is corrected in this PR, release text only: see DELIBERATE CORRECTION below. The two notes now cross-reference each other.
  • The sharing relief is skipped on a vouched write. With the floor handed to the gate there is no floor left to replace, so no sharing verdict is asked for such a write. The skip is not pinned by a case of its own: on these fixtures the relief would answer nothing either way.
  • One read fewer. A predicate write of such a detail asked the read door for its rows twice (the gate, then the readable scope) and now asks once.
  • ownerMayEdit and the whole-write refusal are the two places a predicate write and the by-id writes still differ, both in the refusing direction and both stated in the ruling (items 2 and 4).

Follow-ups from the contract review

Nits of record 7076369115 (PASS at 4fe236dbd1). Each is carried by a queued card, not fixed here, so the head stays on that record:

DELIBERATE CORRECTION

One pending release note is corrected, release text only: .changeset/35802-predicate-write-floor-deferral.md (the sharing half, unreleased). It ships in the same @objectstack/plugin-security CHANGELOG entry as this PR's note and said the opposite of it in two sentences. check-empty-changeset is red on it, as it should be; no skip-changeset.

  1. Paragraph 4.
    • Before: "A row the service abstains on keeps the floor: on an object with no owner_id, on a delete under public_read_write (an update there has no floor to keep, because that OWD opens row updates), and on a controlled_by_parent detail unless an update's row sits in a queue the caller belongs to. A row it denies keeps the floor too."
    • After: "A row the service abstains on keeps the floor: on an object with no owner_id, and on a delete under public_read_write (an update there has no floor to keep, because that OWD opens row updates). A row it denies keeps the floor too."
  2. The last "What does not change" bullet.
    • Before: "A controlled_by_parent detail keeps the floor on a predicate write, except on an update of a row that sits in a queue the caller belongs to, which the sharing service answers allow for under any OWD. The master gate still judges the predicate write. Its by-id write is decided by the master gate instead of the floor, and that half is not changed here."
    • After: "A controlled_by_parent detail is not decided by this composition. Its predicate write, like its by-id write, is decided by its master gate instead of the floor: see the note "a predicate update or delete of a controlled_by_parent detail now writes every row its caller may write by id"."

This PR's own note (.changeset/35802-cbp-predicate-write-master-gate.md) drops "whose bullet … no longer holds" for a plain cross-reference: "This is the controlled_by_parent half of the predicate-write change shipped beside it: see the note "a predicate update or delete now writes the rows a Modify All holder, a non-creator owner or an edit-share target can write by id" for every other object."

Verification

Read first, by risk:

  1. packages/plugins/plugin-security/src/security-plugin-authz-middleware.ts: the hunk in step 2.8 that takes the vouch, and the step 3 hunk that passes it and scopes the write to the gate's rows. This is where a widening would live.
  2. packages/plugins/plugin-security/src/security-plugin-cbp-write-gate.ts: where the record is written, after every refusal of the predicate leg.
  3. docs/adr/0055-master-detail-controlled-by-parent.md: the 2026-11-22 amendment.

Two-minute check: pnpm --filter @objectstack/plugin-security exec vitest run --maxWorkers=2 src/predicate-write-floor-deferral.test.ts. Expect Tests 75 passed (75), 24 of them under "a predicate write of a controlled_by_parent detail writes the rows its by-id writes do".

Gates

Derived with node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack at 2ba103da71 (14 paths against merge base a5a5312ff4): 107 families, each run once after the last commit with its exit code captured before any pipe. dispatch-gates --ran: "107 derived famil(ies) accounted for — 104 run, 3 NOT-MEASURED (3 DERIVED from a recorded exit 3)", exit 0.

  • 104 exit 0. Two of them on a second run: pnpm check:dts-closure first exited 1 naming packages this worktree had not built yet, and pnpm check:i18n first exited 3; both exit 0 once the dogfood closure was built.
  • NOT MEASURED, PREREQUISITE NOT MET (exit 3), left to CI: pnpm --filter @objectstack/spec run check:skill-examples and pnpm check:dual-build-cjs-loads read the dist of packages outside the closures built here; pnpm check:type-check-debt did not get its turn on the shared verify lock for its own closure build (queue-timeout, twice).
  • node scripts/check-platform-checklist.mjs --changed-from origin/main: "OK — 2 anchored file(s) in the change set, 6 anchor(s) judged, 0 lost", exit 0. node scripts/check-nul-bytes.mjs: exit 0.
  • Not run locally, by rule: the repo-wide lint and test:repo (CI-owned; the diff touches none of its tests).

🤖 Generated with Claude Code

…ail hands the ownership floor to the master gate

Once the master gate has judged every master an addressed, non-delegated
predicate update or delete reaches, the write composes the Layer 1 and the
check its rows' by-id writes do, scoped to the rows the gate judged.

Claude-Session: https://claude.ai/code/session_01FEkQ5kt9AD1TPLy7Y9oa9D
Co-Authored-By: Claude <noreply@anthropic.com>
…idual pin; changeset

Claude-Session: https://claude.ai/code/session_01FEkQ5kt9AD1TPLy7Y9oa9D
Co-Authored-By: Claude <noreply@anthropic.com>
…e write's floor decision

Claude-Session: https://claude.ai/code/session_01FEkQ5kt9AD1TPLy7Y9oa9D
Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 22, 2026
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/plugin-security, touching 10 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/plugins/plugin-security/src/platform-ownership-policies.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

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

  • content/docs/permissions/attachments-access.mdx (via SecurityPlugin (symbol, a top-level class))
  • content/docs/permissions/field-level-security.mdx (via SecurityPlugin (symbol, a top-level class))
  • content/docs/permissions/index.mdx (via SecurityPlugin (symbol, a top-level class))
  • content/docs/permissions/permissions-matrix.mdx (via computeLayeredRlsFilter (symbol, a top-level function))
  • content/docs/permissions/sharing-rules.mdx (via computeLayeredRlsFilter (symbol, a top-level function))
  • content/docs/permissions/system-context.mdx (via SecurityPlugin (symbol, a top-level class), registerAuthzMiddleware (symbol, a top-level function))
  • content/docs/plugins/packages.mdx (via SecurityPlugin (symbol, a top-level class))
  • content/docs/ui/forms.mdx (via SecurityPlugin (symbol, a top-level class))

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

  • content/docs/releases/implementation-status.mdx (via SecurityPlugin (symbol, a top-level class))
  • content/docs/releases/v18/18-0.mdx (via SecurityPlugin (symbol, a top-level class))

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
  • 1 changed file(s) yielded no anchor (packages/plugins/plugin-security/src/platform-ownership-policies.ts) — pages documenting those are invisible to this run
  • the SDK route bridge reached 67 of 249 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 — 18 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 99fbaa6d1841e2556c48ba88de54226ae6b2de3f → packageMentionDocs.

Which tree this was computed on

This run read content/docs from fa6afb463398b2195cf811c9fff24838bb6db3aa — the merge of head 4fe236dbd1652989eb591cd8ba2befce20e7261c into base 99fbaa6d1841e2556c48ba88de54226ae6b2de3f, 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 fa6afb463398b2195cf811c9fff24838bb6db3aa && git checkout fa6afb463398b2195cf811c9fff24838bb6db3aa
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 99fbaa6d1841e2556c48ba88de54226ae6b2de3f 4fe236dbd1652989eb591cd8ba2befce20e7261c && git checkout -B drift-repro 99fbaa6d1841e2556c48ba88de54226ae6b2de3f && git merge --no-ff 4fe236dbd1652989eb591cd8ba2befce20e7261c

node scripts/docs-audit/affected-docs.mjs --json 99fbaa6d1841e2556c48ba88de54226ae6b2de3f

⚠️ 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 99fbaa6d1841e2556c48ba88de54226ae6b2de3f → 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

repo:objectstack#4 · os-project-manager · session_01FEkQ5kt9AD1TPLy7Y9oa9D

Final green head for L1: 2ba103da71349d3ac7f3bac97a6ad6fec8687375. Check-runs on it: 59, 42 success (Dogfood Regression Gate among them), 17 skipped, 0 failed or pending; mergeable state clean. Report: #35802 comment 7074306032 (built at CONTRACT_REVIEW_TIER, verified from the dev transcript; full dogfood battery on this head in its dogfood_battery). Skills-docs: follow-up filed as #36285 and written into the body. Governed (docs/adr/0055) and Clause-②: no (narrowing): after L1 the seat runs the ceiling-tier contract review and hands it to the maintainer; this area does not land it. Sent to L1-b.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5oVqoTJkrRZcyZS4xd
L1-b · 2026-11-22T05:09Z

席位核对 — REWORK (release text only) · head 2ba103d

The code, the vouch, the row scope, the pins, the ADR amendment and the docs all hold, as listed below. One item is owed: release text that ships in the same CHANGELOG as this note and that this PR makes false.

To fix

  1. .changeset/35802-predicate-write-floor-deferral.md (the fix(plugin-security)!: a predicate write composes the platform ownership floor per row, as the by-id write does #35914 half, still unreleased in .changeset/) states the opposite of this PR in two places.
    • The "What does not change" bullet reads "A controlled_by_parent detail keeps the floor on a predicate write, except on an update of a row that sits in a queue the caller belongs to … that half is not changed here."
    • Paragraph 4's clause reads "A row the service abstains on keeps the floor: … and on a controlled_by_parent detail unless an update's row sits in a queue the caller belongs to."
    • Both notes go into the same @objectstack/plugin-security CHANGELOG entry. A reader of that release would get one bullet saying the floor stays on this path and a second note saying it does not. That is release text this round makes false (checklist: "published defects this round made false"). It is not yet published, so correcting it costs a sentence rather than a second note.
    • The route exists. os-dev.md (editing an existing .changeset/*.md) and landing-operations.md (DELIBERATE CORRECTION) apply: no skip-changeset, check-empty-changeset stays red as it should, and the body declares DELIBERATE CORRECTION naming the note and quoting each sentence before and after.
    • Point both sentences at this PR's note. For example, the bullet could say a controlled_by_parent detail's predicate write is decided by its master gate (see that note), and the paragraph-4 clause could drop the controlled_by_parent arm.
    • Then the new changeset's sentence "whose bullet … no longer holds" can become a plain cross-reference. That one is yours to word.
    • The seat's confirmation of a release-text-only correction is an ACCEPT that quotes before and after. I will write it in my delta read, so the seat's Fable and four-piece step still runs once, on the final head.

The head changes, so declare the new final green head in a PR comment and message me. I will read the delta.

Checked and holding

  • Shape: l1-face.mjs --pr 36282 at 2ba103d shows 42 success, 17 expected skip, 0 failed and mergeable_state clean.
    • The declarations are Clause-②: no (narrowing) · Metadata-protocol: none. The ! title and the BREAKING banner are first in the changeset, and the ADR-0087 disposition is not-required (no-migration-prescription). The level is patch, which follows Metadata-protocol none.
    • Fixes #35802 is right: with fix(plugin-security)!: a predicate write composes the platform ownership floor per row, as the by-id write does #35914's sharing half merged, this delivers the ruled remainder (7073030861 「A 批量与逐条一致」).
    • The dogfood battery ran in full on this head (484 files passed, no failure), which clears the face's one flag.
  • The vouch fails closed both ways.
    • judgeControlledByParentWrite writes the row list into a WeakMap keyed on opCtx only after every refusal of the predicate leg: the master walk, the null-master owner rule and the body-named master.
    • The middleware reads it straight after the caller's own pass, and only when !delegatorSets && addressedPredicateWrite(...).
    • If the gate judged nothing, or the middleware does not see an addressed predicate write, the value is null and the floor stays. A delegated write never reads it, and keeps both floors.
  • Row scope:
    • The write is scoped to { id: { $in: rowIds } }, the ids whose master reference the gate read. Those rows come from the caller-context read-door find of the caller's predicate under the 10,000 cap, and the cap throws rather than truncating.
    • It is ANDed with the caller's where and with Layer 0 (the tenant wall) and Layer 1, which masterGateCoversThisWrite composes without the floor and with every authored policy intact.
    • This closes P3 by construction: no row is written under the handed-over floor without its master having been judged. Ablation 3 and the row-inserted-after-the-read case pin it.
    • An empty rowIds scopes to nothing, which is right.
    • Step 3.6's post-image check is composed on the same decision. The sharing relief is skipped on a vouched write because there is no floor left to replace. It is not pinned, as the body says, and is harmless either way.
  • Pins:
    • There are 24 new cases on the real-engine rig. Each caller (master owner, edit-share member, Modify All, writeRequiresMasterRead, ownerMayEdit, null-master, delegated) is compared row for row with by-id writes on a second copy. The refused-whole cases, all-or-none (409) and the late-insert case are covered.
    • The [#8757] §3 RESIDUAL pin is flipped with its comment corrected.
    • The two write-shape suites now expect all for a member and keep own for the delegated agent. Before that update the full suite failed on exactly those 4 cases.
  • Surface deviation (area question): no amendment owed.
    • The four files outside the claim only deliver the claimed change: one comment in security-plugin-rls-filter.ts, the one rls.mdx sentence this change makes false, and the two tests that pinned the superseded outcome.
    • None changes another consumer's behaviour, and none is named in the body.
  • Text:
    • The ADR-0055 amendment is a dated status line, a pointer under the superseded 2026-11-14 sentence, and a closing section quoting the ruling verbatim. No older amendment is rewritten.
    • The three permissions pages say the new rule, sentence by sentence.
    • skills/objectstack-data/rules/relationships.md is carried by Skills-docs: follow-up #36285.
  • Gates: check:skill-examples, check:dual-build-cjs-loads and check:type-check-debt were NOT MEASURED locally. All three are carried by green CI at this head, which I accept.
  • Landing: this is governed (Tier H, docs/adr/**) and narrowing, so after my ACCEPT it goes to the seat for Fable and the four pieces. The area does not land it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5oVqoTJkrRZcyZS4xd
L1-b · 2026-11-22T05:10Z

席位核对 — correction to 7074592987

The "Surface deviation" bullet said "none is named in the body". That is wrong: all four files are named in the body's Acceptance notes, under "Files outside the dispatched surface". The verdict is unchanged: no amendment is owed, and the one REWORK item, the earlier changeset's two sentences, still stands.

…rent note instead of contradicting it

DELIBERATE CORRECTION of .changeset/35802-predicate-write-floor-deferral.md: release text only.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5kt9AD1TPLy7Y9oa9D

Final head after rework round 1: cdb290f78314feb5018be3cd1151a972bc3e93bb. Check-runs on it: 59, 40 success (Dogfood Regression Gate among them), 17 skipped, and Check Changeset red twice (the push and the body edit) for one reason only: .changeset/35802-predicate-write-floor-deferral.md is an existing note this PR edits, the DELIBERATE CORRECTION class, declared in the body with before and after for both sentences. That red stays by design until the seat's confirmation record. Round 1 is release text only (2 changesets, +3/−3; report #35802 comment 7074653092); code, tests, ADR and docs are byte-identical to 2ba103d, whose dogfood battery stands. Sent to L1-b for the delta.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5oVqoTJkrRZcyZS4xd
L1-b · 2026-11-22T05:43Z

席位核对 — ACCEPT (delta) · head cdb290f

I read the delta from 2ba103d alone, after REWORK 7074592987. It changes 2 .changeset/ files, +3/−3, and no code. Everything else that record checked stands. The dogfood battery's reading at 2ba103d stands, because nothing it runs changed.

The DELIBERATE CORRECTION, sentence by sentence

Note corrected: .changeset/35802-predicate-write-floor-deferral.md, the #35914 sharing half, which is unreleased.

  1. Paragraph 4.
    • Before: "A row the service abstains on keeps the floor: on an object with no owner_id, on a delete under public_read_write (an update there has no floor to keep, because that OWD opens row updates), and on a controlled_by_parent detail unless an update's row sits in a queue the caller belongs to."
    • After: "A row the service abstains on keeps the floor: on an object with no owner_id, and on a delete under public_read_write (an update there has no floor to keep, because that OWD opens row updates)."
    • Judgement: true at this head. On a non-delegated addressed predicate write of a controlled_by_parent detail, step 3 now composes Layer 1 with masterGateCoversThisWrite and skips the sharing relief (!predicateMasterGateRowIds). So the abstain-or-queue path no longer decides that detail's rows. The two remaining arms are unchanged.
  2. The last "What does not change" bullet.
    • Before: "A controlled_by_parent detail keeps the floor on a predicate write, except on an update of a row that sits in a queue the caller belongs to, … Its by-id write is decided by the master gate instead of the floor, and that half is not changed here."
    • After: "A controlled_by_parent detail is not decided by this composition. Its predicate write, like its by-id write, is decided by its master gate instead of the floor: see the note "a predicate update or delete of a controlled_by_parent detail now writes every row its caller may write by id"."
    • Judgement: true at this head. The quoted title is a verbatim prefix of the new note's first line. The delegated write, which keeps both floors, is stated by the bullet just above it, which is unchanged.
  3. This PR's own note.
    • Before: "…shipped beside it (the note "…"), whose bullet "A controlled_by_parent detail keeps the floor on a predicate write" no longer holds."
    • After: "…shipped beside it: see the note "a predicate update or delete now writes the rows a Modify All holder, a non-creator owner or an edit-share target can write by id" for every other object."
    • Judgement: the quote is a verbatim prefix of the deferral note's first line. The two notes now agree, and each points at the other.

Checks

  • Check Changeset is red, in both runs, for check-empty-changeset alone. It refuses the base-present .changeset/35802-predicate-write-floor-deferral.md, which is the DELIBERATE CORRECTION it names. No skip-changeset is hung, as the rule says. The other changeset gates in the same job pass: the ADR-0087 registration, and the level axis at patch.
  • Everything else is 40 success and 17 expected skip.
  • Who confirms the correction. Under landing-operations.md, a correction inside a PR that also changes code is confirmed by the same-head, at-tier L2 PASS record, which judges each rewritten sentence. The seat ACCEPT confirms it only when the diff is release text or comments alone. This PR changes code, so the seat's Fable contract review at cdb290f must judge the three sentences above. My REWORK said this ACCEPT would be the confirmation, and that was wrong for this PR.
  • Landing: this is governed (Tier H, docs/adr/**) and narrowing, so it goes to the seat for Fable and the four pieces. It enters the queue red, under SKILL.md's three conditions.

…rent detail as a change

A predicate write no longer composes the platform floor beside an
app-authored update or delete policy on such a detail, so the caller's
own rows the policy does not admit are left unwritten. That is a change,
not a constant: the bullet moves out of What does not change.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5krBqrrgxCYgjXmfbv

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: cdb290f78314feb5018be3cd1151a972bc3e93bb
Local-runs: none
Scope: docs/adr/0055-master-detail-controlled-by-parent.md + packages/plugins/plugin-security/src/security-plugin-authz-middleware.ts, packages/plugins/plugin-security/src/security-plugin-cbp-write-gate.ts, packages/plugins/plugin-security/src/security-plugin-rls-filter.ts, packages/plugins/plugin-security/src/security-plugin.ts, packages/plugins/plugin-security/src/platform-ownership-policies.ts, packages/plugins/plugin-security/src/predicate-write-floor-deferral.test.ts, packages/plugins/plugin-security/src/controlled-by-parent-detail-write-authority.test.ts, packages/plugins/plugin-security/src/controlled-by-parent-every-master-edit.test.ts, packages/plugins/plugin-security/src/controlled-by-parent-write-shape-master-edit.test.ts
Security-touching: yes

① Derived judgments

  1. The diff. 15 files, +575/−59, against merge base a5a5312ff4. Five source files and four test files in packages/plugins/plugin-security/src, one ADR, three permissions docs, two changesets. No file under packages/spec, no index.ts, no package.json. The delta from 2ba103da71 (the head the dev report and the dogfood battery name) is the two changeset files, +3/−3, and nothing else.
  2. Where the vouch is taken. security-plugin-authz-middleware.ts:1668–1670, inside step 2.8, on the line after the caller's own assertControlledByParentWrite returns. It is taken only when the write is not delegated and addressedPredicateWrite is true (not nested, not the referential clear, and the engine's own dispatch says multi).
  3. Where the record is written. security-plugin-cbp-write-gate.ts:694, the last statement of the predicate leg of judgeControlledByParentWrite. Every refusal of that leg is above it: each master's chain walk, the owner rule for each null-master row, and the master the body names. The function returns at :503 for an object that does not declare controlled_by_parent, and it takes this leg only when no single id is addressed and the engine's dispatch says multi. So a record exists only for a predicate write of a controlled_by_parent detail that the gate admitted.
  4. A stale record cannot be used. The record is keyed by the operation object. The early returns of the gate depend on the object and the shape of the operation, not on the principal, so the caller's own admitted pass always rewrites the record before the middleware reads it. The delegator's later pass rewrites it too, but the middleware has read it by then, and only when the write is not delegated.
  5. What the vouch changes, three places.
    • Step 3, :2829–2835: Layer 1 is composed with masterGateCoversThisWrite.
    • Step 3, :2894–2896: the row scope is id IN (the gate's row list) in place of the second read.
    • Step 3.6, :2273: a predicate update's per-row check is composed with the same option.
    • Two guards follow from it: the sharing relief is skipped (:2915) and the per-row floor-drop judge is skipped (:2532), because there is no floor left to replace.
  6. The floor comes off only on a detail. masterGateCoversThisWrite is read in one predicate, platformFloorYieldsToObjectWriteModel (security-plugin.ts:4535–4547). It answers true only when the object declares controlled_by_parent and the operation is in the update or delete class. So even if the option were passed for another object it would drop nothing. Both guards hold independently: the record exists only for a detail, and the drop happens only for a detail.
  7. The row scope only narrows. The gate's rowIds are the rows of its second read (:1133–1148), which is id IN (the read door's answer for the caller's predicate). So the list is a subset of what readableRowsScopeForPredicateWrite returned before. An empty list composes id IN (), the same shape the old scope composed for an empty answer.
  8. By-id parity, read in the code. A by-id write of a detail passes masterGateCoversThisWrite = !delegatorSets at step 2.7 (:1484). The predicate path now passes the same option under the same exclusion, to the same computeLayeredRlsFilter and computeWriteCheckFilter. The app-authored policies and the write-visibility derivation are composed by that one function for both.
  9. No gate verdict moves. The only change in the gate is the record and the extra member of CbpPredicateWriteSelection. That type is the return of a private method and the module is not re-exported from the package entry, so the published surface does not move.
  10. Checks at this head. 59 check-runs: 40 success, 17 skipped, 2 failure. Both failures are Check Changeset, and in both the failing step is "Reject an empty-frontmatter changeset added by this PR". That is the DELIBERATE CORRECTION red. The PR is draft, with no auto-merge and no requested reviewer.
  11. Pins and ablations. Not re-run (read-only review). The pins run on the file's real rig: SecurityPlugin, ObjectQL, the SQL driver on better-sqlite3, SharingService. Each case writes by predicate on one seeded copy and by id on a second, and asserts both the equality and the named set, so a case cannot pass by both sides being wrong in the same way. I counted, from the test source, the cases each ablation should turn red:
    • vouch set to null: 7 per verb in the new describe (14), the hook case, the late-row case, 2 in the flipped pin, 4 in the two write-shape suites (the member's selecting write on three legs in one file, and the member's case in the other): 22. The dev report says 22.
    • the new describe alone on unchanged main: 16. The dev report says 16.
    • per-row check left on the floor: 7 predicate updates, the late-row case, 1 in the flipped pin, and the same 4 write-shape cases, each of which runs a predicate update: 13. The dev report says 13.
    • second read in place of the gate's list: the late-row case, 1. The dev report says 1.
    • delegated exclusion removed: the two delegated cases, 2. The delegator in that pin holds Modify All, so only the agent's floor holds the rows back, and the pin does tell the two apart. The dev report says 2.
      The reported counts match the test design on every leg.

② Semver level

patch on @objectstack/plugin-security, with ! in the title, the BREAKING banner, both declaration lines and one ADR-0087 marker (not-required (no-migration-prescription)) in the changeset body. That is the level AGENTS.md Post-Task Checklist step 3 sets for a non-protocol breaking change. Metadata-protocol: none is true: no key, accepted value, metadata type, export or response member is added or removed. Clause-②: no is true: no published schema and no accept set moves. The (narrowing) arm is the one ruling item 5 orders.

③ Boundary flags

④ Design judgment

Does the code make predicate writes match by-id writes on a detail, and only that? Yes.

  • On a controlled_by_parent detail, a non-delegated addressed predicate update or delete that the gate admitted now composes the Layer 1 and the per-row check a by-id write of each row composes. That is ruling item 1.
  • Items 2 to 4 hold in the code. The read narrowing and the 10,000-row cap are the gate's own first read. The whole-write refusal is unchanged gate code. The null-master owner rule is asked per row before the record is written. A delegated write takes no vouch. ownerMayEdit has no owner leg on the predicate path, as before.
  • Nothing else is built. No key, no switch, no response member (item 6).

Can it widen access anywhere else? No, on my reading.

  • Another sharing model, or a delete on an object that is not a detail: the gate returns before it writes a record, so the middleware reads null and every changed line takes its old branch.
  • A nested write, the referential clear, a shape the engine refuses, a principal for whom step 2.8 does not run: no vouch, the floor stays. The flipped pin's third case holds the "no id and no multi" shape on the floor.
  • The row scope can only shrink (① 7).

The P3 closure. Sound. The rows the floor is handed over for are exactly the rows whose master the gate read and judged. The late-row pin is built so the unjudged row would be written without the fix (the caller created it), and the dev reports it red under the ablation.

The ADR amendment against the ruling. It says what the ruling says.

  • The status line, the pointer under the superseded sentence and the new section state items 1 to 6. The two older amendments are not rewritten.
  • "The rows" and "The vouch is a fact about the pass" go beyond the ruling's numbered items, but they are the P3 route the ruling names and the precondition it quotes. They add no rule.
  • The measurements quoted are the dev report's P1 readings.
  • First consumer and execution: the code in this PR, and the "Proof" section names the tests that hold it.

The narrowing declaration. The arm is right (item 5). The declaration is incomplete in one case, S1.

S1 (should-fix) — The upgrade note leaves out one changed outcome and lists it under "What does not change".

  • The case: a detail that carries an app-authored using policy for update or delete. Layer 1 is an OR of permissive policies. Before this PR a predicate write composed the floor beside that policy, so it wrote the rows the caller created as well as the rows the policy admits. rls.mdx on main said so: "(a predicate write on a detail keeps the floor)".
  • At this head the floor is filtered out for such a write (security-plugin-rls-filter.ts:314), so the policy alone bounds it. A row the caller created that the policy does not admit is no longer matched. The write answers success and skips it. This is by-id parity, and it is what ruling item 1 orders: a by-id write of that row is already refused. The code is right.
  • The text is not. .changeset/35802-cbp-predicate-write-master-gate.md:28 lists "An app-authored row-level policy on the detail binds every row" under "What does not change", and the banner says the write now reaches "every row its predicate matches that the member can read". A builder with such a policy is told nothing changes for them, and one of their flows now writes fewer rows in silence.
  • The fix is release text only: say in the FROM and TO lines, or in a sentence after the banner, that on a detail with an app-authored write policy the predicate write no longer writes the caller's own rows the policy does not admit, and move the bullet out of "What does not change". rls.mdx at this head already states the new rule correctly.

The three corrected sentences (the DELIBERATE CORRECTION; before and after as quoted in L1-b record 7074919277, each checked against the diff):

  1. Deferral note, paragraph 4. After: "A row the service abstains on keeps the floor: on an object with no owner_id, and on a delete under public_read_write (an update there has no floor to keep, because that OWD opens row updates)." Correct. The removed clause said a detail keeps the floor unless an update's row sits in a queue of the caller's. At this head a non-delegated predicate write of a detail carries no floor and skips the relief, so that clause would be false. The two arms that remain are untouched by this PR.
  2. Deferral note, last "What does not change" bullet. After: "A controlled_by_parent detail is not decided by this composition. Its predicate write, like its by-id write, is decided by its master gate instead of the floor: see the note "a predicate update or delete of a controlled_by_parent detail now writes every row its caller may write by id"." Correct. The relief is not reached for a vouched write. The quoted title is a word-for-word prefix of the new note's first line. The delegated write, which keeps both floors, is the bullet directly above it.
  3. This PR's own note. After: "This is the controlled_by_parent half of the predicate-write change shipped beside it: see the note "a predicate update or delete now writes the rows a Modify All holder, a non-creator owner or an edit-share target can write by id" for every other object." Correct. The quoted title is a word-for-word prefix of the deferral note's first line. The two notes no longer contradict each other.

The docs. permissions-matrix.mdx, sharing-rules.mdx and rls.mdx state the new rule and agree with the code. The delegated exception is stated beside each.

N1 (nit) — docs/adr/0055-master-detail-controlled-by-parent.md:340 carries the same bullet as S1 under "What is unchanged". It copies ruling item 2, and as a statement of the rule it is true; the "The floor" bullet at :326 states the composition exactly. If the ADR is touched again, add "as it does by id" to it.

N2 (nit) — The PR body is stale in two places after the delta. An acceptance note says the earlier changeset "is not edited", and the DELIBERATE CORRECTION section below it says it is. The body also says 14 files; the head has 15 (+575/−59).

N3 (nit) — Two compositions on the vouched path have no pin of their own: an app-authored write policy on the detail (the S1 case), and the skipped sharing relief. Both go through code the by-id path shares. A follow-up card can add the first.

N4 (nit) — #36285 should name skills/objectstack-data/evals/objects-fields-relationships.json:297. Its expected output ends "The platform ownership floor still binds predicate and on-behalf-of updates and deletes", which is false for the predicate half after this PR. The card's grep would find it; naming it avoids a miss.

N5 (nit) — sharing-rules.mdx says a predicate write "writes the rows a by-id write of each would". That leaves out the ownerMayEdit owner leg, which is by-id only. The ADR and the changeset state it.

Implemented-by: claude/issue-35802-predicate-write-floor-cbp
Reviewed-by: session_01FEkQ5krBqrrgxCYgjXmfbv

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5kt9AD1TPLy7Y9oa9D

Final head after the S1 prose round: 4fe236dbd1652989eb591cd8ba2befce20e7261c.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jTeURPvEm465RcoYEC

Contract-review-claim: session_01QsR2jTeURPvEm465RcoYEC · head 4fe236d · 2026-11-22T08:03Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jTeURPvEm465RcoYEC

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 4fe236dbd1652989eb591cd8ba2befce20e7261c
Local-runs: none
Scope: docs/adr/0055-master-detail-controlled-by-parent.md + packages/plugins/plugin-security/src/security-plugin-authz-middleware.ts, packages/plugins/plugin-security/src/security-plugin-cbp-write-gate.ts, packages/plugins/plugin-security/src/security-plugin-rls-filter.ts, packages/plugins/plugin-security/src/security-plugin.ts, packages/plugins/plugin-security/src/platform-ownership-policies.ts, packages/plugins/plugin-security/src/predicate-write-floor-deferral.test.ts, packages/plugins/plugin-security/src/controlled-by-parent-detail-write-authority.test.ts
Security-touching: yes

Delta round on record 7075099454 (head cdb290f783). S1: closed. No must-fix, no should-fix. The red Check Changeset is a DELIBERATE CORRECTION, not a collision, and this record confirms it (③ and ④).

① Derived judgments

  1. The delta. cdb290f783..4fe236dbd1 is one commit, one file: .changeset/35802-cbp-predicate-write-master-gate.md, +3/−2. No code, test, ADR or docs byte moved. I re-read the whole PR on this head all the same, not the delta alone.
  2. The diff. 15 files, +576/−59, against merge base a5a5312ff4: five source files and four test files in packages/plugins/plugin-security/src, one ADR, three permissions pages, two changesets (one added, one existing note modified +2/−2). No file under packages/spec, no index.ts, no package.json. origin/main is ahead of the merge base and touches none of these 15 files; the existing note is the same blob on main as on the merge base.
  3. Where the vouch is taken, read in the tree. Step 2.8 of security-plugin-authz-middleware.ts, on the line after the caller's own assertControlledByParentWrite returns, and only under !delegatorSets and addressedPredicateWrite (not nested, not the referential clear, the engine's dispatch says multi). The variable is per operation and starts null.
  4. Where the record is written. The last statement of the predicate leg of judgeControlledByParentWrite, below every refusal of that leg: each master's chain walk, the owner rule for each null-master row, the master the body names. The function returns before it for an object that does not declare controlled_by_parent, for a by-id write and for a shape the engine does not route to multi. A pass that refuses throws before the write. So a record exists only for an admitted predicate write of a detail. It is keyed on the operation object, and the middleware reads it before the delegator's pass can overwrite it. Right.
  5. What the vouch changes. Three compositions and two guards: step 3's Layer 1 (masterGateCoversThisWrite), step 3's row scope (id IN the gate's row list in place of the second read), step 3.6's per-row check; the sharing relief and the per-row floor-drop judge are skipped, since no floor is left to replace. Each takes its old branch when the value is null.
  6. The floor comes off only on a detail. masterGateCoversThisWrite is read by one predicate, platformFloorYieldsToObjectWriteModel, which also requires declaresControlledByParent(object) and an update or delete class operation. Two independent guards: the record exists only for a detail, and the drop happens only for a detail.
  7. The row scope only narrows. The gate's rowIds are the rows of its system re-read of id IN the caller-context read door's answer for the caller's own predicate, under the 10,000 cap, which throws and never truncates. That is a subset of what readableRowsScopeForPredicateWrite returned. The one behaviour of that function the new branch skips, re-throwing a read-door refusal, is already given by the gate's own read at step 2.8, which throws the same refusal earlier. An empty list is still a list: the write takes the vouch and is scoped to id IN (), which matches nothing.
  8. By-id parity. Step 2.7 passes masterGateCoversThisWrite = !delegatorSets for a by-id write; the predicate path now passes the same option under the same exclusion to the same two functions. Right.
  9. Public surface. No export of the package entry moves: the new function and the widened CbpPredicateWriteSelection live in a module the entry does not re-export. No accept set moves. Right.
  10. Checks on this head. 59 check-runs: 40 success, 17 skipped, 2 failure. Both failures are Check Changeset, and in both the one failing step is "Reject an empty-frontmatter changeset added by this PR", with the message that .changeset/35802-predicate-write-floor-deferral.md exists on the merge base and was not added by this PR. The steps after it ran and passed in the same job: the ADR-0087 disposition and the major-bump guard. Test Core (10 shards), Dogfood Regression Gate, the type-check and lint families, Governed Surface Queue Guard and both PR-body guard runs are green. The PR is a draft with no auto-merge and no requested reviewer.

② Semver level

patch on @objectstack/plugin-security, ! in the title, the BREAKING banner first, one ADR-0087 marker (not-required (no-migration-prescription)), which is the level AGENTS.md Post-Task Checklist step 3 sets for a non-protocol breaking change. Metadata-protocol: none is true: no key, accepted value, metadata type, export or response member moves. Clause-②: no (narrowing) is true on both halves: no published schema or accept set moves, and the arm is the one ruling item 5 orders. After this round the note declares two narrowed outcomes, not one: the all-or-none refusal, and the authored-policy case S1 named. The banner still leads with the sentence the ruling orders first. The changeset matches what the diff publishes.

③ Boundary flags

④ Design judgment

S1: closed. The three changes of the delta, each read against the tree:

  1. The banner now ends "every row its predicate matches that the member can read, within any row-level update or delete policy the app authored on the detail". True: with the floor filtered out, Layer 1 for a vouched write is the authored policies alone.
  2. "An app-authored row-level policy on the detail binds every row." is gone from "What does not change". Right: before this PR the policy did not bind the caller's own rows on the predicate path.
  3. The new paragraph, sentence by sentence.
    • "a predicate write used to compose the platform floor beside that policy as one more OR term, so it also wrote the rows the caller created that the policy does not admit": true of the merge base, where the predicate path passed no vouch and Layer 1 is an OR of permissive policies.
    • "The floor is no longer a term of that write, so the authored policy alone bounds it: those rows are left unwritten and the write answers success for the rows the policy admits": true. computeLayeredRlsFilter removes the floor policy outright when platformFloorYieldsToObjectWriteModel answers true, with no last-term condition (that condition belongs to the sharing allow path of plugin-security: on a by-id write, a sharing allow drops owner_only_writes out of the OR of permissive policies, so an owner-creator holding an authored widener is refused on their own row #35917 only). A row outside the policy is not matched, so it is skipped, not refused.
    • "A by-id write of such a row was already refused, so the two now agree": true, step 2.7 has passed the same option for a detail since 6feac910b6.
    • "A write made on another user's behalf keeps the floor and is not changed": true, a delegated write takes no vouch.
    • The sentence further down, "author a row-level policy on the detail; it binds every row, by id and by predicate", is now true as written.

The DELIBERATE CORRECTION, each rewritten sentence of .changeset/35802-predicate-write-floor-deferral.md:

  1. Paragraph 4. Before: "A row the service abstains on keeps the floor: on an object with no owner_id, on a delete under public_read_write (an update there has no floor to keep, because that OWD opens row updates), and on a controlled_by_parent detail unless an update's row sits in a queue the caller belongs to." After: "A row the service abstains on keeps the floor: on an object with no owner_id, and on a delete under public_read_write (an update there has no floor to keep, because that OWD opens row updates)." Correct. The removed arm is false at this head: a non-delegated predicate write of a detail carries no floor and never reaches the relief. The two arms that stay are untouched by this PR.
  2. The last "What does not change" bullet. Before: "A controlled_by_parent detail keeps the floor on a predicate write, except on an update of a row that sits in a queue the caller belongs to, which the sharing service answers allow for under any OWD. The master gate still judges the predicate write. Its by-id write is decided by the master gate instead of the floor, and that half is not changed here." After: "A controlled_by_parent detail is not decided by this composition. Its predicate write, like its by-id write, is decided by its master gate instead of the floor: see the note "a predicate update or delete of a controlled_by_parent detail now writes every row its caller may write by id"." Correct. The quoted title is a word-for-word prefix of the new note's first line. The delegated write, which keeps both floors, is the bullet directly above it.
  3. The cross-reference in this PR's own note (not a base note; judged because the correction leans on it): "see the note "a predicate update or delete now writes the rows a Modify All holder, a non-creator owner or an edit-share target can write by id" for every other object." Correct, a word-for-word prefix of the earlier note's first line. The two notes agree and point at each other.

I also read the third pending note of the same package, .changeset/35917-by-id-widener-floor-term.md: no sentence of it says a detail's predicate write keeps the floor, so nothing else in the pending CHANGELOG entry is made false.

The ADR amendment (the hits file), against the ruling and its first consumer. It holds.

  • The status line, the pointer under the superseded 2026-11-14 sentence and the closing section state ruling items 1 to 6. No older amendment is rewritten.
  • "The floor", "The rows" and "The vouch is a fact about the pass" each match the code sentence by sentence (① 3 to 7). The symbol predicateWriteRowIdsJudgedByMasterGate and the steps cited exist as named.
  • "Equal to the by-id answer", with its two refusing differences, is what the code does and what the pins assert.
  • The "Proof" section names the describe and the cases that exist in the two test files.

The implementing files. The code agrees with the contract.

  • I tried to reach the floor-less composition without a judged master: another sharing model, a by-id write, a nested or referential write, a shape the engine refuses, a delegated write, a principal step 2.8 skips, a gate pass that throws. Each leaves the value null and the floor in place.
  • I tried to write a row the gate did not judge: the scope is the gate's own list, and the late-row pin is built so the unjudged row would be written without it (the caller created it, under a master the caller only reads).
  • A row re-pointed to another master between the gate's read and the write is the same window a by-id write has; this PR does not widen it.
  • The pins compare each predicate write with by-id writes of a second seeded copy and assert both the equality and the named set, on the real plugin, engine, SQL driver and sharing service. Not re-run; Test Core is green on this head.

Nits. None affects correctness or the contract, none blocks, and each can ride a follow-up card: fixing any of them in this PR moves the head off this record.

N1 (nit) — docs/adr/0055-master-detail-controlled-by-parent.md: the "What is unchanged" list of the 2026-11-22 amendment still carries "An app-authored row-level policy binds every row", and "The declared narrowing" names the all-or-none outcome only. The rule as stated is true and "The floor" bullet states the composition exactly, but the release note now declares a second narrowed outcome the ADR does not name. Follow-up card: add one sentence to the amendment.

N2 (nit) — closed: the PR body now says 15 files, +576/−59, and no longer says the earlier changeset is not edited.

N3 (nit) — the authored-policy outcome is now a declared breaking outcome with no pin of its own on the vouched path, and the skipped sharing relief has none either. Both run through code the by-id path shares, and the flipped pin asserts the composed predicate carries no floor. Follow-up card: one case with an authored update policy on a detail, predicate against by id.

N4 (nit) — #36285 should name skills/objectstack-data/evals/objects-fields-relationships.json; the seat reports it added, not verified here.

N5 (nit) — sharing-rules.mdx says a predicate write "writes the rows a by-id write of each would", which leaves out the ownerMayEdit owner leg; and of the three pages only rls.mdx states the authored-policy case. Follow-up with #36285 or N1's card.

Implemented-by: claude/issue-35802-predicate-write-floor-cbp
Reviewed-by: session_01QsR2jTeURPvEm465RcoYEC

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5krBqrrgxCYgjXmfbv

席位核对

Awaiting the maintainer's merge (narrowing) · 2026-11-22T08:18Z · head 4fe236dbd1652989eb591cd8ba2befce20e7261c

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 22, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 22, 2026 08:21
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit ed33f8a Nov 22, 2026
68 of 73 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-35802-predicate-write-floor-cbp branch November 22, 2026 08:49
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…d sharing relief on a controlled_by_parent predicate write (objectstack-ai#38338)

Fixes objectstack-ai#36367
Clause-②: no
Metadata-protocol: none

## 维护者速读

- 用户能看到什么变化:用户无感;只补测试,产品行为不变。
-
为什么做:为「共享授权与字段权限改造」专题补上上一单(批量与逐条一致)留下的两处测试空白:明细上应用自写的修改/删除规则,以及批量改删时不再去问共享服务。
- 出错会怎样:只动一个测试文件,不影响任何用户;有问题可以直接撤回。
- 要你做什么:无。

## What changes

Test-only. One file:
`packages/plugins/plugin-security/src/predicate-write-floor-deferral.test.ts`,
on its own real-engine rig (real `SecurityPlugin`, `ObjectQL`, SQL
driver over better-sqlite3, `SharingService` and its middleware). It
carries nit N3 of contract record 7076369115 on PR objectstack-ai#36282.

The rig gains one detail, `pwf_line_staged`: the `controlled_by_parent`
detail of `pwf_order`, with a `stage` column. Two permission sets carry
REP_SET's grants and one app-authored policy each: `update` with `using:
"stage == 'open'"`, and the same for `delete`. `seedLines` takes per-row
overrides. On the staged matrix the order's owner ALICE created r1 and
r3, which are closed. CAROL created r2 and r4, which are open.

**The authored-policy outcome** (new describe inside the
`controlled_by_parent` block, real engine, row for row against the by-id
oracle):

- `update`: under the update policy, the predicate update writes exactly
r2 and r4, which is what a by-id update of each writes. It skips r1 and
r3, which ALICE created and the policy does not admit.
- `delete`: the same under the delete policy.
- CONTROL, each verb: a policy on the other verb binds nothing, so every
row is written, the closed rows ALICE created included. So it is the
policy that keeps r1 and r3 out, not the master gate.

**The skipped sharing relief** (second new describe):

- End to end, each verb: a vouched predicate write by the master's owner
asks the sharing service no write verdict about the detail, per row or
set form. It writes beyond the floor, with no authored policy (all four
rows) and with one (r2 and r4). A control: a by-id write of one row of
the same detail does ask, so the recorder sees verdicts on that object.
- Why it can't be seen, measured on this rig: the skip on its own moves
no row and asks nothing here. One case pins each of three facts that
make that true:
1. With no authored policy, the vouched Layer 1 is empty, so the relief
has no Layer 1 to work on.
2. With an authored `using`, the vouched Layer 1 is the policy alone (`{
stage: 'open' }`). Replacing only the floor (the relief's own test)
keeps the authored term, so the relief returns before it asks anything.
3. Record sharing answers `abstain` for every row of both details, for
both verbs. So a verdict, even if one were asked, would replace no
floor.

No product code is touched. Every pin measures the outcome PR objectstack-ai#36282
declares. No product defect was measured.

## Tests

Head `198443d7b0`. The suite, typecheck and gate runs below were taken
at this head, after its last commit.

<details><summary>The file, the plugin-security suite and
typecheck</summary>

- `pnpm --filter @objectstack/plugin-security exec vitest run
--maxWorkers=2 src/predicate-write-floor-deferral.test.ts`, under the
verify lock: `Tests 116 passed (116)` (109 before, plus 7 new), `VERDICT
command-exit 0`.
- `pnpm --filter @objectstack/plugin-security exec vitest run
--maxWorkers=2`, under the verify lock: `Test Files 290 passed (290)`,
`Tests 7337 passed | 45 skipped (7382)`, `VERDICT command-exit 0`.
- `pnpm --filter @objectstack/plugin-security typecheck` (tsc, scripts
project, `check:test-typecheck`), under the verify lock: `VERDICT
command-exit 0`. The file is in the `tsconfig.test.json` program
(`--listFiles`: 1 hit).

</details>

<details><summary>Ablations, through scripts/ablation-replace.mjs, each
restored and proved by blob hash</summary>

The test imports plugin-security's source, so there is no dist hop. On
every leg the anchor went from 1 to 0 and the blob changed. After each
restore the blob equals HEAD and `git diff HEAD` is empty. The whole
file is run each time; the counts below are the 7 new cases.

1. **A1, the vouch taken off step 3's Layer 1**
(`security-plugin-authz-middleware.ts`, `predicateMasterGateRowIds ? {
masterGateCoversThisWrite: true } : undefined` becomes `undefined`): 22
failed / 94 passed. 6 of the 7 new cases are red. The authored-policy
update and delete wrote r1 to r4 by predicate (floor OR policy, the
outcome before PR objectstack-ai#36282) against r2 and r4 by id. The other-verb
controls wrote only r1 and r3. The end-to-end relief case wrote only r1
and r3. The "why" case stays green, as expected: it calls the
composition directly with the vouch option.
2. **A2, the relief's skip removed** (`&& !predicateMasterGateRowIds`
dropped from the relief's guard): 116 passed. This is the outcome the
"why" case pins: on its own, the skip is not visible here.
3. **A3, the floor's yield to the master gate removed**
(`security-plugin-rls-filter.ts`, the `collected.filter(...
!isPlatformOwnershipFloorPolicy ...)` under
`platformFloorYieldsToObjectWriteModel` becomes a no-op): 26 failed / 90
passed, all 7 new cases red. The "why" case read the vouched Layer 1 as
`{ created_by: 'usr_alice' }` instead of null.
4. **A4, A2 and A3 together** (A2 held with `--hold`, A3 wrapped, then
A2 restored): 26 failed / 90 passed, all 7 new cases red. The verdict
assertion itself now fails, on both verbs: `pwf_line: verdicts the
predicate write asked: expected [ { verb: 'edit', … }, … ] to deeply
equal []` (and `'delete'` for the delete). So the recorder catches a
relief verdict on a vouched write once the relief can reach one.

</details>

## Acceptance notes

- The card allows "or show why none is observable" for the sharing
relief. A2 shows that removing the skip alone changes nothing on these
fixtures, so the relief case pins the three reasons and is ablated red
through A3 and A4. PR objectstack-ai#36282 named this gap ("on these fixtures the
relief would answer nothing either way").
- `scripts/pm/overlap-check.mjs` before each push: `VERDICT clean`.
- The test file's own run: about 5.3 s of tests inside about 20 s of
wall time, most of it module import, as before.

## Verification

Read first:

1. The `[objectstack-ai#36367]` describe "why the skip moves no row" in the test file:
it holds the three facts above.
2. The `[objectstack-ai#36367]` describe on the authored policy: the four cases and
the staged seed.

Two-minute check: `pnpm --filter @objectstack/plugin-security exec
vitest run --maxWorkers=2 src/predicate-write-floor-deferral.test.ts -t
36367`. Expect 7 passed.

<details><summary>Gates</summary>

Derived with `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` at `198443d7b0`: 1 path against merge base
`c279520a0c`, 54 families. Each was run once at this head, with its exit
code captured before any pipe. `dispatch-gates --ran`: "54 derived
famil(ies) accounted for — 52 run, 2 NOT-MEASURED (2 DERIVED from a
recorded exit 3)", exit 0.

- 52 exit 0. One of them took a second run: `node
scripts/check-plugin-teardown-shape.mjs --self-test` first exited 3
because its pinned positive-control commit was missing from the shallow
clone. Once that one commit was fetched it exited 0 (48 cases pass).
- NOT MEASURED, PREREQUISITE NOT MET (exit 3), left to CI's `Lint & Repo
Gates`: `pnpm check:dual-build-cjs-loads` and `pnpm check:i18n` read the
`dist/` of packages outside the plugin-security closure built here (59
packages, and the CLI).
- Not run locally, by rule: the repo-wide lint and `test:repo`
(CI-owned; the diff touches no test in that project).
`check-platform-checklist` is not owed: no exported symbol is renamed or
removed.

</details>

---
_Generated by [Claude
Code](https://claude.ai/code/session_017xRBcSCSJLNEQQeWJhKnd1)_

---------

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 pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

3 participants