Skip to content

Commit 4fcfbed

Browse files
committed
test(objectql): the can() value-site pin's driver refuses a WHERE combinator it does not implement
Claude-Session: https://claude.ai/code/session_01Bvd69VPa6puiNzzPUroDBx Co-authored-by: Claude <noreply@anthropic.com>
1 parent 55ec8fe commit 4fcfbed

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎packages/objectql/src/engine-formula-default-permission.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ function makeDriver() {
5454
if (!where || typeof where !== 'object') return true;
5555
return Object.entries(where as Record<string, unknown>).every(([k, v]) => {
5656
if (k === '$and') return (v as unknown[]).every((w) => matches(row, w));
57+
if (k === '$or') return (v as unknown[]).some((w) => matches(row, w));
58+
// Any other combinator is REFUSED, never read as a field name
59+
// (`check:where-matcher`).
60+
if (k.startsWith('$')) throw new Error(`test driver: unsupported combinator ${k}`);
5761
const cond = v as Record<string, unknown> | null;
5862
if (cond && typeof cond === 'object' && !Array.isArray(cond)) {
5963
if ('$in' in cond) return Array.isArray(cond.$in) && cond.$in.includes(row[k]);

0 commit comments

Comments
 (0)