Commit 898cb35
test(embed-directive): poll for async embed count before asserting
The caching-table test was asserting `fake.embedCallCount()` immediately
after a GET. The GET response returns before the cache write's txn commits
(Table.ts:~4275 design note), so the embed hook can fire on a later
event-loop tick. The assertion was racing with the async write.
Added a short polling loop (up to 500ms, 20×25ms) before the assertion —
consistent with the `search_by_hash` retry loop already in the same test
for the txn-commit lag.
Root cause of the regression: `88c94e67e` (yield event loop during
synchronous HNSW backfill) changed event-loop scheduling globally; this
made the race window between the GET response and the embed call wider,
exposing the pre-existing fragile assertion on Node.js v26.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent c93a726 commit 898cb35
1 file changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
420 | 420 | | |
421 | 421 | | |
422 | 422 | | |
423 | | - | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
424 | 431 | | |
425 | 432 | | |
426 | 433 | | |
| |||
0 commit comments