Skip to content

Commit 3c2fb32

Browse files
perf(objectql): drop a required master's parent chain for a View All reader over unrestricted hops (#33897)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbSUQWB2j9eHYsRcrCiq1X1C)_ **Do not land before #33820 (ADR-0139 status-line amendment) merges.** ## 维护者速读 - 改了什么:对"受控于父对象"且主从字段必填的明细对象,只有同时持有明细"查看全部"、且每一级主对象读取范围都不受限的读者(典型是单租户管理员),读取时不再带父链子查询;其他读者完全不变;所有写操作(条件更新/删除、按 id 写、钩子里的读取)仍带父链,行为与 main 完全一致。 - 为什么改:这类读者的父链子查询挡不住任何有主记录的行,只拖慢管理员的列表、计数和汇总(卡上 1M 行实测快 29% 到 42%,本 PR 未重测)。 - 风险与回滚:该类读者的合计、计数、汇总可能包含孤儿行(主记录缺失或为空的明细),这是维护者裁决接受的;限制读者、仅有明细查看全部的读者、普通成员仍看不到孤儿行;回滚即 revert 本 PR。 - 先看:`engine-readable-ids-permission-formula.ts` 第 5 步、`readerViewsAllOf` 与 `READABLE_IDS_WRITE_IN_FLIGHT`;`engine-middleware-and-context.ts` 新增的写作用域;`security-plugin-cbp-read-filter.test.ts` 的反向钉子与写路径钉子。 - 两分钟验证:`pnpm --filter @objectstack/plugin-security exec vitest run --maxWorkers=2 src/security-plugin-cbp-read-filter.test.ts`,预期 12 个测试全绿。 - 需要你做的:等 #33820(ADR-0139 状态行修订)合并后再合并本 PR。 Fixes #33696 Clause-②: no Metadata-protocol: none ## Ruling Ruling record 6893666857 (replaces 6893097935), quoted verbatim as it binds this card: > - The parent chain is dropped only for a reader who holds view-all on the detail AND whose every master hop answers unrestricted (the engine's per-hop scope, not `hasSuperuserReadBypass`), with a required master FK. That reader sees null and dangling-FK rows inside its own tenant wall, consistent with #30905 ruling A. Every other reader, members included, keeps the chain unchanged. > - This deliberately lifts #24932 ruling B item 4 and ADR-0139 D6's ⛔ for that reader class only. **The PR must not land before the ADR-0139 status-line amendment** (citing this record; ADR-0055's 10-22 note in step) merges. That amendment is a docs/adr/** card for the skills lane, which the seat files. > - Pins: the three controlled-by-parent-leaf-switch tests are rewritten for the view-all + unrestricted reader. Reverse pins stay: a reader with a restricted master hop, and a reader with view-all on the detail only, still never see null or dangling rows. > - Release note: totals, counts and aggregates for that reader may include orphan rows. A follow-up card to close the orphan sources (option B of the original request) is owed as the PR's one loose-ends card. > - Multi-tenant deployments: a tenant admin's master scope is the tenant wall, so it is not unrestricted. No speed-up there, by design; widening that is a separate decision. ## Review 6895328067: route (a), write doors unchanged The review found that the drop reached the write doors. The security plugin's predicate-write narrowing, its 2.8 gate's predicate leg and its step-2.7 by-id read all ask `ql.find`/`findOne` under the caller's context. The seat ruled route (a), claim amendments 6895345175 and 6895620230: the write paths stay byte-identical to main. A write's middleware chain now runs inside an engine async scope, and step 5 drops nothing inside it. No plugin-security write-door source file changes. ## What changes - `packages/objectql/src/engine-readable-ids-permission-formula.ts`: `composeReadableIdsChain` gains step 5. A leaf over the REQUIRED master of a `controlled_by_parent` object, in an AND position and as the whole comparand of a `$in` on its `master_detail` field, is dropped instead of composed. Two conditions must both hold: - the master's answered scope is `undefined` (admitted, no row condition), per hop: a nested scope left empty once its own leaves are dropped answers `undefined`, so a chain drops whole only when every hop is unrestricted; - the caller holds View All (`viewAllRecords` or `modifyAllRecords`) on the detail, read from `ISecurityService.getEffectiveObjectPermissions` (`readerViewsAllOf`, asked once per read). A delegated caller, a service without that member, or a call that throws keeps the chain. A failure costs the subquery, never a row. An optional master, a leaf inside `$or` or `$not`, and every non-`controlled_by_parent` object compose exactly as before. - `packages/objectql/src/engine-middleware-and-context.ts`: **approved widening** (claim amendment 6895620230, `executeWithMiddleware` only, +4/−1). For a write-epoch operation (insert, update, delete, purge, restore), the middleware chain runs inside `READABLE_IDS_WRITE_IN_FLIGHT`, an `AsyncLocalStorage` exported from `engine-readable-ids-permission-formula.ts`. `readerViewsAllOf` answers false inside it, so every read made while a write runs keeps the chain: the security write-door reads, hook reads and cascade reads. It is an async scope rather than a context stamp, for the reason `SecurityPlugin.engineOperationScope` gives: a context is shared and spread across those very reads. - `packages/objectql/src/engine.ts`: **approved widening** (coordinator, 2 lines). The private `composeReadableIdsChain` host literal gains a `_registry` getter, the same getter shape the neighbouring host literals use. - `packages/plugins/plugin-security/src/security-plugin.ts`: a prose-only paragraph in the `computeControlledByParentFilter` docblock (review should-fix 2). It says the drop is read-only and that write paths keep the chain. - `packages/plugins/plugin-security/src/security-plugin-cbp-read-filter.ts`: a docblock paragraph only. The leaf is still written for every caller, and the engine drops it. View All on the detail alone never drops it. - `packages/plugins/plugin-security/src/controlled-by-parent-leaf-switch.test.ts`: **approved widening**. The existing pins are unchanged. A new reader (View All on the account, contact, quote and line objects) gets legs in the three leaf-switch tests, and those legs see the dangling and null rows and run one statement with no `in (select`. - `.changeset/33696-drop-unrestricted-cbp-chain.md`: patch for `@objectstack/objectql`, with the ruling's release-note sentence. Perf, the card's measurement, not re-run here (1M rows): page SQLite 397 to 281 ms, PG 97 to 56 ms; total SQLite 217 to 136 ms, PG 78 to 54 ms. ## Tests Pins on a real stack (`security-plugin-cbp-read-filter.test.ts`: ObjectQL, SqlDriver on better-sqlite3, the real SecurityPlugin and SharingService, orphan rows seeded through the driver), 8 tests: - (a) View All on the detail over unrestricted hops: no parent-chain subquery, every stored row including the orphans, count 7, `findOne` of a dangling row. Plus parity on the rows whose chain resolves, and the analytics door (the `getReadFilter` scope passed as `where`) composing the same way. - (b) a reader with a restricted master hop keeps the whole chain and sees no orphan. - (c) a reader with View All on the detail only keeps the whole chain and sees no orphan. - (d) a plain member keeps the chain over a restricted master and over an unrestricted (`public_read_write`) one. The admin control on the same object drops it. - (e) isolated tenancy: org A and org B never read each other's rows, and the tenant wall keeps the chain. - An optional master keeps its leaf. Write-door pins (review 6895328067, route (a)), in the same file, 4 tests. The View All admin reads over unrestricted hops, and the set it writes holds orphans: - a hook's read inside a write, under the caller's context, keeps the chain and sees no orphan (control: the same caller's plain read drops it); - a predicate delete over a set holding an empty-required-master orphan lands on the other row and leaves the orphan; - a predicate update over a set holding an empty-master orphan and a dangling-master orphan lands on the other row and leaves both; - a by-id update of a dangling orphan and a by-id delete of an empty-master orphan both still answer `RECORD_NOT_FOUND` / 404. Measured on head 2c6025c's objectql source (the three objectql files set back to 2c6025c, then restored with `git diff HEAD` empty), all 4 are red: | Pin | Red on 2c6025c | |---|---| | hook read | it sees the 4 orphans (`line_a_ghost`, `line_a_ghost_account`, `line_a_null`, `line_b_ghost`) | | predicate delete | refused: `MISSING_REQUIRED_FIELD` / 422 | | predicate update | refused: `MISSING_REQUIRED_FIELD` / 422 | | by-id write | refused: `PERMISSION_DENIED` / 403, not `RECORD_NOT_FOUND` / 404 | On origin/main's objectql source, the 3 write pins pass and the hook pin's write leg passes. Its plain-read control leg fails there, as it should, because main drops nothing. Ablations (`ablation-replace`, every restore checked as blob == HEAD): - deleting the `READABLE_IDS_WRITE_IN_FLIGHT` guard in `readerViewsAllOf` turns all 4 red; - running a write's chain outside the scope in `executeWithMiddleware` turns all 4 red. Unit pins (`engine-readable-ids-nested-composition.test.ts`, a new describe, 17 tests in the file): the drop at the root, in an `$and` and in a merged-key position; a restricted hop keeps both leaves; `$or`, optional and non-cbp positions compose; five kinds of caller without View All on the detail keep the chain (no View All, View All on another object, no service member, a service that throws, delegated); a non-readable master gives `$in: []`. Ablations, on the committed implementation (`node scripts/ablation-replace.mjs`, every restore proven `blob == HEAD 8ec17d5` and `git diff HEAD` empty): | Mutation | Real-stack pins red | Unit pins red | |---|---|---| | per-hop check removed (drop whenever the master answered) | (b), (c) | restricted hop keeps; caller without View All keeps | | `readerViewsAllOf` answers `true` | (d) | caller without View All keeps | | step 5 disabled | (a), parity, analytics, (d) admin control | drop at root and `$and`; `$or`/optional/non-cbp | <details><summary>Full suites</summary> Runs were under `scripts/pm/os-verify-lock.sh`, with each exit captured before any pipe. On head `df3fb3b9` (the implementation plus origin/main at c59198f, which includes #33884's step-2.8 changes): - `@objectstack/plugin-security`: `pnpm test` exit 0, 269/269 files, 6705 passed and 45 skipped. `typecheck` exit 0. - `@objectstack/objectql`: `pnpm test` exit 0, 598/598 files, 13238 tests. `typecheck` exit 0. On head `3089656f` (the same implementation, one main merge earlier), the direct runtime dependents of objectql, after `pnpm --filter 'PKG^...' build` (exit 0). All exits 0: - example-embed-objectql 1/1 files, 2 tests - plugin-audit 94/94, 1541 - plugin-email 53/53, 1018 - plugin-pinyin-search 4/4, 39 - plugin-sharing 74/74, 1525 - plugin-webhooks 25/25, 307 - runtime 605/605, 10958 (19 skipped) - scenarios 34/34, 859 - service-automation 282/282, 3982 - cloud-connection 82/82, 1224 - example-todo 9/9, 249 - plugin-dev 10/10, 89 - verify 52/52, 439 - cli `vitest run --project unit` 422/422 files, 6002 tests The second main merge touches none of this PR's files. Packages that depend on objectql only as a devDependency, the cli integration tier, and dogfood are left to CI. The PR title has no `!`, so the full dogfood battery is not owed. </details> ## Acceptance notes - Loose-ends card owed (the ruling's one): stop orphan rows at their sources (option B of the original request). Measured sources: a system-context insert or update that names a missing master is stored (the documented residual in `engine-referential-integrity.ts`), and promoting an optional master to required leaves rows with a NULL foreign key. The seat files it. - #33820 (skills lane) carries the ADR-0139 status-line amendment. This PR does not touch `docs/adr/**`. - Under walled tenancy the tenant admin's master scope carries the Layer-0 tenant equality, so nothing is dropped there, by design. Pin (e) measures this. - Open PR #33652 (another seat) edits the same function in `engine-readable-ids-permission-formula.ts`: the import line and the final `composeReadableIdsLeaves` call. The two PRs conflict as text, and whichever lands second rebases. They do not conflict in meaning. Its planned relation-semi-join leaves are never asked into `chain.answers`, and step 5 drops only a leaf whose master has an answer, so it leaves them alone. #33703 touches `engine.ts` far from this literal. ## Verification - At head `df3fb3b9`, `dispatch-gates --commands --repo objectstack-ai/objectstack` derived 77 gate families. - 74 of them ran locally, every one exit 0. `--ran` reconciliation: "77 derived, 74 run, 0 NOT-MEASURED, 3 UNRUN". The 3 are whole-repo families left to CI: `check:i18n`, `check:dual-build-cjs-loads`, `check:type-check-debt`. - `node scripts/check-nul-bytes.mjs` exit 0. `pnpm lint` (whole-repo eslint) is left to CI. - `git merge-tree --write-tree --name-only` from `df3fb3b9`: - origin/main: clean. Main is now 18 commits ahead, and none of them touches this PR's files. - #33887 (`engine-middleware-and-context.ts`, its `claimReferentialCascadeDelete`): clean. This PR's hunk stays inside `executeWithMiddleware`. - #33884: merged into main as c59198f and included in this head. - #33652: conflicts in `engine-readable-ids-permission-formula.ts`, in two hunks: the import block and the step-5 / final `composeReadableIdsLeaves` lines. That overlap was known before. The two changes do not conflict in meaning, and whichever lands second rebases. --- 🤖 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> Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
1 parent 385ea1c commit 3c2fb32

9 files changed

Lines changed: 844 additions & 10 deletions
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
'@objectstack/objectql': patch
3+
---
4+
5+
Clause-②: no
6+
Metadata-protocol: none
7+
8+
perf(objectql): a `controlled_by_parent` read no longer carries the parent-chain subquery for a
9+
reader who holds View All on the detail and whose scope is unrestricted at every master hop, when the
10+
detail's `master_detail` is required.
11+
12+
For that reader (an admin with View All on the detail and on every object of the chain, under a
13+
posture whose read scope adds no row condition), the engine's `ReadableIds` composition drops the
14+
required master's leaf (`fk IN (SELECT id FROM master …)`) instead of compiling it. Admin lists,
15+
counts and aggregates on detail objects run one subquery fewer per hop.
16+
17+
Behaviour change, by maintainer ruling: totals, counts and aggregates for that reader may include
18+
orphan rows, which are detail rows whose required master is missing or empty (rows that a
19+
system-context write or a schema change left behind), inside the reader's own tenant wall. Every
20+
other reader keeps the whole chain and sees exactly what it saw before. That includes a reader with
21+
any restricted hop, a reader with View All on the detail only, and a plain member. An optional master
22+
keeps its leaf. Under walled tenancy a tenant admin's master scope is the tenant wall, so nothing is
23+
dropped there.
24+
25+
Writes are unchanged. Every read a write makes while it runs keeps the chain: the security checks on a
26+
predicate or by-id update or delete, and a hook's reads. An orphan therefore stays outside every
27+
write, exactly as before.

‎packages/objectql/src/engine-middleware-and-context.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import type { IPubSub } from '@objectstack/spec/contracts';
3838
import { redactPropagatedDriverFault } from '@objectstack/types';
3939
import type { ExecutionContext } from '@objectstack/spec/kernel';
4040
import { isWriteEpochOperation } from './write-epoch.js';
41+
import { READABLE_IDS_WRITE_IN_FLIGHT } from './engine-readable-ids-permission-formula.js';
4142
import { bridgeAuthzInvalidation } from './authz-invalidation-bridge.js';
4243
import { isMissingTableError } from '@objectstack/metadata/errors';
4344
import { ORGANIZATION_OBJECT, SystemWriteOrganizationRequiredError, carriesOrganization, resolveSystemWriteOrganization, resolveTenantFieldName, type SystemWriteOrganizationDecision } from './tenancy/system-write-organization.js';
@@ -160,7 +161,9 @@ export class MiddlewareAndContextFacet {
160161
}
161162
};
162163

163-
await next();
164+
// [#33696] A write's chain runs inside the write scope: its reads keep the chain.
165+
if (isWriteEpochOperation(ctx.operation)) await READABLE_IDS_WRITE_IN_FLIGHT.run(true, next);
166+
else await next();
164167
return ctx.result;
165168
}
166169

‎packages/objectql/src/engine-readable-ids-nested-composition.test.ts‎

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,3 +409,132 @@ describe('[ADR-0139 D6 as amended] a leaf inside a composed scope is composed to
409409
expect(outer.scope).toBe(scope);
410410
});
411411
});
412+
413+
// ── [#33696 · ruling record 6893666857] step 5: the required master's leaf over an unrestricted master ──
414+
//
415+
// A leaf over the REQUIRED master of a `controlled_by_parent` object, the whole
416+
// comparand of a `$in` on that master field in an AND position, is dropped when
417+
// the master's answered scope is unrestricted AND the caller holds View All on
418+
// that object (the security service's effective object-permission map); a
419+
// scope left empty by the drop is unrestricted itself, so a chain drops whole
420+
// only when every hop is. Every other position, an optional master, a
421+
// restricted hop, a caller without View All, a delegated caller, a service
422+
// without the map or one whose map throws, and a leaf on an object that is not
423+
// `controlled_by_parent` compose exactly as before. The rows this
424+
// serves are measured on the real stack in `@objectstack/plugin-security`
425+
// (`security-plugin-cbp-read-filter.test.ts`).
426+
describe('[#33696 ruling 6893666857] the required master\'s leaf over an unrestricted master is dropped, nowhere else', () => {
427+
let engine: ObjectQL;
428+
let calls: SeenCall[];
429+
430+
const cbp = (name: string, fk: string, master: string, required: boolean) => ({
431+
name,
432+
label: name,
433+
sharingModel: 'controlled_by_parent',
434+
fields: {
435+
name: { name: 'name', type: 'text' },
436+
[fk]: { name: fk, type: 'master_detail', reference: master, required },
437+
},
438+
});
439+
const ACCOUNT = { name: 'rid_r4_account', label: 'Account', fields: { owner: { name: 'owner', type: 'text' } } };
440+
const OPP = cbp('rid_r4_opp', 'account', 'rid_r4_account', true);
441+
const LINE = cbp('rid_r4_line', 'opp', 'rid_r4_opp', true);
442+
const NOTE = cbp('rid_r4_note', 'opp', 'rid_r4_opp', false);
443+
/** The leaf the controlled-by-parent derivation answers for a detail over `master` on `fk`. */
444+
const leafOn = (fk: string, master: string) => ({ [fk]: { $in: ReadableIds.of(master) } });
445+
/** View All on every detail: the effective map a security service answers for an administrator. */
446+
const VIEW_ALL_DETAILS = { rid_r4_opp: { viewAllRecords: true }, rid_r4_line: { viewAllRecords: true }, rid_r4_note: { modifyAllRecords: true } };
447+
/**
448+
* The service of the chain: the opportunity's scope is its leaf over the
449+
* account; the account's is `accountScope`; the caller's effective map is
450+
* `effective` (`null`: the service has no such member; a function: its answer).
451+
*/
452+
const chain = (accountScope: unknown, effective: unknown = VIEW_ALL_DETAILS) => {
453+
const security = makeSecurity({
454+
scope: (object) => (object === 'rid_r4_opp' ? leafOn('account', 'rid_r4_account') : object === 'rid_r4_account' ? accountScope : undefined),
455+
});
456+
if (effective !== null) {
457+
security.svc.getEffectiveObjectPermissions = async (context?: unknown) => {
458+
security.asked.push('getEffectiveObjectPermissions');
459+
return typeof effective === 'function' ? (effective as (c: unknown) => unknown)(context) : effective;
460+
};
461+
}
462+
return security;
463+
};
464+
const whereOf = async (object: string, where: Record<string, unknown>, context: unknown = { userId: 'u1' }) => {
465+
calls.length = 0;
466+
await engine.find(object, { where, context: context as any });
467+
expect(calls.map((c) => c.verb)).toEqual(['find']);
468+
return calls[0].ast.where;
469+
};
470+
471+
beforeEach(async () => {
472+
const rec = makeRecordingDriver();
473+
calls = rec.calls;
474+
engine = new ObjectQL();
475+
engine.registerDriver(rec.driver, true);
476+
await engine.init();
477+
for (const def of [ACCOUNT, OPP, LINE, NOTE, CHILD, PARENT]) engine.registry.registerObject(def as any, 'test');
478+
calls.length = 0;
479+
});
480+
481+
it('every hop unrestricted: the leaf at the root, and as an `$and` member, is dropped; the masters are still asked', async () => {
482+
const { svc, asked } = chain(undefined);
483+
wire(engine, () => svc);
484+
expect(await whereOf('rid_r4_line', leafOn('opp', 'rid_r4_opp'))).toEqual({});
485+
// The effective map is asked once per read, and only once a leaf could be dropped.
486+
expect(asked).toEqual([
487+
'canReadObject:rid_r4_opp', 'getReadFilter:rid_r4_opp', 'canReadObject:rid_r4_account', 'getReadFilter:rid_r4_account',
488+
'getEffectiveObjectPermissions',
489+
]);
490+
expect(await whereOf('rid_r4_line', { $and: [{ name: 'x' }, leafOn('opp', 'rid_r4_opp')] })).toEqual({ $and: [{ name: 'x' }] });
491+
expect(await whereOf('rid_r4_line', { name: 'x', ...leafOn('opp', 'rid_r4_opp') })).toEqual({ name: 'x' });
492+
});
493+
494+
it('a restricted hop keeps the whole chain: the outer leaf composed, the inner one too', async () => {
495+
const accountScope = { owner: 'u1' };
496+
const { svc } = chain(accountScope);
497+
wire(engine, () => svc);
498+
const outer = (await whereOf('rid_r4_line', leafOn('opp', 'rid_r4_opp'))).opp.$in;
499+
expect(isComposedReadableIds(outer)).toBe(true);
500+
expect(outer.object).toBe('rid_r4_opp');
501+
expect(isComposedReadableIds(outer.scope.account.$in)).toBe(true);
502+
expect(outer.scope.account.$in.scope).toBe(accountScope);
503+
});
504+
505+
it('an `$or` position, an OPTIONAL master and an object that is not controlled_by_parent compose as before', async () => {
506+
const { svc } = chain(undefined);
507+
wire(engine, () => svc);
508+
const or = await whereOf('rid_r4_line', { $or: [leafOn('opp', 'rid_r4_opp'), { name: 'x' }] });
509+
expect(isComposedReadableIds(or.$or[0].opp.$in)).toBe(true);
510+
const optional = await whereOf('rid_r4_note', leafOn('opp', 'rid_r4_opp'));
511+
expect(isComposedReadableIds(optional.opp.$in)).toBe(true);
512+
// The master's own leaf was dropped, so its composed scope is unrestricted.
513+
expect(optional.opp.$in.scope).toBeUndefined();
514+
const plain = await whereOf('rid_child', branch('rid_parent'));
515+
expect(isComposedReadableIds(plain.record_id.$in)).toBe(true);
516+
});
517+
518+
it('a caller without View All on the detail keeps the whole chain, whatever the hops answer', async () => {
519+
for (const [label, effective, context] of [
520+
['no View All on any detail', { rid_r4_line: { allowRead: true }, rid_r4_opp: { allowRead: true } }, { userId: 'u1' }],
521+
['View All on the read detail only', { rid_r4_line: { viewAllRecords: true } }, { userId: 'u1' }],
522+
['a service without the effective map', null, { userId: 'u1' }],
523+
['an effective map that throws', () => { throw new Error('resolution is down'); }, { userId: 'u1' }],
524+
['a delegated caller', VIEW_ALL_DETAILS, { userId: 'agent', onBehalfOf: { userId: 'u1' } }],
525+
] as const) {
526+
const { svc } = chain(undefined, effective);
527+
wire(engine, () => svc);
528+
const outer = (await whereOf('rid_r4_line', leafOn('opp', 'rid_r4_opp'), context)).opp.$in;
529+
expect(isComposedReadableIds(outer), label).toBe(true);
530+
expect(isComposedReadableIds(outer.scope.account.$in), label).toBe(true);
531+
expect(outer.scope.account.$in.scope, label).toBeUndefined();
532+
}
533+
});
534+
535+
it('a master the caller may not read keeps the leaf, answered `$in: []`', async () => {
536+
const { svc } = makeSecurity({ canRead: (object) => object !== 'rid_r4_opp' });
537+
wire(engine, () => svc);
538+
expect(await whereOf('rid_r4_line', leafOn('opp', 'rid_r4_opp'))).toEqual({ opp: { $in: [] } });
539+
});
540+
});

0 commit comments

Comments
 (0)