Skip to content

Deleting a Cloud workspace releases its trial; a live subscription blocks the deletion - #894

Merged
keysersoft merged 4 commits into
mainfrom
keysersoft/account-delete-ends-trial
Oct 6, 2026
Merged

keysersoft merged 4 commits into
mainfrom
keysersoft/account-delete-ends-trial

Conversation

@keysersoft

@keysersoft keysersoft commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Deleting a workspace (or an account, together with its own workspaces) left the licence row with organization_id NULL (ON DELETE SET NULL), and the licence site never found out. In production right now there are 44 active trials and 53 expired trials of deleted workspaces that keep getting reminder and win-back emails.

Changes

  • No subscription is ever cancelled by us. LicenseReleaseService.assertNoLiveSubscription: in Cloud, before deleteOrganization and before deleteSelf (for the workspaces deleted with the account), it asks the licence site (/api/license/verify?billing=1, service token) for the subscription's state. If Stripe would charge again (trialing/active/past_due/unpaid, not set to cancel), deletion is refused with 409 and a pointer to Settings → License → Manage subscription & billing. If the site cannot be reached, it uses the last known state, or refuses with "try again" when there is none.
  • After a deletion, licences left without a workspace are sent to /api/license/release, which revokes trials. When the site confirms (or answers with the route's own JSON 404), the local row is deleted. A refusal (e.g. a subscription still running until period end) marks the row invalid. A failure leaves it for the next onboarding cron run, which also backfills the existing orphans. Only one pass runs at a time, and it is a no-op on self-hosted. The module is separate to avoid the LicenseModule ↔ UsersModule cycle.
  • Dialog copy unchanged.

Deploy website HelpCode-ai/anythingmcp-website#310 first. Even in the wrong order nothing is lost: only the route's own 404 drops a row.

Tests

  • license-release.service.spec.ts, deletion tests in users/organizations, and the cron spec. Full jest: 6712 passed. The only failure is the HANA suite (hdb is missing locally), unrelated.
  • Local E2E: see the website PR.

A deleted workspace's licence row was left with organization_id NULL and the
licence site never heard of the deletion: trials kept getting reminder and
win-back emails, and card trials went on to their first charge. The deletion
paths now release the orphaned licences (the site cancels the subscription and
revokes the licence), and the onboarding cron retries what the site did not
confirm. The delete dialogs say the plan ends with the workspace.
Comment thread packages/frontend/src/app/settings/organization/page.tsx Fixed
Subscriptions are cancelled by the customer in the Stripe billing portal only.
Deleting a workspace (or an account with its workspaces) is refused while a
subscription Stripe would charge again is live; once it is set to cancel, the
deletion goes through and only trials are released. The delete dialogs are
back to their previous wording.
@keysersoft keysersoft changed the title Deleting a Cloud workspace ends its licence on the licence site Deleting a Cloud workspace releases its trial; a live subscription blocks the deletion Oct 6, 2026
@keysersoft
keysersoft merged commit bf883c5 into main Oct 6, 2026
13 checks passed
@keysersoft
keysersoft deleted the keysersoft/account-delete-ends-trial branch October 6, 2026 09:12
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants