3
Failure Scenarios
Factor Review
Factor identified three production risks in Polar's jurisdiction-level tax breakdown migration: invoice tax mismatches, duplicate order processing during retries, and invoice rendering drift. Existing tests validate individual components but do not verify end-to-end consistency across checkout, order creation, payment retries, and invoice generation.
Factor identified production risks not validated by existing tests.
A fast summary of the review output.
3
Failure Scenarios
1
Missing Tests
3
Risky Assumptions
2
Silent Failures
Factor identified production risks not validated by existing tests.
Factor identifies assumptions, production-only failure paths, and hidden dependencies that may not be covered by tests.
Validate findings before merging.
Rendered exactly as Factor generated it.
Verdict: REVIEW_REQUIRED
Can we add an end-to-end test that validates tax amounts on the final invoice after a retry of the checkout flow?
When this happens
Checkout flow invokes updated tax calculation functions (e.g. _update_checkout_tax) leading to downstream invoice generation.
How it unfolds
checkout.service._update_checkout_tax → tax.calculation.stripe.calculate → invoice.generator._tax_item_label → invoice.service.create_payout_invoice → invoice rendered to user
Evidence
Confidence trap
Confidence
0.78
What breaks
Customers are billed incorrect tax amounts, triggering compliance violations, refunds, and loss of trust.
When this happens
Transient failure during order.handle_payment triggers a retry of the same order creation path.
How it unfolds
order.service.handle_payment → order.service._create_order_from_checkout → payment gateway call → database write of order record
Evidence
Confidence trap
Confidence
0.72
What breaks
Duplicate orders, double inventory deduction, possible double charge to customers, leading to revenue leakage and support overhead.
When this happens
Checkout updates tax breakdown fields but invoice.generator does not consume the new fields when building the invoice.
How it unfolds
checkout.service._update_checkout_tax → order.service._create_order_from_checkout → invoice.generator.from_order → invoice.generator.displayed_tax_items → invoice PDF generation
Evidence
Confidence trap
Confidence
0.68
What breaks
Invoices show tax totals that differ from what was actually charged, causing customer confusion, support tickets, and potential legal exposure.
order.handle_payment, and validates that the final invoice tax amount matches the charged amount.Changes to tax calculation and checkout flow can silently produce incorrect tax amounts or duplicate processing. Existing unit tests miss these scenarios because they mock external services and do not exercise retry paths.
The PR introduces high-severity financial risks that are not covered by existing tests. Merging could cause tax misbilling, duplicate orders, and compliance issues.
REVIEW_REQUIRED because three high-severity failure scenarios (tax_billing_mismatch, idempotency_break, and partial_update_drift) have confidence ≥ 0.6 and affect core financial pathways. The impact is significant and not caught by current CI.
Generated by Factor — validate before merging.