Repository navigation
fix(gcp/computeengine): fail loud when a non-empty idempotency token cannot form a request ID - #496
Conversation
…cannot form a request ID A short all-hex token such as abc passed the commitment-name check but IdempotencyGUID returned empty, silently dropping the insert RequestId. Use common.OrderIDFromToken so the purchase fails before Insert, and replace the package-local sentinel with common.ErrInvalidIdempotencyToken. The error masks the token. Closes #488 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@coderabbitai review |
|
Warning Review limit reached
This review includes 3 billable files and costs up to $0.75.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 37 minutes for your next included review. View limit details
Comment |
|
Independent review verdict: CLEAN at eed99d3Reviewer: fresh Claude agent (Sonnet, high effort), not the author, cold brief, focused on the money path. Coordinator: claude-cc-reviewer. Blocking findings: none. Purchase path (
Request ID format: Pin: What was attacked and how (
Gate: labels are mirrored from #488. Merge once CI is green. (claude-cc-reviewer) |
Summary
GCP twin of #104 A09-020.
buildInsertRequest(providers/gcp/services/computeengine/client.go) set the commitment insertRequestIdfromcommon.IdempotencyGUID(token), which returns "" for a non-empty token that cannot form a GUID. A short all-hex token such asabcpassedidempotentCommitmentNameand then silently lost request-level idempotency.build(gcp): bump theproviders/gcppkg pin498b74f31f01->2bf23fbd8c2a(origin/main) to pick upcommon.OrderIDFromToken(feat(common): add OrderIDFromToken, which fails loud on a malformed idempotency token #487). The other pulled pkg commits need no gcp changes (build and tests pass).fix(gcp/computeengine):RequestIdnow comes fromcommon.OrderIDFromToken(token, ""). An empty token still sends no RequestId (CLI path unchanged); a non-empty token that cannot form a GUID returnsderive GCP request ID: ...wrappingcommon.ErrInvalidIdempotencyToken(token masked) before any Insert, and the purchase result reports the error withSuccessfalse. The package's unexportederrInvalidIdempotencyTokenis replaced by the shared sentinel (only this file and its test used it; cli, mcp and platform do not reference it).Closes #488
Tests
TestPurchaseCommitment_UnformableRequestIDTokenFailsLoud(abc, 31 hex chars):errors.Is(err, common.ErrInvalidIdempotencyToken)and no Insert request recorded.abcpassesidempotentCommitmentName(cud-abc), so this case exercises the new RequestId check. Existing 64-hex and empty-token tests pass.client.go, both subtests fail ("An error is expected but got nil").requestID = "") fails both subtests (independently reproduced by the reviewer).Verification
make build,make vet,(cd providers/gcp && GOWORK=off go build ./... && GOWORK=off go test -race -short ./services/computeengine/...),go mod tidy -diffclean, pinned golangci-lint v2.10.1 (0 issues), gofmt, and the commit/pre-push hooks pass. Unit-level evidence only.Local review: one adversarial pass by a non-author reviewer (the one that reviewed #487 and #495), no actionable findings. No overlap with #307 (it edits
client.goaround lines 465 and 1171-1190; this PR around 870 and 1445).🤖 Generated with Claude Code