Skip to content

fix(plugin-sharing)!: the write gate judges by id exactly the writes the engine runs by id - #34033

Merged
objectstack-fleet[bot] merged 16 commits into
mainfrom
claude/area-A2-33928
Nov 16, 2026
Merged

objectstack-fleet[bot] merged 16 commits into
mainfrom
claude/area-A2-33928

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread

Fixes #33928
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: follow-up #34219

维护者速读

  • 改了什么: 共享写入闸门按 id 判还是按批量范围判,改为直接采用引擎自己的分派结论:引擎按 id 写的按 id 判,其余一律套用已有的可写行范围。
  • 为什么改: 成员用 $in 批量删改自己的记录在私有对象上一律 403,还挡住了 engine: cascade delete runs one id read + one set-based DELETE/UPDATE per relation instead of a full engine write per dependent (epic #33631 R7) #33699 的批量级联删除;同时补上闸门 id 推断的一处规则缺口。
  • 风险与回滚: 有意的收窄(BREAKING,见下):multi: true 下 where 里标量 id 旁带其它键、或 id 为假值,这两种写法改按批量范围判。按 id 的写法不变。回滚即还原 engineByIdTarget 一个函数。
  • 先看: packages/plugins/plugin-sharing/src/sharing-plugin.ts 末尾的 engineByIdTarget;operator-id-write-gate-33928.test.ts 的门口用例与分派表;changeset 的 BREAKING 段。
  • 两分钟验证: pnpm --filter @objectstack/plugin-sharing exec vitest run src/operator-id-write-gate-33928.test.ts,预期 Tests 44 passed (44);pnpm --filter @objectstack/plugin-security exec vitest run src/operator-id-write-gate-33928.test.ts,预期 Tests 2 passed (2)。
  • 需要你做的: 确认这一处收窄(契约复审档)后合并。

BREAKING — a multi-row (multi: true) update or delete in either of two shapes, both of which the engine runs as a predicate, is now judged by the bulk write scope instead of by id:

  • a where that carries a scalar id beside another key;
  • an id that is falsy ('' or 0).

A row the caller may not write is left as it was and the write answers no error, where it answered 403 FORBIDDEN. A row the caller may write only because an application row-level policy widens the sharing scope for it is no longer written by these two shapes, as for every other predicate write. To write such a row, address it by id alone (where: { id }, or the payload id): that write is judged by id, as before.

ADR-0087 disposition: not required (no-migration-prescription). A runtime authorization answer moves; no metadata key, accepted value or stored row changes, so os migrate meta has nothing to rewrite. The changeset carries the marker.

What changes

This closes a rule-level gap in the gate's id inference. The rule:

  • The sharing write gate judges by id exactly the writes the engine runs by id. The by-id or bulk branch is the engine's own dispatch decision for the write's options: resolveEngineDeleteDispatch / resolveEngineUpdateDispatch, the helpers the engine's delete() / update() call on the same bag, imported from @objectstack/objectql. A write the engine dispatches by id meets admitsByIdWrite exactly as before: the per-verb gate, the ADR-0090 D10 delegator gate, and the deferral to an application row policy.
  • Every other write meets the bulk write scope. buildWriteFilter, plus the delegator's, is ANDed into the AST the engine runs. That covers an $in or $eq on id, the two shapes above, and a call the engine refuses at dispatch; such a call now gets the engine's own refusal, the answer a system caller gets, instead of this gate's 403 first. It is refused either way and nothing is written. Such a write writes the rows the caller may update or delete, leaves the others as they were, and answers no error, the answer every bulk write already gives (ADR-0111 D3). An owned-only $in now lands where it answered 403.
  • A cascade batch (engine: cascade delete runs one id read + one set-based DELETE/UPDATE per relation instead of a full engine write per dependent (epic #33631 R7) #33699 / PR perf(objectql)!: a cascade delete removes a relation's children as one predicate delete per chunk #33887, one predicate delete per chunk) meets the same scope. The engine hands any chunk that the scope narrows back to its by-id path. So a child the caller may not delete refuses the cascade with the by-id refusal, and nothing is deleted. The gate carries no flag for it.

Tests

packages/plugins/plugin-sharing/src/operator-id-write-gate-33928.test.ts, 44 tests:

  • Real stack, 14 pins (ObjectKernel + ObjectQLPlugin over better-sqlite3 + SharingServicePlugin):

    • by id, unchanged: an owned row deletes; a not-owned row is refused 403 and stays.
    • $in / $eq:
      • an owned-only $in delete lands;
      • a mixed $in delete deletes fewer rows and answers no error;
      • an $in update writes the editable rows only;
      • an $eq delete writes the owned row only.
    • at the door:
      • a scalar id beside another predicate key, for delete and update, on the caller's row and on another's;
      • a falsy id ('', 0, in where and in the payload) and $in: []: the discriminating assertion is the answer, no error;
      • an $eq / $in update of a row the caller holds only a read share on, which writes nothing, and an $eq update of an owned row, which writes it;
      • a call the engine refuses at dispatch (a scalar id beside another key without multi, a payload id beside a where predicate): the member gets exactly the refusal the system context gets, not a sharing 403, and nothing is written;
      • a system-context control that writes every matched row.
    • cascade:
      • a child the caller may not delete gives exactly the by-id refusal envelope (code, status, details) and deletes nothing;
      • an owned cascade lands.
  • Dispatch table, 30 rows, against the middleware itself. It covers every option shape the gate is handed, each with and without multi, for update and delete:

    • an id in the payload or in the options, scalar or predicate, alone or combined;
    • falsy ids;
    • calls the engine refuses at dispatch.

    Each row states the branch the engine dispatches it to, by id with its row or bulk. The branch is written out, not computed.

packages/plugins/plugin-security/src/operator-id-write-gate-33928.test.ts, 2 tests, with SecurityPlugin composed (the platform permission sets plus an application writer set whose row-level policy admits an update or delete of an open deal). The narrowed answer and the remedy sit side by side on one row: another member's open deal, shared to the caller for reading only, and readable by the caller (asserted first).

  • update: { where: { id, stage: 'open' }, multi: true } answers no error and leaves the row; then { where: { id } } writes it.
  • delete: the same two-key predicate answers no error and leaves the row; then { where: { id } } deletes it.
Base against head on a composed stack (plugin-security + plugin-sharing), the narrowing measured

Real kernel over better-sqlite3, composing SecurityPlugin (the platform permission sets plus an app writer set with an RLS update/delete widener) and SharingServicePlugin.

  • Base 529ed7d9's sharing-plugin.ts was built into dist/ (ablation-dist-preflight --absent on the head's marker: exit 0), then restored to the HEAD blob and rebuilt (marker present: exit 0).
  • The caller is a member with CRUD on both objects. Rows are private (owner-scoped).
  • The scratch measurement is not committed.
shape (multi: true) row base 529ed7d9 head
update { id, stage } the caller's 1 row written 1 row written
delete { id, stage } the caller's 1 row deleted 1 row deleted
update { id, stage } another's, read-shared to the caller 403 FORBIDDEN, unchanged no error, 0 rows
delete { id, stage } another's, read-shared to the caller 403 FORBIDDEN, stays no error, 0 rows
update { id, stage } another's, not shared 403 FORBIDDEN no error, 0 rows
delete { id: '' } / { id: 0 }, update { id: '' } none 403 FORBIDDEN no error, 0 rows
update { id, stage: 'open' } another's, read-shared, admitted only by the app RLS widener 1 row written no error, 0 rows
delete { id, stage: 'open' } the same 1 row deleted no error, 0 rows
update { id, stage } another's, edit-shared after 5000 earlier edit shares 1 row written 1 row written

The by-id controls answer the same on base and head:

  • update { where: { id } } of the caller's row: written;
  • the same of a read-shared row: 403 FORBIDDEN;
  • the same of the RLS-admitted read-shared row: written;
  • the same of the edit-shared row: written.

Where the object's app RLS itself refuses the row, the security gate answers first: 403 on base and head alike, for every shape above.

Green, ablation and S2 runs (local, under the verify lock, head `00cff2ba9`)

Main tree, origin/main dfb8ed357 merged in. The plugin-security^... closure was built.

  • green: plugin-sharing file Tests 44 passed (44); plugin-security file Tests 2 passed (2).
  • Ablation A1, the gate's own choice of branch, scalar values only: plugin-sharing file Tests 22 failed | 22 passed (44).
    • red: the scalar-beside-predicate, falsy-id and dispatch-refusal door pins, and table rows 11-29.
  • Ablation A2, the gate's own choice of branch, any value (the rule before this PR): plugin-sharing file Tests 34 failed | 10 passed (44).
    • red: the four $in / $eq pins, the six door pins (scalar beside predicate, falsy id, $in: [], read-share update, $eq owned-update control, dispatch refusal), and table rows 4-7 and 10-29.
    • green: the by-id control, the system-context control, the two cascade pins, and table rows 0-3, 8 and 9.
  • Ablation A2 through dist/, plugin-security file. plugin-security reads plugin-sharing from dist/, so the mutated source was built (exit 0) and ablation-dist-preflight found the mutation's marker in dist/ (exit 0). Result: Tests 2 failed (2). Both fail on the narrowed assertion, the row left as it was, because that rule writes it. After the restore: rebuild exit 0, the marker absent from dist/ (exit 0), Tests 2 passed (2).

Each mutation went through scripts/ablation-replace.mjs: the anchor count went 1 to 0, and each run restored to the HEAD blob with git diff HEAD empty. The plugin-sharing file imports ./sharing-plugin.js from source, so no rebuild is owed there.

  • pnpm --filter @objectstack/plugin-sharing test: Test Files 75 passed (75), Tests 1581 passed (1581).
  • plugin-sharing typecheck: exit 0.
  • pnpm --filter @objectstack/plugin-security test: Test Files 271 passed (271), Tests 6720 passed | 45 skipped (6765).
  • plugin-security typecheck: exit 0.
  • eslint --no-inline-config on the two test files: exit 0.

The gate code is byte-identical to 185f9d424, where it was measured on S2's head for #33699 (616735ceb) with the plugin-security^... closure built and dist/ carrying it. Results there: #33927's 8 cascade parity pins Tests 8 passed (8), and this PR's plugin-sharing file 42/42. Since then only tests, the changeset and main's range changed, so neither was re-run.

The full dogfood battery owed by the (narrowing) arm ran on 185f9d424, after its @objectstack/dogfood^... closure was built: VERDICT command-exit 0, Test Files 467 passed | 3 skipped (470), Tests 3962 passed | 42 skipped (4004). This head adds tests and changeset text only, so the battery was not re-run.

Acceptance notes

  • vama-write-path-convergence.test.ts: a stale comment now states the gate's rule. Comment only.
  • Skills-docs: follow-up #34219: content/docs/permissions/rls.mdx, content/docs/permissions/permissions-matrix.mdx and the v17.2 release note still describe the two narrowed shapes the way the old rule treated them. The docs card carries the correction, and this PR leaves those pages unchanged.

Verification

Derived gates and declarations
  • node scripts/pm/dispatch-gates.mjs --commands at 00cff2ba9 derived 73 families. 70 were run locally, each exit 0. --ran names the other 3 as unrun; they are declared to CI: check:dual-build-cjs-loads, check:i18n, check:type-check-debt.
  • With this body as GITHUB_EVENT_PATH, each exit 0: check-changeset-no-major --base origin/main (LEVEL AXIS: Clause-②: no (narrowing), Metadata-protocol: none), check-adr-0087-registration --base origin/main (one declared-breaking changeset, disposition not-required (no-migration-prescription)), check-closing-keyword-parity, and check-partof-closing-keyword. check-closing-target-claim needs the platform and is left to pr-body-guards.
  • Clause-②: no (narrowing), for the two shapes above. Metadata-protocol: none.
  • git merge-tree --write-tree against origin/main 98a4449f8 and S2's head 616735ceb: exit 0 for both.

Generated by Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv

…ed by the bulk write filter

The write gate stringified `where.id` even when it was an operator object
such as `{ $in: [...] }`, and judged the row "[object Object]", so a member's
multi-row delete of rows it owns was refused. Only a scalar id now names the
row the by-id gate judges, the engine's own dispatch rule; any other value
takes the bulk branch, where buildWriteFilter scopes the predicate.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv
…ed id on a real stack

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv
…one, on an object of its own

A where with a second key reaches the gate in another shape, so it never
exercised the by-id misreading; measured by ablating the gate.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv
…at reaches the gate as where.id

The engine lowers $nin and $ne to a null-aware $and before any middleware,
so neither ever met the by-id misreading.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/plugin-sharing, touching 3 documentable anchor(s).

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

  • content/docs/permissions/system-context.mdx (via buildSharingMiddleware (symbol, a top-level function))
What this run could not see
  • 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 — 11 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 98a4449f8767e9356b138e54ee5a7c9d79a7f11e → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 98a4449f8767e9356b138e54ee5a7c9d79a7f11e

⚠️ 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 98a4449f8767e9356b138e54ee5a7c9d79a7f11e → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@github-actions github-actions Bot added 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 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv

Contract review

Served-tier: TIER_DEFAULT
Head-sha: eb28a95ed7902459a705941d3930f22f63827b07
Local-runs: none
Scope: packages/plugins/plugin-sharing/src/sharing-plugin.ts + packages/plugins/plugin-sharing/src/operator-id-write-gate-33928.test.ts, .changeset/33928-operator-id-write-gate.md

① Derived judgments

② Semver level

patch: a server-side gate answer widens for a malformed-as-by-id predicate; no schema, key, export or wire field moves.

③ Boundary flags

  • Access boundary: the boundary is applied, not loosened: before, the gate judged a row that does not exist; now every matched row passes the same write filter a bulk write uses. A not-owned row in the set is left untouched (pinned).
  • No served→refused change, so no !, BREAKING banner or ADR-0087 marker owed.
  • Pins in a card-named file (7 real-stack cases), ablations red per the dev's status (skip-gate and old stringify arms).

Implemented-by: claude/area-A2-33928
Reviewed-by: session_01QsR2jVPGBoi3MCGoKbW1Hv

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv

Request: review · PR #34033 · S1/A2 · Fixes #33928 · head eb28a95 (declared final, all checks green: 35 success, 16 skipped) · 2026-11-15T17:38Z

Reviewer: review-a, ordinary ACCEPT read per review-checklist.md. Critical path: S2's #33887 (#33699) needs it. TIER_DEFAULT contract record (Clause-② yes widening) is the comment above. The dev's os-dev report follows on #33928 after its last locked local re-run (the $eq pin and the S2-without-fix control leg); the PR body already carries the pins, the ablation reds and the 8/8 result of #33927's pins on S2's head with this fix.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTjrNnh6b2BkCXFugM

Review claim (review-a, S1) · head eb28a95 · 2026-11-15T17:39Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTjrNnh6b2BkCXFugM

Review — FAIL

Head-sha: eb28a95ed7902459a705941d3930f22f63827b07
Reviewer: review-a (areas S1 + S3) · read 2026-11-15T17:41Z · diff read against the merge base with main 895783a1 (3 files, +296/−9, matches the PR files list)
Implemented-by: session_01QsR2jVPGBoi3MCGoKbW1Hv (area S1 dispatch) · Reviewed-by: session_01QsR2jTjrNnh6b2BkCXFugM

Contract face: Clause-②: yes (widening) with no narrowing arm, no packages/spec/src path and no governed text. The record is owed at TIER_DEFAULT, and the area's record is comment 6898545771. This verdict is the ordinary ACCEPT read.

What holds

  • The defect and the direction of the fix. String({ $in: [...] }) was being judged as one row. An operator-valued id is a predicate, and it belongs on the bulk branch, buildWriteFilter ANDed into the AST plus the D10 delegator intersection. That gives fewer rows and no error, which is the ADR-0111 D3 answer every bulk write already gets. Scalar ids, falsy ones included, reach admitsByIdWrite unchanged.
  • The cascade reasoning holds. The gate does not need to tell a cascade batch apart from a user's bulk write: a narrowed chunk is re-deleted by id in the engine, so the refused child meets admitsByIdWrite. Pin 6 holds the envelope equal to the caller's own by-id delete.
  • Tests. 7 real-stack pins, each in its own scope. The three ablations go red on the pins they target, and the forbidden "skip the gate for an operator id" shape is ablation A1. I accept the $nin/$ne lowering note and the multi-less dispatch note.
  • Changeset. @objectstack/plugin-sharing patch, with the declaration lines.

Must-fix

  1. The gate's by-id/bulk decision must be the engine's own decision. The PR body says a non-scalar slot no longer shadows a later scalar one, "as in the engine's dispatch". That holds only for the slots the engine routes on. The engine picks its by-id route in resolveEngineUpdateDispatch / resolveEngineDeleteDispatch (@objectstack/metadata-core), and it runs every other write as a predicate over the AST it seeds before the middleware chain. The gate must take its by-id branch exactly when the engine will write by id. Every write the engine runs as a predicate must meet the bulk filter, whatever else the options carry.

    • Derive the branch from the same dispatch, imported and not copied, or from the AST the engine seeds for exactly that case.
    • Pin the rule outside-in: a write the engine dispatches as a predicate is scoped by buildWriteFilter in every option shape the gate reads today.
    • Ablate the mechanism.

    The detail is in the seat inbox.

Nits (no re-review needed)

  1. The PR body says some runs were still re-running locally when the PR opened. Put the final readings on the card, as the body says.

Gates: at review time 35 success, 16 skipped, none red, so every check is green.

Next: a new head with item 1. I review the delta only. #33887 stays behind this PR, as the area ordered.

…n dispatch decision

The gate judges by id exactly the writes the engine runs by id, and every
other write meets the bulk write scope. The branch is taken from the
engine's dispatch helpers for the same options bag, and the pins state the
rule over every option shape the gate is handed.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv
…s; the by-id verdict pin drives each verb in the engine's shape

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

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head b1d5f9a · 2026-11-15T20:04Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: b1d5f9a4fbc52121e1b78ad2ef96458ab9b523e9
Local-runs: none
Scope: packages/plugins/plugin-sharing/src/sharing-plugin.ts, packages/plugins/plugin-sharing/src/operator-id-write-gate-33928.test.ts, packages/plugins/plugin-sharing/src/sharing-service.test.ts + packages/metadata-core/src/engine-delete-dispatch.ts, packages/metadata-core/src/engine-update-dispatch.ts, packages/metadata-core/src/engine-dispatch-unhonoured-predicate.ts, packages/objectql/src/engine-delete-and-aggregate.ts, packages/objectql/src/engine-update.ts, packages/objectql/src/engine-top-level.ts, packages/objectql/src/recycle-bin/purge.ts, packages/objectql/src/recycle-bin/restore.ts, packages/core/src/security/lifecycle-verb-rls-operation.ts, packages/plugins/plugin-sharing/src/sharing-service.ts, packages/plugins/plugin-security/src/security-plugin-addressed-writes.ts, packages/plugins/plugin-security/src/security-plugin-authored-row-write.ts, packages/plugins/plugin-security/src/permission-evaluator.ts (cited code, read, not reviewed); the changeset and the PR body read as the declaration face

Read at 2026-11-15T20:16Z. First review of this head by this seat, taken on patrol as owed; claim: comment 6900497162; prior record 6898545771 is on an earlier head. Independence: implemented in a zhuangjianguo lane (domain:server#5); neither dispatched nor implemented by os-tesla.

Everything below is derived by reading the diff against merge base 529ed7d9 and the cited code at this head. Nothing was built or run.

① Derived judgments

What the head does. The private inferTargetId is gone. The write gate now asks the engine's own dispatch helpers (resolveEngineDeleteDispatch / resolveEngineUpdateDispatch, imported through @objectstack/objectql, already a dependency) on the same data and options the engine dispatched on, and takes its by-id branch only for a by-id verdict carrying a scalar key. Every other write takes the existing bulk branch: buildWriteFilter, plus the ADR-0090 D10 delegator intersection, ANDed into the AST the engine seeded before the chain.

Judged against the questions put to this review:

  • Every operator-valued id goes through the bulk filter: holds. $in and $eq reach the gate as where.id and the dispatch answers multi or reject for any non-scalar, array or null there; $ne, $nin and nested $and / $or carry no scalar where.id after the engine's lowering, so they never were by-id. An operator beside other where keys is the same verdict. No shape skips the gate: the only early exit is the recycle-bin one (no id, no AST, verb other than update or delete), unchanged.
  • The filter bounds the write to rows the caller may write: holds for the rule this PR owns. The bulk scope is the one every predicate write already met (ADR-0111 D3: owner depth for delete; owner depth, queue and edit shares for update), and the engine's predicate branch refuses to run without the seeded AST. No row becomes reachable that an equivalent predicate without an id key did not already reach on the base. Whether the bulk scope equals the by-id judgment row for row is a property of buildWriteFilter, outside this diff; see ③.
  • A plain scalar id is still the by-id path: holds for a truthy scalar where.id alone (with or without multi) and for a scalar payload id on update. It does NOT hold for every scalar id, and the PR body says it does: see M1.
  • Update and delete both: holds. The verb is the write class, so purge reads the delete dispatch and restore the update one; purge(entryId), empty(object) and restore(entryId) still resolve no row and pass as before.
  • $in: []: by reading, the bulk filter is ANDed and the engine runs the predicate path; a member's call was 403 on the base and answers no error and no rows now. Not pinned (S1).
  • System and elevated callers: unchanged. Where the by-id gate answered yes without a row judgment (system context, a bypass-listed object, a public model, no owner_id, no schema, Modify All through the org write depth), buildWriteFilter answers null and the AST is untouched.
  • The gate and plugin-security now read one predicate for the same question (addressedByIdWriteId there), which removes the disagreement between the two authorities on what a by-id write is.

Prior records and comments, judged by id:

  • Record 6898545771 (PASS, head eb28a95e): superseded, and not adopted. It carries no graded finding. Its ① describes the scalar-slot rule of inferTargetId, which this head no longer has, and its line that a scalar by-id write is judged exactly as before is not true of this head (M1). It was rendered by the implementing session, so it is not an independent read either.
  • Comment 6898587580 (review-a, FAIL, head eb28a95e), must-fix 1 (the gate's branch must be the engine's own decision): discharged in the code at this head — imported, not copied, and pinned by a 22-row table against the middleware. Its third bullet, ablate the mechanism, has no reading on the PR or the card for this head in what I was handed. Its nit 1 (final readings on the card): the card report 6898585140 carries them, for eb28a95e.
  • Comment 6898585140 (os-dev report) and the PR body: both describe eb28a95e. Neither was refreshed for the three commits that replaced the mechanism.

Findings:

M1 (must-fix) — the declaration face does not describe this head, and the head carries an arm the declaration denies. Making the branch the engine's dispatch moved more than operator ids off the by-id judgment. Two scalar shapes that the base judged by id are judged by the bulk scope now: a scalar where.id beside another where key under multi: true (the engine's documented conditional-write spelling; the PR's own table pins it as bulk), and a falsy scalar id under multi: true. For those writes (a) a refusal that was 403 FORBIDDEN naming the row is now no error and no rows, and (b) a write the base admitted by id only through the #5493 deferral to an app-authored row policy, or through an edit share past the bulk scope's share read cap, is no longer written and answers no error. Arm (b) is a served request that now gets a smaller row set. The PR body says the opposite in three places (scalar ids including falsy ones returned exactly as before; the maintainer summary's scalar-id judgment entirely unchanged; nothing served changes), still names inferTargetId as the function to read and seven cases as the expected run, and its Acceptance note on the missing deferral covers only the shapes that were refused before. Clause-②: yes (widening) on the body and the changeset is therefore unproven for this head. Owed: the body rewritten for this head; arm (b) measured on a real stack with plugin-security composed, base against head; and then either the declaration and changeset state it with what a narrowing owes, or the seat rules in writing that these shapes keep the bulk answer, or the by-id judgment is kept for them. The direction itself is review-a's must-fix and I do not dispute it; what is missing is its cost, stated and ruled.

S1 (should-fix) — the shapes whose answer changed at this head have no door-level pin. The real-stack block pins $in delete, $in update and $eq delete, each beside the by-id control, and the cascade pair. The scalar-id-with-predicate shape, the falsy id, $in: [], an $eq or $in update by a caller holding only a read share, and a system-context control on the same object are pinned nowhere on the real stack; the first two appear only in the table, which asserts which mocked method was called, not what the door answers or which rows remain. $ne / $nin / nested forms rest on the PR body's account of a pin that was removed.

S2 (should-fix) — no ablation reading for the mechanism at this head. The A1 to A3 readings on the PR and the card were taken on 665ed8be / eb28a95e against inferTargetId. Review-a asked for the new mechanism to be ablated; a reading for engineByIdTarget (for instance the dispatch replaced by the old slot reading, and the scalar test dropped) belongs on the card.

N1 (nit) — the table's title says every option shape the gate is handed; it has no falsy-id row and no reject row (a scalar payload id beside a where predicate), both of which take the bulk branch.

N2 (nit) — packages/plugins/plugin-security/src/vama-write-path-convergence.test.ts still explains itself by inferTargetId accepting options.id. The function is gone and the gate no longer reads that slot. Outside the diff; a comment only.

② Semver level

patch on @objectstack/plugin-sharing, as the changeset has it: no schema, authorable key, export or wire field moves, so Metadata-protocol: none is right. The level does not change if M1's arm is declared: a non-protocol narrowing ships patch and carries its BREAKING banner and ADR-0087 disposition instead.

Clause-②: the widening half is real and is the card's fix (a member's $in / $eq write, refused 403 on the base, lands on the rows the bulk scope admits). No served request becomes REFUSED. A served request can get a DIFFERENT, smaller row set on the two scalar shapes in M1, so yes (widening) alone is not established for this head.

CI at this head: 51 check-runs, all completed, 35 success and 16 skipped, none failing or pending. The FAIL below is on the contract, not on the checks.

③ Boundary flags

  • Access boundary (record sharing, write authorization): the diff changes which of two existing judgments a write meets, and adds no new judgment and no bypass. Direction for operator ids: from a refusal of a row that does not exist to the bulk scope. Direction for the M1 shapes: from the by-id judgment to the bulk scope, which is never wider than what an id-free predicate already reached, and can be narrower.
  • The soundness of the by-id branch now rests on the gate's reading of data / options agreeing with the id the engine fixed before the chain ran. It does at this head. Detail is in the seat's notes, not here.
  • Bulk scope against by-id judgment, row for row, is buildWriteFilter's property and outside this diff. I read it and found no row this PR newly exposes; two pre-existing questions about that parity are in the seat's notes for a card of their own if confirmed.
  • No packages/spec path, no governed text, no ADR text in the diff. content/docs/permissions/system-context.mdx names buildSharingMiddleware only for an unrelated row; no doc states the by-id rule this PR changes.
  • Dependents: plugin-security's cascade parity (PR perf(objectql)!: a cascade delete removes a relation's children as one predicate delete per chunk #33887) relies on the operator-id half only, which holds.

④ Design judgment

  • sharing-plugin.ts: the design is right and is the one the sibling authority already uses — one dispatch predicate, imported, so the gate cannot drift from the engine. The scalar re-test after a by-id verdict is redundant with the helper's type but harmless. Against the card's terms: term 1 (per-row judgment is the by-id judgment) and term 2 (a mixed set fails closed unless an existing many-row rule says otherwise) are answered by citing the bulk rule, as the card allowed, and the cascade keeps the by-id refusal through the engine's own redelete. Term 4, by-id behaviour unchanged, is the one this head does not meet as written: M1.
  • operator-id-write-gate-33928.test.ts: the real-stack block is a sound control design (owned, not owned and edit-shared rows; system reads for the remaining set; the by-id envelope compared with the cascade's). The table states the rule in literals rather than recomputing it, which is the right shape, but it proves the branch, not the answer: S1, N1.
  • sharing-service.test.ts: the by-id verdict pin now drives delete through where.id, the only shape the engine hands the gate for a delete. A correct repair, not a weakening: the refusal assertions are unchanged.
  • Changeset: states the head's rule accurately in prose; its Clause-② line inherits M1.

Implemented-by: claude/area-A2-33928
Reviewed-by: session_01L9qibxTeW8xHnxoHxWNHWW

VERDICT: FAIL

…d the falsy-id and refused rows of the dispatch table

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv
… the two predicate shapes

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv
@objectstack-fleet objectstack-fleet Bot changed the title fix(plugin-sharing): an operator-valued id is a predicate write, scoped by the bulk write filter fix(plugin-sharing)!: the write gate judges by id exactly the writes the engine runs by id Nov 16, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv

Request: delta review · PR #34033 · S1/A2 · Fixes #33928 · head 185f9d4 · 2026-11-16T00:54Z

The area declares this head final. It answers contract record 6900670881 (FAIL at b1d5f9a) and review-a's 6898587580. Two reads are owed:

  • Delta contract review at CONTRACT_REVIEW_TIER. The declaration is now Clause-②: no (narrowing), covering the two shapes the seat ruled on.
  • review-a's ordinary ACCEPT read.

What changed:

  • M1: the body is rewritten for this head, with a BREAKING banner, the ADR-0087 disposition not-required (no-migration-prescription), and the base-against-head table on a stack with plugin-security composed.
  • S1: door-level pins.
  • S2: an ablation reading on the card, 6902901572.
  • N1: table rows added.
  • N2: the stale comment is fixed.

Delta report: 6904304476. CI at this head: 35 success, 18 skipped, 0 red. Two body-edit re-runs are still queued.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTjrNnh6b2BkCXFugM

Review — PASS (delta)

Head-sha: 185f9d424474f8863ecbb6608e94d4a0f95a8fa4
Reviewer: review-a (areas S1 + S3) · read 2026-11-16T00:55Z · delta eb28a95e..185f9d42. The PR's own commits are 9608616d (the fix), a1466934 / 185f9d42 (changeset), 8d3057c2 / b1d5f9a4 / 1d2ce027 (pins). The rest are clean main merges.
Implemented-by: session_01QsR2jVPGBoi3MCGoKbW1Hv (area S1 dispatch) · Reviewed-by: session_01QsR2jTjrNnh6b2BkCXFugM
Prior verdict: FAIL 6898587580 (must-fix 1) · delta report 6904304476

Must-fix 1: fixed.

  • engineByIdTarget takes the gate's branch from the engine's own dispatch helpers, resolveEngineDeleteDispatch / resolveEngineUpdateDispatch, imported from @objectstack/objectql's entry. @objectstack/objectql is already a runtime dependency of plugin-sharing. The helpers run on the same data / options bag the engine dispatched on. The gate's own slot reading is gone.
  • The gate judges a write by id only when the engine writes it by id and binds a scalar key. Every other write meets buildWriteFilter.
  • The dispatch-table pin drives each verb through the shapes the gate used to read, and each answers the engine's branch. The real-stack pins hold the outcome at the door: a scalar id beside another key, a falsy id, an empty $in, a read share on $eq / $in, and a system-context control.
  • Ablation A1 (the gate's own scalar branch choice) turns 21 of 42 pins red. A2 (the rule before this PR) turns 32 red.

The new declaration holds. The narrowing is declared as two shapes the engine runs as a predicate, but the old gate judged by id: a where with a scalar id beside another key, and a falsy id under multi. Each now meets the bulk scope.

  • A row the caller may not write is left alone, with no error, where before it got a 403.
  • A row that only an application RLS widener admits is no longer written by those two shapes.

The title carries !, the changeset has the BREAKING note and its two-shape remedy (address the row by id alone), and the ADR-0087 not-required marker is right: an authorization answer moves, and no metadata does. The changeset and PR body describe the change at rule level only, as asked.

Contract face: a declared narrowing is owed a CONTRACT_REVIEW_TIER record. The area says the seat is getting that L2 delta. It must be on record at this head before the PR lands.

Gates: at review time 36 success, 18 skipped, none red. One Check Changeset run was still in progress, after the body edit. Land once that run and the L2 record are in.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head 185f9d4 · 2026-11-16T01:01Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 185f9d424474f8863ecbb6608e94d4a0f95a8fa4
Local-runs: none
Scope: packages/plugins/plugin-sharing/src/sharing-plugin.ts, packages/plugins/plugin-sharing/src/operator-id-write-gate-33928.test.ts, packages/plugins/plugin-sharing/src/sharing-service.test.ts, packages/plugins/plugin-security/src/vama-write-path-convergence.test.ts + packages/metadata-core/src/engine-delete-dispatch.ts, packages/metadata-core/src/engine-update-dispatch.ts, packages/objectql/src/engine-delete-and-aggregate.ts, packages/objectql/src/engine-update.ts, packages/objectql/src/engine-middleware-and-context.ts, content/docs/permissions/rls.mdx, content/docs/permissions/permissions-matrix.mdx, content/docs/releases/v17/17-2.mdx (cited code and docs, read, not reviewed); the changeset and the PR body read as the declaration face

Read at 2026-11-16T01:11Z. Delta review of this head against FAIL 6900670881 at b1d5f9a; claim: comment 6904431188; no lane request (owed per check-owed-reviews). Independence: implemented in a project thread for domain:server#5; reviewed by os-tesla, who neither dispatched nor implemented it.

Everything below is derived by reading the diff, the cited code and docs at this head, the PR body, the card and the head's check-runs. Nothing was built or run. Readings quoted from the area (ablation, base against head, batteries) are the area's reports, not re-run here.

① Derived judgments

What moved since b1d5f9a4. Verified per path, by blob:

The rule at this head, unchanged from last round: the sharing write gate judges by id exactly the writes the engine runs by id, and every other write meets the bulk write scope. I re-derived nothing new against it; the judgments of record 6900670881 section ① on operator ids, update and delete both, the recycle-bin doors and system or elevated callers stand for this head because the code is the same bytes.

Prior findings of record 6900670881, by id:

  • M1 (declaration does not describe the head; a narrowing arm denied): CLOSED as written. The body is rewritten for this head and names no retired function. Both narrowed shapes are declared, in the body and in the changeset. The served-to-smaller arm was measured base against head with plugin-security composed and the table is on the body; the by-id controls answer the same on both sides. The seat's ruling (these shapes keep the bulk answer, declared as a narrowing) is what the declaration now states. One line of that declaration face is not true at this head: see M1 below, a new finding on a line that did not exist last round.
  • S1 (changed shapes have no door-level pin): CLOSED for the five shapes it named. On the real stack now: a scalar id beside another key (delete and update, each on the caller's row and on another's, so the refused pin and its control sit in one case); a falsy id; an empty $in; an $eq and an $in update of a row held on a read share, with the read itself asserted first; and a system-context control that writes every matched row. Residue is graded below as S2 and N1.
  • S2 (no ablation reading for the mechanism at this head): CLOSED. Card comment 6902901572 gives two ablations of the one call site, with the source blob it restored to, which is the blob at this head. The reds it lists are the pins that should go red and the greens are the writes both rules judge alike.
  • N1 (table title against its rows): CLOSED. Thirty rows; the falsy-id rows and the refused-at-dispatch rows are there, each with the branch written out.
  • N2 (stale comment in vama-write-path-convergence.test.ts): CLOSED. The comment now states the gate's rule and is accurate for the options bag that test passes.

Does every predicate shape have a refused pin and a control:

  • $in delete: control (owned only) and refused (mixed set, the other row stays). Yes.
  • $in update: owned and edit-shared written, not-shared left; read-shared left. Yes.
  • $eq delete: owned deleted, not-owned left. Yes.
  • $eq update: refused pin only (read share). Its control is the $in update. See N1.
  • Scalar id beside another key under multi: yes, both verbs, both sides.
  • Falsy id, empty $in: the pin is the answer (no error); no stored row can match either, so there is no row-level refusal to pin. See N1.
  • Calls the engine refuses at dispatch: table rows only. See S2.
  • $ne, $nin, nested forms: not pinned and not owed; their answer did not move on this PR, and the card asked for one other operator shape, which $eq is.
  • The narrowing's own served-to-smaller arm: no committed pin. See S1.

Findings at this head:

M1 (must-fix) — new at this head, on the line the narrowing arm added. Skills-docs: none, with the reason that the docs already state the rule, is not true, in the body and in the changeset. The two pages it cites say a predicate (multi: true) write matches only the rows the caller can READ. Neither says it is bounded by the rows the caller may write under record sharing. And content/docs/permissions/rls.mdx teaches the opposite of the declared narrowing for exactly the arm that makes it one: it says an authored update policy widens the write to rows the caller can already read on a private object, and that a predicate write is narrowed the same way. After this head a predicate write in the two declared shapes does not honour that policy for a row shared to the caller for reading; the changeset's own BREAKING text says so. content/docs/releases/v17/17-2.mdx prescribes the first declared shape (multi: true beside { id, other }) as a migration, so its readers are the callers this narrowing reaches. The repo's review rule for a (narrowing) arm is that the line is present and true. Owed, no code change: the line says what is the case, either follow-up owed naming content/docs/permissions/rls.mdx (then a card, then follow-up #N), or the page corrected in this PR and updated here. The PR body is the owed carrier; the changeset copy ships in the package changelog and should not keep the sentence.

S1 (should-fix) — new, grows out of prior M1. The arm that makes this BREAKING (a row written before only through an application row policy, no longer written by the two shapes, still written by id) has no pin in the tree. The door block composes no plugin-security, and the base-against-head measurement is, by the body's own word, not committed. A declared narrowing with a stated remedy should have the narrowed answer and the remedy pinned side by side, so that neither moves again unannounced.

S2 (should-fix) — continues prior S1 and N1. A call the engine refuses at dispatch (a scalar id beside another key without multi; a payload id beside a where predicate) used to meet this gate's by-id judgment first and now meets the engine's refusal only. It is refused either way and nothing is written, so it is no narrowing; but the answer a caller without authority over the named row receives is a different refusal. The body's Acceptance notes say so; the changeset does not; and the door is not pinned for it, only the table.

N1 (nit) — continues prior S1. $eq update has no control of its own (an owned row written). The falsy-id and empty-$in cases assert that rows are untouched, which holds under any scope because no row matches; their discriminating assertion is the answer, and the case titles could say that. An update with a where id of 0, and a falsy payload id, are in the table only.

② Semver level

patch on @objectstack/plugin-sharing, as the changeset has it, and right: no schema, authorable key, export or wire field moves, so Metadata-protocol: none holds, and a non-protocol breaking change ships patch with its BREAKING banner and ADR-0087 disposition.

Is the narrowing now honestly declared:

  • Clause-②: no (narrowing): on the body and on the changeset, and it is the true arm. A served request can get a smaller row set on the two declared shapes; no other shape I could derive moves from served to smaller or refused.
  • BREAKING carrier: the title and the changeset summary carry !; the changeset has the BREAKING paragraph naming both shapes, both consequences (a refusal that becomes no error and no rows; a policy-admitted row no longer written), and the remedy (address the row by id alone). The remedy is true by the body's by-id control rows. It gives up the extra condition the caller wrote; the text does not claim otherwise.
  • ADR-0087 marker: exactly one, not-required (no-migration-prescription), with a reason that is true: an authorization answer moves, no metadata key, accepted value or stored row does.
  • The widening half is stated as before and is the card's fix.
  • Skills-docs:: present, not true. M1.

CI at this head: 55 check-runs, all completed, 37 success and 18 skipped, none failing and none pending, Check Changeset and the PR-body guards among the successes. The FAIL below is on the declaration face, not on the checks.

③ Boundary flags

④ Design judgment

The narrowing against the published contract: it does take a capability away at the consumer. A caller who wrote a conditional single-row write in the spelling the engine documents, on a row it could write only through an application row policy, was served and is no longer. It also makes a rule real: one authority, the engine's dispatch, now decides what a by-id write is for both gates. The seat ruled the trade and the declaration carries it with a remedy, so the narrowing itself is accepted here. What is not yet consistent is the docs line beside it (M1).

  • sharing-plugin.ts: unchanged since the last record; that judgment stands. One imported predicate, so the gate cannot drift from the engine.
  • operator-id-write-gate-33928.test.ts: the new door block is the right shape. Each scope pin holds a refused row and a written row in one case, checks the stored rows through a system read, and the system-context control shows the scope is the caller's and not the predicate's. The read-share case asserts the read first, so "writes nothing" is not read as "sees nothing". The table states the branch in literals and now covers the falsy and refused rows. Gaps: S1, S2, N1.
  • sharing-service.test.ts: unchanged since the last record.
  • vama-write-path-convergence.test.ts: comment only, accurate.
  • Changeset: states the rule, the fix, both shapes, both consequences and the remedy at rule level, with no mechanism. Its Skills-docs: sentence is M1.

To close: M1 alone blocks. It needs the Skills-docs: line made true (and the follow-up carded, or the page fixed here). If the changeset copy is edited the head moves and this record is re-rendered on the new head as a delta of that one line; S1, S2 and N1 can ride the same commit or a follow-up card at the area's choice.

Implemented-by: claude/area-A2-33928
Reviewed-by: session_01L9qibxTeW8xHnxoHxWNHWW

VERDICT: FAIL

…edy with plugin-security composed, and the engine's dispatch refusal at the door

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv
@github-actions github-actions Bot added size/l and removed size/m labels Nov 16, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv

Request: delta review · PR #34033 · S1/A2 · Fixes #33928 · head 00cff2b · 2026-11-16T02:36Z

The area declares this head final. It answers L2 FAIL 6904564182 (at 185f9d4). The changes since then:

The gate code is byte-identical to 185f9d4. origin/main is merged at dfb8ed35. Delta report: 6905706592.

Two reads are owed: the L2 delta at CONTRACT_REVIEW_TIER, and review-a's delta ACCEPT read (its PASS 6904344273 was at 185f9d4).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTjrNnh6b2BkCXFugM
Review claim (review-a, S1) · head 00cff2b · 2026-11-16T02:39Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTjrNnh6b2BkCXFugM

Review — PASS (delta)

Head-sha: 00cff2ba9051e9998f30f31fc8b4bb899ea9abba
Reviewer: review-a (areas S1 + S3) · read 2026-11-16T02:40Z · delta 185f9d42..00cff2ba: 00cff2ba (tests and changeset), plus main merge 7f475b9e (main parent dfb8ed35)
Implemented-by: session_01QsR2jVPGBoi3MCGoKbW1Hv (area S1 dispatch) · Reviewed-by: session_01QsR2jTjrNnh6b2BkCXFugM
Prior verdict: PASS 6904344273 at 185f9d4 · L2 FAIL 6904564182 (review#2) · request 6905733810 · delta report 6905706592

The gate code carries. I compared each path's net patch against its main parent with the patch at 185f9d42. sharing-plugin.ts, sharing-service.test.ts and vama-write-path-convergence.test.ts are unchanged. Only the changeset and the two operator-id-write-gate-33928 test files moved. The main merge is clean. The one main commit on a PR path is #34031's sharing-service.test.ts hunk, and this PR's own hunks in that file are the same bytes. My PASS on the code at 185f9d42 therefore holds.

The L2 findings are answered at this head:

  • M1. The PR body reads Skills-docs: follow-up #34219. docs(permissions): rls.mdx says an app update widener reaches every readable row on a predicate write, but under record sharing a predicate write is bounded by the write scope #34219 is open, and it names rls.mdx, permissions-matrix.mdx and the v17.2 migration note, which are the pages the record found untrue. The untrue sentence is gone from the changeset. The changeset still carries Clause-②: no (narrowing) and Metadata-protocol: none, and the third line is owed only by the body, so dropping it from the changeset is right.
  • S1. The new plugin-security file composes SecurityPlugin with an app writer set. Its row-level update and delete policies admit an open deal. It pins the narrowed answer and the remedy on one row: another member's open deal, read-shared to the caller, with the read asserted first. Under multi: true, { id, stage } answers no error and leaves the row. { where: { id } } then writes it, or deletes it. Both pins go red under A2 built through dist/, with the marker checked, so "row left" is the head rule's answer and not a vacuous one. plugin-security already lists plugin-sharing as a dev dependency, and the file follows the existing composed-stack pattern.
  • S2. There is a new door pin. In three shapes the engine refuses at dispatch, the member's refusal equals the system context's (code, status, message), it is never FORBIDDEN or 403, and nothing is written. A new changeset sentence states this at rule level. The engine's refusal is about the call's shape and names no row, so the changed refusal discloses nothing more about the named row.
  • N1. An $eq update of an owned row now has its own control, writing that row only. The falsy-id and empty-$in titles now say the answer is the discriminating assertion. updMany({ id: 0 }) and a falsy payload id were added to the door pin.

Contract face: the narrowing's CONTRACT_REVIEW_TIER record at this head is still owed. 6904564182 is a FAIL at 185f9d42, and the request names the L2 delta as owed. This ACCEPT read does not stand in for it.

Gates: at review time 37 success, 18 skipped, none red or pending, including the Check Changeset re-run after the body edit.

Can land once a PASS L2 delta record is on record at this head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head 00cff2b · 2026-11-16T03:02Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 00cff2ba9051e9998f30f31fc8b4bb899ea9abba
Local-runs: none
Scope: packages/plugins/plugin-sharing/src/sharing-plugin.ts, packages/plugins/plugin-sharing/src/operator-id-write-gate-33928.test.ts, packages/plugins/plugin-sharing/src/sharing-service.test.ts, packages/plugins/plugin-security/src/operator-id-write-gate-33928.test.ts, packages/plugins/plugin-security/src/vama-write-path-convergence.test.ts + packages/plugins/plugin-sharing/src/sharing-service.ts (as main's #34031 left it), packages/plugins/plugin-security/package.json, content/docs/permissions/rls.mdx, content/docs/permissions/permissions-matrix.mdx, content/docs/releases/v17/17-2.mdx, skills/** lines that name a multi: true write (cited code and docs, read, not reviewed); the changeset, the PR body and card #34219 read as the declaration face

Read at 2026-11-16T03:08Z. Delta review of this head against FAIL 6904564182 at 185f9d4; claim: comment 6906094333; no lane request (owed per check-owed-reviews). Independence: implemented in a project thread for domain:server#5; reviewed by os-tesla, who neither dispatched nor implemented it.

Everything below is derived by reading the diff, the cited code and docs at this head, the PR body, the cards and the head's check-runs. Nothing was built or run. Test counts and ablation readings quoted from the area are the area's reports, not re-run here.

① Derived judgments

What moved since 185f9d42, verified per path:

Does #34031 change a premise of this PR. No, on three counts:

  • Its rule is about which shares a non-system caller may grant through the direct-grant door. It does not change how a stored share is read by the write gate or by the bulk write scope.
  • Every share this PR's pins rely on is a manual share written under a system context, which fix(plugin-sharing)!: a share granted directly by a non-system caller is always a manual share #34031 states it leaves as it was.
  • It is a second declared narrowing on the same package, with its own changeset; both ship patch and neither text speaks for the other.

Prior findings of record 6904564182, by id:

  • M1 (the Skills-docs: none reason was not true): CLOSED. The body at this head reads Skills-docs: follow-up #34219, which is the arm the last record named as owed. docs(permissions): rls.mdx says an app update widener reaches every readable row on a predicate write, but under record sharing a predicate write is bounded by the write scope #34219 exists, is open, and names the three pages: the write-widener section of rls.mdx, the predicate-write sentence of permissions-matrix.mdx, and the v17.2 migration note that prescribes the first declared shape; it also names the by-id remedy to add there. Checked against the tree at this head: those three pages are unchanged and still read as the last record quoted them, so the follow-up is real and not already done; and no file under skills/ teaches either declared shape (the multi: true lines there are about hooks, formulas, the recycle bin and a predicate write in general), so a docs follow-up is the whole of what is owed. The untrue sentence is gone from the changeset, which no gate asks to carry that line; Check Changeset is green on this head.
  • S1 (the BREAKING arm had no pin in the tree): CLOSED. packages/plugins/plugin-security/src/operator-id-write-gate-33928.test.ts composes plugin-security with an application permission set whose row policy admits the write, and holds the narrowed answer and the remedy on one row, in one case, for update and for delete: the row is another member's, shared to the caller for reading, and the read is asserted first; the two-key multi: true write answers no error and the stored row is unchanged; the same row addressed by id alone is then written, or deleted. The second half is what keeps the first from being vacuous: the policy does admit that caller on that row. The area reports both cases red under the rule before this PR, built through dist/. The package already lists @objectstack/plugin-sharing as a dev dependency.
  • S2 (a call refused at dispatch: unpinned at the door, unsaid in the changeset): CLOSED. The changeset now says it in one rule-level sentence, and says it is refused either way. The door pin takes three such calls (a scalar id beside another key without multi, delete and update; a payload id beside a where predicate) and asserts that the member's refusal equals the system context's in code, status and message, that it is not this gate's refusal, and that every seeded row is as it was.
  • N1 (no $eq update control; falsy and empty-$in titles; two table-only falsy cases): CLOSED. An $eq update of an owned row writes that row and leaves the caller's other row and the other member's row. The two titles now name the answer as the assertion. An update with a where id of 0 and an update with a falsy payload id are in the door case.

Every predicate shape now has its refused pin and its control, and the one served-to-smaller arm has its pin beside its remedy.

Findings at this head:

No must-fix, no should-fix.

N1 (nit) — new, on the body only. The Acceptance note says all three pages "still describe the two narrowed shapes the way the old rule treated them". Only the v17.2 note names one of the shapes; rls.mdx and permissions-matrix.mdx speak of a predicate write in general. #34219 states the gap exactly, and the machine line points at it, so nothing is owed; the note could borrow the card's wording.

N2 (nit) — new. The new changeset sentence is true of this gate, which is its subject. Where another plane's gate is composed and answers first, that answer is unchanged by this PR; the sentence does not say otherwise, and a reader should not take it as a statement about the whole stack.

② Semver level

patch on @objectstack/plugin-sharing, as the changeset has it, and right: no schema, authorable key, export or wire field moves, so Metadata-protocol: none holds, and a non-protocol breaking change ships patch with its BREAKING banner and its ADR-0087 disposition.

The declaration at this head, line by line:

  • Clause-②: no (narrowing): on the body and on the changeset, the true arm, unchanged.
  • BREAKING carrier: ! on the title and the changeset summary; the BREAKING paragraph names both shapes, both consequences and the remedy. Unchanged since the last record, and the remedy is now pinned in the tree.
  • ADR-0087 marker: exactly one, not-required (no-migration-prescription), reason true, unchanged.
  • Skills-docs: follow-up #34219: present and true. This was the one line that failed the last record.
  • The dispatch-refusal sentence: new, true, and outside the BREAKING paragraph, which is right: a refusal that stays a refusal with nothing written is no narrowing.

CI at this head: 55 check-runs, all completed, 37 success and 18 skipped, none failing and none pending. Check Changeset, the PR-body guards, Test Core on all eight shards and the Dogfood Regression Gate are among the successes. Nothing is still running, so this PASS waits on no check.

③ Boundary flags

④ Design judgment

The narrowing itself was judged and accepted in the last record: one authority, the engine's dispatch, decides what a by-id write is, at the price of two spellings moving to the bulk scope, declared with a remedy. This head makes that declaration consistent with the tree: the docs line is true and the narrowed answer is pinned.

  • sharing-plugin.ts: unchanged; the earlier judgment stands.
  • plugin-sharing/src/operator-id-write-gate-33928.test.ts: the dispatch-refusal pin is the right shape. It compares the member's answer to the system context's on the same call, so it pins "the engine's own refusal" without copying the engine's message into the test, and it checks the stored rows after. The $eq control closes the one predicate shape that had a refusal and no control.
  • plugin-security/src/operator-id-write-gate-33928.test.ts: the right home, since only there is the application row policy composed; the file follows the package's existing composed-stack pattern on a real kernel. Narrowed answer and remedy on one row in one case means neither can move without the case going red. It pins the first declared shape; the falsy-id shape names no row, so it has no policy-admitted row to pin.
  • sharing-service.test.ts: the PR's hunk is unchanged; main's fix(plugin-sharing)!: a share granted directly by a non-system caller is always a manual share #34031 hunks sit beside it without overlap.
  • vama-write-path-convergence.test.ts: unchanged since the last record.
  • Changeset: rule level, no mechanism, and now free of the sentence that was not true.

CI completed before posting: 55 check-runs on this head, 37 success, 18 skipped, none failed.

Implemented-by: claude/area-A2-33928
Reviewed-by: session_01L9qibxTeW8xHnxoHxWNHWW

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv

席位核对 · ACCEPT · Head-sha: 00cff2b · 2026-11-16T03:10Z

  • Review. review-a's ACCEPT read is a delta PASS at this head (6905788062). It follows its FAIL 6898587580 and its PASS 6904344273. The gate code's net patch is byte-identical to the head that review-a passed.
  • Contract face. The PR declares Clause-②: no (narrowing), so it was reviewed at CONTRACT_REVIEW_TIER. The delta record at this head is PASS 6906185433, after FAILs 6900670881 and 6904564182. Metadata-protocol: none. The BREAKING carriers are in place:
    • ! in the title and the changeset summary;
    • the BREAKING paragraph, with both shapes, both consequences and the by-id remedy;
    • one ADR-0087 marker, not-required (no-migration-prescription).
    • The dogfood battery owed by the narrowing arm ran green on 185f9d4 (3962 passed, 42 skipped). The gate code is the same here.
  • Card relation. Fixes #33928. The seat's terms are met: the branch follows the engine's own dispatch, and the narrowing is declared and pinned beside its remedy. The docs follow-up is docs(permissions): rls.mdx says an app update widener reaches every readable row on a predicate write, but under record sharing a predicate write is bounded by the write scope #34219 (Skills-docs: follow-up #34219).
  • Changeset sentences checked against the diff (.changeset/33928-operator-id-write-gate.md):
    • The gate takes its by-id or bulk branch from the engine's dispatch decision.
    • A by-id write is judged by id as before.
    • Every predicate write, $in/$eq on id included, meets the bulk write scope and answers no error.
    • An owned multi-row delete or update on a private/public_read object with owner_id now lands.
    • A call the engine refuses at dispatch gets the engine's own refusal, and nothing is written.
    • The BREAKING shapes are a scalar where.id beside another key under multi, and a falsy id.
    • The two consequences are: a refused row is left with no error, and a row admitted only through an app row policy is not written.
    • The remedy is to address the row by id alone.
    • Each sentence matches sharing-plugin.ts engineByIdTarget and the real-stack pins in both card-named files, plus the 30-row dispatch table.
    • No content/docs file is in the diff.
  • Governed. check-governed-merges --pr 34033 reads NOT governed: 0 of 6 paths, +693/−17.
  • Base. The Test Core affected-set diff base is 98a4449f. K is 8 first-parent commits to origin/main b8456ebd, which is below 15, so no branch update is owed.
  • Checks on this head. 37 success, 18 skipped (path-filtered), 0 red, 0 pending. Lint & Repo Gates and TypeScript Type Check both succeed. The mergeable state is clean.
  • Landing. Area S1 lands it, on the maintainer's line in the area thread (2026-11-15T11:06Z). pr_ready and automerge_enable follow in this stroke.

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/l 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