Skip to content

Commit c3237a7

Browse files
committed
test(plugin-security): the pin's observed engine exposes find only
The loader under test calls find alone, and the plugin's kernel:ready bootstraps are never fired, so no by-id or write verb is needed. Claude-Session: https://claude.ai/code/session_01XY5uCwTjZj7884yYtyur4H Co-authored-by: Claude <noreply@anthropic.com>
1 parent b17af30 commit c3237a7

1 file changed

Lines changed: 4 additions & 20 deletions

File tree

‎packages/plugins/plugin-security/src/orgless-position-name-fold.test.ts‎

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ import { SysPositionPermissionSet } from './objects/sys-position-permission-set.
5656
import { SysUserPosition } from './objects/sys-user-position.object.js';
5757
import { SysUserPermissionSet } from './objects/sys-user-permission-set.object.js';
5858
import { SysOrganization, SysUser, SysMember } from '@objectstack/platform-objects/identity';
59-
import {
60-
assertEngineUpdateDispatch,
61-
assertEngineFindOnePredicate,
62-
assertEngineDeleteDispatch,
63-
} from '@objectstack/metadata-core';
6459

6560
import { SecurityPlugin } from './security-plugin.js';
6661
import { buildContextForUser } from './explain-engine.js';
@@ -171,8 +166,10 @@ async function boot(): Promise<ObjectQL> {
171166
interface LoaderRead { rows: Array<{ id: string; name: string; organization_id: string | null }> }
172167

173168
/**
174-
* The real engine, `find` OBSERVED and forwarded verbatim. The dispatch-shaped
175-
* verbs open with the producer's own predicates (`check:engine-double-contract`).
169+
* The real engine's `find`, OBSERVED and forwarded verbatim — the one verb the
170+
* loader under test calls. No write or by-id verb is exposed: the plugin's
171+
* `kernel:ready` bootstraps are never fired here, so nothing on this path
172+
* needs one, and a verb that is not there cannot answer on the engine's behalf.
176173
*/
177174
function observed(engine: any, reads: LoaderRead[]): any {
178175
return {
@@ -188,19 +185,6 @@ function observed(engine: any, reads: LoaderRead[]): any {
188185
}
189186
return r;
190187
},
191-
findOne: (o: string, q?: any, opt?: any) => {
192-
assertEngineFindOnePredicate(o, q);
193-
return engine.findOne(o, q, opt);
194-
},
195-
insert: (o: string, d: any, opt?: any) => engine.insert(o, d, opt),
196-
update: (o: string, d: any, opt?: any) => {
197-
assertEngineUpdateDispatch(d, opt);
198-
return engine.update(o, d, opt);
199-
},
200-
delete: (o: string, id: any, opt?: any) => {
201-
assertEngineDeleteDispatch(opt);
202-
return engine.delete(o, id, opt);
203-
},
204188
};
205189
}
206190

0 commit comments

Comments
 (0)