summaryrefslogtreecommitdiff
path: root/tests/cli.sh
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-24 21:36:34 +0300
committerPaul Buetow <paul@buetow.org>2026-06-24 21:36:34 +0300
commita79e7d77cc6717f6c5bfaaefa5361f396c322de3 (patch)
tree1787b7d87a95f9b2a99626837f9b988dd5ee7f9a /tests/cli.sh
parentfe89919d47296844364323e5b1dd9ce25511f3dd (diff)
Fix TARBALL_INCLUDE config default drift (7r0, scoped down)
apply_config_defaults fell back to TARBALL_INCLUDE=no while the user-facing src/shuriken.default.conf documents (and --init writes) TARBALL_INCLUDE=yes. The two disagreed, so an album generated from a config that omitted the key silently dropped the tarball despite the documented default saying otherwise. 'yes' is the authoritative default: the original definition was `declare -r TARBALL_INCLUDE=yes` (tarball inclusion was on from the start); the ':-no' fallback was introduced later during a refactor and drifted from the documented intent. Align apply_config_defaults to ':-yes' and add a comment explaining the invariant and the history. Tests: add test_tarball_include_default_matches_init_config asserting the effective default agrees between a fresh --init config and apply_config_defaults (and is 'yes'); update the omitted-runtime-defaults --print-config expectation to the corrected 'yes'. bin/shuriken regenerated via just build. This is the scoped-down drift fix only. The full CONFIG_SPECS registry plus cfg_get/SHURIKEN_CFG access-layer rewrite proposed in 7r0 remains DEFERRED. just test, just shellcheck, just check-generated and git diff --check all pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'tests/cli.sh')
-rwxr-xr-xtests/cli.sh44
1 files changed, 43 insertions, 1 deletions
diff --git a/tests/cli.sh b/tests/cli.sh
index eae2f19..5d69684 100755
--- a/tests/cli.sh
+++ b/tests/cli.sh
@@ -251,6 +251,45 @@ test_init_existing_config_fails_without_overwrite() {
test::teardown
}
+# Guards against config DEFAULT DRIFT for TARBALL_INCLUDE: its documented default
+# in shuriken.default.conf (written verbatim by --init) MUST agree with the
+# fallback applied by apply_config_defaults when the key is unset. These two
+# previously disagreed ('yes' in the conf vs 'no' in apply_config_defaults); the
+# authoritative default is 'yes' (tarball inclusion has been on since the start).
+test_tarball_include_default_matches_init_config() {
+ local init_default
+ local applied_default
+
+ test::setup
+
+ # Value a fresh --init config gives the user (the documented default).
+ (
+ cd "$TEST_TMPDIR"
+ SHURIKEN_DEFAULT_RC="$TEST_TMPDIR/missing" \
+ "$TEST_SHURIKEN" --init >/dev/null
+ )
+ init_default=$(
+ set -euo pipefail
+ # shellcheck disable=SC1090,SC1091
+ source "$TEST_TMPDIR/shuriken.conf"
+ printf '%s\n' "$TARBALL_INCLUDE"
+ )
+
+ # Value apply_config_defaults falls back to when the key is left unset.
+ applied_default=$(
+ set -euo pipefail
+ # shellcheck source=/dev/null
+ source <(sed '$d' "$TEST_SHURIKEN")
+ unset -v TARBALL_INCLUDE || true
+ apply_config_defaults
+ printf '%s\n' "$TARBALL_INCLUDE"
+ )
+
+ test "$init_default" = "$applied_default"
+ test "$applied_default" = yes
+ test::teardown
+}
+
test_just_install_and_deinstall_with_destdir() {
local stage_dir
@@ -1499,7 +1538,7 @@ RANDOM_SEED=''
SHUFFLE=no
SPLASH_PAGE=yes
STATS_PAGE=no
-TARBALL_INCLUDE=no
+TARBALL_INCLUDE=yes
TARBALL_SUFFIX=.tar
TAR_TIMEOUT=120
TAR_OPTS=( -c )
@@ -6466,6 +6505,9 @@ main() {
'--init refuses existing config without overwrite' \
test_init_existing_config_fails_without_overwrite
test::run_case \
+ 'TARBALL_INCLUDE default matches between --init config and apply_config_defaults' \
+ test_tarball_include_default_matches_init_config
+ test::run_case \
'just install and deinstall supports DESTDIR' \
test_just_install_and_deinstall_with_destdir
test::run_case '--clean succeeds' test_clean