Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,14 @@ describe('diffAgents', () => {
expect(diff.removed[0]?.id).toBe('reviewer-0');
});

it('returns empty arrays when both inputs are empty', () => {
const diff = diffAgents([], []);

expect(diff.stateChanged).toEqual([]);
expect(diff.added).toEqual([]);
expect(diff.removed).toEqual([]);
});

it('ignores slotIndex changes when state is unchanged', () => {
const prev = [agent('reviewer-0', { slotIndex: 0, state: 'working' })];
const next = [agent('reviewer-0', { slotIndex: 1, state: 'working' })];
Expand Down Expand Up @@ -346,6 +354,24 @@ describe('diffCatwalkConfig', () => {
expect(diff.agents.stateChanged).toHaveLength(1);
});

it('returns hasChanges true when an agent is added', () => {
const prev = sceneConfig();
const next = sceneConfig({ agents: [agent('arch'), agent('reviewer-0', { stationIndex: 3 })] });
const diff = diffCatwalkConfig(prev, next);

expect(diff.hasChanges).toBe(true);
expect(diff.agents.added).toHaveLength(1);
});

it('returns hasChanges true when an agent is removed', () => {
const prev = sceneConfig({ agents: [agent('arch'), agent('reviewer-0', { stationIndex: 3 })] });
const next = sceneConfig();
const diff = diffCatwalkConfig(prev, next);

expect(diff.hasChanges).toBe(true);
expect(diff.agents.removed).toHaveLength(1);
});

it('returns hasChanges true when a gate opens', () => {
const prev = sceneConfig({ gates: [gate(0, 1, false)] });
const next = sceneConfig({ gates: [gate(0, 1, true)] });
Expand Down
3 changes: 2 additions & 1 deletion packages/mcp/src/__tests__/protocol-stdio.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ describe('stdio transport smoke test', { timeout: 20_000 }, () => {
projectRoot: tmpDir,
branch: 'main',
task: 'smoke test',
baseDir: tmpDir,
},
});

Expand All @@ -47,7 +48,7 @@ describe('stdio transport smoke test', { timeout: 20_000 }, () => {
const runId = parseAndGetString(result, 'runId');
expect(runId).toMatch(/^\d{8}-\d{6}Z$/);
const resultRunDir = parseAndGetString(result, 'runDir');
expect(resultRunDir).toContain('.ai/projects/smoke-test/tickets/');
expect(resultRunDir).toContain('projects/smoke-test/tickets/');
} finally {
await client.close();
}
Expand Down
14 changes: 13 additions & 1 deletion packages/mcp/src/__tests__/protocol.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ describe('full lifecycle via protocol', () => {
branch: 'feature/protocol',
task: 'protocol integration test',
ticketId: 'PROTO-1',
baseDir: runDir,
},
});
expect(isErrorResult(initResult)).toBe(false);
Expand All @@ -97,7 +98,7 @@ describe('full lifecycle via protocol', () => {
const runId = getStringField(initData, 'runId');
const resultRunDir = getStringField(initData, 'runDir');
expect(runId).toMatch(/^\d{8}-\d{6}Z$/);
expect(resultRunDir).toContain('.ai/projects/protocol-test/tickets/PROTO-1/');
expect(resultRunDir).toContain('projects/protocol-test/tickets/PROTO-1/');

// 2. emit phase_started(architecture)
const phaseStartResult = await client.callTool({
Expand Down Expand Up @@ -178,6 +179,7 @@ describe('full lifecycle via protocol', () => {
branch: 'main',
task: 'v3 header check',
ticketId: 'PROTO-2',
baseDir: runDir,
},
});
expect(isErrorResult(initResult)).toBe(false);
Expand Down Expand Up @@ -221,6 +223,7 @@ describe('full lifecycle via protocol', () => {
projectRoot: runDir,
branch: 'main',
task: 'timestamp check',
baseDir: runDir,
},
});
expect(isErrorResult(initResult)).toBe(false);
Expand Down Expand Up @@ -281,6 +284,7 @@ describe('review cycle events - all 13 event types', () => {
branch: 'feature/review',
task: 'review cycle test',
ticketId: 'PROTO-3',
baseDir: runDir,
},
});
expect(isErrorResult(initResult)).toBe(false);
Expand Down Expand Up @@ -468,6 +472,7 @@ describe('review cycle events - all 13 event types', () => {
projectRoot: failedRunDir,
branch: 'main',
task: 'failure test',
baseDir: failedRunDir,
},
});
expect(isErrorResult(failInitResult)).toBe(false);
Expand Down Expand Up @@ -571,6 +576,7 @@ describe('get_run_state at each checkpoint', () => {
projectRoot: runDir,
branch: 'main',
task: 'checkpoint test',
baseDir: runDir,
},
});
expect(isErrorResult(initResult)).toBe(false);
Expand Down Expand Up @@ -599,6 +605,7 @@ describe('get_run_state at each checkpoint', () => {
projectRoot: runDir,
branch: 'main',
task: 'checkpoint test',
baseDir: runDir,
},
});
expect(isErrorResult(initResult)).toBe(false);
Expand Down Expand Up @@ -635,6 +642,7 @@ describe('get_run_state at each checkpoint', () => {
projectRoot: runDir,
branch: 'main',
task: 'checkpoint test',
baseDir: runDir,
},
});
expect(isErrorResult(initResult)).toBe(false);
Expand Down Expand Up @@ -683,6 +691,7 @@ describe('get_run_state at each checkpoint', () => {
projectRoot: runDir,
branch: 'main',
task: 'checkpoint test',
baseDir: runDir,
},
});
expect(isErrorResult(initResult)).toBe(false);
Expand Down Expand Up @@ -721,6 +730,7 @@ describe('error propagation', () => {
projectRoot: runDir,
branch: 'main',
task: 'error test',
baseDir: runDir,
},
});
expect(isErrorResult(initResult)).toBe(false);
Expand Down Expand Up @@ -776,6 +786,7 @@ describe('error propagation', () => {
projectRoot: runDir,
branch: 'main',
task: 'failed status test',
baseDir: runDir,
},
});
expect(isErrorResult(initResult)).toBe(false);
Expand Down Expand Up @@ -812,6 +823,7 @@ describe('error propagation', () => {
projectRoot: runDir,
branch: 'main',
task: 'artifact optional fields test',
baseDir: runDir,
},
});
expect(isErrorResult(initResult)).toBe(false);
Expand Down