Skip to content

TestPurgeRemovesGivenUpDelivery: age the rows, don't race the clock - #63

Merged
markmnl merged 1 commit into
mainfrom
purge-test-clock
Oct 29, 2026
Merged

markmnl merged 1 commit into
mainfrom
purge-test-clock

Conversation

@markmnl

@markmnl markmnl commented Oct 29, 2026

Copy link
Copy Markdown
Owner

TestPurgeRemovesGivenUpDelivery was flaky. It set RetryMaxAge = 0.2 and expected the first message to still be inside the window after a second send, an add-to and several updates. On a slow runner that took longer than 0.2s, so the delivery had already aged out and was purged (delivery still in the retry window removed, seen in fmsgAI CI).

It now uses a one-hour window and steps past it with a new ageBy helper. The helper moves the message's time_sent and its add-to batches' time_added back two hours, with triggers off (session_replication_role = replica), because time_sent is immutable once sent. The sleep is gone.

Checks, against local Postgres 17:

  • passes 20 runs in a row;
  • with a 1s pause added before the in-window check, it still passes, where the old version fails;
  • with purge made to never give up, it fails, so it still catches the bug it was written for.

Test-only change.

🤖 Generated with Claude Code

The test used a 0.2s retry window, so on a slow runner the setup before
the first check outlasted it and the in-window delivery was purged
(seen in CI). It now uses an hour's window and moves time_sent and
time_added back two hours, with triggers off, to step past it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@markmnl
markmnl merged commit 81a22d8 into main Oct 29, 2026
1 check passed
@markmnl
markmnl deleted the purge-test-clock branch October 29, 2026 13:37
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.

1 participant