diff options
| author | Drew Ritter <drew@ritter.dev> | 2026-11-02 13:49:28 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-11-02 13:49:28 -0800 |
| commit | 6aeac7ed95b1c31394eca620518e26d592ebd68d (patch) | |
| tree | bf5ecffd4cf0bc81b6879242b53f7a34c1cd451f /tests/claude-code | |
| parent | 7166b468f638f047a31eb8b0d1138000c9f8e3ae (diff) | |
| parent | 750ba92008b88850f6ab321706c7f840bbfff503 (diff) | |
Merge pull request #2604 from obra/fix/2459-2496-task-brief-headings
fix(sdd): task-brief finds alphanumeric task IDs and explains non-English headings (#2459, #2496)
Diffstat (limited to 'tests/claude-code')
| -rwxr-xr-x | tests/claude-code/test-sdd-workspace.sh | 145 |
1 files changed, 145 insertions, 0 deletions
diff --git a/tests/claude-code/test-sdd-workspace.sh b/tests/claude-code/test-sdd-workspace.sh index 369cac2..6db6960 100755 --- a/tests/claude-code/test-sdd-workspace.sh +++ b/tests/claude-code/test-sdd-workspace.sh @@ -162,6 +162,151 @@ PLAN echo " got: $brief_path" fi + # --- Task IDs: alphanumeric (#2459), matched whole, never as a prefix --- + cat > "$repo/plan-ids.md" <<'PLAN' +# Lanes Plan + +## Task Overview + +Shared context; not a task. + +### Task A1: First lane + +BODY-A1 + +#### Task notes + +Still part of A1. + +### Task A10: Same lane, later + +BODY-A10 + +### Task 6: Numbered + +BODY-6 + +### Task 6b: Sub-task + +BODY-6B + +### Task 2.1: Dotted + +BODY-2.1 + +### Task 201: Decoy + +BODY-201 +PLAN + local id want got id_out="$TEST_ROOT/id-brief.md" + for id in A1 A10 6 6b 2.1 201; do + want="BODY-$(printf '%s' "$id" | tr '[:lower:]' '[:upper:]')" + rc=0 + (cd "$repo" && "$SDD_SCRIPTS/task-brief" plan-ids.md "$id" "$id_out" >/dev/null 2>&1) || rc=$? + got="$(grep '^BODY-' "$id_out" 2>/dev/null | tr '\n' ' ')" || true + if [[ "$rc" -eq 0 && "$got" == "$want " ]]; then + pass "task-brief extracts Task $id and nothing else" + else + fail "task-brief extracts Task $id and nothing else" + echo " exit: $rc, bodies: $got" + fi + : > "$id_out" + done + (cd "$repo" && "$SDD_SCRIPTS/task-brief" plan-ids.md A1 "$id_out" >/dev/null 2>&1) || true + if grep -q 'Still part of A1.' "$id_out"; then + pass "a Task heading with no digit in its ID is not a task boundary" + else + fail "a Task heading with no digit in its ID is not a task boundary" + echo " brief: $(cat "$id_out" 2>/dev/null)" + fi + # A deeper heading whose ID extends the task's (7 -> 7a) is a sub-task and + # stays in the parent's brief; a deeper heading for another task (a plan + # that drifts from ## Task 9 to ### Task 10) is still a boundary. + cat > "$repo/plan-nested.md" <<'PLAN' +### Task 7: Parent + +BODY-7 + +#### Task 7a: First part + +BODY-7A + +#### Task 7b: Second part + +BODY-7B + +### Task 8: Next + +BODY-8 + +## Task 9: Shallower heading + +BODY-9 + +### Task 10: Deeper, but not a sub-task + +BODY-10 +PLAN + for id in 7 7a 7b 8 9 10; do + case "$id" in + 7) want="BODY-7 BODY-7A BODY-7B " ;; + *) want="BODY-$(printf '%s' "$id" | tr '[:lower:]' '[:upper:]') " ;; + esac + rc=0 + (cd "$repo" && "$SDD_SCRIPTS/task-brief" plan-nested.md "$id" "$id_out" >/dev/null 2>&1) || rc=$? + got="$(grep '^BODY-' "$id_out" 2>/dev/null | tr '\n' ' ')" || true + if [[ "$rc" -eq 0 && "$got" == "$want" ]]; then + pass "nested plan: Task $id brief holds exactly its own section" + else + fail "nested plan: Task $id brief holds exactly its own section" + echo " exit: $rc, bodies: $got (want: $want)" + fi + done + + for id in 2 '2|6' '6(' Overview; do + rc=0 + (cd "$repo" && "$SDD_SCRIPTS/task-brief" plan-ids.md "$id" "$id_out" >/dev/null 2>&1) || rc=$? + if [[ "$rc" -eq 3 ]]; then + pass "task-brief '$id' matches no task (exit 3)" + else + fail "task-brief '$id' matches no task (exit 3)" + echo " exit: $rc, brief: $(cat "$id_out" 2>/dev/null)" + fi + done + + # --- Translated task headings: say so instead of "not found" (#2496) --- + cat > "$repo/plan-es.md" <<'PLAN' +# Plan: demo + +## Tarea 1: Banner + +**Archivos:** + +## Tarea 2: Segunda +PLAN + local es_err + rc=0 + es_err="$(cd "$repo" && "$SDD_SCRIPTS/task-brief" plan-es.md 1 "$id_out" 2>&1 >/dev/null)" || rc=$? + if [[ "$rc" -eq 3 && "$es_err" == *'English word "Task"'* \ + && "$es_err" == *"## Tarea 1: Banner"* && "$es_err" == *"## Tarea 2: Segunda"* ]]; then + pass "task-brief on a plan with no Task headings names the headings it saw" + else + fail "task-brief on a plan with no Task headings names the headings it saw" + echo " exit: $rc" + echo " stderr: $es_err" + fi + + # A plan that has Task headings, just not this one, gets the plain error. + rc=0 + es_err="$(cd "$repo" && "$SDD_SCRIPTS/task-brief" plan-ids.md 99 "$id_out" 2>&1 >/dev/null)" || rc=$? + if [[ "$rc" -eq 3 && "$es_err" == "task 99 not found in plan-ids.md (no heading matching 'Task 99')" ]]; then + pass "a missing task in a plan with Task headings gets only the not-found line" + else + fail "a missing task in a plan with Task headings gets only the not-found line" + echo " exit: $rc" + echo " stderr: $es_err" + fi + # --- review-package takes the plan first and lands in its directory --- local git_id=(-c user.email=t@example.com -c user.name=t -c commit.gpgsign=false) ( cd "$repo" \ |
