Repository navigation
feat(portal): let clients end one monthly add-on online - #627
Conversation
Codex Review Summary: ✅ CompletedThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f1d1e85d5
ℹ️ 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".
636e6b3 to
bee8e02
Compare
Codex review on #627: - An add-on ended while the monthly Checkout was still open is removed from the subscription the Checkout creates, inside the completion event's transaction: if Stripe fails, the event is not recorded and Stripe's retry converges. The client's end locks the order's monthly Checkouts, so it and the completion are ordered. - A closed card gate never changes a subscription: the end is refused before any Stripe call. - A card order's last billed month is the UTC month, since Stripe renews at midnight UTC on the 1st. - Work approval expects a monthly-only order's first month less any add-on ended before it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3f1d1e8 to
a95cb55
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a95cb55004
ℹ️ 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".
Codex review on #627: if Stripe removed the item but its answer was lost, or the session expired during the call, the rolled-back end left the subscription changed with no record. The end is now recorded first, then Stripe is asked to remove the add-on's item, and its confirmation is recorded on its own (portal_addon_removals, in migration v27). A failure leaves the end standing: the operator's page offers to ask Stripe again until it confirms, as for order ends. A Checkout completing later removes ended add-ons and records the confirmations in its own transaction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codex review for Re-review after recording the add-on end before the Stripe call and confirming removals separately (portal_addon_removals) with an operator retry. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6696e51f79
ℹ️ 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".
Codex review on #627: commitProposalWrite refuses without rolling back, so a gate closing or a principal expiring left the operator's transaction and its locks open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codex review |
bee8e02 to
157ead2
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 58b0f211a2
ℹ️ 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".
157ead2 to
0db2aa7
Compare
Codex review on #627: - An add-on ended while the monthly Checkout was still open is removed from the subscription the Checkout creates, inside the completion event's transaction: if Stripe fails, the event is not recorded and Stripe's retry converges. The client's end locks the order's monthly Checkouts, so it and the completion are ordered. - A closed card gate never changes a subscription: the end is refused before any Stripe call. - A card order's last billed month is the UTC month, since Stripe renews at midnight UTC on the 1st. - Work approval expects a monthly-only order's first month less any add-on ended before it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex review on #627: if Stripe removed the item but its answer was lost, or the session expired during the call, the rolled-back end left the subscription changed with no record. The end is now recorded first, then Stripe is asked to remove the add-on's item, and its confirmation is recorded on its own (portal_addon_removals, in migration v27). A failure leaves the end standing: the operator's page offers to ask Stripe again until it confirms, as for order ends. A Checkout completing later removes ended add-ons and records the confirmations in its own transaction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex review on #627: commitProposalWrite refuses without rolling back, so a gate closing or a principal expiring left the operator's transaction and its locks open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d items Codex review on #627: - The receipt, the recorded end and the client's level now use one month (addonLastMonth): UTC for a card order, Copenhagen's for an invoice order, which differ for an hour or two on the 1st. - Every Checkout line names what it charges (portal_line or portal_addon). A subscription with an unnamed item, or more items than one page, is refused, so no removal is confirmed that Stripe may still charge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
58b0f21 to
03e07d9
Compare
@codex review |
The maintainer's decision for Consumer Contracts Act section 28 a: a monthly add-on ordered in the portal can be ended there. - The receipt offers to end each monthly add-on after the current month (portal_addon_ends, migration v27). It is billed through that month; later monthly charges, invoices and card renewals leave it out. - A card order's subscription first loses the add-on's item, found by the portal_addon metadata on its product, without proration. The end is recorded only once Stripe confirms, so a retry converges. - Ending Priority or Express drops the client's level after that month. - The operator's page and the retention purge know the ends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex review on #627: - An add-on ended while the monthly Checkout was still open is removed from the subscription the Checkout creates, inside the completion event's transaction: if Stripe fails, the event is not recorded and Stripe's retry converges. The client's end locks the order's monthly Checkouts, so it and the completion are ordered. - A closed card gate never changes a subscription: the end is refused before any Stripe call. - A card order's last billed month is the UTC month, since Stripe renews at midnight UTC on the 1st. - Work approval expects a monthly-only order's first month less any add-on ended before it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex review on #627: if Stripe removed the item but its answer was lost, or the session expired during the call, the rolled-back end left the subscription changed with no record. The end is now recorded first, then Stripe is asked to remove the add-on's item, and its confirmation is recorded on its own (portal_addon_removals, in migration v27). A failure leaves the end standing: the operator's page offers to ask Stripe again until it confirms, as for order ends. A Checkout completing later removes ended add-ons and records the confirmations in its own transaction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex review on #627: commitProposalWrite refuses without rolling back, so a gate closing or a principal expiring left the operator's transaction and its locks open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d items Codex review on #627: - The receipt, the recorded end and the client's level now use one month (addonLastMonth): UTC for a card order, Copenhagen's for an invoice order, which differ for an hour or two on the 1st. - Every Checkout line names what it charges (portal_line or portal_addon). A subscription with an unnamed item, or more items than one page, is refused, so no removal is confirmed that Stripe may still charge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
03e07d9 to
4e7040f
Compare
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
✅MegaLinter analysis: Success
See detailed reports in MegaLinter artifacts Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining
|
Code coverage overviewLanguages: Go Go / code-coverage/go
Line coverage data for the main branch is not yet available. View coverage of the 10 most covered files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. |

Stacked on #624 (fair use). Review only this PR's commit.
The maintainer's decision for the Consumer Contracts Act, section 28 a: a monthly add-on ordered in the portal can be ended there, one at a time, and the rest of the order continues. Ending all monthly billing in the portal already exists (#608).
What changes
<this month>" for each monthly add-on (POST /requests/{id}/addon-end,portal_addon_ends, migration v27). It is billed through the current month and no longer after; a retry is admitted and changes nothing. The receipt then shows "ended after<month>", and the operator's page lists it. An order whose monthly billing already ended, or a one-time add-on, cannot end one: that is a conflict.portal_addonmetadata. Ending an add-on first removes that subscription item without proration (RemoveSubscriptionAddon): the current month stays paid, and the next invoice no longer charges it. The end is recorded only once Stripe confirms. If Stripe fails, nothing is recorded, the client sees the error, and a retry converges, since a missing item counts as already removed. Renewals expect the lower amount from the month after the end.onlyFields, a form-field helper shared with the operator's "finished" form, because jscpd found the parsing repeated.Tests
TestAddonEndOnTheInvoicePath:TestAddonEndOnTheCardPath:si_emailand records the end.Mutation checks are load-bearing: skipping the Stripe removal, or the period exclusion, each fails its test. The full Go suite passes, on top of #625's latest head, and golangci-lint (with gocritic and revive), vet, gofmt, jscpd and cspell are clean.
Part of #21
🤖 Generated with Claude Code