fix(billing-polar): reject failed webhooks so providers can retry delivery - #2702
Conversation
|
Important Approval pendingCodeRabbit has no unresolved comments, but it could not review the latest commit because the review limit was reached. Follow the review guidance in this comment to continue. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis 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. |
📊 Benchmark Results✅ All benchmarks passed
Updated: 2026-09-08T06:24:07.402Z · Commit: f8efc20 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2af2534f35
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
Internal Polar webhook failures now reject with
WebhookProcessingProblem, allowing Croco HTTP controllers to return 500 and Polar to retry. Original causes and rollback diagnostics remain available; completed duplicates still succeed and signature verification is unchanged.Paid-order retries now upsert by billing account and order ID and publish with a stable webhook-derived event ID through
publishIdempotently. CustomBillingStore.saveOrderimplementations must support that upsert contract. Callers previously inspectingsuccess: falsemust handle the rejection and preserve the error response.Closes #2656
Validation
Elevated profile for persistence and retry behavior across billing-core and billing-polar.
Original negative control: 15 regression failures. Review repair: two store and two handler regressions fail before their fixes.
billing-core: 180 tests passed. billing-polar: 171 tests passed. Both package typechecks and lint passed.
Reconstructed handlers recover from publication-after-acceptance and completion failures with one stored order and the same logical event ID.
Independent code review and integration/evidence review passed on
f8efc20fae6c536ea7c706ba6f6a4f386aeed1c8; final cleanup was a no-op.Full build, tests, and typecheck each passed 243/243 tasks on the repaired head; all normal Git hooks passed.
Repository checks: 27 applicable gates have passing aggregate evidence. The first contract-cache test failed; the unchanged contract suite then passed 683 tests and the prerequisite-skipped benchmark passed. Companion architecture and public API checks passed.
Signed HTTP smoke on the repaired build returned a redacted 500 after DB failure and 200 on same-event retry.
Evidence identity
Head:
f8efc20fae6c536ea7c706ba6f6a4f386aeed1c8. Assessed target base:c2a26539a965065486813fda9462a0bae6d82212. Base drift from the original validation affects unrelated search, auth, and customer-health contracts; no rebase was needed.CI, review companion, and benchmark passed on the repaired head. All required checks passed; the PR is conflict-free with no unresolved review threads.
Compatibility
Custom stores and publishers remain responsible for their documented durable upsert and idempotent publication contracts. Failed reservation rollback retains the existing store recovery requirement. Order timestamps preserve provider
createdAtwhen supplied; the existing missing-date behavior is unchanged.