refactor(config): unify validator-count rules across modes #108
Open
kangeunchan wants to merge 1 commit intoaltuslabsxyz:mainfrom
Open
refactor(config): unify validator-count rules across modes #108kangeunchan wants to merge 1 commit intoaltuslabsxyz:mainfrom
kangeunchan wants to merge 1 commit intoaltuslabsxyz:mainfrom
Conversation
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
Unify validator count rules across YAML/TOML/CLI paths to prevent late runtime failures and inconsistent behavior.
Summary
This PR introduces a single source of truth for validator count validation and applies it consistently across config and CLI entry points.
Previously, validator checks differed by path:
deployused mode-aware bounds (docker: 1-100,local: 1-4)1-4regardless of modedvb provisionhad no upper bound check in flag modeNow all relevant paths use one shared validator rule.
What Changed
1) SSOT validator function
Added shared mode-aware validation in:
internal/config/validator.gointernal/config/validator_test.goRules:
local:1-4docker:1-100docker2) Replaced inconsistent call sites with SSOT
Updated:
internal/config/validate.goEffectiveConfig.Validate()now validates validator count by modeValidateFileConfig()now validates validator count by mode (when mode is set; defaults to docker otherwise)internal/config/yaml_validator.gointernal/config/yaml_config.gocmd/devnet-builder/commands/manage/deploy.gocmd/dvb/provision.go3) Interactive path consistency
Updated interactive validator prompt to use the same mode-aware bounds:
internal/config/interactive.go4) Tests
Added/updated tests:
internal/config/validate_test.gointernal/config/validator_test.gointernal/config/yaml_validator_test.gointernal/config/yaml_config_test.gocmd/dvb/provision_test.goWhy This Is Needed
This is a consistency bugfix, not a semantic change:
Behavior Notes / Regression Impact
This may tighten validation for users who previously relied on permissive or inconsistent paths.
Example: values that passed some YAML/TOML flows but violate mode-specific constraints now fail early with consistent errors.
Validation Performed
go test ./internal/config/...go test ./cmd/devnet-builder/commands/manage/...go test ./cmd/dvb/...go test ./...golangci-lint runwas also executed; repository has existing baseline lint issues outside this PR scope.