Skip to content

fix(web): stay on billing after subscription cancellation - #1092

Merged
AchoArnold merged 13 commits into
mainfrom
fix/stay-on-billing-after-cancellation
Nov 24, 2026
Merged

AchoArnold merged 13 commits into
mainfrom
fix/stay-on-billing-after-cancellation

Conversation

@AchoArnold

@AchoArnold AchoArnold commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Billing-page-only change: no auth-store, profile-update, API-key, or logout behavior changes.
  • Keep the modal open and spinner active until cancellation is confirmed or ten seconds total have elapsed, including the initial cancellation API request.
  • Close the modal and show exactly one result notification. If still pending, show: Cancellation is in progress. Please check your billing status shortly.
  • Stay on billing and render confirmed subscription details locally without browser reload, navigation, or shared auth-state writes.

Verification

  • All 101 web tests passed, including mounted billing cards/modal, the total cancellation deadline, one notification, and unchanged shared auth state.
  • ESLint, Stylelint, Prettier, vue-tsc --noEmit, and git diff --check passed.
  • The final PR changes only the billing page and its tests.

Reload the current billing page instead of navigating home after cancellation.
Add regression coverage for refresh-on-success and error handling.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4
Reload account data without reloading the browser or navigating away.
Close the confirmation dialog and preserve the success notification.
Report account refresh failures separately from cancellation failures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4
@codacy-production

codacy-production Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 143 complexity · 6 duplication

Metric Results
Complexity 143
Duplication 6

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@greptile-apps

greptile-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Keeps subscription cancellation on the billing page.

  • Billing stays open until cancellation is confirmed or times out.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[User confirms cancellation] --> B[Keep dialog open and spinner active]
  B --> C[Request cancellation]
  C --> D[Poll account]
  D -->|Confirmed| E[Show updated billing details]
  B -->|Ten seconds total| F[Show cancellation pending]
  C -->|Request fails| G[Show error]
  D -->|Refresh fails| G
  E --> H[Close dialog and show one notice]
  F --> H
  G --> H
Loading

Reviews (2) · Last reviewed commit: "fix(web): confine subscription cancellat..." · Reviewed by Greptile

Comment thread web/app/pages/billing/index.vue Resolved
Comment thread web/app/pages/billing/index.vue Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The cancellation flow can leave active-plan controls visible after success, while refresh errors can overwrite the notification and obscure that cancellation succeeded.

2 open issues
What changed in this PR

This PR updates the web billing flow to keep users on the billing page after subscription cancellation and refresh account details in place.

Changes:

  • Removes post-cancellation navigation, closes the confirmation dialog, and calls authStore.loadUser().
  • Separates cancellation and account-refresh error handling while retaining the success notification.
  • Adds regression tests for successful cancellation, cancellation failure, and refresh failure.
File Description
web/​app/​pages/​billing/​index.vue Updates cancellation handling to stay on billing and refresh account data.
web/​app/​pages/​billing/​index.test.ts Adds cancellation-handler tests covering navigation, dialog state, and notifications.

Review effort: Balanced

Comment thread web/app/pages/billing/index.vue Resolved
Comment thread web/app/pages/billing/index.vue Resolved
Poll account data briefly while showing a cancelled pending-details card.
Avoid showing stale active-plan controls while the webhook is pending.
Keep cancellation success context when account refresh returns an API error.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The cancellation flow can leave the pending card stuck after account updates, and polling continues after unmount, potentially updating shared state and posting notifications on another page.

2 open issues
2 resolved since last review

Review effort: Balanced

Comment thread web/app/pages/billing/index.vue Resolved
Comment thread web/app/pages/billing/index.vue Resolved
Limit the billing-status refresh wait to ten seconds, including slow requests.
Keep the confirmation dialog open and non-dismissible while waiting.
Emit one final notification rather than an initial and a follow-up toast.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4
Stop scheduling refreshes and suppress notifications when billing unmounts.
Reveal the final plan card when late account data confirms cancellation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A timed-out refresh can overwrite newer subscription state and API keys, and the tests do not exercise the required pending-state and dialog behavior in the mounted component.

4 open issues

Review effort: Balanced

Comment thread web/app/pages/billing/index.vue Resolved
Comment thread web/app/pages/billing/index.test.ts Resolved
Abort billing refreshes on timeout and unmount, and guard stale account writes.
Add mounted billing-card and dialog regression coverage using Vue's renderer.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Overlapping loadUser requests can discard a successful response when a newer request fails or aborts, leaving user null and causing initialization callers to permanently skip account event subscriptions.

3 open issues
2 resolved since last review

Review effort: Balanced

Comment thread web/app/stores/auth.ts Resolved
Only discard older responses when a newer account load has published data.
Keep valid initialization results if a replacement refresh fails or aborts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human assessment is needed because findings omitted from the published review include a critical race that can restore an invalidated API key and a cancellation dialog that can remain locked after a failed load.

No open issues 🎉

3 resolved since last review

Review effort: Balanced

Lock the dialog only during cancellation, not unrelated billing loading.
Invalidate older refresh results when user updates or API-key rotation finish.
Add mounted-dialog and refresh-versus-mutation regression tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4
@AchoArnold

Copy link
Copy Markdown
Member Author

Addressed the two concerns mentioned in the latest review summary: successful account updates and API-key rotation invalidate earlier account refreshes, with regression tests for both. Dialog persistence and Keep Subscription disabling now use a cancellation-specific flag, so unrelated billing loading cannot lock the dialog; the mounted-component regression covers that case. All 104 web tests, targeted lint/format checks, and TypeScript checks pass.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Response-time coordination in auth mutations can discard a newer GET containing webhook cancellation state, leaving stale billing data in both the PUT and API-key rotation paths.

1 open issue

Review effort: Balanced

Comment thread web/app/stores/auth.ts Resolved
Track account-read freshness separately from mutation credential freshness.
Preserve newer billing reads without restoring credentials from older requests.
Cover both reply orderings for account updates and API-key rotation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Overlapping auth requests can discard successful timezone and active-phone updates or leave both the user state and shared request header using an invalidated API key.

2 open issues
1 resolved since last review

Review effort: Balanced

Comment thread web/app/stores/auth.ts Resolved
Comment thread web/app/stores/auth.ts Resolved
Remove all shared auth-store coordination changes from this PR.
Keep refreshed billing data local to the page without updating credentials.
Cap the entire cancellation flow at ten seconds with one progress notification.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Billing can retain or publish a previous account’s details after logout or an account switch because session changes do not clear cached state or invalidate pending operations.

1 open issue
2 resolved since last review

Review effort: Balanced

Comment thread web/app/pages/billing/index.vue Resolved
Discard the billing snapshot and stop pending page work when the account changes.
Do not change the auth store or logout behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human assessment is needed to evaluate stale subscription state after same-account updates and the inability to observe late cancellation confirmation once polling stops.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Clear the page-local override when newer shared account data arrives.
Keep the ten-second cancellation deadline and auth store behavior unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4
@AchoArnold

Copy link
Copy Markdown
Member Author

Addressed the same-account stale-card concern in the latest review summary: a newer shared account snapshot now clears the billing-page override, with a mounted regression that transitions the same account from cancelled to expired/free. Stopping polling after ten seconds and displaying Cancellation is in progress is intentional and explicitly requested by the user; no second automatic notification or indefinite waiting is desired. Auth-store files remain unchanged from main. All 101 tests and targeted lint/type checks pass.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A stale mount-time account response can overwrite confirmed cancellation data, causing the billing card to show renewal details and Cancel Plan again despite a success notification.

1 open issue

Review effort: Balanced

Comment thread web/app/pages/billing/index.vue Resolved
Keep the billing-page cancellation snapshot when an older active-state read arrives.
Still reflect confirmed shared cancellation or free-plan updates and account changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ed7b2928-caae-4667-8285-9b3c3f31bca4
@AchoArnold
AchoArnold merged commit 081c0f7 into main Nov 24, 2026
13 checks passed
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.

2 participants