feat: Add ability to purchase provider coding plans#3521
Conversation
c5a5451 to
f768c1e
Compare
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryIncremental review of 2 new commits found no issues: Resolved since previous review
Other Observations (not in diff)Migration trailing newline: Offset-based pagination: Files Reviewed (66 files)
Reviewed by claude-4.6-sonnet-20260217 · 354,261 tokens Review guidance: REVIEW.md from base branch |
- Add upstream_plan_id to the coding plan key inventory (migration 0148) and parse managed MiniMax credentials in <api key>::<plan id> format. - Clear encrypted_api_key when a credential enters revocation_pending, including on GDPR soft-delete, so revoked keys are not retained. - Gate the Coding Plans tab on /subscriptions behind CODING_PLANS_PURCHASE_ENABLED; hidden by default for a dark launch. - Update billing lifecycle, revocation, inventory validation, the coding-plans router, and admin operations surfaces accordingly.
f768c1e to
ab56852
Compare
The counter intentionally measures triggered auto-top-up attempts (not successful charges), matching spec rule 5.5. Document that a best-effort maybePerformAutoTopUp failure still counts as a triggered attempt.
Replace the serial validation loop in uploadKeysToInventory with a p-limit(10) fan-out so large inventory uploads finish well within the request budget without firing one unbounded burst at the MiniMax API. Behavior is unchanged: malformed entries fail before validation, any invalid credential aborts the upload, and nothing is inserted on failure.
PLAN.md was a development planning artifact and does not belong in the repo root (the designated location for plans is .plans/). Drop it so it is not part of this PR's changes.
This duplicated glob with a doubled dev/dev segment was auto-written into tsconfig.json by the Next dev server and committed by mistake. It points at a nonexistent directory and duplicates the existing .next/dev/types entry, so removing it restores tsconfig to match main.
| summary: CodingPlanCronSummary | ||
| ): Promise<void> { | ||
| const rows = await database | ||
| .select({ |
There was a problem hiding this comment.
Same here. Probably want to add a limit just in case
| } | ||
| } | ||
|
|
||
| async function processRenewal( |
There was a problem hiding this comment.
There's a lot of implicit business logic in this function. It would be nice to have some explainer comments walking through the various scenarios
Summary
Adds managed MiniMax Token Plan Plus subscriptions funded by Kilo Credits and surfaced through Subscription Center and admin operations.
Why this change is needed
Kilo needs a first Coding Plans offering that can sell provider-plan access without redirecting subscribers to an upstream checkout or exposing managed provider credentials. The pilot also needs explicit billing, cleanup, and manual-revocation rules because ordinary MiniMax BYOK controls routing while Kilo remains responsible for subscription lifecycle and issued credentials.
How this is addressed
/subscriptionsbehind theCODING_PLANS_PURCHASE_ENABLEDserver flag (hidden by default) so the feature can ship dark; backend routers, billing lifecycle cron, and admin operations remain active regardless of the flag.Human Verification
Reviewer Notes
Human Reviewer Flags
.specs/coding-plans.mdand extends Subscription Center contract for first managed provider-plan pilot.CODING_PLANS_PURCHASE_ENABLED=true, so merging does not expose Coding Plans to users until the flag is enabled in the target environment.Code Reviewer Agent
Code Reviewer Notes