Skip to content

fix(payments): recover stuck initiated payments in the retry sweep - #321

Merged
tiana-code merged 1 commit into
mainfrom
feat/E-02-sweep-initiated
Jun 19, 2026
Merged

fix(payments): recover stuck initiated payments in the retry sweep#321
tiana-code merged 1 commit into
mainfrom
feat/E-02-sweep-initiated

Conversation

@tiana-code

Copy link
Copy Markdown
Owner

#318 - durability backstop for #317.

A crash between an initiate commit and the after-commit @async orchestration could leave a payment stranded in INITIATED with nothing to advance it (the sweep previously only handled SCREENING). Now retryStuck() sweeps both states via a shared loop: stuck INITIATED -> orchestrator.process (INITIATED -> SCREENING -> submit), stuck SCREENING -> resume, either past the deadline -> markFailed. SCREENING behaviour is preserved.

Tests

PaymentRetryServiceTest extended with per-status stubbing and INITIATED cases (within-window -> process, no resume/markFailed; past-deadline -> markFailed, no process/resume); the three SCREENING tests are unchanged. detekt + spotless + unit tests green locally.

Gate chain

code-reviewer: APPROVED after one must-fix applied (added a resume cross-call guard to the INITIATED-deadline test). evaluator: PASS (0.89). The unbounded sweep query is a pre-existing concern (it predates this change on the SCREENING path) and is left as a follow-up.

Closes #318

The retry sweep previously only re-routed payments stuck in SCREENING. A
crash between an initiate commit and the after-commit orchestration could
leave a payment stranded in INITIATED with nothing to advance it. Sweep
both states through a shared loop: stuck INITIATED payments are
orchestrated from the start, stuck SCREENING payments are resumed, and
either is failed once past the deadline.

Closes #318
@tiana-code tiana-code added this to the v0.2.0 milestone Jun 19, 2026
@tiana-code
tiana-code merged commit 78216d1 into main Jun 19, 2026
8 checks passed
@tiana-code
tiana-code deleted the feat/E-02-sweep-initiated branch June 19, 2026 23:36
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.

fix(payments): retry sweeper should recover stuck INITIATED payments, not only SCREENING

1 participant