Skip to content

test(webapp): poll for replicated rows instead of fixed sleeps in runs replication tests#4181

Merged
matt-aitken merged 2 commits into
mainfrom
claude/flaky-replication-test-waitfor
Jul 7, 2026
Merged

test(webapp): poll for replicated rows instead of fixed sleeps in runs replication tests#4181
matt-aitken merged 2 commits into
mainfrom
claude/flaky-replication-test-waitfor

Conversation

@claude

@claude claude Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Requested by Matt Aitken · Slack thread

✅ Checklist

  • The PR title follows the convention.
  • I ran and tested the code works (typecheck of the edited files is clean; see Testing)

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.ts files type-check with no new errors.


Changelog

How: wrapped the ~21 present-row assertions across runsReplicationService.part1..part8.test.ts in vi.waitFor, matching the existing poll pattern in part9.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 in internal-packages/replication/src/client.ts (a riskier, separate follow-up).

💯


Generated by Claude Code

…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.
@changeset-bot

changeset-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: e78f1dd

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@matt-aitken matt-aitken marked this pull request as ready for review July 7, 2026 14:20
devin-ai-integration[bot]

This comment was marked as resolved.

@matt-aitken matt-aitken merged commit 8bf5879 into main Jul 7, 2026
29 of 31 checks passed
@matt-aitken matt-aitken deleted the claude/flaky-replication-test-waitfor branch July 7, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants