Show an Android run stage's Model/Provider in the headline

Surface a run stage's recorded Model and Provider configs in the stage
pane's always-visible headline instead of leaving them inside the
collapsed Definition section, so the operator sees them without expanding
anything, and stop rendering them twice.

- StageDetailPane.kt gains the pure STAGE_CONFIG_HEADLINE_LABELS
  ({"Model", "Provider"}), stageConfigHeadlineFields(definition) and
  remainingDefinitionFields(definition). StageDetailBody renders
  headlineFields(runFields) + stageConfigHeadlineFields(definition) as the
  headline and remainingDefinitionFields(definition) inside the collapsed
  Definition section; both derivations are remember(definition)-keyed and
  the run-evidence split stays runStepFields/headlineFields/evidenceFields.
- The definition-only, never-visited stage keeps its existing look; the
  Definition section no longer repeats Model/Provider because they are now
  headline facts, and everything else stays as before.
- StageDetailSheetTest adds
  definitionModelAndProviderArePromotedToTheHeadlineWithoutDuplication and
  aDefinitionWithNoConfigsPromotesNothing.
- android/README.md records the pass: the reported "content lost" symptom
  is not reproducible at 791d3dd (the run-61 definition-only screenshots
  are the Pipelines destination), the promoted facts are the real gap, and
  the unit tests (132/0), assembleDebug, device verification on
  emulator-5554 and the APK publish are noted with what was not verified.
This commit is contained in:
2026-10-16 00:54:22 +01:00
parent 791d3dd3ff
commit 206953e067
3 changed files with 161 additions and 3 deletions
@@ -156,6 +156,26 @@ internal fun headlineFields(fields: List<StageField>): List<StageField> =
internal fun evidenceFields(fields: List<StageField>): List<StageField> =
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<String> = setOf("Model", "Provider")
/** The non-blank Model/Provider config rows of [definition], in definition order. */
internal fun stageConfigHeadlineFields(definition: List<StageField>): List<StageField> =
definition.filter { it.label in STAGE_CONFIG_HEADLINE_LABELS }
/**
* 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.
*/
internal fun remainingDefinitionFields(definition: List<StageField>): List<StageField> =
definition.filter { it.label !in STAGE_CONFIG_HEADLINE_LABELS }
/**
* The pure run view of one [RunStep] for the selected stage: status, outcome,
* duration, visit against the control's max_visits, target, session id,
@@ -325,8 +345,12 @@ private fun StageDetailBody(
val selectedStep = runSteps.getOrNull(clampedVisit)
// Derived once per selected step, not per recomposition.
val runFields = remember(selectedStep) { selectedStep?.let(::runStepFields).orEmpty() }
val headline = headlineFields(runFields)
// 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 evidence = evidenceFields(runFields)
val definitionRows = remember(definition) { remainingDefinitionFields(definition) }
val expansion = rememberSectionExpansion(stageKey)
DetailTabBody(wide, modifier) { columnModifier ->
@@ -365,11 +389,11 @@ private fun StageDetailBody(
Text("No details recorded for this node.", style = text.meta)
}
if (definition.isNotEmpty()) {
if (definitionRows.isNotEmpty()) {
val key = "definition"
SectionHeader(key.capitalized(), expansion.isExpanded(key), { expansion.toggle(key) })
if (expansion.isExpanded(key)) {
definition.forEach { field -> StageFieldRow(field) }
definitionRows.forEach { field -> StageFieldRow(field) }
}
}