Repository navigation
test(ui): accept a final invoice Stripe already finalized - #7378
Conversation
|
Claude finished @luizhf42's task in 8m 3s —— View job Code Review CompleteReviewed 1 file. 1 inline issue posted. Standards: 0 violations, 0 judgement calls. Spec: 0. Correctness: 1. StandardsNothing found. The new name CorrectnessWhen Stripe pays the final invoice during the clock advance, SpecThe Spec axis did not run because the PR and its commit reference no issue. To request another review round, comment |
|
/review |
|
Claude finished @luizhf42's task in 6m 52s —— View job Code Review CompleteReviewed 1 file. 1 inline issue posted. Standards: 0 violations, 1 judgement call. Spec: 0. Correctness: 0. StandardsThe one judgement call is in CorrectnessThe previous review's ordering finding is fixed. When Stripe has already paid the final invoice, SpecThe Spec axis did not run because neither the PR nor its commits reference an issue. To request another review round, comment |
7d63b13 to
9854d22
Compare
|
/review |
|
Claude finished @luizhf42's task in 6m 30s —— View job Code Review CompleteReviewed 1 file. 1 inline issue posted. Standards: 0 violations, 1 judgement call. Spec: 0. Correctness: 0. StandardsThe one judgement call is in CorrectnessNothing new found. Both earlier findings, the delivery order and the SpecThe Spec axis did not run because neither the PR nor its commits reference an issue. To request another review round, comment |
9854d22 to
0efcf28
Compare
|
/review |
|
Claude finished @luizhf42's task in 3m 50s —— View job Code Review CompleteReviewed 1 file on two axes: Standards (repo rules, language conventions, tests, code smells) and Correctness (security and runtime defects). The Spec axis did not run because neither the PR nor its commits reference an issue. No new issues found. The code looks good as-is. |
The period-end cancellation test listed the subscription's draft invoices after the test clock read ready, and threw when there was none. When the test was written, the clock read ready with the final invoice still a draft, so the test finalized it to send `invoice.paid`. Since 2026-10-07 around 18:00 UTC the invoice no longer waits. The cloud e2e job failed this way on master (9a15de8) and on #7369 twice, with no billing change in shellhub or cloud since its last pass at 16:20. In the failed run Stripe sent `invoice.updated`, `invoice.finalized` and `invoice.paid` five seconds after creating the invoice, before `test_clock.ready`, and the server abandoned that `invoice.paid` as it should. Neither the server nor the pinned stripe-cli finalizes invoices, and Stripe's changelog does not mention it, so the cause is on Stripe's side and still unknown. The test now finalizes the invoice only when it is still a draft. The poll for the server's abandon line still fails the test when no `invoice.paid` arrives either way.
0efcf28 to
df75420
Compare
|
/review |
|
Claude finished @otavio's task in 2m 44s —— View job Code Review CompleteReviewed 1 file. 1 inline issue posted. Standards: 1 violation, 0 judgement calls. Spec: 0. Correctness: 0. StandardsThe violation is at SpecThe Spec axis did not run because neither the PR nor its commits reference an issue. Additional notesI left out three things. The 100-event page limit was already raised and fixed in an earlier thread. The other two were possible flakes that I couldn't back with a concrete failing path. One is an invoice still To request another review round, comment |
df75420 to
a2a161b
Compare
|
/review |
|
Claude finished @otavio's task in 4m 27s —— View job Code Review CompleteReviewed 1 file. 1 inline issue posted. Standards: 0 violations, 1 judgement call. Spec: 0. Correctness: 0. StandardsThe one judgement call is at CorrectnessI found nothing new. Every value passed to SpecThe Spec axis did not run because neither the PR nor its commits reference an issue. Additional notesI left out two low-value judgement calls:
To request another review round, comment |
When Stripe pays the final invoice during the clock advance, the test no longer decides when `invoice.paid` reaches the server. The server logs the abandon line only when the namespace is already `canceled` locally, and the webhook's per-tenant lock serializes the two handlers without ordering them. Stripe does not guarantee delivery order, so an `invoice.paid` handled before `customer.subscription.deleted` would never log it and the poll would time out. The test now resends that `invoice.paid` with `stripe events resend` after it has seen `canceled`. Without `--webhook-endpoint` the resend goes to the running `stripe listen` session. A draft final invoice is still finalized as before, which sends `invoice.paid` at the same point. The final invoice comes from `invoices list` with `limit=1`, which relies on Stripe listing a subscription's invoices newest first. The `created < periodEnd` check then refuses the invoice from subscribing, for the case where Stripe made no final invoice; it holds because an invoice's `created` follows the customer's test clock. The `invoice.paid` event is looked up with `created[gte]` set to when the test started, so `invoice.paid` events from other runs on the shared Stripe test account cannot push it off the 100-event page. The bound is the wall-clock start, not `periodEnd`, because an event's `created` follows the wall clock even for a test-clock customer.
a2a161b to
429af9e
Compare
|
/review |
|
Claude finished @otavio's task in 2m 15s —— View job Code Review CompleteReviewed 1 file on two axes: Standards (repo rules, language conventions, tests, code smells) and Correctness (security and runtime defects). The Spec axis did not run because neither the PR nor its commits reference an issue. No new issues found. The code looks good as-is. |
Summary
Since 2026-10-07 around 18:00 UTC, the cloud e2e job fails on master and on PRs in
billing.spec.ts:406, "cancelling at the end of the period is not undone when the final invoice is paid". Stripe now finalizes and pays the final invoice during the test-clock advance. The test expected to find it as a draft and finalize it itself.The poll for that log line still fails the test if
invoice.paidnever arrives, whether Stripe or the test finalizes the invoice.Evidence
expected a draft final invoice for sub_…on master9a15de8a2(job) and twice on test(ui): cover licensing and the admin panel end to end #7369. The same test passed at 16:20 on2ec6590dc, and no billing code changed in shellhub or cloud since.In the failed run, Stripe sent
invoice.updated,invoice.finalizedandinvoice.paidfive seconds after creating the final invoice, beforetest_clock.ready, and the server abandoned thatinvoice.paidas it should.The cause is on Stripe's side and still unknown. Neither the server nor the pinned
stripe-clifinalizes invoices, and Stripe's changelog doesn't mention a change. Theprevious_attributesonevt_1UO0OGDjjCj7k46jqqSmjE3A(invoice.updated) in the Stripe test dashboard should show what changed.Merge Danger
Door: two-way
Blast Radius: e2e
Only the cloud billing e2e spec changes.