Repository navigation
fix(cli): warn that a GCP key may exist when CreateKey fails ambiguously - #2244
Conversation
|
Warning Review limit reached
This review includes 4 billable files and costs up to $1.00.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 31 minutes for your next included review. View limit details
Comment |
Independent review verdict: CLEAN at a4e5d41Reviewer: fresh Claude agent (Sonnet, high effort), not the author, cold brief. The PR body was treated as a claim. Coordinator: claude-cc-reviewer. Blocking findings: none. How CreateKey errors are classified (
Verified:
Non-blocking note: 408 is 4xx, so it is treated as definite. It is a client-side timeout that could in theory follow a successful mint, but that is unlikely. What was attacked and how (no GCP calls):
Gate: labels are mirrored from #2117. Merge after an update onto main and green CI. |
a4e5d41 to
2153b28
Compare
Only a 4xx googleapi error proves the server rejected the request. A cancellation, timeout, 5xx or non-googleapi error can follow a committed mint, so the error now says the key may have been created and prints the gcloud keys list and keys delete commands. Adds unit cases and a check inside the signal-test child, and a CHANGELOG entry for PRs A, B and C. Closes #2117 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2153b28 to
961d56f
Compare
|
Rebase note [claude-cli-impl]: the first CI run on this PR failed in |
|
CR waived: quota, adversarial review + local verification + green CI (per CLAUDE.md:172-173). CodeRabbit posted 'Review limit reached'. Gate at 961d56f: CLEAN verdict (carried by range-diff =), CI green, mergeability CLEAN. (claude-cc-reviewer) |
Closes #2117
This is item 4, the last one. Items 1 and 2 merged in #2233 and item 3 merged in #2240.
Summary
An interrupt or an ambiguous failure during the GCP
CreateKeyRPC can still leave a key minted in GCP: the server may have committed it before the client gave up. The CLI used to report a plain failure, which implied no key exists.There is now a new
createKeyError:Only a
*googleapi.Errorwith a 4xx code, matched througherrors.As, counts as a definite failure. That error is returned as before.Everything else is treated as ambiguous: a canceled context, an exceeded deadline, a 5xx, or any non-googleapi error.
An ambiguous failure keeps the original error (wrapped with
%w) and adds this text:This only reports the possible orphan; the CLI doesn't find or delete it. Auto-reconciling would need a new
ListKeyspermission, and it could delete a key that another operator created at the same time.CHANGELOG.mdgets one(#2117)entry covering all three PRs:Evidence (local, macOS,
GOTOOLCHAIN=go1.26.9, using fakes and the signal-test harness, no GCP calls)configure_gcp.goreverted to origin/main,TestWriteServiceAccountKey_CreateFailureAmbiguous(500,context.Canceledand network-error cases) andTestRunConfigureGCP_InterruptDuringMintfail. Both pass with the change. The child process checks the "may have been created" text after its Canceled guard.CreateFailureNoOrphannow usesgoogleapi.Error{Code: 403}and asserts the warning text is absent.--managed-by=userfails the command assertion.make build,go vet ./...andgo test -race ./cmd/...pass.-count=5: 440 passed.scripts/test-git-secrets-allowlist.shpasses 44/44.🤖 Generated with Claude Code