fix(ui): count completed runs as delivered on the workflows surfaces

The workflows page's per-workflow bar and its 'N of M' text, and the
workflow picker's percent on the new-task form, counted `merged` alone.
A workflow whose runs now end `completed` (a no-change build, a triage
that needed no code) therefore rendered zero delivery beside three
sibling surfaces that already counted both.

The count moves into ui/src/lib/delivered.ts, which GatePulseCard,
ThroughputTiles and TasksSummary now read too instead of keeping their
own copies of the arithmetic. The picker's label says delivered, not
merged: a run that ends completed is not merged.
This commit is contained in:
sam committed 2026-09-26 04:01:08 +10:00
1 parent 4f62ce5dfc
commit f7bfd78d5f
8 files changed
+114 -21

No files matched your search

+2 -3
View File
@@ -4,7 +4,8 @@ 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, type WorkflowStat } from "./state";
import { delivered } from "@/lib/delivered";
import { workflows } from "./state";
/** Sharer of runs: how much of the work that finished passed its gates. */
const stats = computed(() => workflows.value?.workflows ?? []);
@@ -13,8 +14,6 @@ const stats = computed(() => workflows.value?.workflows ?? []);
// 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(
+4 -3
View File
@@ -2,6 +2,7 @@
import { computed } from "vue";
import { StatStrip } from "@/components/ui/stat-strip";
import { delivered } from "@/lib/delivered";
import { compact } from "@/lib/format";
import { attentionStatusIds } from "@/lib/task-meta";
import { summary } from "./state";
@@ -11,9 +12,9 @@ import { summary } from "./state";
const counts = computed(() => summary.value?.statuses ?? {});
const tokensByDay = computed(() => summary.value?.tokens_by_day ?? []);
const used = computed(() => tokensByDay.value.reduce((a, d) => a + (d.tokens || 0), 0));
const done = computed(
() => (counts.value.merged || 0) + (counts.value.completed || 0) + (counts.value.pr_open || 0),
);
// Delivered work is out of archied's hands: merged, finished with no change to
// make (`completed`), or open in review.
const done = computed(() => delivered(counts.value) + (counts.value.pr_open || 0));
// "Needs you" is the server's grouping (attentionStatusIds), the same one the
// Tasks page's needs_you filter reads.
const attention = computed(() => {