feat(cli): add mint sub-command for standalone GCP mint management - #1261
Conversation
Site previewPreview: https://00b6dcad-site.fullsend-ai.workers.dev Commit: |
ReviewReason: stale-head The review agent reviewed commit Previous runReviewFindingsNo findings. Well-structured additive feature with thorough input validation, comprehensive error handling, and good test coverage (354 lines CLI tests + 296 lines provisioner tests). The three behavioral changes to existing code were verified against the diff:
Race conditions on WIF condition read-modify-write ( Previous run (2)ReviewFindingsMedium
Low
Info
Previous run (3)ReviewFindingsMedium
Low
Info
Previous run (4)ReviewFindingsMedium
Info
Previous run (5)ReviewFindingsMedium
Info
Previous run (6)ReviewFindingsLow
Info
Previous run (7)ReviewFindingsMedium
Low
Info
Previous run (8)ReviewFindingsMedium
Low
Info
Previous run (9)ReviewFindingsMedium
Low
Previous run (10)ReviewFindingsMedium
Low
Previous run (11)ReviewFindingsLow
Info
|
0cd6d29 to
3b70f4b
Compare
3b70f4b to
7b71dc4
Compare
7b71dc4 to
122dad5
Compare
122dad5 to
b76f100
Compare
b76f100 to
26376f2
Compare
26376f2 to
36b2423
Compare
36b2423 to
1d75fdb
Compare
ralphbean
left a comment
There was a problem hiding this comment.
The make test tests need to pass. e2e can continue to fail until it is fixed on main, but let's not regress make test.
Add `fullsend mint` command tree with four sub-commands that operate on GCP mint infrastructure without requiring a GitHub token: - `mint deploy`: deploy/update the mint Cloud Function - `mint enroll <org|owner/repo>`: enroll org or repo in mint - `mint unenroll <org|owner/repo>`: remove org or repo from mint - `mint status [org]`: read-only health check of mint state Also adds new Provisioner methods for unenroll operations: RemoveOrgFromMint, RemoveRepoFromMint, DisablePEMSecrets, DeletePEMSecrets, DisableWIFProvider, DeleteWIFProvider. Extends GCFClient interface with DisableSecretVersion, DeleteSecret, DisableWIFProvider, and DeleteWIFProvider methods. Signed-off-by: Wayne Sun <gsun@redhat.com>
…er step The conflict-recovery path now calls enableWIFProvider after undelete + update. Add a 4th mock handler for the enable PATCH and bump the expected call count from 3 to 4. Signed-off-by: Wayne Sun <gsun@redhat.com>
Validate the request body in the 4th mock handler to prove the conflict-recovery path sends disabled=false (enable), not disabled=true. Signed-off-by: Wayne Sun <gsun@redhat.com>
- Update Banner() calls to Banner(Version()) to match signature change from the merged inference-subcommand PR - Add unit tests for stripPlaceholderOrg and stripPlaceholderRoleAppIDs covering edge cases (empty, malformed JSON, mixed placeholders) - Add unit tests for confirmUnenroll (match, mismatch, EOF, non-terminal) - Add HTTP-level tests for DisableSecretVersion, DeleteSecret, DisableWIFProvider, and DeleteWIFProvider (happy path, 404 idempotency, error status codes) - Log undelete error during WIF provider conflict recovery instead of silently discarding it Signed-off-by: Wayne Sun <gsun@redhat.com>
2d3c9c0 to
eaf38d4
Compare
Test failure fixed: added 4th mock handler for enableWIFProvider in CreateWIFProvider conflict test. CI test job now passes green.
Summary
fullsend mintsub-command tree with 4 commands:deploy,enroll,unenroll,statusadmin installso GCP admins can manage token mint infrastructure without needing GitHub credentialsdeployprovisions the Cloud Function and supporting GCP infrastructure (SA, WIF, function deploy)enrollperforms full enrollment: PEM copy, env var merge (ALLOWED_ORGS, ROLE_APP_IDS), and per-repo WIF provider creationunenrollreverses enrollment with confirmation prompt; defaults to disable-only (explicit flags for permanent deletion)statusprovides read-only health check with enrolled orgs, PEM status, and WIF stateProvisionermethods for unenroll operations (RemoveOrgFromMint, RemoveRepoFromMint, DisablePEMSecrets, DeletePEMSecrets, DisableWIFProvider, DeleteWIFProvider, etc.)GCFClientinterface with 4 new GCP operationsTest plan
go test ./internal/cli/...passesgo test ./internal/dispatch/gcf/...passes (296 new lines of provisioner tests)go vetcleanfullsend mint --helpshows all 4 sub-commandsfullsend mint deploy --helpshows all flagsfullsend mint enroll --helphandles both org and owner/repo argsfullsend mint unenrollrequires confirmationfullsend mint deploy <org> --project=<proj>deploys Cloud Functionfullsend mint enroll <org> --project=<proj>copies PEMs and updates env varsfullsend mint status --project=<proj>shows mint healthBehavioral changes to existing code
This PR is predominantly additive, but it modifies 3 existing behaviors:
validateOrgName()tightening (internal/cli/admin.go) — Adds a max-length check (39 characters) and rejects consecutive hyphens. This aligns validation with GitHub's actual org name rules. Low risk: GitHub itself already enforces these constraints, so no valid org name should be rejected that was previously accepted.CreateWIFProviderconflict-handling fix (internal/dispatch/gcf/gcp.go) — When a 409 Conflict occurs (soft-deleted provider), the old code would undelete and update the provider but could leave it in a disabled state. The new code adds anenableWIFProvider()call after recovery so the provider is always re-enabled. This is a bug fix.EnsureOrgInMintplaceholder stripping (internal/dispatch/gcf/provisioner.go) — On the firstadmin installrun, the deploy-timePlaceholderOrgentries are now stripped fromALLOWED_ORGSandROLE_APP_IDSbefore the real org is enrolled. This is correct behavior since enrollment always follows deployment, and the placeholder values should not persist alongside real data.