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:
@@ -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) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -163,4 +163,45 @@ class StageDetailSheetTest {
|
||||
// Input/output are surfaced as their own sections, not the evidence block.
|
||||
assertTrue(evidence.none { it == "Input" || it == "Output" })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun definitionModelAndProviderArePromotedToTheHeadlineWithoutDuplication() {
|
||||
val stage = Stage(
|
||||
key = "implementer",
|
||||
type = "model",
|
||||
prompt = "do the thing",
|
||||
configs = mapOf(
|
||||
"model" to "deepseek-v4.1-flash",
|
||||
"provider" to "opencode-go",
|
||||
"retries" to "2",
|
||||
),
|
||||
)
|
||||
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...
|
||||
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")))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aDefinitionWithNoConfigsPromotesNothing() {
|
||||
val fields = stageDefinitionFields(Stage(key = "planner"))
|
||||
assertTrue(stageConfigHeadlineFields(fields).isEmpty())
|
||||
assertEquals(fields, remainingDefinitionFields(fields))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user