Skip to content

Commit c47e4ea

Browse files
fix(plugin-sharing)!: the write gate judges by id exactly the writes the engine runs by id (#34033)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbSUQWB2j9eHYsRcrCiq1X1C)_ Fixes #33928 Clause-②: no (narrowing) Metadata-protocol: none Skills-docs: follow-up #34219 ## 维护者速读 - **改了什么:** 共享写入闸门按 id 判还是按批量范围判,改为直接采用引擎自己的分派结论:引擎按 id 写的按 id 判,其余一律套用已有的可写行范围。 - **为什么改:** 成员用 `$in` 批量删改自己的记录在私有对象上一律 403,还挡住了 #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** (#33699 / PR #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. <details><summary>Base against head on a composed stack (plugin-security + plugin-sharing), the narrowing measured</summary> 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. </details> <details><summary>Green, ablation and S2 runs (local, under the verify lock, head `00cff2ba9`)</summary> 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. </details> ## 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 <details><summary>Derived gates and declarations</summary> - `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. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QsR2jVPGBoi3MCGoKbW1Hv <!-- signed: domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 01598d9 commit c47e4ea

6 files changed

Lines changed: 693 additions & 17 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
'@objectstack/plugin-sharing': patch
3+
---
4+
5+
fix(plugin-sharing)!: the write gate judges by id exactly the writes the engine runs by id
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: none
9+
10+
<!-- adr-0087: 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 -->
11+
12+
The sharing write gate now takes its by-id or bulk branch from the engine's own dispatch decision for the write's options. A write the engine runs by id is judged by id, as before. Every other write is one the engine runs as a predicate, an `$in` or `$eq` on `id` included, and it meets the bulk write scope: it writes the rows the caller may update or delete, leaves the others as they were, and answers no error.
13+
14+
A member's multi-row delete or update of rows it owns, on a `private` or `public_read` object with an `owner_id`, now lands where it answered 403 FORBIDDEN.
15+
16+
A call the engine refuses at dispatch (for example a scalar `where.id` beside another key without `multi: true`, or a payload `id` beside a `where` predicate) 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.
17+
18+
**BREAKING** for a caller of a multi-row (`multi: true`) update or delete in one of two shapes, both of which the engine runs as a predicate and the gate now judges as one:
19+
20+
- a `where` that carries a scalar `id` beside another key;
21+
- an `id` that is falsy (`''` or `0`).
22+
23+
Such a write meets the bulk write scope instead of the by-id judgment:
24+
25+
- a row the caller may not write is left as it was, and the write answers no error where it answered 403 FORBIDDEN;
26+
- a row the caller may write only because an application row-level policy widens the sharing scope for it (the by-id judgment's deferral to such a policy) is no longer written by these two shapes, as for every other predicate write.
27+
28+
To write such a row, address it by id alone (`where: { id }`, or the payload `id`): that write is judged by id, as before.
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* The declared narrowing of the sharing write gate, with plugin-security composed in.
5+
*
6+
* Under `multi: true`, a scalar `where.id` beside another `where` key is a write
7+
* the engine runs as a predicate. The sharing write gate judges it by the bulk
8+
* write scope, as it judges every predicate write, and not by id.
9+
*
10+
* Two answers are pinned on the same row, side by side:
11+
*
12+
* - the narrowed answer: a row the caller may write only because an
13+
* application row-level policy widens the sharing scope for it is not
14+
* written by that shape, and the write answers no error;
15+
* - the remedy: the same row, addressed by id alone, is judged by id and
16+
* written.
17+
*
18+
* Real stack: an `ObjectKernel` with `ObjectQLPlugin` over better-sqlite3, the
19+
* platform permission sets plus an application writer set with a row-level
20+
* update/delete policy, `SecurityPlugin` and `SharingServicePlugin`.
21+
*/
22+
23+
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
24+
import { ObjectKernel, type Plugin, type PluginContext } from '@objectstack/core';
25+
import { ObjectQL, ObjectQLPlugin } from '@objectstack/objectql';
26+
import { SqlDriver } from '@objectstack/driver-sql';
27+
import { SharingServicePlugin } from '@objectstack/plugin-sharing';
28+
import { SysMember, SysOrganization, SysUser } from '@objectstack/platform-objects/identity';
29+
import { PermissionSetSchema } from '@objectstack/spec/security';
30+
import { SecurityPlugin } from './security-plugin.js';
31+
import { defaultPermissionSets } from './objects/default-permission-sets.js';
32+
33+
const ORG = 'org_opidc';
34+
const ME = 'usr_opidc_me';
35+
const OTHER = 'usr_opidc_other';
36+
/** Owner-scoped (`private` OWD with an `owner_id`): record sharing enforces on it. */
37+
const DEAL = 'qa_opidc_deal';
38+
39+
const CRUD = { allowRead: true, allowCreate: true, allowEdit: true, allowDelete: true } as const;
40+
/** The application's writer set: a row-level policy admits an update or delete of any `open` deal. */
41+
const WRITER = PermissionSetSchema.parse({
42+
name: 'qa_opidc_writer',
43+
objects: { [DEAL]: CRUD },
44+
rowLevelSecurity: [
45+
{ name: 'qa_opidc_open_updates', object: DEAL, operation: 'update', using: "stage == 'open'" },
46+
{ name: 'qa_opidc_open_deletes', object: DEAL, operation: 'delete', using: "stage == 'open'" },
47+
],
48+
});
49+
50+
const SYSTEM = { isSystem: true, tenantId: ORG } as const;
51+
const SYS = { context: SYSTEM } as never;
52+
const asCaller = () => ({ userId: ME, tenantId: ORG, positions: [], permissions: [WRITER.name] });
53+
54+
type Outcome = { kind: 'landed' } | { kind: 'refused'; code?: string; status?: number };
55+
const outcomeOf = (p: Promise<unknown>): Promise<Outcome> =>
56+
p.then(
57+
() => ({ kind: 'landed' as const }),
58+
(e: { code?: unknown; status?: unknown; statusCode?: unknown } | null) => {
59+
const status = e?.statusCode ?? e?.status;
60+
return {
61+
kind: 'refused' as const,
62+
code: e?.code == null ? undefined : String(e.code),
63+
status: status == null ? undefined : Number(status),
64+
};
65+
},
66+
);
67+
68+
function sqliteDriverPlugin(): Plugin {
69+
return {
70+
name: 'test.driver.sqlite',
71+
type: 'standard',
72+
version: '1.0.0',
73+
async init(ctx: PluginContext) {
74+
ctx.registerService(
75+
'driver.default',
76+
new SqlDriver({ client: 'better-sqlite3', connection: { filename: ':memory:' }, useNullAsDefault: true }),
77+
);
78+
},
79+
};
80+
}
81+
82+
function objectsPlugin(): Plugin {
83+
return {
84+
name: 'test.objects',
85+
type: 'standard',
86+
version: '1.0.0',
87+
dependencies: ['com.objectstack.engine.objectql'],
88+
async init(ctx: PluginContext) {
89+
ctx.getService<{ register(m: unknown): unknown }>('manifest').register({
90+
id: 'test.operator-id-write-gate-composed',
91+
namespace: 'qa_opidc',
92+
version: '1.0.0',
93+
type: 'plugin',
94+
name: 'Operator id write gate, composed',
95+
objects: [
96+
SysUser, SysMember, SysOrganization,
97+
{
98+
name: DEAL,
99+
label: 'Deal',
100+
sharingModel: 'private',
101+
fields: {
102+
name: { type: 'text', label: 'Name' },
103+
stage: { type: 'text', label: 'Stage' },
104+
owner_id: { type: 'lookup', reference: 'sys_user', label: 'Owner' },
105+
},
106+
},
107+
],
108+
});
109+
},
110+
};
111+
}
112+
113+
describe('sharing write gate with plugin-security: a scalar id beside another key under multi meets the bulk scope; by id alone it is judged by id', () => {
114+
let kernel: ObjectKernel;
115+
let ql: ObjectQL;
116+
117+
beforeAll(async () => {
118+
kernel = new ObjectKernel({ logger: { level: 'silent' } } as never);
119+
await kernel.use(sqliteDriverPlugin());
120+
await kernel.use(new ObjectQLPlugin());
121+
await kernel.use(objectsPlugin());
122+
await kernel.use(new SecurityPlugin({
123+
defaultPermissionSets: [...defaultPermissionSets, WRITER],
124+
fallbackPermissionSet: 'member_default',
125+
}));
126+
await kernel.use(new SharingServicePlugin({ registerShareLinkRoutes: false }));
127+
await kernel.bootstrap();
128+
ql = kernel.getService<ObjectQL>('objectql');
129+
130+
await ql.insert('sys_organization', { id: ORG, name: 'Acme', slug: 'acme' }, SYS);
131+
for (const userId of [ME, OTHER]) {
132+
await ql.insert('sys_user', { id: userId, name: userId, email: `${userId}@acme.test`, email_verified: true }, SYS);
133+
await ql.insert('sys_member', { user_id: userId, organization_id: ORG, role: 'member' }, SYS);
134+
}
135+
}, 120_000);
136+
137+
afterAll(async () => {
138+
if (kernel) await Promise.race([kernel.shutdown(), new Promise<void>((r) => setTimeout(r, 10_000))]);
139+
}, 30_000);
140+
141+
const stored = async (id: string) =>
142+
((await ql.find(DEAL, { where: { id }, context: SYSTEM } as never)) as Array<{ name?: string }>)[0] ?? null;
143+
144+
/**
145+
* Another member's `open` deal, shared to the caller for reading only. Record
146+
* sharing does not let the caller write it; the application's row-level
147+
* policy does.
148+
*/
149+
const seedPolicyAdmittedRow = async (id: string) => {
150+
await ql.insert(DEAL, { id, owner_id: OTHER, created_by: OTHER, stage: 'open', name: 'seed' }, SYS);
151+
await ql.insert('sys_record_share', {
152+
object_name: DEAL, record_id: id, recipient_type: 'user', recipient_id: ME,
153+
access_level: 'read', source: 'manual',
154+
}, SYS);
155+
expect(await ql.findOne(DEAL, { where: { id }, context: asCaller() } as never)).toMatchObject({ id });
156+
};
157+
158+
it('update: the two-key predicate answers no error and leaves the row; the same row by id alone is written', async () => {
159+
await seedPolicyAdmittedRow('u_1');
160+
161+
const narrowed = await outcomeOf(
162+
ql.update(DEAL, { name: 'by_predicate' }, { where: { id: 'u_1', stage: 'open' }, multi: true, context: asCaller() } as never),
163+
);
164+
expect(narrowed).toEqual({ kind: 'landed' });
165+
expect(await stored('u_1')).toMatchObject({ name: 'seed' });
166+
167+
const byId = await outcomeOf(ql.update(DEAL, { name: 'by_id' }, { where: { id: 'u_1' }, context: asCaller() } as never));
168+
expect(byId).toEqual({ kind: 'landed' });
169+
expect(await stored('u_1')).toMatchObject({ name: 'by_id' });
170+
});
171+
172+
it('delete: the two-key predicate answers no error and leaves the row; the same row by id alone is deleted', async () => {
173+
await seedPolicyAdmittedRow('d_1');
174+
175+
const narrowed = await outcomeOf(
176+
ql.delete(DEAL, { where: { id: 'd_1', stage: 'open' }, multi: true, context: asCaller() } as never),
177+
);
178+
expect(narrowed).toEqual({ kind: 'landed' });
179+
expect(await stored('d_1')).not.toBeNull();
180+
181+
const byId = await outcomeOf(ql.delete(DEAL, { where: { id: 'd_1' }, context: asCaller() } as never));
182+
expect(byId).toEqual({ kind: 'landed' });
183+
expect(await stored('d_1')).toBeNull();
184+
});
185+
});

‎packages/plugins/plugin-security/src/vama-write-path-convergence.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,9 @@ describe('[#4647] VAMA holder + private OWD + ownerless record — explain vs. t
392392
await expect(makeEngine().delete('crm_contract', { id: OWNERLESS.id })).rejects.toThrow(
393393
ENGINE_DELETE_REJECT_MESSAGE,
394394
);
395-
// The asymmetry that let it hide for so long: plugin-sharing's
396-
// `inferTargetId` DOES accept `options.id`, so `canDelete` kept running and
397-
// kept answering — one of the two gates, doing the work of two.
395+
// `canDelete` itself still answers for the row: the sharing write gate
396+
// takes its by-id branch from the engine's own dispatch decision, so it
397+
// judges by id only what the engine writes by id, and this bag is not one.
398398
expect(await stack.sharing.canDelete('crm_contract', OWNERLESS.id, MEMBER_CTX as any)).toBe(false);
399399
});
400400

0 commit comments

Comments
 (0)