Repository navigation
test(changehook): stop the end-to-end delivery test failing when the close lands in a later POST - #4668
Conversation
The end-to-end delivery test stopped at the first webhook POST and expected it to carry both job-a changes. They are two transactions, and the feed only shows rows below the cluster's oldest open transaction, so an unrelated open transaction between them leaves the closing change for a later POST. Collect across POSTs until both arrive and assert on the combined list.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: de827711-9971-4046-aa5e-404261ae419b) |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
TestDeliveryEndToEndfails now and then (CodeRabbit flagged it on #4591). The first subtest stopped at the first webhook POST and expected it to carry bothjob-achanges (opened, then closed).Those two changes are separate transactions. The change feed only returns rows below
pg_snapshot_xmin(pg_current_snapshot()), the oldest open transaction of the whole cluster. If another transaction (on a shared dev/CI database, usually another test) starts between them and is still open, the first run seesjob-a openedbut notjob-a closed, sends a POST with only that, and the test fails. The rerun loop did not help, because it stopped once one POST arrived.Fix (test only): keep running the worker until the received changes, across all POSTs, contain both
job-achanges, then assert on that combined list. It still checks that every POST is a signedjob.changesevent whose ID matches the delivery header, that nothing besidesbeforeandjob-aarrives, that the order and seq are right, and that the cursor moves. The wait uses the file's existinguntil(20 s deadline), so a real regression still fails fast.What I ran:
mise exec -- go test -tags=integration -count=20 -run TestDeliveryEndToEnd ./internal/engage/changehook/: 20/20 pass.job-astatements: the old test fails with exactly the reported error (first POST =job-a openedonly); the new test passes 3/3.gofmt -l,go vet -tags=integration ./...,golangci-lint runon the package: clean.Created with Claude Opus 5.5 in Claude Code.
Note
Low Risk
Test-only change to integration test polling and assertions; no production webhook or worker behavior is modified.
Overview
Makes
TestDeliveryEndToEnd’s first subtest resilient whenjob-a’s open and close changes land in separate webhook POSTs (e.g. another open transaction hides the close from the change feed on the first run).The test no longer stops after the first delivery or assumes both changes appear in one event. It keeps driving the worker via
untiluntil two non-beforechanges forjob-aare seen across all POSTs, then asserts each delivery is a signedjob.changesevent with matching delivery ID, the combinedopened→closedorder and seq, and that the subscription cursor advances.Reviewed by Cursor Bugbot for commit d9242eb. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit