Repository navigation
feat(cli): enforce token-balance suspension on paid plans below -200 - #174
Merged
Merged
Conversation
remove-exceeding-tenant-instances previously suspended only FREE-plan tenants. It now also covers self-service paid plans (PERSONAL, PROFESSIONAL, BUSINESS). ENTERPRISE, managed reseller sub-workspaces, tenants with the sub-workspace billing exception, and tenants without a plan record are skipped. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Member
Author
Research ReviewVerified
Needs Verification (non-blocking)
Adjacent Stubs DetectedNone in touched files (grepped Orphaned Files DetectedNone: Escape Hatch CoverageNo terminal-rejection branch added. The sweep is dry-run by default ( Object Shape VerificationNo spread of fetched objects in the diff. Contract diffNo request handler or timeout changed. Files checked: Impact Analysis
Risks Not Tested
Research Suggestions
VerdictNo blocking issues found. Reviewed by PR Research Validator. |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
admin remove-exceeding-tenant-instances(the nightlyadmin-dailyCronJob) suspended instances only for tenants on the FREE plan withremainingTokens < -200. It now also suspends for self-service paid plans (PERSONAL, PROFESSIONAL, BUSINESS).The policy is an explicit allowlist (FREE, PERSONAL, PROFESSIONAL, BUSINESS). FREE tenants are always suspended, including ones flagged
managedTenantorsubWorkspaceBillingException(unchanged from before). Paid tenants flaggedmanagedTenantorsubWorkspaceBillingException(billed off-platform) are skipped. Not suspended by the sweep: ENTERPRISE (billed by agreement), unknown plan types, and tenants with no plan record. The policy lives insuspend-policy.tsso it is unit-testable separately from the mockedmoney.ts.Rollout (not done by this PR)
Merging does nothing in prod until the
osccliimage tag in theadmin-dailyCronJob is bumped (infra-osaas) after a release. Runadmin remove-exceeding-tenant-instanceswithout--applyfirst and read how many paid tenants it lists. The first live run will suspend every paid tenant already below -200, not only newly crossing ones.Contract / consumer audit
CLI behaviour change only. No API, status code or response shape changes; reads the existing
/tenantplanfieldsmanagedTenantandsubWorkspaceBillingException(both optional). Consumer of the CLI: theadmin-dailyCronJob only.Tests
cmd.test.ts: paid plans suspended below threshold; ENTERPRISE, managed, billing exception, empty plan type and no plan record are not; -200 exactly is not suspended. 36 tests pass inpackages/cli/src/admin.Risks not tested
No dry run against real prod data (no admin credentials in this session), so the number of affected paid tenants is unknown. Resume of a suspended paid tenant is manual. Community wiki Pricing.md promises a paid-plan "grace period" (undefined); wording needs aligning once this ships.
Lessons
The mocked
./moneymodule incmd.test.tsswallows any new export added there, so policy helpers added next to mocked fetchers silently becomeundefinedin tests; keep them in a separate module.🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com