feat(taskstate): count completed runs in the per-workflow stats
The transition table moved the no-change outcomes to StatusCompleted, so a run that opens no pull request now ends in a status the per-workflow stats did not count at all: it was not merged, not in review, not parked, and the workflows page would have shown it as a run that went nowhere. The count travels the whole State Store path, since every dashboard consumer reads it through the gRPC client rather than the local store. - WorkflowStats filters `completed` beside merged and pr_open; the SQL is the count, so a wrong filter reads as zero rather than failing, and TestWorkflowStatsCountsCompletedRuns holds it against a real store. - storecontract.WorkflowStat gains Completed (json "completed"), the proto message gains field 9, and workflowStatProto/workflowStatValue carry it; TestWorkflowStatProtoCarriesEveryField round-trips every field by name. - The gateway's chat task report names the status. - The dashboard counts a completed run as delivered in GatePulseCard's totals and badge numerator, and the WorkflowStat/WorkflowStats/WorkflowRow interfaces carry the field. - TestOutcomeSitesAreTransitionsFromRunning is the guard that keeps the producer and the table agreeing: it re-reads this package's tc.Outcome assignment sites from source and requires each status to be one internal/taskstate allows from running, so a new or moved site has to be adjudicated against the table instead of discovered on a live run.
This commit is contained in:
14 files changed
+279
-10
No files matched your search
@@ -4,15 +4,21 @@ import { computed } from "vue";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { workflows } from "./state";
|
||||
import { workflows, type WorkflowStat } from "./state";
|
||||
|
||||
/** Sharer of runs: how much of the work that finished passed its gates. */
|
||||
const stats = computed(() => workflows.value?.workflows ?? []);
|
||||
|
||||
// A run that finished without opening a pull request (a no-change build, a
|
||||
// triage that needed no code) is delivered like a merge or a PR in review, so
|
||||
// both totals count it: the pass rate would otherwise read every `completed`
|
||||
// row as a failed gate.
|
||||
const delivered = (w: WorkflowStat) => (w.merged || 0) + (w.completed || 0);
|
||||
|
||||
const totals = computed(() => ({
|
||||
runs: stats.value.reduce((a, w) => a + (w.runs || 0), 0),
|
||||
merged: stats.value.reduce(
|
||||
(a, w) => a + (w.merged || 0) + (w.pr_open || 0),
|
||||
(a, w) => a + delivered(w) + (w.pr_open || 0),
|
||||
0,
|
||||
),
|
||||
}));
|
||||
@@ -61,14 +67,14 @@ const pct = computed(() => {
|
||||
}}</span>
|
||||
<Badge
|
||||
:variant="
|
||||
(w.merged || 0) === (w.runs || 0)
|
||||
delivered(w) === (w.runs || 0)
|
||||
? 'ok'
|
||||
: (w.parked || 0) > 0
|
||||
? 'warn'
|
||||
: 'info'
|
||||
"
|
||||
>
|
||||
{{ w.merged || 0 }}/{{ w.runs || 0 }}
|
||||
{{ delivered(w) }}/{{ w.runs || 0 }}
|
||||
</Badge>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -22,6 +22,7 @@ export interface WorkflowStat {
|
||||
workflow?: string;
|
||||
runs?: number;
|
||||
merged?: number;
|
||||
completed?: number;
|
||||
pr_open?: number;
|
||||
parked?: number;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ export interface WorkflowStats {
|
||||
workflow: string;
|
||||
runs?: number;
|
||||
merged?: number;
|
||||
completed?: number;
|
||||
avg_tokens?: number;
|
||||
avg_steps?: number;
|
||||
origin?: string;
|
||||
@@ -34,6 +35,7 @@ export interface WorkflowRow {
|
||||
workflow: string;
|
||||
runs?: number;
|
||||
merged?: number;
|
||||
completed?: number;
|
||||
avg_tokens?: number;
|
||||
avg_steps?: number;
|
||||
origin?: string;
|
||||
@@ -59,6 +61,7 @@ export function workflowRows(
|
||||
workflow: definition.id,
|
||||
runs: 0,
|
||||
merged: 0,
|
||||
completed: 0,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user