Handle 403 during first GCP up - #2061
Conversation
Fixes GCP API Activation error on first deployment Fixes #2051
📝 WalkthroughWalkthroughThe PR improves GCP error handling to treat access-denied scenarios as "object not found" conditions, removes unused test utilities, skips completion installation during CI runs, and deletes an unused error-detail extraction helper function. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.11.4)level=warning msg="[linters_context] running gomodguard failed: unable to read module file go.mod: current working directory must have a go.mod file: if you are not using go modules it is suggested to disable this linter" Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/pkg/cli/client/byoc/gcp/byoc.go`:
- Around line 851-852: The current predicate treats any error containing "(or it
may not exist)" as a not-exist case which can mask real auth failures; change
the conditional around gcp.ErrObjectNotExist so you only return
client.ErrNotExist when the error is explicitly gcp.ErrObjectNotExist OR when
the error is a 403 permission response that also includes the exact "(or it may
not exist)" text (i.e., narrow to HTTP 403 + that phrase). Implement a small
helper (e.g., is403WithMaybeNotExist(err)) and use it in place of
strings.Contains(err.Error(), "(or it may not exist)") so only the specific
forbidden-with-maybe-not-exist scenario falls back to client.ErrNotExist instead
of all errors containing that substring.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 96e7028f-0d2b-4337-9c7e-7e8a718bda38
📒 Files selected for processing (6)
src/bin/installsrc/pkg/cli/client/byoc/aws/byoc_test.gosrc/pkg/cli/client/byoc/gcp/byoc.gosrc/pkg/cli/client/byoc/gcp/byoc_test.gosrc/pkg/cli/client/byoc/gcp/errors.gosrc/pkg/cli/client/byoc/gcp/errors_test.go
💤 Files with no reviewable changes (2)
- src/pkg/cli/client/byoc/aws/byoc_test.go
- src/pkg/cli/client/byoc/gcp/errors.go
Description
Handle permission error that happens when we try to load the ProjectUpdate bucket object the first time we do "up". This happens before the
SetupCDis run, so before bootstrapping.Linked Issues
Fixes #2051
Checklist
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests
Chores