Show the last run on every pipeline row
Each pipeline row in the Android list now renders its most recent run: the status chip, how long ago it started, its recorded duration and its run id. Pipelines that have never run say "no runs recorded" instead of leaving a blank line, and the line is withheld until the run history has loaded so a missing history is never reported as "no runs". The list_runs history already arrives whole (id DESC), so the join is client-side: PipelineLastRun.kt folds it onto a Map keyed by pipeline id, recency decided from the timestamps with the higher run id breaking an exact tie, and formats "ago · duration · run N", omitting any genuinely absent fragment. The change is android/-only, adds no server field or dependency, keeps the existing title/secondary structure and selected-row highlight, and never starts a run. PipelineLastRunTest covers most-recent-wins, no runs, unknown pipeline id, equal timestamps, a bad timestamp, an unknown status word, the formatRanAgo scales and the "no runs recorded" wording. README records the verification: :app:testDebugUnitTest (153 tests, 0 failures) and a full --rerun-tasks assembleDebug (17,863,337 bytes, sha256 b2255066…).
This commit is contained in:
@@ -1376,3 +1376,62 @@ tree (JDK 17 from Homebrew `openjdk@17`, Gradle 8.11.1, `--offline`):
|
||||
http://10.0.0.249:8080/artifacts/72/1/pipelines-debug-wip-24584d8.apk` returned
|
||||
`HTTP/1.1 200 OK`, `Content-Type: application/vnd.android.package-archive`,
|
||||
`Content-Length: 18009527`, and a streamed `GET | shasum -a 256` matched.
|
||||
|
||||
## Last-run facts on every pipeline row (16 Oct 2026)
|
||||
|
||||
`android/` only. No server field was added: the whole run history already arrives
|
||||
from `list_runs` (`internal/pipeline/runs.go`, id DESC), so the join is
|
||||
client-side.
|
||||
|
||||
- **Pure join.** `ui/screens/PipelineLastRun.kt` adds `pipelineRunBadges(runs, now)`,
|
||||
which folds the history onto a `Map<Long, PipelineRunBadge>` keyed by
|
||||
pipeline id with `runId`, `state` (`runStateOf`), `ranAgo` and `duration`.
|
||||
Recency comes from the run timestamps, not the input order — the higher run id
|
||||
breaks an exact tie (or a missing/blank `created_at`), so an unsorted or
|
||||
partial response is still correct. `PipelineRunBadge.metaLine()` formats
|
||||
`ago · duration · run N` and drops any fragment that is genuinely absent (a
|
||||
still-running run has no `finished_at`); it never prints a blank separator.
|
||||
`formatRanAgo` mirrors the `formatDuration` integer rhythm (`just now`, then
|
||||
`Nm ago`/`Nh ago`/`Nd ago`) and clamps clock skew to `just now`. A pipeline with
|
||||
no run is simply absent from the map and the row prints the explicit
|
||||
`NO_RUNS_RECORDED`
|
||||
("no runs recorded") instead of a blank line. The last-run line is withheld
|
||||
until `runsState.data != null` (`runsKnown`), so a not-yet-loaded history never
|
||||
makes the false "no runs recorded" claim.
|
||||
- **Row.** `PipelineListScreen.kt` refreshes runs alongside pipelines, anchors
|
||||
"now" once per composition (`remember`), and renders the chip + meta line in a
|
||||
`Row` under the unchanged title/secondary lines; the selected-row highlight is
|
||||
untouched.
|
||||
- **Tests.** `test/.../PipelineLastRunTest.kt` (10 cases) covers most-recent-wins
|
||||
on unsorted input, no runs, unknown pipeline id, equal timestamps, an
|
||||
unparseable timestamp, an unknown status word (`RunState.Unknown`, id still
|
||||
rendered), each `formatRanAgo` scale plus blank/bad input, and the
|
||||
`NO_RUNS_RECORDED` wording.
|
||||
|
||||
Verified on this tree (macOS, JDK 17 from Homebrew `openjdk@17`, Gradle 9.7.1,
|
||||
`ANDROID_HOME=/Users/alan/Library/Android/sdk`):
|
||||
|
||||
- `gradle :app:testDebugUnitTest` → **153 tests, 0 failures, 0 errors, 0
|
||||
skipped** (`PipelineLastRunTest` 10/10).
|
||||
- `gradle :app:assembleDebug --rerun-tasks --no-build-cache` succeeded →
|
||||
`app-debug.apk` **17,863,337 bytes**, sha256
|
||||
`b22550660c1ce9f42719eb5a32a296055d9f3df97fa0fd94bb26fa3868730506`. This is a
|
||||
full rebuild of the current tree; the review's blocker was that the earlier
|
||||
published `artifacts/83/1/pipelines-debug-wip-5444390.apk` (17,997,811 bytes,
|
||||
sha256 `0fb07207…`) was a different revision of `PipelineListScreen.kt`, so it
|
||||
has been rebuilt and republished (see below).
|
||||
- Screenshots on `emulator-5556` (`FoldB_API_36`, 2208x1840, density 420, dark
|
||||
mode) with `android/scripts/capture_png.sh -s emulator-5556`: the narrow window
|
||||
via `adb shell wm size 1080x2340`, the wide window at the default 2208x1840
|
||||
(`wm size reset`). Both show the running run omitting its duration, the failed
|
||||
and canceled rows carrying `ago · duration · run N`, and pipeline id 3 "Plan,
|
||||
implement, review" printing `no runs recorded`.
|
||||
- **APK publish.** Copied to
|
||||
`…/artifacts/83/3/pipelines-debug-wip-5444390.apk` (`5444390` = `git rev-parse
|
||||
--short HEAD`). `curl -I
|
||||
http://10.0.0.249:8080/artifacts/83/3/pipelines-debug-wip-5444390.apk` returned
|
||||
`HTTP/1.1 200 OK`, `Content-Type: application/vnd.android.package-archive`,
|
||||
`Content-Length: 17863337`, and a streamed `GET | shasum -a 256` returned the
|
||||
same `b2255066…` as the local file. The same APK was installed on the emulator
|
||||
and the pulled installed `base.apk` hashed to `b2255066…`, so the reviewed
|
||||
source is what was actually rendered.
|
||||
|
||||
Reference in New Issue
Block a user