Let the detail tabs collapse and rebuild the step and source layouts

DetailTabs: give every tab a meaningful ImageVector from the core Material
icon set and turn the wide rail into a collapsible one. A rememberSaveable
railExpanded flag plus an accessibility-labelled "Collapse tabs"/"Expand
tabs" control shrink the rail to a narrow icon-only strip and back; the
collapsed tile still names its tab via the icon's content description and
still marks the selected tab by container colour and tab semantics, and the
content box reclaims the rail width. Narrow windows keep the top
PrimaryScrollableTabRow. railWidthDp is a pure, unit-tested predicate.

RunDetailScreen: render a step's metadata as aligned label/value rows
(KeyValueRow) instead of a ragged stack of lines, paired into two columns on
wide windows (status/outcome, duration/visit, target/session, agent/model
target) and a single column on narrow ones. Evidence (input, output,
transcript, file changes, notifications, control diagnostics) fills its card
in full-width monospace with a shared padding/line height, and the vertical
rhythm is one bottom gap per step with no doubled gap for a step without
expandable detail. The timeline glyph and connector stay aligned with the
step title. All previously shown fields are retained.

PipelineDetailScreen/CodeBlock: the Source tab now fills the whole tab area
with the tab's single LazyColumn owning all scrolling (CodeBlock gains an
optional maxHeight = null that renders unbounded; the default bounded
behaviour is unchanged for other callers). It renders the parsed definition
as one collapsible section per stage (key, type) built from the same
stageDefinitionFields/StageFieldRow the stage detail sheet uses, covering
prompt, output, tools, configs, edges (outcomes with resolved targets and
#success/#failure terminals), memory, limits and notify policy while skipping
absent fields. A Raw toggle reveals the exact markdown and a copy action
copies the whole definition.

Extract shared formatting helpers (fileChangeLine, notificationLine,
fileChangesSummary, controlVisitLabel) into Format.kt and expose
StageFieldRow/StageTypeChip/stageDefinitionFields so the sheet and the Source
tab agree. Add StageDetailSheetTest and StepMetaTest, extend DetailTabsTest
(icon distinctness, rail width) and FormatTest, and record the build,
unit-test and emulator-screenshot verification in android/README.md; the
captures stay in the git-ignored android/captures/space_pass/.

Assisted-by: DeepSeek V4.1 Flash
This commit is contained in:
2026-10-15 17:18:05 +01:00
parent 238f3fbdd8
commit 370eaaed1f
11 changed files with 703 additions and 149 deletions
+70 -9
View File
@@ -113,14 +113,27 @@ stops it.
existing back/refresh/start/cancel/retry bars on the detail screens).
- Both detail screens are tabbed via one shared `ui/components/DetailTabs.kt`:
run detail exposes Summary, Graph, Input, Output, Evidence and Steps, pipeline
detail Summary, Graph and Source, with Summary first and the default. The run's
six tabs scroll horizontally on a narrow window; on a wide window the same tabs
render as a vertical selectable rail. Selection is `rememberSaveable` (survives
detail Summary, Graph and Source, with Summary first and the default. Every tab
carries a meaningful icon alongside its label. The run's six tabs scroll
horizontally on a narrow window; on a wide window the same tabs render as a
vertical selectable rail that **collapses to a narrow icon-only strip** and
expands back via an accessibility-labelled "Collapse tabs"/"Expand tabs"
control, so the content reclaims the rail's width; the collapsed strip keeps
each icon's accurate content description and still marks the selected tab. Both
the selection and the collapsed/expanded state are `rememberSaveable` (survive
recomposition and configuration changes) and the tabs carry real tab semantics
(`Role.Tab` + selected state), so selection is never conveyed by colour alone.
Only the selected tab's body composes (`when`), each tab is a single
`LazyColumn`, and the Graph tab keeps the full-height `WorkflowGraph` panel
with its Fit and expand controls.
- The Source tab fills the whole tab area and renders the parsed definition
instead of dumping the raw markdown: one collapsible section per stage (name ·
type) holding labelled blocks for prompt, output, tools, configs, edges
(outcomes with their resolved targets, `#success`/`#failure` named as
terminals), memory, limits and notification policy, skipping what a stage does
not have. The rows come from the same `stageDefinitionFields`/`StageFieldRow`
the stage detail sheet uses, so the two views cannot diverge. The exact source
stays available behind a "Raw" toggle and a whole-definition copy action.
- The Summary tab carries what each page header carried: for a run the
status/outcome/executing chip row, recorded + completed visits, pipeline
id/version, stage, workspace, content hash, start/finish/duration and the
@@ -131,8 +144,10 @@ stops it.
CodeBlock.kt` card: `surfaceContainer` role, default rounded shape, a small
label header, a whole-block copy action (`LocalClipboardManager`) and monospace
at the shared size/line height, with a bounded height that scrolls internally
instead of pushing the page. Blank content renders nothing, and no raw bordered
monospace box remains.
instead of pushing the page. `maxHeight = null` renders a block unbounded so the
surrounding page scrolls as a whole (the Source tab uses this); the default
bounded behaviour is unchanged for every other caller. Blank content renders
nothing, and no raw bordered monospace box remains.
- Inside each tab the existing `LazyListScope.collapsibleSection` (`SectionHeader`)
provides inner sections where content naturally breaks down: Output per result
field, Input per labelled part, Steps per stage group and Evidence per entry.
@@ -155,10 +170,16 @@ stops it.
per screen, defaulting to expanded. Real lists (versions, steps, session
evidence) are items of the one outer list, so nothing nests a scrollable.
- Steps render as a timeline in run detail: a leading status glyph connected to
the next step by an outcome-coloured line, the stage with its sequence/visit
number, an outcome chip and the duration, with every retained piece of evidence
(input, output, transcript, file changes, notifications, control evidence)
behind a collapsible, collapsed-by-default detail in monospace.
the next step by an outcome-coloured line (kept aligned with the step title),
the stage with its sequence and an outcome chip. A step's metadata is a set of
aligned label/value rows (`KeyValueRow`) — paired side by side in two columns on
a wide window and stacked in one column on a narrow one — with a single
consistent vertical rhythm (one bottom gap per step, no doubled gap when a step
has no expandable detail) and full-width monospace evidence cards. Every
retained field stays: status, outcome, duration, visit/maxVisits/limitReached/
model target, target, session id, agent active, diagnostic and, behind the
collapsed-by-default detail, input, output, transcript, file changes (including
binary/truncated and skipped) and notification receipts.
- The runs list is grouped by day (`Today`/`Yesterday`/date, newest first) under
sticky headers, with the usage aggregates as a metrics block (total, average
via `formatDuration`, and colour-coded succeeded/failed/canceled/interrupted/
@@ -288,6 +309,46 @@ with the run detail open; the selected tab stayed selected
(`18_before_config`, `18_after_config`). `adb logcat` for the app package
contained no `FATAL EXCEPTION` and no Compose/other runtime exception.
The space-usage pass (collapsible icon rail, roomier Steps, rendered Source tab)
was verified on the same `Pixel_Fold_API_36` emulator (dark mode after
`adb shell cmd uimode night yes`) against the live server at
`ws://10.0.2.2:8080/connect`:
- `:app:testDebugUnitTest` reported **76 tests, 0 failures** (up from 60:
new `StageDetailSheetTest` for the stage/step field derivation and
`StepMetaTest` for the step metadata pairing + details predicate, plus the
icon/rail-width assertions in `DetailTabsTest` and the file-change/notification
formatting in `FormatTest`). `:app:assembleDebug` and `:app:installDebug`
succeeded; the install reported `Installed on 1 device` (the emulator — no
physical device was attached at install time).
- Captures were written with `adb -s emulator-5554 shell screencap -p
/sdcard/shot.png` followed by `adb -s emulator-5554 pull` (never
`exec-out … >`), to `captures/space_pass/` (git-ignored):
`narrow_pipeline_top_tabs` (narrow window, tabs across the top),
`source_tab_narrow` (rendered definition) and `source_tab_raw_narrow` (the
`Raw` toggle revealing the exact markdown), `wide_source_rail_expanded`
(icon+label rail, Source tab) and `wide_source_rail_collapsed` (icon-only rail,
content visibly wider), `wide_run_steps_expanded` and
`wide_run_steps_expanded_rail_collapsed` (a step with the two-column metadata
grid — Status/Outcome, Duration/Visit, Target/Session — and full-width Input/
Output/File-changes/Transcript cards), plus `wide_graph_stage_sheet` (tapping a
stage on the Graph tab still opens the refactored `StageDetailSheet`). No
clipping, even step spacing and a height-filling Source tab were confirmed by
eye.
- Rail-collapse persistence across a configuration change was exercised by
collapsing the rail on a detail screen and switching `wm density` 390→401: the
activity recreated and the collapsed strip stayed collapsed (`Expand tabs` was
still the control's description after the change; capture
`wide_detail_rail_collapsed_config_change`). The saved tab index is clamped by
`clampTabIndex` (unit-tested), so a stale index never indexes out of bounds.
- The wide layout was exercised by resizing the emulated display
(`adb shell wm size 2000x3400`, ≈820dp at density 390) and reset afterwards
(`wm size reset`); the attached Pixel 10 Pro Fold was never used and no run was
started from the app.
- `adb -s emulator-5554 logcat -d` contained 0 `FATAL EXCEPTION` lines and 0
`E AndroidRuntime` lines. The emulator was stopped with `adb emu kill`; no
`qemu-system-aarch64-headless` process survived.
Because `adb` cannot physically fold the phone, the wide two-pane/rail layout was
exercised on the emulator by resizing the emulated display (`adb shell wm size
2000x3400`, ≈820dp at density 390) and the narrow single-pane layout at the