Full test sweep for the worktree decision table #325
Labels
No labels
batch
bug
chore
documentation
enhancement
pi-loop
ready
resume
No milestone
No project
No assignees
1 participant
Notifications
Due date
Dependencies
No dependencies set
Reference
david/pi-loop#325
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Confirm every branch of ADR-022's decision table and every
worktree.dirpath rule has a named test, plus batch and resume assertions. A verification pass — no production-code changes expected.Background
Earlier steps in this series implement the
worktree:section end to end:src/config/services/configFile.ts),dirvalidation helper (src/config/helpers/validateWorktreeDir.ts),src/shared/git/services/resolveWorktree.ts),src/cli/services/runCli.ts).This final step walks the decision table and the code paths, adding tests for anything missing. If a test exposes a real gap (a missing error path, a routing bug), fix the code and list the fix in the PR description.
Decision table (ADR-022 §2):
enableddirdirname(repo)); normal: run in placetruedir(both repo kinds); validated at parse timetrueConfigFileErrorfalsedirnever validatedfalseDepends on: #320, #321, #322, #323.
Implementation Details
Test areas (extend the existing test files; no new seams):
src/config/services/configFile.test.ts): section shape (enabledonly,dironly, both); all five decision-table rows; relativeworktree.dir→ error;~and~/x→ tilde-specific error;direqual to / inside the repo root → error; parent-of-repo and sibling (/srv/wt2vs/srv/wt) → pass;dirpointing at a file → error; unknown key inside the section → error.src/shared/git/services/resolveWorktree.test.ts):worktreeDirused asparentDir; registry wins overworktreeDir; normal clone creates a worktree whenworktreeDiris set; normal clone runs in place whenworktreeDiris undefined.src/cli/services/runCli.test.ts): widened early-fetch gate for a normal clone withenabled: true; no early fetch for a normal clone with the section absent or disabled;ConfigFileErrorfrom a baddir→error.jsonwithkind: 'config', exit 1;resolveWorkDirFn/fetchIssueFndoubles matching the current signatures.worktree.dir; the batch-mode per-issue behavior matches what the early-fetch step documented (regression assertion — batch runs in the launch repo unless that step found the batch path routes through worktree resolution).Acceptance Criteria
dirrule (tilde, relative, equal-to-root, inside-root, sibling, parent, file, missing) has at least one named test.npm run lintandnpm testare clean.Test Plan
Run
npm test— the full suite is the verification. Spot-check the new tests by name in the output.pi-loop opened and merged a pull request for this issue: #331