Skip to content

Commit a446bae

Browse files
committed
test(objectql): the empty-projection suite's driver double holds the caller's limit
Claude-Session: https://claude.ai/code/session_01FEkQ5mbUpy4ebfWUHxAv87 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 26ebfb4 commit a446bae

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎packages/objectql/src/engine-empty-projection-refusal.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ function makeDriver() {
8787
async connect() {}, async disconnect() {}, async checkHealth() { return true; }, async execute() { return null; },
8888
async find(object: string, ast: any) {
8989
reads.push({ object, fields: ast?.fields });
90-
return (rows[object] ?? []).filter((r) => matches(r, ast?.where)).map((r) => project(r, ast?.fields));
90+
const matched = (rows[object] ?? []).filter((r) => matches(r, ast?.where));
91+
const page = typeof ast?.limit === 'number' ? matched.slice(0, ast.limit) : matched;
92+
return page.map((r) => project(r, ast?.fields));
9193
},
9294
async findOne(object: string, ast: any) {
9395
reads.push({ object, fields: ast?.fields });

0 commit comments

Comments
 (0)