From cfd5887311d92a32028485c668b795503867552a Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Fri, 16 Oct 2026 02:02:43 +0100 Subject: [PATCH] Lead a run's stage pane with the run's results A stage opened from a run (Timeline, run graph or run stage list) now leads with the run-side result instead of the stage's own definition: status, outcome, duration, visit and target, then the visit's results in the order Artifacts (gallery first), Output, Input, then the remaining run evidence under This run. The stage's full definition (type, prompt, output contract, outcomes, model, provider, configs, tools, limits, memory, notify) moves into one collapsed "Stage definition" section at the bottom. StageDetailPane gains a runContext flag: RunStagePane passes true and gets the collapsed-definition default, while PipelineStagePane passes false and keeps the definition expanded, since it is then the pane's only content. rememberSectionExpansion gains an initiallyExpanded set (part of the save key) so the seed respects an operator's own expand/collapse choices without inheriting them across contexts. Nothing visible before is removed - the previous Model/Provider headline promotion is reverted and those facts remain reachable inside the expanded definition. The visit tabs and the collapsed-by-default behaviour of the other sections are unchanged. android/ only; no dependency added. Updates android/README.md and StageDetailSheetTest.kt accordingly. --- android/README.md | 109 +++++++++++ .../pipelines/ui/components/DetailTabs.kt | 19 +- .../pipelines/ui/graph/StageDetailPane.kt | 173 +++++++++++------- .../ui/graph/StageDetailSheetTest.kt | 41 +++-- 4 files changed, 250 insertions(+), 92 deletions(-) diff --git a/android/README.md b/android/README.md index 49c9221e..73f53e3f 100644 --- a/android/README.md +++ b/android/README.md @@ -210,6 +210,15 @@ stops it. (`"Steps, expanded"`). Expanded state is `rememberSaveable`, per section and per screen, defaulting to expanded. Real lists (versions, steps, session evidence) are items of the one outer list, so nothing nests a scrollable. +- The stage pane (opened from a Timeline row, a run graph node or a run's stage + list) leads with the run's results, not the stage's definition: the stage's + status, outcome, duration and the selected visit's target, then the visit's + artifacts gallery (first), output and input, then the remaining run evidence. + The stage's own definition — type, prompt, output contract, outcomes, model, + provider, configs, tools, limits, memory and notify — moves into one collapsed + `Stage definition` section at the bottom. A pipeline stage pane has no run + context, so its definition section renders expanded as its only content. + Nothing is removed, and the visit tabs still switch the selected visit. - Steps render as a timeline in run detail: a leading status glyph connected to 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 @@ -1268,3 +1277,103 @@ has exactly three pane levels (`MasterPane.List/Detail/Stage`, `MAX_PANE_DEPTH = `SlidingPaneStackTest` cases instead; a long covered detail title wraps to three centred lines and ellipsizes (e.g. `Pipelines maintenance - plan implem…`) rather than being rotated. + + +## Run stage pane leads with the run's results (16 Oct 2026) + +A stage opened from a run no longer leads with its own definition. The pane now +shows the run's result first — the stage's status, outcome, duration, visit and +target, then the visit's results — and the stage's own definition is one +collapsed `Stage definition` section at the bottom. `android/` only; nothing in +the Pipelines server, its Go source, the Docker/compose files or the installer was +touched, no dependency was added, no run was started from the app, and the +attached Pixel was never installed on or driven (the debug APK was installed with +`adb -s emulator-5554 install -r`). + +- **Results first.** `ui/graph/StageDetailPane.kt` renders `headlineFields` + (Status, Outcome, Duration, Visit, Target, Model target — the run-side facts) + immediately, then the run-side result sections in + `STAGE_RESULT_SECTIONS` order: `Artifacts` (the per-visit gallery, first, per the + operator's earlier "artifacts at the top" preference), `Output`, `Input`, then + the remaining evidence under `This run`. Each is collapsed by default via the + unchanged `SectionHeader`/`rememberSectionExpansion`, and a new private + `StageSection` renders them all through one header+content helper. +- **One collapsed definition.** The previous Model/Provider headline promotion is + reverted: `STAGE_CONFIG_HEADLINE_LABELS`, `stageConfigHeadlineFields` and + `remainingDefinitionFields` are gone, and the full `stageDefinitionFields` + (type, prompt, output contract, outcomes, model, provider, configs, tools, + limits, memory, notify) renders in the single `Stage definition` section + (`STAGE_DEFINITION_KEY`/`STAGE_DEFINITION_TITLE`). Nothing visible before is + removed — Model/Provider are reachable by expanding the section. +- **Run vs. definition-only.** `StageDetailPane` gained `runContext` (default + false); `RunStagePane` passes `true` (Timeline, run graph and run stage list all + go through it), `PipelineStagePane` leaves it `false`. The pure + `definitionStartsExpanded(runContext)` seeds the section's default: collapsed in + a run pane, expanded in a pipeline stage pane, where the definition is the only + content. `rememberSectionExpansion` gained an `initiallyExpanded` set (part of + the save key) for that seed. +- **Visit tabs unchanged.** The visit tab row (`showVisitTabs`, `clampVisitIndex`) + still switches the selected visit above the results. + +Evidence (macOS, JDK 17 from Homebrew `openjdk@17`, cached Gradle 8.11.1, +`ANDROID_HOME=/Users/alan/Library/Android/sdk`, `--offline`): + +- `gradle :app:testDebugUnitTest :app:assembleDebug` → `BUILD SUCCESSFUL`; the + test-result XMLs aggregate to **137 tests, 0 failures, 0 errors, 0 skipped**. + `StageDetailSheetTest` dropped the two promotion tests and gained + `theRunHeadlineIsRunSideOnlyAndTheDefinitionKeepsModelAndProvider`, + `theDefinitionStartsExpandedOnlyWithoutARunContext` and + `theRunResultSectionsLeadWithTheArtifactsGallery` (12 cases, 0 failures). + `app/build/outputs/apk/debug/app-debug.apk` is 18,011,770 bytes, sha256 + `1ba2119ad2e2c34b0928460036bdda7b02e2b4d819be2c68d225dd9b072611b8`. +- `gradle :app:lintDebug` under JDK 17 fails only on the two **pre-existing** + `NewApi` errors for `android:windowLightNavigationBar` in `res/values/themes.xml` + and `res/values-night/themes.xml` (unchanged by this pass). +- On `emulator-5554` (narrow `wm size 1080x1920` / `wm density 480` ≈ 360dp; wide + `wm size reset` / `wm density reset` = 2076x2152 / 390 ≈ 852dp; **never** the + attached Pixel) against the live server `ws://10.0.2.2:8080/connect`, driven + with `adb shell input` and `uiautomator dump`; run 60's `implementer` (two + visits) and pipeline 11 v1's `implementer`: + - `narrow_timeline_top.png` / `narrow_timeline_sections.png` and + `wide_timeline_stage.png`: the `implementer` pane opened from the Timeline row + `implementer · visit 2` — title, `model` chip, `visit 1`/`visit 2` tabs, + Status/Outcome/Duration/Visit/Target, then `Artifacts`, `Output`, `Input`, + `This run`, `Stage definition` (all collapsed) in that order. + - `narrow_graph_top.png` / `narrow_graph_sections.png` and + `wide_graph_stage.png`: the same pane opened by tapping the `implementer` graph + node (starts on visit 2), identical ordering. + - `wide_pipeline_stage_definition.png`: pipeline 11 v1's `implementer` opened + from the pipeline graph — no visit tabs and no run sections, `Stage definition` + **expanded** with Type/Prompt/Output, because a pipeline stage has no run. + - `narrow_run_definition_model_provider.png`: the run pane's `Stage definition` + expanded to Type `model`, Prompt, Outcomes, Model `deepseek-v4.1-flash`, + Provider `opencode-go`, Retries, Timeout, Tools, Memory — nothing removed. + - `narrow_run_artifacts_gallery.png`: the `Artifacts` section (the first + result): `Artifacts · 47 recorded · partial capture` and the thumbnail grid. + (Run 60's own artifact files are the corrupt `adb screencap` captures noted in + the run-64 pass, so they render the honest `!` failure mark, not a blank tile.) + - Every capture was written and validated with + `android/scripts/capture_png.sh -s emulator-5554 …` (`--check` re-validated all + eight). `adb -s emulator-5554 logcat -d` contained **0** `FATAL EXCEPTION`, + **0** `E AndroidRuntime` and no `E`-level `net.awan.pipelines` line; no run was + started from the app. Screenshots and the raw `uiautomator` dumps are in + `~/.local/share/pipelines/data/artifacts/68/2/`. +- **APK publish.** `app/build/outputs/apk/debug/app-debug.apk` was copied to + `~/.local/share/pipelines/data/artifacts/68/1/pipelines-debug-wip-cd85f69.apk` + (`cd85f69` = `git rev-parse --short HEAD`; the working tree is uncommitted WIP on + top of it); `shasum -a 256` matched. `curl -I + http://10.0.0.249:8080/artifacts/68/1/pipelines-debug-wip-cd85f69.apk` (LAN + address from `ipconfig getifaddr en0`) returned `HTTP/1.1 200 OK`, + `Content-Type: application/vnd.android.package-archive`, `Content-Length: + 18011770`; a streamed `GET | shasum -a 256` returned + `1ba2119ad2e2c34b0928460036bdda7b02e2b4d819be2c68d225dd9b072611b8`, equal to the + local file. At 17.2 MiB it exceeds the server's 8 MiB per-file inventory cap, so + it is served by direct URL only. + +Not verified in this pass: a run stage that was never visited (no recorded step) +still belongs to a run, so its definition is collapsed; the pane then leads with +only the title/type and the collapsed section, which the pure +`definitionStartsExpanded` rule covers but was not driven on the device. A +terminal node opened from a run graph likewise collapses its single +`Incoming routes` definition-and-only section. The wide layout was exercised +headless on the fold AVD, not on physical hardware. diff --git a/android/app/src/main/java/net/awan/pipelines/ui/components/DetailTabs.kt b/android/app/src/main/java/net/awan/pipelines/ui/components/DetailTabs.kt index 4fc6c621..14e644eb 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/components/DetailTabs.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/components/DetailTabs.kt @@ -239,9 +239,13 @@ fun DetailTabBody( /** * Remembers which inner sections are expanded, keyed by their stable section - * key and saved across configuration changes. Every section starts collapsed the - * first time a screen is opened (the initial set is empty); the operator's own - * expand/collapse choices are persisted (as an [ArrayList] a Bundle can hold). + * key and saved across configuration changes. Sections start collapsed unless + * [initiallyExpanded] names some, which only a screen whose sections would + * otherwise read as empty does (see the pipeline stage pane's definition); the + * operator's own expand/collapse choices are then persisted (as an [ArrayList] + * a Bundle can hold). [initiallyExpanded] participates in the save key, so a pane + * switching between run and definition contexts reseeds rather than inheriting + * the other context's choices. */ @Stable class SectionExpansionState internal constructor( @@ -260,9 +264,12 @@ private val expandedKeysSaver: Saver, ArrayList> = Saver( ) @Composable -fun rememberSectionExpansion(vararg inputs: Any?): SectionExpansionState { - val expanded = rememberSaveable(*inputs, stateSaver = expandedKeysSaver) { - mutableStateOf(emptySet()) +fun rememberSectionExpansion( + vararg inputs: Any?, + initiallyExpanded: Set = emptySet(), +): SectionExpansionState { + val expanded = rememberSaveable(*inputs, initiallyExpanded, stateSaver = expandedKeysSaver) { + mutableStateOf(initiallyExpanded) } return remember(expanded) { SectionExpansionState(expanded) } } diff --git a/android/app/src/main/java/net/awan/pipelines/ui/graph/StageDetailPane.kt b/android/app/src/main/java/net/awan/pipelines/ui/graph/StageDetailPane.kt index 5ceb488f..0cf87a9d 100644 --- a/android/app/src/main/java/net/awan/pipelines/ui/graph/StageDetailPane.kt +++ b/android/app/src/main/java/net/awan/pipelines/ui/graph/StageDetailPane.kt @@ -43,6 +43,7 @@ import net.awan.pipelines.ui.components.CodeBlock import net.awan.pipelines.ui.components.DetailTabBody import net.awan.pipelines.ui.components.KeyValueRow import net.awan.pipelines.ui.components.PaneIdentity +import net.awan.pipelines.ui.components.SectionExpansionState import net.awan.pipelines.ui.components.SectionHeader import net.awan.pipelines.ui.components.rememberSectionExpansion import net.awan.pipelines.ui.displayMap @@ -138,45 +139,59 @@ internal fun controlVisitLabel(control: ControlEvidence): String { } /** - * The identity/result labels that must be visible the moment the stage pane is - * opened, before anything is expanded: the stage's status and outcome, its - * target, duration, visit and model target. Everything else lives in a - * collapsible section. + * The run-side identity/result labels that must be visible the moment a run's + * stage pane is opened, before anything is expanded: the stage's status and + * outcome, its target, duration, visit and the model it targeted. The stage's + * own definition (including its model and provider configs) is deliberately not + * part of these; it lives in the collapsed stage-definition section below. */ internal val STAGE_HEADLINE_LABELS: Set = setOf("Status", "Outcome", "Target", "Duration", "Visit", "Model target") -/** The always-visible identity/result fields of a step's recorded evidence. */ +/** The always-visible run-side identity/result fields of a step's evidence. */ internal fun headlineFields(fields: List): List = fields.filter { it.label in STAGE_HEADLINE_LABELS } /** * The remaining run evidence (diagnostic, transcript, session/agent, file * changes, notifications) that belongs in a collapsible section: the headline - * facts and the input/output blocks are surfaced elsewhere. + * facts and the input/output result blocks are surfaced elsewhere. */ internal fun evidenceFields(fields: List): List = fields.filter { it.label !in STAGE_HEADLINE_LABELS && it.label != "Input" && it.label != "Output" } -/** - * The definition configs promoted to the always-visible headline so the operator - * sees the recorded model and provider without expanding Definition. Only these - * two labels are promoted; the rest of the definition stays collapsible. Pure, - * so the promotion is unit-tested without the Compose runtime. - */ -internal val STAGE_CONFIG_HEADLINE_LABELS: Set = setOf("Model", "Provider") +/** The section key of the one stage-definition section (expansion is saved on it). */ +internal const val STAGE_DEFINITION_KEY = "definition" -/** The non-blank Model/Provider config rows of [definition], in definition order. */ -internal fun stageConfigHeadlineFields(definition: List): List = - definition.filter { it.label in STAGE_CONFIG_HEADLINE_LABELS } +/** The stage-definition section's title, naming clearly what it holds. */ +internal const val STAGE_DEFINITION_TITLE = "Stage definition" /** - * The definition rows that stay in the collapsed Definition section: everything - * except the configs [stageConfigHeadlineFields] already promoted to the - * headline, so a promoted fact is never rendered twice. + * Whether the stage-definition section starts expanded. It is the only content of + * a pane opened without a run context (a pipeline's own stage definition, see + * [PipelineStagePane]), and starts collapsed in a run pane, where the run's + * results lead and the definition sits at the bottom. An operator's own + * expand/collapse choice is still remembered on top of this default. */ -internal fun remainingDefinitionFields(definition: List): List = - definition.filter { it.label !in STAGE_CONFIG_HEADLINE_LABELS } +internal fun definitionStartsExpanded(runContext: Boolean): Boolean = !runContext + +/** + * One run-side result section of the stage pane. The order is the operator's + * stated preference: the artifacts gallery first, then the output the stage + * produced for that visit, then the input it received. + */ +internal enum class StageResultSection(val key: String) { + Artifacts("artifacts"), + Output("output"), + Input("input"), +} + +/** The run-side result sections, in display order (the artifacts gallery first). */ +internal val STAGE_RESULT_SECTIONS: List = listOf( + StageResultSection.Artifacts, + StageResultSection.Output, + StageResultSection.Input, +) /** * The pure run view of one [RunStep] for the selected stage: status, outcome, @@ -292,6 +307,7 @@ fun StageDetailPane( wide: Boolean = false, modifier: Modifier = Modifier, covered: Boolean = false, + runContext: Boolean = false, ) { // A covered pane shows its compact identity only; the visit tab row and the // stage body must never be drawn squeezed into the peek strip. @@ -325,6 +341,7 @@ fun StageDetailPane( configuredServerUrl = configuredServerUrl, fetchArtifactBytes = fetchArtifactBytes, wide = wide, + runContext = runContext, modifier = Modifier.padding(padding), ) } @@ -341,6 +358,7 @@ private fun StageDetailBody( configuredServerUrl: String, fetchArtifactBytes: suspend (String) -> ByteArray?, wide: Boolean, + runContext: Boolean, modifier: Modifier = Modifier, ) { val text = pipelinesText() @@ -357,15 +375,23 @@ private fun StageDetailBody( } val clampedVisit = clampVisitIndex(visitIndex, runSteps.size) val selectedStep = runSteps.getOrNull(clampedVisit) - // Derived once per selected step, not per recomposition. + // Derived once per selected step, not per recomposition. Only the run-side + // facts lead the pane; the stage's own configs stay in the definition section. val runFields = remember(selectedStep) { selectedStep?.let(::runStepFields).orEmpty() } - // The identity/result facts, plus the stage's recorded Model/Provider, are - // visible without expanding anything; nothing is derived per frame. - val configHeadline = remember(definition) { stageConfigHeadlineFields(definition) } - val headline = headlineFields(runFields) + configHeadline + val headline = headlineFields(runFields) + val inputFields = remember(runFields) { runFields.filter { it.label == "Input" } } + val outputFields = remember(runFields) { runFields.filter { it.label == "Output" } } val evidence = evidenceFields(runFields) - val definitionRows = remember(definition) { remainingDefinitionFields(definition) } - val expansion = rememberSectionExpansion(stageKey) + // The stage definition is the only content of a pane without a run context, + // so it starts expanded there and collapsed at the bottom of a run pane. + val expansion = rememberSectionExpansion( + stageKey, + initiallyExpanded = if (definitionStartsExpanded(runContext)) { + setOf(STAGE_DEFINITION_KEY) + } else { + emptySet() + }, + ) DetailTabBody(wide, modifier) { columnModifier -> Column( @@ -403,56 +429,66 @@ private fun StageDetailBody( Text("No details recorded for this node.", style = text.meta) } - if (definitionRows.isNotEmpty()) { - val key = "definition" - SectionHeader(key.capitalized(), expansion.isExpanded(key), { expansion.toggle(key) }) - if (expansion.isExpanded(key)) { - definitionRows.forEach { field -> StageFieldRow(field) } - } - } - - if (selectedStep != null) { - val inputFields = runFields.filter { it.label == "Input" } - val outputFields = runFields.filter { it.label == "Output" } - if (inputFields.isNotEmpty()) { - val key = "input" - SectionHeader(key.capitalized(), expansion.isExpanded(key), { expansion.toggle(key) }) - if (expansion.isExpanded(key)) inputFields.forEach { StageFieldRow(it) } - } - if (outputFields.isNotEmpty()) { - val key = "output" - SectionHeader(key.capitalized(), expansion.isExpanded(key), { expansion.toggle(key) }) - if (expansion.isExpanded(key)) outputFields.forEach { StageFieldRow(it) } - } - val artifactsKey = "artifacts" - SectionHeader( - artifactsKey.capitalized(), - expansion.isExpanded(artifactsKey), - { expansion.toggle(artifactsKey) }, - ) - if (expansion.isExpanded(artifactsKey)) { - ArtifactsSection( - step = selectedStep, - configuredServerUrl = configuredServerUrl, - fetchArtifactBytes = fetchArtifactBytes, - ) + // A run pane leads with the run's results: the artifacts gallery + // first, then the output and the input, then the remaining evidence. + if (runContext && selectedStep != null) { + STAGE_RESULT_SECTIONS.forEach { section -> + when (section) { + StageResultSection.Artifacts -> StageSection(expansion, section.key) { + ArtifactsSection( + step = selectedStep, + configuredServerUrl = configuredServerUrl, + fetchArtifactBytes = fetchArtifactBytes, + ) + } + StageResultSection.Output -> if (outputFields.isNotEmpty()) { + StageSection(expansion, section.key) { + outputFields.forEach { StageFieldRow(it) } + } + } + StageResultSection.Input -> if (inputFields.isNotEmpty()) { + StageSection(expansion, section.key) { + inputFields.forEach { StageFieldRow(it) } + } + } + } } if (evidence.isNotEmpty()) { - val key = "run" - SectionHeader( - "This run", - expansion.isExpanded(key), - { expansion.toggle(key) }, - ) - if (expansion.isExpanded(key)) { + StageSection(expansion, "run", "This run") { evidence.forEach { field -> StageFieldRow(field) } } } } + + // The stage's own definition sits in one clearly named section: it is + // the pane's only content without a run context (so it starts + // expanded) and the collapsed last section of a run pane. + if (definition.isNotEmpty()) { + StageSection(expansion, STAGE_DEFINITION_KEY, STAGE_DEFINITION_TITLE) { + definition.forEach { field -> StageFieldRow(field) } + } + } } } } +/** + * One collapsible section of the stage pane: its header toggles [expansion] + * under [key] and, while it is expanded, [content] is rendered. The title + * defaults to the capitalised key (e.g. `artifacts` → `Artifacts`), so the pane + * names every section the same way. + */ +@Composable +private fun StageSection( + expansion: SectionExpansionState, + key: String, + title: String = key.capitalized(), + content: @Composable () -> Unit, +) { + SectionHeader(title, expansion.isExpanded(key), { expansion.toggle(key) }) + if (expansion.isExpanded(key)) content() +} + /** The stage pane hosted directly by the run destination, reading the run detail. */ @Composable fun RunStagePane( @@ -482,6 +518,7 @@ fun RunStagePane( wide = wide, modifier = modifier, covered = covered, + runContext = true, ) } diff --git a/android/app/src/test/java/net/awan/pipelines/ui/graph/StageDetailSheetTest.kt b/android/app/src/test/java/net/awan/pipelines/ui/graph/StageDetailSheetTest.kt index b5bc04bd..d0854328 100644 --- a/android/app/src/test/java/net/awan/pipelines/ui/graph/StageDetailSheetTest.kt +++ b/android/app/src/test/java/net/awan/pipelines/ui/graph/StageDetailSheetTest.kt @@ -165,7 +165,7 @@ class StageDetailSheetTest { } @Test - fun definitionModelAndProviderArePromotedToTheHeadlineWithoutDuplication() { + fun theRunHeadlineIsRunSideOnlyAndTheDefinitionKeepsModelAndProvider() { val stage = Stage( key = "implementer", type = "model", @@ -177,31 +177,36 @@ class StageDetailSheetTest { ), ) val definition = stageDefinitionFields(stage) - val promoted = stageConfigHeadlineFields(definition).map { it.label } - assertEquals(listOf("Model", "Provider"), promoted) - // The promoted facts stay in the always-visible headline... + // Nothing is removed: the definition section still carries model/provider. + val labels = definition.map { it.label } + assertTrue(labels.containsAll(listOf("Type", "Prompt", "Model", "Provider", "Retries"))) + assertEquals("deepseek-v4.1-flash", definition.first { it.label == "Model" }.value) + assertEquals("opencode-go", definition.first { it.label == "Provider" }.value) + // The always-visible headline is the run-side result only. val step = RunStep( status = "completed", outcome = "success", target = "reviewer", control = ControlEvidence(visit = 1, maxVisits = 5, modelTarget = "deepseek-v4.1-flash"), ) - val headline = headlineFields(runStepFields(step)) + stageConfigHeadlineFields(definition) - val labels = headline.map { it.label } - assertEquals(listOf("Status", "Outcome", "Visit", "Model target", "Target", "Model", "Provider"), labels) - assertEquals("deepseek-v4.1-flash", headline.first { it.label == "Model" }.value) - assertEquals("opencode-go", headline.first { it.label == "Provider" }.value) - // ...and are never rendered a second time in the collapsed Definition. - val remaining = remainingDefinitionFields(definition).map { it.label } - assertTrue(remaining.none { it == "Model" || it == "Provider" }) - // The rest of the definition is untouched and still needs no expansion to exist. - assertTrue(remaining.containsAll(listOf("Type", "Prompt", "Retries"))) + val headline = headlineFields(runStepFields(step)).map { it.label } + assertEquals(listOf("Status", "Outcome", "Visit", "Model target", "Target"), headline) + assertTrue(headline.none { it == "Model" || it == "Provider" }) } @Test - fun aDefinitionWithNoConfigsPromotesNothing() { - val fields = stageDefinitionFields(Stage(key = "planner")) - assertTrue(stageConfigHeadlineFields(fields).isEmpty()) - assertEquals(fields, remainingDefinitionFields(fields)) + fun theDefinitionStartsExpandedOnlyWithoutARunContext() { + // A pipeline's stage definition is the pane's only content, so it starts + // expanded; a run pane leads with results and collapses the definition. + assertTrue(definitionStartsExpanded(runContext = false)) + assertFalse(definitionStartsExpanded(runContext = true)) + } + + @Test + fun theRunResultSectionsLeadWithTheArtifactsGallery() { + assertEquals( + listOf("artifacts", "output", "input"), + STAGE_RESULT_SECTIONS.map { it.key }, + ) } }