Skip to content

refactor(cmd): split configure_gcp.go by concern - #2291

Merged
cristim merged 8 commits into
mainfrom
refactor/1834-split-gcp
Oct 20, 2026
Merged

cristim merged 8 commits into
mainfrom
refactor/1834-split-gcp

Conversation

@cristim

@cristim cristim commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Pure-move split of cmd/configure_gcp.go into concern-focused files (part of #1834).

Part of #1834.

AST proof: a go/ast dump of every top-level declaration with its doc comment and free-floating comments across cmd/*.go (non-test) was byte-identical to origin/main at every commit (checked after each commit). go vet ./cmd/... and go test -count=1 ./cmd/... pass.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added an interactive Google Cloud setup workflow covering authentication, project selection, service-account creation, IAM role configuration, and key creation.
    • Added support for creating or validating required custom IAM roles and granting access to the configured service account.
    • Added guided prompts for running authentication commands, confirming actions, and entering required configuration values.
    • Added automatic cleanup of temporary service-account keys after upload.
    • Improved credential validation, project discovery, and error reporting during setup.

cristim and others added 6 commits October 20, 2026 19:57
Pure move of the GCP SDK option, project listing and service-account creation helpers into configure_gcp_sdk.go. No behaviour change.

Part of #1834.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pure move of grantGCPIAMRole and addMemberToPolicyBinding into configure_gcp_iam.go. No behaviour change.

Part of #1834.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pure move of runGCPSetupCommands, gcpStepLogin and gcpStepSelectProject into configure_gcp_setup.go. No behaviour change.

Part of #1834.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pure move of the service-account step, existing-SA prompt and custom role helpers into configure_gcp_sa.go. No behaviour change.

Part of #1834.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pure move of gcpStepGrantRole and gcpStepCreateKey into configure_gcp_grant.go. No behaviour change.

Part of #1834.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pure move of readRequiredInputLine, promptAndRunGCPCommand and executeGCPCommand into configure_gcp_exec.go. No behaviour change.

Part of #1834.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

  • Run on-demand review

This review includes 8 billable files and costs up to $2.00.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 50 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 89 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: LeanerCloud/cloud-commitments-cli/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: fbf2f5c7-5e09-4bf4-91d3-de5149b78c8f
📥 Commits

Reviewing files that changed from the base of the PR and between 831d7a0 and 85ad31c.

📒 Files selected for processing: 8
  • .golangci.yml
  • cmd/configure_gcp.go
  • cmd/configure_gcp_exec.go
  • cmd/configure_gcp_grant.go
  • cmd/configure_gcp_iam.go
  • cmd/configure_gcp_sa.go
  • cmd/configure_gcp_sdk.go
  • cmd/configure_gcp_setup.go

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: LeanerCloud/cloud-commitments-cli/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: ed7d1303-0050-4307-8f7f-b50c5078549f
📥 Commits

Reviewing files that changed from the base of the PR and between 94cfa79 and 831d7a0.

📒 Files selected for processing: 8
  • .golangci.yml
  • cmd/configure_gcp.go
  • cmd/configure_gcp_exec.go
  • cmd/configure_gcp_grant.go
  • cmd/configure_gcp_iam.go
  • cmd/configure_gcp_sa.go
  • cmd/configure_gcp_sdk.go
  • cmd/configure_gcp_setup.go
💤 Files with no reviewable changes: 1
  • cmd/configure_gcp.go

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

📝 Walkthrough

The GCP setup implementation is divided into SDK, IAM, command-execution, and orchestration helpers. The existing configure file retains credential loading and Secrets Manager storage. The lint exclusion pattern now covers GCP and Azure configure files with optional _exec and _setup suffixes.

Changes: GCP setup

Layer / File(s) Summary
GCP SDK and service-account helpers
cmd/configure_gcp_sdk.go, cmd/configure_gcp_sa.go
Added ADC-backed project listing and service-account creation. Added input validation and custom-role provisioning.
IAM grants and key creation
cmd/configure_gcp_iam.go, cmd/configure_gcp_grant.go
Added IAM policy updates and interactive role-grant and service-account key steps.
Interactive setup orchestration
cmd/configure_gcp_exec.go, cmd/configure_gcp_setup.go, cmd/configure_gcp.go, .golangci.yml
Added input and command-execution helpers and sequential setup orchestration. Removed the setup implementation from configure_gcp.go and expanded the lint exclusion pattern.

Priority: ⬇️ Low

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to 831d7

No actionable merge-blocking issue is identified in the GCP setup reorganization; normal checks remain appropriate before merging.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: splitting configure_gcp.go into concern-focused files.
Docstring Coverage Passed Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 6 files. (1 skipped: 1 …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 6 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

cristim and others added 2 commits October 20, 2026 20:28
The moved exec.Command calls live in configure_{gcp,azure}_{exec,setup}.go, so widen the per-file noctx exclusion to match.

Part of #1834.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cristim

cristim commented Oct 20, 2026

Copy link
Copy Markdown
Member Author

Merge gate verdict (claude-cc-libs)

Every gate holds at head 85ad31c:

  • Two independent reviews approve the reviewed head 831d7a0. The branch was then updated from main, and the PR diff is byte-identical to the reviewed diff (compared mechanically).
  • CI is green on 85ad31c, which is the reviewed change on top of current main.
  • 0 unresolved threads; MERGEABLE/CLEAN.

CodeRabbit is waived as a merge gate under the 2026-10-19 decision. Squash-merging.

@cristim
cristim merged commit e7ae236 into main Oct 20, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant