feat(#2680): add mint delete command to tear down mint infrastructure - #6022
Conversation
Add `fullsend mint delete` as the inverse of `mint deploy`, supporting all three deployment shapes: GCP (--platform=gcp): deletes Cloud Function, PEM secrets in Secret Manager, the mint service account, and the WIF pool with all providers. Cloudflare durable (--platform=cloudflare): deletes the Worker script and all associated bindings/secrets via wrangler delete. Cloudflare preview (--platform=cloudflare --preview=<alias>): abandons the preview alias without affecting the durable Worker script. Supports --dry-run to preview what would be deleted, and --yolo to skip the confirmation prompt (consistent with mint unenroll). Implementation: - Add DeleteFunction, DeleteServiceAccount, DeleteWIFPool to GCFClient interface with LiveGCFClient implementations using GCP REST APIs - Add DeleteMintFunction, DeleteMintServiceAccount, DeleteMintWIFPool provisioner wrapper methods - Extend CF Provisioner.Teardown to support durable Worker deletion (previously rejected durable mode; now calls wrangler.Delete) - Register newMintDeleteCmd in the mint command group - GCP delete order: function first (stops serving), then PEM secrets, service account, and WIF pool. Partial failures on non-critical resources (SA, WIF) are reported as warnings, not hard errors. Closes #2680
|
🤖 Finished Review · ✅ Success · Started 6:15 AM UTC · Completed 6:35 AM UTC Commit: |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
Looks good to me Previous runReviewFindingsLow
Previous run (2)ReviewFindingsMedium
Low
Labels: PR adds new mint CLI subcommand and modifies mint provisioner infrastructure |
|
/fs-fix the review comments, and do not assume docs are out of scope |
|
🤖 Finished Fix · ✅ Success · Started 8:18 AM UTC · Completed 8:31 AM UTC Commit: |
- Add assertions for DeleteFunction, DeleteServiceAccount, DeleteWIFPool calls in TestMintDeleteGCP_FullTeardown (test-inadequate) - Add deleteCalls tracking to fakeCFWranglerRunner and assert Delete was called in TestMintDeleteCloudflare_DurableTeardown (test-inadequate) - Track warnings and adjust summary message when non-critical resource deletions fail (error-handling) - Replace -- with em-dash in both dry-run messages to match codebase convention (naming-convention) - Add validate() call at top of CF Teardown() for defense-in-depth parity with Provision() (missing-validation) - Add mint delete to docs/cli/mint.md commands table and dedicated section, cross-reference in preview teardown description (missing-doc, stale-doc) - Add mint delete to docs/guides/infrastructure/mint-administration.md command summary and IAM role tables (missing-doc) - Add delete to mint section of CLI command tree in docs/guides/dev/cli-internals.md (missing-doc) - Add mint delete to standalone commands and IAM role breakdown tables in docs/guides/getting-started/operations.md (missing-doc) - Add fullsend mint delete to Token Mint managed-by annotation in docs/guides/infrastructure/infrastructure-reference.md (missing-doc) Addresses review feedback on #6022
🔧 Fix agent — iteration 1 (human-triggered)Addressed all 11 review findings: 2 test-inadequate (added GCF delete operation assertions and CF wrangler.Delete tracking), 6 missing-doc (added mint delete to all 5 referenced doc files), 1 stale-doc (cross-reference), 1 error-handling (conditional summary), 1 naming-convention (em-dash), 1 missing-validation (validate in Teardown). Fixed (11):
Tests: passedNext steps:
|
|
🤖 Review · ❌ Terminated · Started 8:32 AM UTC · Ended 8:50 AM UTC Commit: |
Site previewPreview: https://3b204bb6-site.fullsend-ai.workers.dev Commit: |
|
🤖 Finished Review · ✅ Success · Started 8:32 AM UTC · Completed 8:50 AM UTC Commit: |
|
/fs-fix fix the additional comments, and get coverage to 80% or above for this PR |
|
🤖 Finished Fix · ✅ Success · Started 8:58 AM UTC · Completed 9:15 AM UTC Commit: |
- Update stale validate() comment in cf/provisioner.go to reflect that DeployDurable now triggers full Worker deletion via Teardown - Add "delete" to the mint command Long description enumeration - Remove cfResolveAuth closure override pattern from mint_delete.go; call cf.ResolveCloudflareAuth(ctx) directly to match deploy command's env-var-based testability pattern - Add comprehensive tests for uncovered paths: GCP delete wrapper methods, LiveGCFClient delete REST calls (httptest), CF Teardown edge cases (validation failure, delete error), CLI error/validation paths (invalid region, invalid worker name, invalid preview alias, auth failure, dry-run preview, default worker name, unsupported platform), and fake client delete operations Addresses review feedback on #6022
🔧 Fix agent — iteration 2 (human-triggered)Addressed all 3 review findings (stale comment, missing 'delete' in description, inconsistent testability pattern) and boosted test coverage with 35+ new tests covering delete operations across CLI, provisioner, LiveGCFClient, and fake client layers. Fixed (8):
Tests: passedNext steps:
|
|
🤖 Finished Review · ✅ Success · Started 9:17 AM UTC · Completed 9:29 AM UTC Commit: |
ifireball
left a comment
There was a problem hiding this comment.
Approving after local tests indicate this is working both o GCP and on CF.
|
🤖 Finished Retro · ✅ Success · Started 10:18 AM UTC · Completed 10:32 AM UTC Commit: |
Retro: PR #6022 —
|
Summary
Add
fullsend mint deletecommand — the inverse ofmint deploy— to tear down mint infrastructure across all three deployment shapes:--platform=gcp): Deletes Cloud Function, PEM secrets, service account, and WIF pool/providers--platform=cloudflare): Deletes the Worker script and all bindings/secrets--platform=cloudflare --preview=<alias>): Abandons the preview alias without affecting the durable WorkerChanges
DeleteFunction,DeleteServiceAccount,DeleteWIFPoolmethods to theGCFClientinterface withLiveGCFClientREST API implementationsDeleteMintFunction,DeleteMintServiceAccount,DeleteMintWIFPoolprovisioner wrapper methodsProvisioner.Teardownto support durable Worker deletion viawrangler delete(previously rejected durable mode)newMintDeleteCmd()with--platform,--project,--region,--worker-name,--preview,--dry-run,--yoloflags--yolo), consistent withmint unenrollTesting
Deleteinstead of rejecting-racego vet ./...cleanCloses #2680
Post-script verification
agent/2680-mint-delete)236cf9501b8cea35985463e345cc92270f1a21a2..HEAD)