Skip to content

Commit 0116829

Browse files
feat(dso-kknz): batch 4 — RED tests for read-config.sh .claude/dso-config.conf resolution
Add 3 new tests to test-read-config.sh verifying that read-config.sh resolves config from .claude/dso-config.conf, removes fallback to workflow-config.conf, and preserves WORKFLOW_CONFIG_FILE env override. Two tests are intentionally RED; one passes (env override already works). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a475056 commit 0116829

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed

.tickets/dso-s6kt.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,10 @@ CHECKPOINT 3/6: Tests written ✓ — added test_resolves_from_dot_claude_dso_co
7070
<!-- sync: unsynced -->
7171

7272
CHECKPOINT 4/6: Implementation complete ✓ — No implementation change needed for RED phase; tests written only.
73+
74+
<!-- note-id: k3w5jqmd -->
75+
<!-- timestamp: 2026-03-20T04:41:00Z -->
76+
<!-- origin: agent -->
77+
<!-- sync: unsynced -->
78+
79+
CHECKPOINT 6/6: Done ✓ — All 4 ACs pass. 3 new tests added to tests/scripts/test-read-config.sh. 2 fail RED (test_resolves_from_dot_claude_dso_config_conf, test_no_fallback_to_workflow_config_conf), 1 passes (test_workflow_config_file_env_still_works — env var override already works). 32 existing tests unaffected.

tests/scripts/test-read-config.sh

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,4 +589,88 @@ if [[ "$FAIL" -eq "$_fail_before_yye" ]]; then
589589
echo "test_yaml_yml_extension ... PASS"
590590
fi
591591

592+
# ── .claude/dso-config.conf resolution tests ─────────────────────────────────
593+
# These tests assert the new resolution behavior: read-config.sh should resolve
594+
# from .claude/dso-config.conf in the git root (not workflow-config.conf).
595+
# These tests are RED (failing) until the implementation task dso-opue runs.
596+
597+
# ── test_resolves_from_dot_claude_dso_config_conf ─────────────────────────────
598+
# Given a temp git repo with .claude/dso-config.conf (no workflow-config.conf),
599+
# read-config.sh reads config from .claude/dso-config.conf.
600+
_fail_before_rdcd=$FAIL
601+
_tmp_repo_rdcd="$(mktemp -d)"
602+
git -C "$_tmp_repo_rdcd" init -q
603+
mkdir -p "$_tmp_repo_rdcd/.claude"
604+
cat > "$_tmp_repo_rdcd/.claude/dso-config.conf" <<'CONF'
605+
test_command=make test-dso
606+
CONF
607+
rdcd_exit=0
608+
rdcd_output=""
609+
rdcd_output=$(
610+
cd "$_tmp_repo_rdcd" && \
611+
unset WORKFLOW_CONFIG_FILE 2>/dev/null; \
612+
unset CLAUDE_PLUGIN_ROOT 2>/dev/null; \
613+
bash "$SCRIPT" "test_command" 2>&1
614+
) || rdcd_exit=$?
615+
assert_eq "test_resolves_from_dot_claude_dso_config_conf: exit 0" "0" "$rdcd_exit"
616+
assert_eq "test_resolves_from_dot_claude_dso_config_conf: reads from .claude/dso-config.conf" "make test-dso" "$rdcd_output"
617+
if [[ "$FAIL" -eq "$_fail_before_rdcd" ]]; then
618+
echo "test_resolves_from_dot_claude_dso_config_conf ... PASS"
619+
fi
620+
rm -rf "$_tmp_repo_rdcd"
621+
622+
# ── test_no_fallback_to_workflow_config_conf ──────────────────────────────────
623+
# Given a temp git repo with only workflow-config.conf at root (no
624+
# .claude/dso-config.conf), read-config.sh returns empty string, exit 0
625+
# (no fallback to old path).
626+
_fail_before_nfwc=$FAIL
627+
_tmp_repo_nfwc="$(mktemp -d)"
628+
git -C "$_tmp_repo_nfwc" init -q
629+
cat > "$_tmp_repo_nfwc/workflow-config.conf" <<'CONF'
630+
test_command=make test-old
631+
CONF
632+
nfwc_exit=0
633+
nfwc_output=""
634+
nfwc_output=$(
635+
cd "$_tmp_repo_nfwc" && \
636+
unset WORKFLOW_CONFIG_FILE 2>/dev/null; \
637+
unset CLAUDE_PLUGIN_ROOT 2>/dev/null; \
638+
bash "$SCRIPT" "test_command" 2>&1
639+
) || nfwc_exit=$?
640+
assert_eq "test_no_fallback_to_workflow_config_conf: exit 0" "0" "$nfwc_exit"
641+
assert_eq "test_no_fallback_to_workflow_config_conf: empty output (no fallback)" "" "$nfwc_output"
642+
if [[ "$FAIL" -eq "$_fail_before_nfwc" ]]; then
643+
echo "test_no_fallback_to_workflow_config_conf ... PASS"
644+
fi
645+
rm -rf "$_tmp_repo_nfwc"
646+
647+
# ── test_workflow_config_file_env_still_works ─────────────────────────────────
648+
# WORKFLOW_CONFIG_FILE env var still overrides all resolution (backward compat
649+
# for test isolation).
650+
_fail_before_wcfe=$FAIL
651+
_tmp_repo_wcfe="$(mktemp -d)"
652+
git -C "$_tmp_repo_wcfe" init -q
653+
mkdir -p "$_tmp_repo_wcfe/.claude"
654+
# .claude/dso-config.conf exists but should NOT be used — env var wins
655+
cat > "$_tmp_repo_wcfe/.claude/dso-config.conf" <<'CONF'
656+
test_command=make test-from-dso-config
657+
CONF
658+
_wcfe_override_file="$(mktemp)"
659+
cat > "$_wcfe_override_file" <<'CONF'
660+
test_command=make test-from-env-override
661+
CONF
662+
wcfe_exit=0
663+
wcfe_output=""
664+
wcfe_output=$(
665+
cd "$_tmp_repo_wcfe" && \
666+
WORKFLOW_CONFIG_FILE="$_wcfe_override_file" bash "$SCRIPT" "test_command" 2>&1
667+
) || wcfe_exit=$?
668+
assert_eq "test_workflow_config_file_env_still_works: exit 0" "0" "$wcfe_exit"
669+
assert_eq "test_workflow_config_file_env_still_works: env var overrides .claude/dso-config.conf" "make test-from-env-override" "$wcfe_output"
670+
if [[ "$FAIL" -eq "$_fail_before_wcfe" ]]; then
671+
echo "test_workflow_config_file_env_still_works ... PASS"
672+
fi
673+
rm -rf "$_tmp_repo_wcfe"
674+
rm -f "$_wcfe_override_file"
675+
592676
print_summary

0 commit comments

Comments
 (0)