fix: default write_tests skips when target type is unimplemented (#396)

This commit is contained in:
nrslib 2026-02-27 00:45:40 +09:00
parent e2289bfbd5
commit f61f71d127
5 changed files with 60 additions and 0 deletions

View File

@ -53,6 +53,8 @@ movements:
rules:
- condition: Tests written successfully
next: implement
- condition: Cannot proceed because the test target is not implemented yet, so skip test writing
next: implement
- condition: Cannot proceed with test creation
next: ABORT
- condition: User input required because there are items to confirm with the user

View File

@ -84,6 +84,8 @@ movements:
rules:
- condition: Tests written successfully
next: implement
- condition: Cannot proceed because the test target is not implemented yet, so skip test writing
next: implement
- condition: Cannot proceed with test writing
next: ABORT
- condition: User input needed for clarification

View File

@ -53,6 +53,8 @@ movements:
rules:
- condition: テスト作成が完了した
next: implement
- condition: テスト対象が未実装のためテスト作成をスキップする
next: implement
- condition: テスト作成を進行できない
next: ABORT
- condition: ユーザーへの確認事項があるためユーザー入力が必要

View File

@ -84,6 +84,8 @@ movements:
rules:
- condition: テスト作成が完了した
next: implement
- condition: テスト対象が未実装のためテスト作成をスキップする
next: implement
- condition: テスト作成を進行できない
next: ABORT
- condition: ユーザーへの確認事項があるためユーザー入力が必要

View File

@ -182,6 +182,26 @@ describe('Piece Patterns IT: default piece (parallel reviewers)', () => {
expect(state.status).toBe('completed');
});
it('should continue to implement when tests cannot be written because target is not implemented', async () => {
const config = loadPiece('default', testDir);
setMockScenario([
{ persona: 'planner', status: 'done', content: 'Requirements are clear and implementable' },
{ persona: 'coder', status: 'done', content: 'Cannot proceed because the test target is not implemented yet, so skip test writing' },
{ persona: 'coder', status: 'done', content: 'Implementation complete' },
{ persona: 'ai-antipattern-reviewer', status: 'done', content: 'No AI-specific issues' },
{ persona: 'architecture-reviewer', status: 'done', content: 'approved' },
{ persona: 'qa-reviewer', status: 'done', content: 'approved' },
{ persona: 'testing-reviewer', status: 'done', content: 'approved' },
{ persona: 'supervisor', status: 'done', content: 'All checks passed' },
]);
const engine = createEngine(config!, testDir, 'Test task');
const state = await engine.run();
expect(state.status).toBe('completed');
});
it('should route to fix when any("needs_fix") in parallel review step', async () => {
const config = loadPiece('default', testDir);
@ -211,6 +231,38 @@ describe('Piece Patterns IT: default piece (parallel reviewers)', () => {
});
});
describe('Piece Patterns IT: default-test-first-mini piece', () => {
let testDir: string;
beforeEach(() => {
vi.clearAllMocks();
testDir = createTestDir();
});
afterEach(() => {
resetScenario();
rmSync(testDir, { recursive: true, force: true });
});
it('should continue to implement when tests cannot be written because target is not implemented', async () => {
const config = loadPiece('default-test-first-mini', testDir);
expect(config).not.toBeNull();
setMockScenario([
{ persona: 'planner', status: 'done', content: 'Requirements are clear and implementation is possible' },
{ persona: 'coder', status: 'done', content: 'Cannot proceed because the test target is not implemented yet, so skip test writing' },
{ persona: 'coder', status: 'done', content: 'Implementation complete' },
{ persona: 'ai-antipattern-reviewer', status: 'done', content: 'No AI-specific issues' },
{ persona: 'supervisor', status: 'done', content: 'All checks passed' },
]);
const engine = createEngine(config!, testDir, 'Test task');
const state = await engine.run();
expect(state.status).toBe('completed');
});
});
describe('Piece Patterns IT: research piece', () => {
let testDir: string;