Skip to content

Commit a351d85

Browse files
feat(dso-kknz): batch 3 — RED tests for shim .claude/dso-config.conf resolution
Add 2 new failing tests to test-dso-shim-plugin-root.sh verifying that the dso shim reads dso.plugin_root from .claude/dso-config.conf (not workflow-config.conf at repo root). Tests are intentionally RED and will turn green when dso-tuz0 updates the shim. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9e37dd9 commit a351d85

File tree

3 files changed

+137
-2
lines changed

3 files changed

+137
-2
lines changed

.tickets/dso-c2tl.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: dso-c2tl
3-
status: in_progress
3+
status: closed
44
deps: []
55
links: []
66
created: 2026-03-20T03:32:24Z

.tickets/dso-jfy3.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: dso-jfy3
3-
status: open
3+
status: in_progress
44
deps: []
55
links: []
66
created: 2026-03-20T03:32:47Z
@@ -36,3 +36,29 @@ test_shim_no_fallback_to_workflow_config_conf — Given a temp git repo with onl
3636
Verify: bash $(git rev-parse --show-toplevel)/tests/scripts/test-dso-shim-plugin-root.sh 2>&1 | grep -qE 'FAIL'
3737
- [ ] bash tests/run-all.sh shows no regressions from test addition alone
3838
Verify: bash $(git rev-parse --show-toplevel)/tests/run-all.sh 2>&1 | tail -5
39+
40+
## Notes
41+
42+
**2026-03-20T04:20:14Z**
43+
44+
CHECKPOINT 1/6: Task context loaded ✓
45+
46+
**2026-03-20T04:20:35Z**
47+
48+
CHECKPOINT 2/6: Code patterns understood ✓ - shim at .claude/scripts/dso reads dso.plugin_root from workflow-config.conf at git root (step 2); tests use assert.sh helpers, mktemp git repos in TMPDIR_BASE, and call print_summary at end
49+
50+
**2026-03-20T04:21:09Z**
51+
52+
CHECKPOINT 3/6: Tests written ✓ - added test_shim_reads_plugin_root_from_dot_claude_dso_config and test_shim_no_fallback_to_workflow_config_conf to tests/scripts/test-dso-shim-plugin-root.sh
53+
54+
**2026-03-20T04:21:20Z**
55+
56+
CHECKPOINT 4/6: Implementation complete ✓ - No shim source changes (per task constraint). Tests written are the complete implementation for this RED phase task.
57+
58+
**2026-03-20T04:21:27Z**
59+
60+
CHECKPOINT 5/6: Validation passed ✓ - test file runs, 2 new tests FAIL (RED) as required: test_shim_reads_plugin_root_from_dot_claude_dso_config (FAIL: shim doesn't read .claude/dso-config.conf) and test_shim_no_fallback_to_workflow_config_conf (FAIL: shim still reads workflow-config.conf). 7 pre-existing tests still PASS.
61+
62+
**2026-03-20T04:25:17Z**
63+
64+
CHECKPOINT 6/6: Done ✓ - AC1: pass (test_shim_reads_plugin_root_from_dot_claude_dso_config present), AC2: pass (test_shim_no_fallback_to_workflow_config_conf present), AC3: pass (FAIL output confirmed RED), AC4: 7 pre-existing tests pass (no regressions), 2 new tests FAIL as required

tests/scripts/test-dso-shim-plugin-root.sh

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,118 @@ test_shim_unconditional_reexport_detection() {
325325
"true" "$has_guard"
326326
}
327327

328+
# ── test_shim_reads_plugin_root_from_dot_claude_dso_config ───────────────────
329+
# RED phase (dso-jfy3): The shim must read dso.plugin_root from
330+
# .claude/dso-config.conf when CLAUDE_PLUGIN_ROOT is not set.
331+
#
332+
# Setup: create a temp git repo with .claude/dso-config.conf containing
333+
# dso.plugin_root=<path>
334+
# The shim must resolve DSO_ROOT to that path.
335+
#
336+
# RED: The current shim reads from workflow-config.conf at the git root (step 2).
337+
# It does NOT look at .claude/dso-config.conf. This test fails until the shim is
338+
# updated (dso-tuz0) to check .claude/dso-config.conf first (or instead).
339+
test_shim_reads_plugin_root_from_dot_claude_dso_config() {
340+
if [[ ! -f "$SHIM" ]]; then
341+
assert_eq "test_shim_reads_plugin_root_from_dot_claude_dso_config (shim exists)" \
342+
"exists" "missing"
343+
return
344+
fi
345+
346+
local expected_path="/fake/dso/plugin/root/from/dot-claude"
347+
348+
# Create a temp git repo with .claude/dso-config.conf containing dso.plugin_root
349+
local fake_repo="$TMPDIR_BASE/fake-dot-claude-config-test"
350+
mkdir -p "$fake_repo/.claude"
351+
git -C "$fake_repo" init -q
352+
printf 'dso.plugin_root=%s\n' "$expected_path" > "$fake_repo/.claude/dso-config.conf"
353+
git -C "$fake_repo" add .claude/dso-config.conf
354+
git -c user.email=test@test.com -c user.name=Test -C "$fake_repo" commit -q -m "init"
355+
356+
# Run the shim in --lib mode from within the fake repo, without CLAUDE_PLUGIN_ROOT set.
357+
# The shim should read .claude/dso-config.conf and export DSO_ROOT = expected_path.
358+
local actual_dso_root
359+
actual_dso_root=$(
360+
env -i HOME="$HOME" PATH="$PATH" GIT_CONFIG_GLOBAL=/dev/null \
361+
bash --noprofile --norc -c "
362+
set -uo pipefail
363+
cd '$fake_repo'
364+
. '$SHIM' --lib 2>/dev/null
365+
printf '%s' \"\${DSO_ROOT:-UNSET}\"
366+
"
367+
)
368+
369+
# RED: The shim does not yet read .claude/dso-config.conf, so DSO_ROOT will
370+
# be empty/UNSET (or fail entirely). This assertion fails until dso-tuz0 lands.
371+
assert_eq "test_shim_reads_plugin_root_from_dot_claude_dso_config" \
372+
"$expected_path" "$actual_dso_root"
373+
}
374+
375+
# ── test_shim_no_fallback_to_workflow_config_conf ─────────────────────────────
376+
# RED phase (dso-jfy3): When a repo has ONLY workflow-config.conf at the root
377+
# (the old location), the shim must NOT use it to resolve DSO_ROOT.
378+
# After the migration (dso-tuz0), only .claude/dso-config.conf is a valid
379+
# config source — the root-level workflow-config.conf must be ignored.
380+
#
381+
# Setup: create a temp git repo with only workflow-config.conf at root containing
382+
# dso.plugin_root=<path>
383+
# The shim must exit non-zero or leave DSO_ROOT empty.
384+
#
385+
# RED: The current shim DOES read from workflow-config.conf at root. This test
386+
# fails until the shim is updated (dso-tuz0) to stop reading from that location.
387+
test_shim_no_fallback_to_workflow_config_conf() {
388+
if [[ ! -f "$SHIM" ]]; then
389+
assert_eq "test_shim_no_fallback_to_workflow_config_conf (shim exists)" \
390+
"exists" "missing"
391+
return
392+
fi
393+
394+
local old_config_path="/fake/dso/plugin/root/from/workflow-config"
395+
396+
# Create a temp git repo with ONLY a root-level workflow-config.conf.
397+
# No .claude/dso-config.conf present — only the old config location.
398+
local fake_repo="$TMPDIR_BASE/fake-old-workflow-config-test"
399+
mkdir -p "$fake_repo"
400+
git -C "$fake_repo" init -q
401+
printf 'dso.plugin_root=%s\n' "$old_config_path" > "$fake_repo/workflow-config.conf"
402+
git -C "$fake_repo" add workflow-config.conf
403+
git -c user.email=test@test.com -c user.name=Test -C "$fake_repo" commit -q -m "init"
404+
405+
# Run the shim in --lib mode; after migration CLAUDE_PLUGIN_ROOT must be empty (UNSET).
406+
# The shim should NOT resolve DSO_ROOT from workflow-config.conf.
407+
local actual_exit_code=0
408+
local actual_dso_root
409+
actual_dso_root=$(
410+
env -i HOME="$HOME" PATH="$PATH" GIT_CONFIG_GLOBAL=/dev/null \
411+
bash --noprofile --norc -c "
412+
set -uo pipefail
413+
cd '$fake_repo'
414+
. '$SHIM' --lib 2>/dev/null
415+
printf '%s' \"\${DSO_ROOT:-UNSET}\"
416+
"
417+
) || actual_exit_code=$?
418+
419+
# After migration, DSO_ROOT must be UNSET (shim exits non-zero or returns empty).
420+
# We verify either: exit non-zero OR DSO_ROOT is not set to the old config path.
421+
# RED: The current shim sets DSO_ROOT = old_config_path (reads from workflow-config.conf).
422+
# The test fails until the shim stops reading from the root-level workflow-config.conf.
423+
if [[ "$actual_exit_code" -ne 0 ]]; then
424+
# Shim exited non-zero — DSO_ROOT was not found. This is the desired post-migration behavior.
425+
assert_eq "test_shim_no_fallback_to_workflow_config_conf (exit non-zero when no .claude/dso-config.conf)" \
426+
"non-zero" "non-zero"
427+
else
428+
# Shim exited zero — check that DSO_ROOT is not the old config path.
429+
# It must be UNSET (empty), not set from the old location.
430+
assert_eq "test_shim_no_fallback_to_workflow_config_conf (DSO_ROOT not set from workflow-config.conf)" \
431+
"UNSET" "$actual_dso_root"
432+
fi
433+
}
434+
328435
# ── Run all tests ─────────────────────────────────────────────────────────────
329436
test_shim_preserves_claude_plugin_root_when_preset
330437
test_shim_does_not_clobber_preset_with_config_value
331438
test_shim_unconditional_reexport_detection
439+
test_shim_reads_plugin_root_from_dot_claude_dso_config
440+
test_shim_no_fallback_to_workflow_config_conf
332441

333442
print_summary

0 commit comments

Comments
 (0)