Skip to content

chore: rename Region in 'cd ls' to CdRegion#1994

Merged
lionello merged 1 commit intomainfrom
lio/rename-cd-region
Mar 18, 2026
Merged

chore: rename Region in 'cd ls' to CdRegion#1994
lionello merged 1 commit intomainfrom
lio/rename-cd-region

Conversation

@lionello
Copy link
Member

@lionello lionello commented Mar 18, 2026

Description

…because might not be the same as stack region, especially after #1916

Linked Issues

Checklist

  • I have performed a self-review of my code
  • I have added appropriate tests
  • I have updated the Defang CLI docs and/or README to reflect my changes, if necessary

Summary by CodeRabbit

Release Notes

  • Refactor
    • Updated column label in CD list from "Region" to "CdRegion" for improved semantic accuracy.
    • Simplified internal stack collection logic for better code efficiency across cloud providers.

because might not be the same as stack region
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a2497ffc-f28d-4bf1-bb0c-2476c16b52a6

📥 Commits

Reviewing files that changed from the base of the PR and between 9f7aa75 and b968f6c.

📒 Files selected for processing (5)
  • src/pkg/cli/cd.go
  • src/pkg/cli/client/byoc/aws/list.go
  • src/pkg/cli/client/byoc/do/byoc.go
  • src/pkg/cli/client/byoc/gcp/byoc.go
  • src/pkg/cli/client/byoc/state/state.go

📝 Walkthrough

Walkthrough

The pull request renames the Region field to CdRegion across the state management struct and all cloud provider implementations (AWS, GCP, DigitalOcean), adding clarification that it doesn't necessarily represent the stack's region. A code cleanup in the CLI refactors iteration logic using slices.Collect.

Changes

Cohort / File(s) Summary
State struct definition
src/pkg/cli/client/byoc/state/state.go
Renamed public field Region to CdRegion in Info struct with added comment noting it's not necessarily the stack region.
Cloud provider implementations
src/pkg/cli/client/byoc/aws/list.go, src/pkg/cli/client/byoc/do/byoc.go, src/pkg/cli/client/byoc/gcp/byoc.go
Updated struct field assignments in state.Info from Region to CdRegion across all three cloud provider implementations.
CLI layer
src/pkg/cli/cd.go
Refactored iteration logic with slices.Collect(), removed unused import, and updated UI table column name from "Region" to "CdRegion".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • DefangLabs/defang#1914: Initial PR that introduced the Region field in state.Info, which this PR refactors by renaming to CdRegion and updating all usages.

Suggested reviewers

  • jordanstephens
  • edwardrf

Poem

🐰 A field renamed with care so true,
From Region to CdRegion, the labels grew,
Through AWS, GCP, and clouds between,
The cleanest refactor ever seen! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: renaming a field from 'Region' to 'CdRegion' in the 'cd ls' command context.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch lio/rename-cd-region
📝 Coding Plan
  • Generate coding plan for human review comments

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.3)

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"
level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


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

@lionello lionello merged commit e7e1625 into main Mar 18, 2026
14 checks passed
@lionello lionello deleted the lio/rename-cd-region branch March 18, 2026 18:15
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.

2 participants