diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-28 09:47:22 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-28 09:47:22 +0300 |
| commit | 493f8aa11ce49572fa23ac06ebde323b470e1623 (patch) | |
| tree | c99276320dffe09f707f96b760c30752f3ddf9bb /tests | |
| parent | ea9de473e3d6788ea08ca3697722cf89b9d1d107 (diff) | |
mr0: add CONFIG_SPECS registry; derive defaults, CLI targets, print, validation
Introduce src/lib/config.spec.source.sh: CONFIG_SPECS, a single '|'-delimited
config-field registry (name|default|has_default|cli_overridable|validation|
print_kind), using the same spec idiom as ACTION_SPECS / TEMPLATE_RENDER_FIELD_SPECS.
This replaces the parallel, hand-maintained config-knowledge lists that caused the
TARBALL_INCLUDE default-drift bug (fixed in 7r0).
Derived consumers (behaviour byte-identical):
- apply_config_defaults: loops the registry applying VAR="${VAR:-default}" for
has_default=yes scalars; arrays keep their declare -p guards.
- CLI_CONFIG_OVERRIDE_TARGETS: built from cli_overridable=yes (verified to match
CLI_OPTION_SPEC's config= targets exactly).
- print_config: emits in registry order dispatching on print_kind.
- validate_common_config: required set + per-field rule come from the registry via
config_spec_validation + validate_config_field_required/_kind; two-phase order and
historical reporting order preserved.
log_configured_action and the dry-run plan are not yet converted (bespoke prose /
intermixed computed values). shellcheck: TARBALL_SUFFIX lost its visible literal
assignment, annotated at the archive use site.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/cli.sh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/cli.sh b/tests/cli.sh index c8cbd36..ca5d170 100755 --- a/tests/cli.sh +++ b/tests/cli.sh @@ -2486,6 +2486,11 @@ test_config_validators_fail_fast_without_errexit() { local output local -i status=0 + # validate_common_config derives its required set and per-field rules from + # CONFIG_SPECS (task mr0), so the registry module must be sourced alongside + # the validators when exercising it in isolation. + # shellcheck source=src/lib/config.spec.source.sh + source "$TEST_REPO_ROOT/src/lib/config.spec.source.sh" # shellcheck source=src/lib/config.validate.source.sh source "$TEST_REPO_ROOT/src/lib/config.validate.source.sh" |
