test(webapp): poll for replicated rows instead of fixed sleeps in runs replication tests#4181
Merged
Merged
Conversation
…s replication tests Replace fixed setTimeout settle delays that gate ClickHouse row-presence assertions with vi.waitFor poll loops (30s timeout, 250ms interval), matching the existing poll pattern in part9. Absence assertions (expecting 0 rows / no spans) keep their fixed settle delay since there is nothing to poll for.
|
matt-aitken
approved these changes
Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Matt Aitken · Slack thread
✅ Checklist
Testing
Before: the webapp run-replication test shard failed on nearly every PR because assertions waited a fixed 1s for rows to replicate from Postgres → ClickHouse and intermittently checked before the row arrived under CI load.
After: those assertions poll (up to 30s, 250ms interval) until the rows land, so they pass as soon as replication completes and stop flaking, without slowing the happy path.
These tests are testcontainers-backed (need Docker + Postgres + ClickHouse), so the full suite is exercised in CI. Locally I confirmed the edited
runsReplicationService.part1..part8.test.tsfiles type-check with no new errors.Changelog
How: wrapped the ~21 present-row assertions across
runsReplicationService.part1..part8.test.tsinvi.waitFor, matching the existing poll pattern inpart9.test.ts. Left absence assertions (expecting 0 rows / no spans) on a fixed settle delay since there is nothing to poll for. Tests only — no production code changed.Note: this does NOT touch the
subscribe()startup race ininternal-packages/replication/src/client.ts(a riskier, separate follow-up).💯
Generated by Claude Code