Bug Description
LoadConfig() in internal/config/config.go assembles a Config struct from flags, environment variables, config file, and defaults, but performs no semantic validation on the result. Invalid values pass through and are only caught later (or not at all) at use sites:
- Empty namespace — produces K8s resources with no namespace, which either fail at the API or land in the
default namespace
- Invalid memory format — caught later by
resource.ParseQuantity in BuildVMSpec, but the error message lacks config-level context
- Zero or negative CPU cores — silently produces a VM spec with 0 CPU cores
- Zero or negative timeout — creates a deadline that is already in the past, causing immediate timeout failures with a misleading error
Steps to Reproduce
- Run
virtwork run --cpu-cores 0 --timeout -1 --namespace ""
- Observe that
LoadConfig succeeds
- Downstream failures occur with confusing error messages that don't point back to the invalid config
Expected Behavior
LoadConfig() should validate the assembled config and return a clear error naming the invalid field, the value it received, and what is expected. Fail fast at config load time rather than producing cascading failures downstream.
Actual Behavior
Invalid config values pass through LoadConfig silently. Failures surface later with no context about which config field caused the problem.
Command
virtwork run
Affected Files
internal/config/config.go:96-181 — LoadConfig() has no post-assembly validation
Bug Description
LoadConfig()ininternal/config/config.goassembles aConfigstruct from flags, environment variables, config file, and defaults, but performs no semantic validation on the result. Invalid values pass through and are only caught later (or not at all) at use sites:defaultnamespaceresource.ParseQuantityinBuildVMSpec, but the error message lacks config-level contextSteps to Reproduce
virtwork run --cpu-cores 0 --timeout -1 --namespace ""LoadConfigsucceedsExpected Behavior
LoadConfig()should validate the assembled config and return a clear error naming the invalid field, the value it received, and what is expected. Fail fast at config load time rather than producing cascading failures downstream.Actual Behavior
Invalid config values pass through
LoadConfigsilently. Failures surface later with no context about which config field caused the problem.Command
virtwork run
Affected Files
internal/config/config.go:96-181—LoadConfig()has no post-assembly validation