Skip to content

Commit 7a10cfa

Browse files
committed
test(plugin-auth): bound the audience-posture find double by presence, not truthiness
The double read the caller's bound as `if (q.limit)`, so `limit: 0` -- a request for NOTHING -- returned every matched row. Arrived with #11767 after this branch's ledger was measured; fixed rather than seated, since it is one line in one file. Ledger unchanged: 253 files, 168 blind, 32 wrong, 55 unjudged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ahemw8RcTgqtxrj15PEZx
1 parent 6e5bb29 commit 7a10cfa

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

packages/plugins/plugin-auth/src/audience-posture.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ const createMemoryEngine = () => {
8383
async find(name: string, q: any = {}) {
8484
let out = rows(name).filter((r) => matches(r, q.where));
8585
if (q.offset) out = out.slice(q.offset);
86-
if (q.limit) out = out.slice(0, q.limit);
86+
// Presence, not truthiness: `limit: 0` is a request for NOTHING, and `0`
87+
// is falsy — `if (q.limit)` answers it with every matched row.
88+
if (typeof q.limit === 'number') out = out.slice(0, q.limit);
8789
return out.map((r) => project(r, q.fields));
8890
},
8991
async count(name: string, q: any = {}) {

0 commit comments

Comments
 (0)