Skip to content

Commit c1e4ca8

Browse files
committed
test(approvals): the wall-clock pin's find double honours the caller's limit
The read-and-append engine double answered a `limit: 1` read with every row; `check:objectql-double-limit` names that shape limit-blind. The bound is now applied by presence, after the filter. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GDA48PuRFrHyRfdkBz8m21
1 parent dcfc2bd commit c1e4ca8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/plugins/plugin-approvals/src/approval-service-sla-calendar-clock.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ function makeEngine() {
6363
return {
6464
_tables: tables,
6565
async find(object: string, options?: any) {
66-
return ensure(object).filter((r) => matches(r, options?.filter ?? options?.where));
66+
const rows = ensure(object).filter((r) => matches(r, options?.filter ?? options?.where));
67+
// Honour the caller's bound by presence, after the filter — the shape
68+
// `check:objectql-double-limit` pins, so a `limit: 1` read cannot be
69+
// silently answered with every row.
70+
return typeof options?.limit === 'number' ? rows.slice(0, options.limit) : rows;
6771
},
6872
async insert(object: string, data: Row) { ensure(object).push({ ...data }); return { ...data }; },
6973
async count(object: string) { return ensure(object).length; },

0 commit comments

Comments
 (0)