summaryrefslogtreecommitdiff
path: root/tests/claude-code/test-executing-plans-scripts.sh
diff options
context:
space:
mode:
authorJesse Vincent <jesse@fsck.com>2026-10-22 22:24:49 +0000
committerJesse Vincent <jesse@fsck.com>2026-10-23 00:21:52 +0000
commit614d80c29a4ad0c0fffb8c49ce5fc5b8afa0bf42 (patch)
tree75e33777c6e24efe53f3f62c9f559b6a1eabfa3a /tests/claude-code/test-executing-plans-scripts.sh
parentb58deb3b948d4c305feeac122700100419ee2777 (diff)
fix(sdd): pick the scripts' repository deliberately, add -C DIR, explain a missing repo
The SDD helpers found their repository with a bare `git rev-parse --show-toplevel` in the caller's cwd, and review-package ran every git command there too. Three reports trace back to that one line: - #2429: outside any repository (the skill's own directory in a 7.0 package has no .git), sdd-workspace fed `cd` an empty path. bash 5.2 treats that as a no-op and wrote the workspace into the cwd after printing git's bare fatal; Git Bash failed with "cd: null directory". A controller working on worktree B from worktree A had no way to name B. - #1799: the only way to aim review-package at a worktree was a `cd <worktree> ; review-package ...` compound, which harnesses cannot allowlist because the path and BASE change on every run. - #2242: in a greenfield directory with no repository, task-brief and sdd-workspace printed git's fatal and then carried on in the cwd (or crashed, depending on bash), review-package said "bad BASE: HEAD~1", and task-start printed an empty BASE with exit 0. A new sdd-repo helper is the single place that picks the repository: the cwd's working tree (or -C DIR's), exactly as git does. Anywhere else it stops with exit 2 and one shared message. sdd-workspace and review-package both use it, so they cannot disagree. The cwd still wins over the plan's location on purpose: writing-plans leaves the plan uncommitted in the main checkout, so an executor working in a linked worktree passes the main checkout's plan path, and its workspace and commits belong to the worktree. Resolving from PLAN_FILE first (draft #2439) breaks exactly that flow: review-package then diffs the main checkout and fails with "empty commit range". sdd-workspace, task-brief and review-package take an optional leading `-C DIR` that runs them as if started in DIR, as git -C does, so a caller can name another worktree in one allowlistable command. Each script resolves its own directory before the cd, so the documented `bash scripts/review-package` form from the skill directory keeps working with -C. PR #1809's version cd's first and then fails to find sdd-workspace (exit 127) in that form. task-start now refuses (exit 2) to print a BASE when HEAD has no commit, instead of printing "base: HEAD" or "base: " with exit 0. Co-authored-by: citizen204 <citizen204@users.noreply.github.com> 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.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/claude-code/test-executing-plans-scripts.sh b/tests/claude-code/test-executing-plans-scripts.sh
index e4e3904..08ba02d 100755
--- a/tests/claude-code/test-executing-plans-scripts.sh
+++ b/tests/claude-code/test-executing-plans-scripts.sh
@@ -154,6 +154,19 @@ PLAN
echo " ledger:"; sed 's/^/ /' "$ledger" 2>/dev/null || echo " (missing)"
fi
+ # --- task-start: a repo with no commit yet has no BASE to record (#2242) ---
+ git init -q -b main "$TEST_ROOT/unborn"
+ cp "$repo/plan.md" "$TEST_ROOT/unborn/plan.md"
+ rc=0
+ out="$(cd "$TEST_ROOT/unborn" && "$EP_SCRIPTS/task-start" plan.md 1 2>&1)" || rc=$?
+ if [[ "$rc" -eq 2 && "$out" == *"initial commit"* && "$out" != *"base:"* ]]; then
+ pass "task-start before the first commit exits 2 instead of printing a bogus BASE"
+ else
+ fail "task-start before the first commit exits 2 instead of printing a bogus BASE"
+ echo " exit: $rc"
+ echo " got: $out"
+ fi
+
echo
if [[ "$FAILURES" -eq 0 ]]; then
echo "PASS"