Skip to content

Commit 4e99a8c

Browse files
committed
test(objectql): 给 hydrate 故障测试的 query options 上类型,不擦成 any (#6116)
CI 的 `check:query-options-erasure` 棘轮判红:新测试把 test 面从 263 抬到 273 —— 10 处 `engine.find('doc', {} as any)` / `findOne(..., { … } as any)`。 这些入参本来就在契约内,不属于「故意越界的拒绝测试」,所以按棘轮给的第一条 remedy 处理:上类型,而不是 `as unknown as EngineQueryOptionsParsed`。 `find` / `findOne` 的 query 形参本身可选,`{}` 直接省略即可;findOne 的 `{ where: { id: 'd1' } }` 去掉断言后原样通过 `EngineQueryOptionsParsed`。 test 面回到上限 263,断言与用例数不变(21 例仍全绿)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019Q7oc7ASjh8yxyS3Yz78We
1 parent 3c02352 commit 4e99a8c

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

packages/objectql/src/engine-file-hydrate-outage.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ describe('sys_file hydrate read fault — distinguishable from "no file" (#6116)
227227
throw make();
228228
});
229229

230-
const rows = await engine.find('doc', {} as any);
230+
const rows = await engine.find('doc');
231231

232232
// The read that ASKED for the file still answers. This is the pin that
233233
// makes #6116 a diagnosability fix and not a behaviour change: if a
@@ -243,7 +243,7 @@ describe('sys_file hydrate read fault — distinguishable from "no file" (#6116)
243243
throw Object.assign(new Error('connect ECONNREFUSED 127.0.0.1:5432'), { code: 'ECONNREFUSED' });
244244
});
245245

246-
const row = await engine.findOne('doc', { where: { id: 'd1' } } as any);
246+
const row = await engine.findOne('doc', { where: { id: 'd1' } });
247247

248248
expect(row?.attachment).toBe(FILE_ID);
249249
});
@@ -258,7 +258,7 @@ describe('sys_file hydrate read fault — distinguishable from "no file" (#6116)
258258
throw make();
259259
});
260260

261-
await engine.find('doc', {} as any);
261+
await engine.find('doc');
262262

263263
// There are genuinely no committed rows, so the un-hydrated answer IS
264264
// the truth and there is nothing to report. Reporting it anyway would
@@ -293,7 +293,7 @@ describe('sys_file hydrate read fault — distinguishable from "no file" (#6116)
293293
await boot(async () => {
294294
throw make();
295295
});
296-
await engine.find('doc', {} as any);
296+
await engine.find('doc');
297297
return logger.lines.error.map((l: any) => l.msg);
298298
}
299299

@@ -313,7 +313,7 @@ describe('sys_file hydrate read fault — distinguishable from "no file" (#6116)
313313
throw Object.assign(new Error('connect ECONNREFUSED 127.0.0.1:5432'), { code: 'ECONNREFUSED' });
314314
});
315315

316-
await engine.find('doc', {} as any);
316+
await engine.find('doc');
317317

318318
// `error(message, error, meta)` — the meta says which object was read…
319319
const [, meta] = logger.lines.error[0].args;
@@ -333,7 +333,7 @@ describe('sys_file hydrate read fault — distinguishable from "no file" (#6116)
333333
throw make();
334334
});
335335

336-
await engine.find('doc', {} as any);
336+
await engine.find('doc');
337337

338338
expect(logger.lines.warn).toHaveLength(1);
339339
// Functional degradation, not durability: nothing here claims to have
@@ -352,7 +352,7 @@ describe('sys_file hydrate read fault — distinguishable from "no file" (#6116)
352352
throw Object.assign(new Error('canceling statement due to statement timeout'), { code: '57014' });
353353
});
354354

355-
await engine.find('doc', {} as any);
355+
await engine.find('doc');
356356

357357
const [line] = logger.lines.warn;
358358
// The CONSEQUENCE, spelled out — this is the whole point of the issue:
@@ -375,7 +375,7 @@ describe('sys_file hydrate read fault — distinguishable from "no file" (#6116)
375375
storeFor('doc').set('d2', { id: 'd2', title: 'Invoice', attachment: 'f_zz11yy22xx' });
376376
storeFor('doc').set('d3', { id: 'd3', title: 'Receipt', attachment: 'f_aa33bb44cc' });
377377

378-
const rows = await engine.find('doc', {} as any);
378+
const rows = await engine.find('doc');
379379

380380
expect(rows).toHaveLength(3);
381381
// One batched lookup fails once, so it is reported once — AGENTS: "Say it
@@ -393,7 +393,7 @@ describe('sys_file hydrate read fault — distinguishable from "no file" (#6116)
393393
{ id: FILE_ID, name: 'contract.pdf', size: 1024, mime_type: 'application/pdf', status: 'committed' },
394394
]);
395395

396-
const rows = await engine.find('doc', {} as any);
396+
const rows = await engine.find('doc');
397397

398398
expect(rows[0].attachment).toMatchObject({
399399
id: FILE_ID,
@@ -407,7 +407,7 @@ describe('sys_file hydrate read fault — distinguishable from "no file" (#6116)
407407
it('an id with no committed row is a MISS, not a fault — still silent', async () => {
408408
await boot(async () => []);
409409

410-
const rows = await engine.find('doc', {} as any);
410+
const rows = await engine.find('doc');
411411

412412
// A clean miss (the read happened, nothing matched) is legitimate absent
413413
// data — exactly the fact the outage branch must not be confused with.

0 commit comments

Comments
 (0)