Skip to content

refactor(manage): decompose upgrade and deploy command handlers#102

Open
kangeunchan wants to merge 1 commit intoaltuslabsxyz:mainfrom
kangeunchan:refactor/cli-decompose-upgrade-deploy
Open

refactor(manage): decompose upgrade and deploy command handlers#102
kangeunchan wants to merge 1 commit intoaltuslabsxyz:mainfrom
kangeunchan:refactor/cli-decompose-upgrade-deploy

Conversation

@kangeunchan
Copy link
Collaborator

Summary

This PR refactors the two critical manage command handlers, runUpgrade and runDeploy, into smaller private steps while preserving existing behavior.
The goal is to reduce complexity, lower review risk, and improve helper-level testability.

What Changed

  • Decomposed runUpgrade into orchestration + extracted private helper steps
  • Decomposed runDeploy into orchestration + extracted private helper steps
  • Added helper-focused unit tests for both command paths
  • Added CI guardrails for cyclomatic complexity and function LOC, scoped only to:
    • runUpgrade
    • runDeploy

Files Updated

  • cmd/devnet-builder/commands/manage/upgrade.go
  • cmd/devnet-builder/commands/manage/deploy.go
  • cmd/devnet-builder/commands/manage/upgrade_refactor_test.go
  • cmd/devnet-builder/commands/manage/deploy_refactor_test.go
  • scripts/check-manage-handler-complexity.sh
  • .github/workflows/ci.yml

Behavior / Compatibility

  • No user-facing flag changes
  • No CLI UX/output format changes
  • No intended business-logic semantic changes

Validation

  • go test ./cmd/devnet-builder/commands/manage/...
  • ./scripts/check-manage-handler-complexity.sh

Measured results:

  • runUpgrade: CC=8, LOC=35
  • runDeploy: CC=6, LOC=29

Known Pre-existing Issue (Out of Scope)

go test ./... -run '^$' still fails due to unrelated existing symbols in cmd/devnet-builder/main_test.go:

  • resolveMigrationTargetVersion
  • defaultMigrationTargetVersion

This is not introduced by this PR and is outside the manage refactor scope.

Risks

These are critical workflows, so subtle regressions are possible in theory.
Risk is mitigated by preserving existing execution paths and adding helper-level tests around extracted logic.

Checklist

  • Decompose runUpgrade
  • Decompose runDeploy
  • Add helper-level tests
  • Add targeted CC/LOC CI checks
  • Attach smoke logs for upgrade + deploy(local/docker) if required by release process

Signed-off-by: kangeunchan <kangeunchan080310@gmail.com>
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