Files
archie/ui/src/lib/delivered.ts
T
sam 9db267e5e7 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.
2026-09-26 04:01:08 +10:00

18 lines
680 B
TypeScript

/**
* The delivered count: work that finished and left archied's hands.
*
* A workflow can end a run `completed` instead of `merged` -- a no-change
* build, or a triage that needed no code -- so a surface that reads `merged`
* alone renders zero for exactly the runs that had nothing to merge. Every
* surface that reports delivered work counts both, through this one function.
*/
export interface DeliveredCounts {
merged?: number;
completed?: number;
}
/** delivered counts the runs that finished without needing a merge. */
export function delivered(counts: DeliveredCounts | null | undefined): number {
return (counts?.merged || 0) + (counts?.completed || 0);
}