-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Enhancement
Centralize configuration precedence (flags > env > file > defaults) in a reusable resolver to remove duplication and inconsistencies.
Scope type: Configuration tooling and CLI support refactor
Background
Multiple commands implement their own config merge logic with slightly different precedence and validation behavior, leading to drift and duplicated code.
Scope
Introduce ConfigResolver with consistent precedence
- Files: internal/config/resolver.go (new)
Migrate commands to use ConfigResolver
- Files: cmd/devnet-builder/commands/manage/deploy.go
- Files: cmd/devnet-builder/commands/manage/upgrade.go
- Files: cmd/dvb/provision.go
- Files: other commands with manual merge logic (as identified)
Add optional config source tracing
- Files: internal/config/resolver.go
- Files: internal/output/** or command output paths (if needed)
Non-Goals
- Changing actual precedence semantics without explicit decision
- Large rework of configuration schemas
- Rewriting CLI flag definitions wholesale
Risks and Open Questions
- Resolver must handle cobra flag “Changed” semantics correctly
- Env var mapping must remain stable and documented
- Tracing of config sources must not leak sensitive values
Validation Plan
Unit and Integration Checks
- go test ./... for resolver and command packages
- Ensure existing command integration tests still pass
- Unit tests covering precedence permutations (flag/env/file/default)
End-to-End Checks
- Smoke: deploy/upgrade/provision with mixed sources and verify effective config
- Verify invalid configs fail early with new resolver path
Evidence Required in Issue Updates
- Example logs showing config source tracing for a few fields
- Diff snippet illustrating removal of duplicated merge blocks
Acceptance Criteria
- All target commands use ConfigResolver
- Precedence is implemented in one place and documented
- Adding a new config field requires editing a single resolver mapping
- Config merge code reduced substantially (target: ~200 LOC -> <50 LOC across commands)
Deliverables
- PR adding ConfigResolver
- PR migrating each command to ConfigResolver
- Documentation notes for precedence and optional tracing
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels