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

+2 -1
View File
@@ -17,6 +17,7 @@ import {
import { Spinner } from "@/components/ui/spinner";
import { Textarea } from "@/components/ui/textarea";
import { api } from "@/lib/api";
import { delivered } from "@/lib/delivered";
import { useIdentitiesStore } from "@/stores/identities";
import type { WorkflowDefinition, WorkflowStats } from "@/workflows/workflow-rows";
@@ -119,7 +120,7 @@ async function submit() {
<span class="block truncate font-mono text-[13px] font-medium">{{ d.name || d.id }}</span>
<span class="block text-xs text-fg-subtle">
{{ statFor(d.id)?.runs || 0 }} runs<template v-if="statFor(d.id)?.runs">
· {{ Math.round(((statFor(d.id)?.merged || 0) / (statFor(d.id)?.runs || 1)) * 100) }}% merged</template
· {{ Math.round((delivered(statFor(d.id)) / (statFor(d.id)?.runs || 1)) * 100) }}% delivered</template
>
</span>
</RadioGroupItem>
+4 -8
View File
@@ -2,6 +2,7 @@
import { computed } from "vue";
import StatTile from "@/base/StatTile.vue";
import { delivered } from "@/lib/delivered";
import { attentionStatusIds } from "@/lib/task-meta";
import type { Task } from "./TaskRow.vue";
@@ -26,12 +27,7 @@ const working = computed(() => counts.value.running ?? 0);
// Delivered counts everything whose work is out of archied's hands: merged,
// in review, or finished with no change to make (completed, which is how a
// no-change build and a no-code triage end).
const delivered = computed(
() =>
(counts.value.merged ?? 0) +
(counts.value.completed ?? 0) +
(counts.value.pr_open ?? 0),
);
const done = computed(() => delivered(counts.value) + (counts.value.pr_open ?? 0));
// "Needs you" is the server's grouping, not a local pair of ids: the same set
// backs the ?status=needs_you filter, so the tile and the filter cannot drift.
@@ -68,10 +64,10 @@ const needsYou = computed(() => {
/>
<StatTile
label="Delivered"
:value="delivered"
:value="done"
:compare="
total
? `${Math.round((delivered / total) * 100)}% of all tasks`
? `${Math.round((done / total) * 100)}% of all tasks`
: 'No tasks yet'
"
/>