Skip to content

Require billing cleanup before account deletion - #1017

Merged
AnthonyRonning merged 3 commits into
masterfrom
codex-billing-account-deletion
Sep 24, 2026
Merged

AnthonyRonning merged 3 commits into
masterfrom
codex-billing-account-deletion

Conversation

@AnthonyRonning

@AnthonyRonning AnthonyRonning commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Require billing cleanup before the existing account-deletion database call so a failed cancellation leaves the account and its confirmation available for an explicit retry. Once the existing confirmation checks pass, the enclave makes one bounded admin-authenticated request using its configured billing integration. Only HTTP 200 with the matching user UUID and status: "ready" permits deletion.

On failure, return a typed 503 response and show the user instructions to cancel manually and retry. The frontend recognizes that exact error contract while preserving existing local cleanup, session fences, and retry behavior. Generic OpenSecret instances without a billing integration retain their existing behavior.

The failure warning records the user UUID and a sanitized reason, including the numeric billing HTTP status. It never logs the response body or credentials.

No additional enclave database checks or changes to its existing deletion transaction; no migrations, queues, workers, automatic retries, or new credentials. Usage checks and cleanup share the existing BillingClient and one HTTP client, with redirects and automatic retries disabled for both paths. Billing must deploy its new endpoint before this caller.

Billing prerequisite: https://github.com/OpenSecretCloud/maple-billing-server/pull/109.

Validation:

  • Backend formatting and warning-clean Clippy passed; 722 unit tests passed. The existing-schema confirmation test proves that invalid confirmation never calls billing, billing failure preserves the user and confirmation, and the same confirmation succeeds after billing becomes ready.
  • SDK integration CI at 2a65d4af ran the deletion database regression and all 21 AEAD/database tests, plus 10 OAuth/settings/callback tests, with no skips. Subsequent changes only add sanitized failure diagnostics. Earlier local macOS SCRAM teardown failures remain recorded in the validation artifacts; the hosted CI database suite completed cleanly.
  • Frontend formatting, lint/typecheck, all 1,173 tests, and PR-profile web build passed. The 13 existing lint warnings remain. Published SDK 4.0.1 carries the required status/header metadata; older clients keep their generic failure message.
  • Independent source security review found no actionable findings. No live deletion, deployment, iOS runtime test, or production change was performed.

Accepted Team policy: the paired billing cleanup includes a deleting owner's Team subscription. A member's deletion never cancels the administrator's subscription. No Team-specific workflow is added here.

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Maple development preview: https://0fadf6d1.maple-ca8.pages.dev

Commit: 2c09f323a662439ce2656052f4223284fda78678

Uses development API, billing, flags and PCR configuration. Cloudflare Access applies.

@AnthonyRonning
AnthonyRonning marked this pull request as ready for review September 24, 2026 01:24
@AnthonyRonning
AnthonyRonning merged commit 03fd32b into master Sep 24, 2026
25 checks passed

This branch was successfully deployed

1 active deployment
pages-pr-1017 — 2c09f323 Deployed Sep 23, 2026 by github-actions[bot]
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.

1 participant