feat: Wire full request-changes flow for phase review

- Add PhaseChangesRequestedEvent to event bus
- Add requestChangesOnPhase() to ExecutionOrchestrator: reads unresolved
  comments, creates revision task (category='review'), resets phase to
  in_progress, queues task for dispatch
- Expand merge-skip and branch routing to include 'review' category so
  revision tasks work directly on the phase branch
- Add requestPhaseChanges tRPC procedure (reads comments from DB)
- Wire frontend: mutation replaces stub handler, window.prompt for
  optional summary, loading state on button
This commit is contained in:
Lukas May
2026-03-05 11:35:34 +01:00
parent 8ae3916c90
commit 7e0749ef17
7 changed files with 153 additions and 11 deletions

View File

@@ -341,5 +341,38 @@ export function phaseProcedures(publicProcedure: ProcedureBuilder) {
}
return comment;
}),
requestPhaseChanges: publicProcedure
.input(z.object({
phaseId: z.string().min(1),
summary: z.string().optional(),
}))
.mutation(async ({ ctx, input }) => {
const orchestrator = requireExecutionOrchestrator(ctx);
const reviewCommentRepo = requireReviewCommentRepository(ctx);
const allComments = await reviewCommentRepo.findByPhaseId(input.phaseId);
const unresolved = allComments
.filter((c: { resolved: boolean }) => !c.resolved)
.map((c: { filePath: string; lineNumber: number; body: string }) => ({
filePath: c.filePath,
lineNumber: c.lineNumber,
body: c.body,
}));
if (unresolved.length === 0 && !input.summary) {
throw new TRPCError({
code: 'BAD_REQUEST',
message: 'Add comments or a summary before requesting changes',
});
}
const result = await orchestrator.requestChangesOnPhase(
input.phaseId,
unresolved,
input.summary,
);
return { success: true, taskId: result.taskId };
}),
};
}