fix: Sort pipeline tasks by dependency order instead of priority+createdAt

The Execution tab's PipelinePhaseGroup was using sortByPriorityAndQueueTime
which ignores task dependencies entirely. Tasks now sort topologically via
topologicalSortPhases, matching the Plan tab's TaskGraph behavior.

- Add listInitiativeTaskDependencies tRPC procedure (bulk fetch)
- Fetch task deps in PipelineTab, group by phase, pass through
- Replace priority sort with topological sort in PipelinePhaseGroup
- Show "blocked by N" count on PipelineTaskCard
This commit is contained in:
Lukas May
2026-03-04 10:18:26 +01:00
parent fcf822363c
commit 1aef986127
8 changed files with 94 additions and 11 deletions

View File

@@ -183,6 +183,19 @@ export function taskProcedures(publicProcedure: ProcedureBuilder) {
return edges;
}),
listInitiativeTaskDependencies: publicProcedure
.input(z.object({ initiativeId: z.string().min(1) }))
.query(async ({ ctx, input }) => {
const taskRepo = requireTaskRepository(ctx);
const tasks = await taskRepo.findByInitiativeId(input.initiativeId);
const edges: Array<{ taskId: string; dependsOn: string[] }> = [];
for (const t of tasks) {
const deps = await taskRepo.getDependencies(t.id);
if (deps.length > 0) edges.push({ taskId: t.id, dependsOn: deps });
}
return edges;
}),
approveTask: publicProcedure
.input(z.object({ taskId: z.string().min(1) }))
.mutation(async ({ ctx, input }) => {