refactor(config): centralize configuration precedence with reusable ConfigResolver#120
Open
kangeunchan wants to merge 1 commit intoaltuslabsxyz:mainfrom
Open
Conversation
Signed-off-by: kangeunchan <kangeunchan080310@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enhancement Description
Centralize configuration precedence with a reusable ConfigResolver to remove duplicated merge logic and inconsistent behavior.
Summary
This PR introduces a single config resolution path that applies the same precedence across command entry points.
Previously, config merge logic was duplicated and could diverge by command path:
Now all targeted paths use one shared resolver with deterministic precedence.
What Changed
1) Added reusable ConfigResolver (SSOT)
Added shared precedence resolution in:
internal/config/resolver.gointernal/config/resolver_test.goPrecedence rule:
flags > env > file > defaults2) Migrated command call sites to shared resolver
Updated:
cmd/devnet-builder/commands/root.gocmd/devnet-builder/commands/core/init.gocmd/devnet-builder/commands/manage/deploy.goAll paths now resolve effective config through the same resolver API.
3) Preserved behavior while removing duplication
4) Tests
Added/updated tests:
internal/config/resolver_test.goWhy This Is Needed
This is a consistency and maintainability refactor.
A single resolver prevents precedence drift, reduces hidden differences between commands, and makes behavior easier to validate.
Behavior Notes / Regression Impact
No intentional user-facing behavior change.
The key change is deterministic and shared precedence handling across all integrated paths.
Validation Performed
go test ./internal/config/...go test ./cmd/devnet-builder/commands/...go test ./...golangci-lint run