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 d0fb41320c
commit 15efec696f
8 files changed
+114 -21

No files matched your search

+6 -3
View File
@@ -7,6 +7,7 @@ import { Button } from "@/components/ui/button";
import { StatusPill } from "@/components/ui/status-pill";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { api } from "@/lib/api";
import { delivered } from "@/lib/delivered";
import { compact } from "@/lib/format";
import { cn } from "@/lib/utils";
import { statusLabel } from "@/lib/task-meta";
@@ -86,7 +87,9 @@ async function restoreShipped() {
if (await store.replace("workflow-definitions", cloneControlPlaneValue(shipped)))
selected.value = shipped.definitions[0]?.id ?? "";
}
const rate = (merged = 0, total = 0) => (total ? merged / total : 0);
// The share of a workflow's runs whose work is finished: merged, or ended
// with nothing to merge (a no-change build, a no-code triage -- `completed`).
const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total : 0);
</script>
<template>
@@ -116,9 +119,9 @@ const rate = (merged = 0, total = 0) => (total ? merged / total : 0);
<span class="mt-1.5 flex items-center gap-2 text-xs text-fg-subtle">
<span class="w-20 shrink-0">{{ row.runs || 0 }} runs</span>
<span class="h-1 flex-1 overflow-hidden rounded-full bg-secondary">
<span class="block h-full rounded-full bg-primary" :style="{ width: `${rate(row.merged, row.runs) * 100}%` }" />
<span class="block h-full rounded-full bg-primary" :style="{ width: `${rate(delivered(row), row.runs) * 100}%` }" />
</span>
<span class="w-16 shrink-0 text-right font-mono">{{ row.merged || 0 }} of {{ row.runs || 0 }}</span>
<span class="w-16 shrink-0 text-right font-mono">{{ delivered(row) }} of {{ row.runs || 0 }}</span>
</span>
</button>
</li>