Skip to content

Commit ee089fe

Browse files
committed
test(runtime): the OAuth organization pins' engine double routes findOne through the predicate guard
The double opens findOne with assertEngineFindOnePredicate, and the engine-double ledger records it (check-engine-double-contract --write). Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QyoWKK9RwUNxBxmevy9Neb
1 parent 4fc42ed commit ee089fe

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

‎packages/runtime/src/security/resolve-execution-context.oauth-organization.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import { describe, it, expect, vi, beforeAll, beforeEach, afterEach } from 'vite
4242
import type { PermissionSet } from '@objectstack/spec/security';
4343
import type { ExecutionContext } from '@objectstack/spec/kernel';
4444
import { SecurityPlugin, RLS_DENY_FILTER } from '@objectstack/plugin-security';
45+
import { assertEngineFindOnePredicate } from '@objectstack/metadata-core';
4546

4647
import { resolveExecutionContext } from './resolve-execution-context.js';
4748
import { bindCatalogFromTables } from './security-catalog.testkit.js';
@@ -134,6 +135,7 @@ function rig(posture: 'isolated' | 'group' | 'single' | undefined) {
134135
return typeof q?.limit === 'number' ? rows.slice(0, q.limit) : rows;
135136
},
136137
async findOne(object: string, q: any = {}) {
138+
assertEngineFindOnePredicate(object, q);
137139
return (t[object] ?? []).filter((r) => matchesWhere(r, q?.where))[0] ?? null;
138140
},
139141
}, t);

‎scripts/engine-double-contract.pinned.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4141,6 +4141,11 @@
41414141
"verb": "update",
41424142
"pinned": 1
41434143
},
4144+
{
4145+
"file": "packages/runtime/src/security/resolve-execution-context.oauth-organization.test.ts",
4146+
"verb": "findOne",
4147+
"pinned": 1
4148+
},
41444149
{
41454150
"file": "packages/runtime/src/seed-loader.test.ts",
41464151
"verb": "delete",

0 commit comments

Comments
 (0)