Show the stage verdict atop the stage pane, with clickable artifacts

Mirror the server's derived verdict onto RunStep as a nullable
StageVerdict ({option, reason, reason_source, artifacts}, absent -> null),
matching internal/protocol/verdict.go.

Render a StageVerdictBlock at the top of the run pane, below the visit
tabs and above the facts, only when a verdict is present - a null or
empty verdict draws nothing, never an empty heading. The chosen option is
a ColoredChip in the stage outcome's existing colour; the reason is plain
pipelinesText().body that wraps without a maxLines clip.

The artifacts the reason names become inline, tappable references
(image/video open the shared ArtifactViewer, anything else uses the
existing openArtifact action) plus the same references as compact
FlowRow chips. Referenced names resolve to the visit's recorded
artifacts, deduplicated and in recorded order; reason text is split
around those names longest-match-first. No new dependency and no new dp
or sp literal.

android/ only.
This commit is contained in:
2026-10-16 19:17:26 +01:00
parent 8b0d7b1ecb
commit 007639948c
6 changed files with 512 additions and 0 deletions
+59
View File
@@ -3717,3 +3717,62 @@ visual review owns the device); no server that actually sends `title` was
available, so the titled layout is exercised by the unit tests and the fallback
path only.
## Stage verdict atop the stage pane, with clickable artifacts (16 Oct 2026)
A completed run visit now leads its stage pane with the server's derived verdict:
the chosen option as a badge, the concise reason in ordinary body text, and the
recorded artifacts the reason names as inline, tappable references plus the same
references as compact chips. `android/` only; nothing in the Pipelines server, its
Go source, the installer or the Docker files was touched, no run was started from
the app, and no device command was run (build + unit tests only).
- **Protocol.** `data/protocol/Message.kt` gains `StageVerdict` and an optional
`verdict` on `RunStep`, mirroring `internal/protocol/verdict.go`
(`{option, reason, reason_source, artifacts}` under the `verdict` wire name). It
is nullable and defaults to absent, so a running step or a pre-verdict server
parses cleanly to null.
- **One block.** New `ui/graph/StageVerdict.kt` holds the pure helpers and the
composable. `StageVerdictBlock` is rendered at the top of the run pane, below the
visit tabs and above the facts, only when the server reported a verdict; a null
verdict (or one with neither option nor reason) draws nothing — never an empty
heading or placeholder.
- **Badge.** The option is a `ColoredChip` in the *stage outcome's* existing colour
(`outcomeColor(step.outcome)`, the graph's palette the Timeline chips already
use), so the badge agrees with the graph rather than a new colour vocabulary.
- **Reason.** Rendered with `pipelinesText().body`, so it is readable plain
language, never a monospace JSON dump, and it wraps with no `maxLines` clip.
- **References.** `referencedVerdictArtifacts` resolves the verdict's referenced
names to the visit's recorded artifacts (recorded order, deduplicated, an
unrecorded/invented name dropped). `verdictReasonSegments` splits the reason
around those names — by full recorded name or basename, longest match first — and
the segments become inline `LinkAnnotation.Clickable` references coloured
`primary` with an underline. An image/video reference opens the shared
`ArtifactViewer`; anything else goes through the existing `openArtifact` action.
The same references are `FlowRow` chips (`VerdictArtifactChip`) with their type
glyph, so they can be tapped without hunting in the sentence.
- **Geometry.** Only existing tokens (`SPACING_M`/`SPACING_S`/`SPACING_XS`,
`ICON_STATUS_DP`); no new `dp`/`sp` literal and no new dependency.
Evidence (macOS, JDK 17 from Homebrew `openjdk@17`, Gradle 8.11.1 from the wrapper
cache, `ANDROID_HOME=/Users/alan/Library/Android/sdk`, `--no-daemon`):
- `:app:testDebugUnitTest` → `BUILD SUCCESSFUL`; the result XMLs aggregate to
**282 tests, 0 failures, 0 errors, 0 skipped**. New `StageVerdictTest` (5 cases:
split around every referenced name, basename for a slashed path, longest match
wins, a reason with no references, and name→recorded-artifact resolution) and
`ProtocolModelTest#runStepVerdictParsesWithItsReasonSourceAndReferencedArtifacts`.
- `:app:assembleDebug` → `app-debug.apk` **18,270,824 bytes**, sha256
`85847c6fe32498f38464741ca1b8f592dbbd7a9e1f34dd649121e723836b0903`.
- **APK publish.** `app-debug.apk` copied to
`~/.local/share/pipelines/data/artifacts/167/1/pipelines-debug-wip-8b0d7b1.apk`
(`8b0d7b1` = short `HEAD`); `shasum -a 256` matched. The LAN URL
`http://10.0.0.249:8080/artifacts/167/1/pipelines-debug-wip-8b0d7b1.apk` returned
`HTTP/1.1 200 OK`, `Content-Type: application/vnd.android.package-archive`,
`Content-Length: 18270824`.
Not verified in this pass: device captures of the stage pane at a narrow and a wide
window (the visual review owns the device, per the brief's device policy), so the
verdict layout is exercised by the unit tests and the compile only. No server that
actually sends `verdict` was available to the implementer, so the block's live
rendering against real data is deferred to visual review.