summaryrefslogtreecommitdiff
path: root/tests/claude-code/test-executing-plans-scripts.sh
diff options
context:
space:
mode:
authorJesse Vincent <jesse@fsck.com>2026-10-22 23:59:39 +0000
committerJesse Vincent <jesse@fsck.com>2026-10-23 00:21:52 +0000
commit0d61007ef6a3a0a870f164a37da14b58f3de192a (patch)
tree7ec3455317cffd6258cf345a0d9d89ae82cc89d3 /tests/claude-code/test-executing-plans-scripts.sh
parentde67241e0a8f241b5607f99c3891d5e517e2cf47 (diff)
fix(sdd): act on the cwd's working tree only, drop the plan-repo fallback
sdd-repo fell back to the plan file's repository when the current directory was outside any repository. That made the plugin-cache case silently succeed somewhere: an agent that cd'd into the skill directory and passed an absolute plan path got whichever checkout that path pointed into. With the plan in the main checkout (where writing-plans leaves it) and execution in a linked worktree, that is the #2429 wrong-worktree bug again, with exit 0. A real session (sdd-cwd-eval sdd-A-5) took exactly this path and only landed in the right place because its plan path happened to be the worktree's. The SDD and executing-plans helpers now pick their repository the way git does: the current directory's working tree, or DIR when given -C DIR. Outside any working tree, sdd-workspace, task-brief, review-package, task-start and task-done all stop with the shared message and write nothing, even when the plan's absolute path is inside a repository. sdd-repo no longer takes PLAN_FILE, since the plan has no say. The two "outside any repository ... uses the plan's repository" tests and the task-start/task-done fallback tests become assertions that the shared message comes out and nothing is written, in the cwd or the plan's repository. Claude-Session: https://claude.ai/code/session_01SHANcr4A71nzuU9et4Fnba
Diffstat (limited to 'tests/claude-code/test-executing-plans-scripts.sh')
-rwxr-xr-xtests/claude-code/test-executing-plans-scripts.sh29
1 files changed, 18 insertions, 11 deletions
diff --git a/tests/claude-code/test-executing-plans-scripts.sh b/tests/claude-code/test-executing-plans-scripts.sh
index d09d97c..bf900f5 100755
--- a/tests/claude-code/test-executing-plans-scripts.sh
+++ b/tests/claude-code/test-executing-plans-scripts.sh
@@ -190,29 +190,36 @@ PLAN
fail "nothing is written without a usable repository"
fi
- # --- outside any repository, task-start and task-done use the plan's (#2429) ---
- # The same fallback task-brief takes, so BASE comes from the repository
- # the brief and ledger were written into, not from the bare cwd.
+ # --- outside any repository, a plan in a repository is not a fallback (#2429) ---
+ # Like git, the scripts act on the current directory's working tree; an
+ # absolute plan path into some repository does not pick that one instead.
+ msg="SDD scripts must run from inside the git working tree you're executing in, with at least one commit (current directory: $TEST_ROOT/no-repo). If this is a new project, run 'git init' and make a first commit, then rerun."
+ local before head_now
+ head_now="$(cd "$repo" && git rev-parse HEAD)"
+ before="$(find "$repo/.superpowers" | sort; cat "$repo/.superpowers/sdd/plan/progress.md")"
rc=0
out="$(cd "$TEST_ROOT/no-repo" && "$EP_SCRIPTS/task-start" "$repo/plan.md" 2 2>&1)" || rc=$?
- local head_now
- head_now="$(cd "$repo" && git rev-parse HEAD)"
- if [[ "$rc" -eq 0 && "$out" == *"brief: $repo/.superpowers/sdd/plan/task-2-brief.md"* && "$out" == *"base: $head_now"* ]]; then
- pass "task-start outside any repository takes the plan's repository and HEAD"
+ if [[ "$rc" -eq 2 && "$out" == "$msg" ]]; then
+ pass "task-start outside any repository stops with the shared message despite a plan in a repository"
else
- fail "task-start outside any repository takes the plan's repository and HEAD"
+ fail "task-start outside any repository stops with the shared message despite a plan in a repository"
echo " exit: $rc"
echo " got: $out"
fi
rc=0
out="$(cd "$TEST_ROOT/no-repo" && "$EP_SCRIPTS/task-done" "$repo/plan.md" 2 "$head_now" -- true 2>&1)" || rc=$?
- if [[ "$rc" -eq 0 ]] && grep -q "^Task 2: complete (commits ${head_now:0:7}..${head_now:0:7}," "$repo/.superpowers/sdd/plan/progress.md"; then
- pass "task-done outside any repository records into the plan's repository"
+ if [[ "$rc" -eq 2 && "$out" == "$msg" ]]; then
+ pass "task-done outside any repository stops with the shared message despite a plan in a repository"
else
- fail "task-done outside any repository records into the plan's repository"
+ fail "task-done outside any repository stops with the shared message despite a plan in a repository"
echo " exit: $rc"
echo " got: $out"
fi
+ if [[ "$(find "$repo/.superpowers" | sort; cat "$repo/.superpowers/sdd/plan/progress.md")" == "$before" && ! -e "$TEST_ROOT/no-repo/.superpowers" ]]; then
+ pass "outside any repository, task-start and task-done write nothing to the plan's repository"
+ else
+ fail "outside any repository, task-start and task-done write nothing to the plan's repository"
+ fi
echo
if [[ "$FAILURES" -eq 0 ]]; then