diff --git a/packages/plugins/plugin-auth/src/member-role-canonical.test.ts b/packages/plugins/plugin-auth/src/member-role-canonical.test.ts index 736bb7d75e..2d181d8c1d 100644 --- a/packages/plugins/plugin-auth/src/member-role-canonical.test.ts +++ b/packages/plugins/plugin-auth/src/member-role-canonical.test.ts @@ -52,6 +52,7 @@ import { callerCarriesCreatorRole, } from './remove-member-permission-guard.js'; import { BUILTIN_MEMBERSHIP_ROLES } from '@objectstack/spec/identity'; +import type { IDataEngine } from '@objectstack/spec/contracts'; // --------------------------------------------------------------------------- // The vendor's three owner-tests, extracted from the installed package @@ -383,13 +384,29 @@ describe('#8317 — write-path canonicalisation hooks', () => { // The one-off pass // --------------------------------------------------------------------------- +/** The test-only handles this double hangs off the contract it implements. */ +type MemoryEngineHandles = { + rows: Array>; + calls: Array<{ object: string; patch: any; options: any }>; +}; + /** * Memory engine for the migration. `update` is pinned to ObjectQL's own * dispatch predicate (#4550/#5480): a fake looser than the real engine turns a * green suite into no suite at all on exactly the write this pass performs. + * + * It DECLARES `IDataEngine` so `check:engine-double-contract` can see that pin + * and ratchet it (#11626's declaration route). The double spells one engine + * sibling (`find`), which is below the inference threshold, so before the + * declaration the `assertEngineUpdateDispatch` call above was real protection + * that no ledger row named — drop it tomorrow and nothing reddens. The + * intersection is what keeps this honest rather than padded: the contract is + * asserted, and `rows`/`calls` stay declared as what they are, test handles. */ -function makeMemoryEngine(rows: Array>) { - const calls: Array<{ object: string; patch: any; options: any }> = []; +function makeMemoryEngine( + rows: MemoryEngineHandles['rows'], +): IDataEngine & MemoryEngineHandles { + const calls: MemoryEngineHandles['calls'] = []; return { rows, calls, @@ -406,7 +423,7 @@ function makeMemoryEngine(rows: Array>) { Object.assign(row, patch); return { ...row }; }, - }; + } as unknown as IDataEngine & MemoryEngineHandles; } describe('#8317 — the one-off convergent pass', () => { diff --git a/scripts/engine-double-contract.pinned.json b/scripts/engine-double-contract.pinned.json index 1f9541c944..29ddde784e 100644 --- a/scripts/engine-double-contract.pinned.json +++ b/scripts/engine-double-contract.pinned.json @@ -1326,6 +1326,11 @@ "verb": "update", "pinned": 1 }, + { + "file": "packages/plugins/plugin-auth/src/member-role-canonical.test.ts", + "verb": "update", + "pinned": 1 + }, { "file": "packages/plugins/plugin-auth/src/org-create-posture-gate.test.ts", "verb": "delete",