Skip to content

Commit f135b5c

Browse files
committed
test(objectql): the seed created_at pin's stub driver applies the caller's limit
check:objectql-double-limit flagged the new stub driver's find as limit-blind; it now applies ast.limit after the filter, by presence. Claude-Session: https://claude.ai/code/session_017ErfyP2Rx7XWHJA27QjyUi Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2a82645 commit f135b5c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎packages/objectql/src/plugin-audit-seed-created-at.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ function makeStubDriver() {
100100
async connect() {}, async disconnect() {}, async checkHealth() { return true; },
101101
async syncSchema() {},
102102
async find(object: string, ast: any) {
103-
return Array.from(storeFor(object).values()).filter((r) => matches(r, ast?.where)).map((r) => ({ ...r }));
103+
const rows = Array.from(storeFor(object).values()).filter((r) => matches(r, ast?.where));
104+
const page = typeof ast?.limit === 'number' ? rows.slice(0, ast.limit) : rows;
105+
return page.map((r) => ({ ...r }));
104106
},
105107
async findOne(object: string, ast: any) {
106108
for (const r of storeFor(object).values()) if (matches(r, ast?.where)) return { ...r };

0 commit comments

Comments
 (0)