Skip to content

Drop stale purges so rescanAll doesn't undo re-deliveries#17

Merged
raymondjacobson merged 1 commit into
mainfrom
fix-stale-purge-replay
May 19, 2026
Merged

Drop stale purges so rescanAll doesn't undo re-deliveries#17
raymondjacobson merged 1 commit into
mainfrom
fix-stale-purge-replay

Conversation

@raymondjacobson
Copy link
Copy Markdown
Member

Summary

  • Follow-up to Allow re-delivery after a release has been deleted #16. After that fix, a re-delivery for a deleted release did re-publish successfully — but the row then bounced back to Deleted because the S3 poller's rescanAll re-parsed the original PurgeReleaseMessage, and markForDelete had no staleness guard.
  • Observed in prod for OnChain Music's "Khthon" delivery: publog shows publishRelease succeeded with a fresh trackId, then a stale purge re-fired deleteTrack against it.
  • Fix: ignore a purge whose messageTimestamp is not newer than the row's current messageTimestamp — same shape as the upsert path's existing staleness check.

Test plan

  • tsc --noEmit passes
  • Existing parseTakedown.test.ts updated: re-loading the same purge XML now correctly no-ops instead of round-tripping through DeletePending.
  • New case: a Published row with a future messageTimestamp stays Published when an older PurgeReleaseMessage is re-parsed.
  • make test — please run before merging (couldn't run locally, no disk for the test postgres)

🤖 Generated with Claude Code

After a re-delivery republishes a previously-deleted release, the S3
poller's rescanAll re-parses the original PurgeReleaseMessage and
markForDelete flips status back to DeletePending — wiping the fresh
publish on the next worker tick.

Mirror upsert's staleness guard: ignore a purge whose messageTimestamp
is not newer than the row's current messageTimestamp.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@raymondjacobson raymondjacobson merged commit 8a84747 into main May 19, 2026
1 check passed
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