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>
59 lines
1.8 KiB
TypeScript
59 lines
1.8 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { classifyDiffAgainstPlan } from '../../src/verify/classify.js'
|
|
|
|
describe('classify — delete-only commits (PBI-47 C5)', () => {
|
|
it('returns ALIGNED when the deleted path is in the plan', () => {
|
|
const diff = `diff --git a/app/todos/page.tsx b/app/todos/page.tsx
|
|
deleted file mode 100644
|
|
index 1234567..0000000
|
|
--- a/app/todos/page.tsx
|
|
+++ /dev/null
|
|
@@ -1,3 +0,0 @@
|
|
-export default function TodosPage() {
|
|
- return null
|
|
-}`
|
|
|
|
const plan = '- Verwijder `app/todos/page.tsx`\n- Verwijder gerelateerde imports'
|
|
|
|
const result = classifyDiffAgainstPlan({ diff, plan })
|
|
expect(result.result).toBe('ALIGNED')
|
|
})
|
|
|
|
it('returns ALIGNED for multi-file delete-only when both paths in plan', () => {
|
|
const diff = `diff --git a/app/todos/page.tsx b/app/todos/page.tsx
|
|
deleted file mode 100644
|
|
--- a/app/todos/page.tsx
|
|
+++ /dev/null
|
|
@@ -1,2 +0,0 @@
|
|
-line 1
|
|
-line 2
|
|
diff --git a/components/todo-list.tsx b/components/todo-list.tsx
|
|
deleted file mode 100644
|
|
--- a/components/todo-list.tsx
|
|
+++ /dev/null
|
|
@@ -1,1 +0,0 @@
|
|
-line`
|
|
|
|
const plan = '- `app/todos/page.tsx`\n- `components/todo-list.tsx`'
|
|
const result = classifyDiffAgainstPlan({ diff, plan })
|
|
expect(result.result).toBe('ALIGNED')
|
|
})
|
|
|
|
it('returns PARTIAL when only some plan deletes appear in the diff', () => {
|
|
const diff = `diff --git a/a.ts b/a.ts
|
|
deleted file mode 100644
|
|
--- a/a.ts
|
|
+++ /dev/null
|
|
@@ -1,1 +0,0 @@
|
|
-x`
|
|
|
|
const plan = '- `a.ts`\n- `b.ts`' // b.ts missing
|
|
const result = classifyDiffAgainstPlan({ diff, plan })
|
|
expect(result.result).toBe('PARTIAL')
|
|
})
|
|
|
|
it('returns EMPTY for a no-op diff', () => {
|
|
const result = classifyDiffAgainstPlan({ diff: '', plan: 'irrelevant' })
|
|
expect(result.result).toBe('EMPTY')
|
|
})
|
|
})
|