scrum4me-mcp/__tests__
Madhura68 f7f5a487ec PBI-9 + PBI-47: worktree foundation, product-worktrees, P0 fixes, PAUSED flow
Adds two interlocking PBIs:

PBI-9 — Worktree foundation + persistent product-worktrees for idea-jobs
  - src/git/worktree-paths.ts: centralised root + skip-set + lock-path helpers
  - src/git/file-lock.ts: proper-lockfile wrapper, deadlock-safe ordered acquire
  - src/git/product-worktree.ts: detached-HEAD worktree per product, .scratch/
    excluded via git rev-parse --git-path (handles linked .git file)
  - src/git/job-locks.ts: setupProductWorktrees + releaseLocksOnTerminal
  - wait-for-job.ts: idea-branch wires product-worktrees for IDEA_GRILL/MAKE_PLAN
  - update-job-status.ts + pbi-cascade.ts + stale-reset: release on all four
    server-side terminal transitions (DONE/FAILED/CANCELLED/stale)
  - cleanup-my-worktrees: skip _products/ + *.lock
  - README: worktrees section with single-host invariant + advisory-lock path

PBI-47 — Sprint-flow P0 corrections + PAUSED flow with rich pause_context
  - prisma schema: ClaudeJob.{base_sha,head_sha} + SprintRun.pause_context
  - tryClaimJob captures base_sha; prepareDoneUpdate captures head_sha
  - verify-task-against-plan diffs vs base_sha (no more origin/main fallback);
    rejects with MISSING_BASE_SHA when null — fixes per-task verify-scope P0
  - pr.ts: createPullRequest enableAutoMerge default false; new
    enableAutoMergeOnPr with --match-head-commit guard + 5-category typed
    EnableAutoMergeResult — fixes STORY auto-merge timing P0
  - src/flow/{effects,worktree-lease,pr-flow,sprint-run}.ts: pure transition
    modules + idempotent declarative effects executor
  - update-job-status: STORY auto-merge fires only on the last task of the
    story (story.status === DONE), with head_sha as merge guard; MERGE_CONFLICT
    routes to sprint-run flow which produces CREATE_CLAUDE_QUESTION +
    SET_SPRINT_RUN_STATUS effects with rich pause_context

Tests: 31 test files, 242 passing. Pure-transition tests cover STORY 3-tasks
auto-merge timing, SPRINT draft→ready, MERGE_CONFLICT pause/resume, file-lock
deadlock prevention, worktree-lease lifecycle, delete-only verify (ALIGNED),
per-job verify scope (base_sha isolation), 5-category auto-merge errors.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 21:09:48 +02:00
..
flow PBI-9 + PBI-47: worktree foundation, product-worktrees, P0 fixes, PAUSED flow 2026-05-06 21:09:48 +02:00
git PBI-9 + PBI-47: worktree foundation, product-worktrees, P0 fixes, PAUSED flow 2026-05-06 21:09:48 +02:00
scripts feat: per-job token-usage capture via PostToolUse hook 2026-05-06 07:53:36 +02:00
verify PBI-9 + PBI-47: worktree foundation, product-worktrees, P0 fixes, PAUSED flow 2026-05-06 21:09:48 +02:00
cancel-pbi-cascade.test.ts feat: PBI fail-cascade — cancel siblings + undo commits 2026-05-06 10:08:31 +02:00
check-queue-empty.test.ts feat: add check_queue_empty tool (v0.3.0) 2026-05-03 17:57:17 +02:00
cleanup-my-worktrees.test.ts PBI-9 + PBI-47: worktree foundation, product-worktrees, P0 fixes, PAUSED flow 2026-05-06 21:09:48 +02:00
get-claude-context-filter.test.ts PBI-8: Sprint-flow MCP-orkestratie + verifier-fix 2026-05-06 16:59:58 +02:00
mark-pbi-pr-merged.test.ts feat(mcp): set_pbi_pr + mark_pbi_pr_merged tools voor PBI-PR-gating (#18) 2026-05-03 16:25:53 +02:00
set-pbi-pr.test.ts feat(mcp): set_pbi_pr + mark_pbi_pr_merged tools voor PBI-PR-gating (#18) 2026-05-03 16:25:53 +02:00
tasks-status-update.test.ts PBI-8: Sprint-flow MCP-orkestratie + verifier-fix 2026-05-06 16:59:58 +02:00
update-job-status-auto-pr.test.ts PBI-8 (vervolg): Sprint-aware branch + SPRINT-mode draft-PR 2026-05-06 17:15:04 +02:00
update-job-status-gate.test.ts feat(gate): verify_required levels — ALIGNED/ALIGNED_OR_PARTIAL/ANY (#16) 2026-05-02 17:55:06 +02:00
update-job-status-next-action.test.ts feat: worker presence layer + batch-loop docs (#7) 2026-05-01 16:39:26 +02:00
update-job-status-push.test.ts feat: integrate push into update_job_status DONE transition 2026-05-01 12:00:30 +02:00
update-job-status-worktree.test.ts feat: branch-per-story + worktree-defer + verify EMPTY edge-cases (#12) 2026-05-01 17:04:54 +02:00
verify-plan.test.ts test+docs: verify-plan tests and README for verify_task_against_plan 2026-04-30 19:36:43 +02:00
verify-task-against-plan.test.ts feat: verify_task_against_plan calls classifyDiffAgainstPlan + saves verify_result to DB 2026-05-01 12:59:17 +02:00
wait-for-job-branch-resolution.test.ts PBI-8 (vervolg): Sprint-aware branch + SPRINT-mode draft-PR 2026-05-06 17:15:04 +02:00
wait-for-job-snapshot.test.ts feat(M13): retry-tracking — stale CLAIMED jobs → QUEUED (retry_count++) or FAILED (≥2 retries) 2026-05-01 13:18:59 +02:00
wait-for-job-worktree.test.ts PBI-8 (vervolg): Sprint-aware branch + SPRINT-mode draft-PR 2026-05-06 17:15:04 +02:00