GAP A: extend PATCH /tasks/:id to support all five TaskStatus values (open, in_progress, review, done, cancelled). Add reviewTask, cancelTask, reopenTask helpers in taskService. Claim semantics preserved: in_progress requires assignedTo. Board columns for review and cancelled now reachable via the API. GAP B: index fromRole/toRole/fromAgent/toAgent on handoff upsert. SQLite migration guard adds columns to pre-existing DBs without data loss. Board renderHandoffs shows "fromRole[@agent] → toRole[@agent]" via → arrow. GET /handoffs now carries the routing fields in every index entry. Tests: +14 (56 total, 21 files, all green). Covers every new status transition, index field presence, board markup assertions, and a guard for the claim-without-assignedTo 400. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
50 lines
1.7 KiB
TypeScript
50 lines
1.7 KiB
TypeScript
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
import { mkdtempSync, rmSync } from 'fs';
|
|
import { tmpdir } from 'os';
|
|
import { join } from 'path';
|
|
import { createHandoff, listHandoffs, getHandoff } from '../src/core/services/handoffService.js';
|
|
|
|
describe('handoffService', () => {
|
|
let cwd: string;
|
|
|
|
beforeEach(() => { cwd = mkdtempSync(join(tmpdir(), 'ah-hof-')); });
|
|
afterEach(() => { rmSync(cwd, { recursive: true, force: true }); });
|
|
|
|
it('creates and reads a handoff', () => {
|
|
const h = createHandoff(cwd, { fromRole: 'architect', toRole: 'implementer', summary: 's', context: 'c' });
|
|
expect(h.id).toBe('HOF-0001');
|
|
expect(getHandoff(cwd, h.id).handoff.summary).toBe('s');
|
|
expect(listHandoffs(cwd)).toHaveLength(1);
|
|
});
|
|
|
|
it('listHandoffs carries fromRole and toRole in the index entry', () => {
|
|
createHandoff(cwd, {
|
|
fromRole: 'architect',
|
|
toRole: 'implementer',
|
|
summary: 'Hand over design',
|
|
context: 'done',
|
|
});
|
|
const items = listHandoffs(cwd);
|
|
expect(items).toHaveLength(1);
|
|
expect(items[0].fromRole).toBe('architect');
|
|
expect(items[0].toRole).toBe('implementer');
|
|
// agent names default to undefined when not supplied
|
|
expect(items[0].fromAgent == null).toBe(true);
|
|
expect(items[0].toAgent == null).toBe(true);
|
|
});
|
|
|
|
it('listHandoffs carries fromAgent and toAgent when supplied', () => {
|
|
createHandoff(cwd, {
|
|
fromRole: 'reviewer',
|
|
toRole: 'implementer',
|
|
fromAgent: 'claude',
|
|
toAgent: 'codex',
|
|
summary: 'Review complete',
|
|
context: 'lgtm',
|
|
});
|
|
const items = listHandoffs(cwd);
|
|
expect(items[0].fromAgent).toBe('claude');
|
|
expect(items[0].toAgent).toBe('codex');
|
|
});
|
|
});
|