skill: match the answer's length to the question in the conciseness guidance

This commit is contained in:
2026-10-17 01:31:24 +01:00
7 changed files with 172 additions and 40 deletions
+82
View File
@@ -5051,3 +5051,85 @@ wrapping is asserted against an injected measurer, not rendered pixels; the
whole-word guarantee therefore rests on `TextMeasurer` and the drawn `Text` whole-word guarantee therefore rests on `TextMeasurer` and the drawn `Text`
using the same role and width, which is why both read `text.cardTitle` and the using the same role and width, which is why both read `text.cardTitle` and the
identity's own `SPACING_S` padding. identity's own `SPACING_S` padding.
## Stage sections open as their own pane, not inline (17 Oct 2026)
The reported stage-screen defect is reproducible and this pass fixes it by
opening every stage section as its own pane and by laying a collapsible body out
in one column. `android/` only; nothing in the Pipelines server, its Go source,
the Docker/compose files or the installer was touched, no dependency was added
and no run was started from the app.
- **The defect and its cause.** Expanding a stage section drew its rows stacked
at the top of the section: the section's content lambda emits one composable
per field (`fields.forEach { StageFieldRow(it) }`) straight into
`CollapsibleSectionBody`'s `AnimatedVisibility`. `AnimatedVisibility` lays out
a *single* child, so several siblings were placed on top of each other at the
section's origin instead of one below the next; the body took the height of its
tallest single row and showed only the last one, so the content did not sit
cleanly under — or under all of — its header.
- **Sections are panes.** The stage screen now keeps a **compact list** of its
section rows (`Artifacts`, `Output`, `Input`, `This run`, `Stage definition`)
and tapping one opens that section as the next pane of the stack — a
full-window screen over the stage on a narrow window, a panel to the stage
pane's right on a wide one — with its own `Scaffold`/`TopAppBar` named for the
section, its own scroll and its own top spacing. Back (the app bar, the gesture
or a peek) returns exactly one level, to the stage screen. `MasterPane` gained
the `Section` level (`MAX_PANE_DEPTH = 3`) and `PaneSelection.sectionKey` (a
primitive saved with the pane selection), so the open section survives rotation
and process death.
- **No trivial inline exceptions.** None of the five sections is kept inline:
each can hold an arbitrarily long value (the definition's prompt/output
contract, the input/output maps, the run evidence, the artifacts gallery), so
an inline body would both risk the layout with many rows and push the run
context off screen; one uniform rule keeps the screen predictable.
- **Rows read as navigation, not as disclosures.** The stage screen's section
rows go through the shared `SectionHeader` with `navigation = true`: the
chevron becomes the static forward arrow (`Icons.AutoMirrored.Filled
.KeyboardArrowRight`, mirrored for RTL) instead of a rotating disclosure
chevron, and the row announces as `Artifacts` with an `Open Artifacts` action
instead of `Artifacts, collapsed` / `Expand Artifacts`. Assistive tech is
therefore never told the row expands in place after it started opening a pane.
The disclosure rows (the run/pipeline detail lists) are unchanged. The
`rememberSectionExpansion` seed that existed only to start the stage pane's
definition expanded (`initiallyExpanded`) is gone with its last caller, so the
shared component no longer carries docs or a parameter for the removed inline
stage behaviour.
- **The shared body fix.** `CollapsibleSectionBody` now lays its content out in a
single full-width `Column`, so *any* collapsible section with more than one row
(it also backs the run/pipeline detail `collapsibleSection` lists) stacks its
rows under the header instead of overlapping them.
- **Semantics kept.** Sections start collapsed; the operator's choice — which
section is open, and the visit — is saved with the pane selection; and each
section's content is derived from the same pure `stageSectionSpecs`
(`stageDefinitionFields`/`runStepFields`/`evidenceFields`), so nothing shown
before is lost. The artifacts section keeps the shared
`ArtifactSelectionScaffold`.
Verification (macOS, JDK 17 from Homebrew `openjdk@17`,
`ANDROID_HOME=/Users/alan/Library/Android/sdk`, cached Gradle 8.11.1,
`--no-daemon --offline`):
- `gradle :app:testDebugUnitTest :app:assembleDebug --no-daemon --offline` →
`BUILD SUCCESSFUL` (`compileDebugKotlin` and `compileDebugUnitTestKotlin`
executed on the edited sources); the test-result XMLs aggregate to **303 tests,
0 failures, 0 errors, 0 skipped** across 34 classes (`PaneStateTest` gained the
Section-level backStep, popTo, encode/decode and depth cases;
`StageDetailSheetTest` replaced the definition-expansion seed with the
`stageSectionSpecs` order/blank-section cases). The `navigation` affordance is
Compose UI semantics, which this module has no unit harness for, so it is
covered by compilation only, not by a test.
- `app/build/outputs/apk/debug/app-debug.apk` is 18,272,941 bytes, sha256
`dccce3ca1a3c5acc724dec376709f694e11a29b68ffd85eae4d5114c4f8989a1`; it was
copied to
`~/.local/share/pipelines/data/artifacts/216/1/pipelines-debug-wip-dcd58b8.apk`
(`dcd58b8` = `git rev-parse --short HEAD`; the tree is uncommitted WIP on top
of it). `curl -sSI
http://10.0.0.249:8080/artifacts/216/1/pipelines-debug-wip-dcd58b8.apk`
returned `HTTP/1.1 200 OK`, `Content-Type: application/vnd.android.package-archive`,
`Content-Length: 18272941`, matching the local file's size.
Not verified in this pass: the on-device narrow/wide renders (a section opening
over the stage and returning, and the wide panel beside the stage pane) and any
screenshot of the former inline case — the brief keeps implementation
verification to the build and the unit tests, and visual review owns the device.
@@ -373,6 +373,10 @@ private fun PipelineDestination(
onPopTo = { level -> onSelectionChange(popTo(selection, level)) }, onPopTo = { level -> onSelectionChange(popTo(selection, level)) },
compactLabel = "Pipelines", compactLabel = "Pipelines",
compactIcon = Icons.Filled.AccountTree, compactIcon = Icons.Filled.AccountTree,
// Every covered pane in this stack (the list, or a pipeline's detail) carries
// a statistics block, so the region is sized for it and a single covered
// pane can show the last-run and average lines rather than only counts.
compactStats = true,
backContentDescription = { level -> backContentDescription = { level ->
when (level) { when (level) {
0 -> "Back to pipelines" 0 -> "Back to pipelines"
@@ -503,6 +507,11 @@ private fun RunsDestination(
onPopTo = { level -> onSelectionChange(popTo(selection, level)) }, onPopTo = { level -> onSelectionChange(popTo(selection, level)) },
compactLabel = "Runs", compactLabel = "Runs",
compactIcon = Icons.Filled.History, compactIcon = Icons.Filled.History,
// Every covered pane in this stack (the runs list, or a run's detail) carries
// a statistics block, so the region is sized for it and the runs list's
// counts and most-recent run are actually shown rather than dropped by the
// title-only tier.
compactStats = true,
backContentDescription = { level -> backContentDescription = { level ->
when (level) { when (level) {
0 -> "Back to runs" 0 -> "Back to runs"
@@ -245,13 +245,9 @@ fun DetailTabBody(
/** /**
* Remembers which inner sections are expanded, keyed by their stable section * Remembers which inner sections are expanded, keyed by their stable section
* key and saved across configuration changes. Sections start collapsed unless * key and saved across configuration changes. Sections start collapsed; the
* [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] * 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 * a Bundle can hold).
* switching between run and definition contexts reseeds rather than inheriting
* the other context's choices.
*/ */
@Stable @Stable
class SectionExpansionState internal constructor( class SectionExpansionState internal constructor(
@@ -270,12 +266,9 @@ private val expandedKeysSaver: Saver<Set<String>, ArrayList<String>> = Saver(
) )
@Composable @Composable
fun rememberSectionExpansion( fun rememberSectionExpansion(vararg inputs: Any?): SectionExpansionState {
vararg inputs: Any?, val expanded = rememberSaveable(*inputs, stateSaver = expandedKeysSaver) {
initiallyExpanded: Set<String> = emptySet(), mutableStateOf(emptySet())
): SectionExpansionState {
val expanded = rememberSaveable(*inputs, initiallyExpanded, stateSaver = expandedKeysSaver) {
mutableStateOf(initiallyExpanded)
} }
return remember(expanded) { SectionExpansionState(expanded) } return remember(expanded) { SectionExpansionState(expanded) }
} }
@@ -16,6 +16,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyListScope import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.KeyboardArrowRight
import androidx.compose.material.icons.filled.KeyboardArrowDown import androidx.compose.material.icons.filled.KeyboardArrowDown
import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
@@ -38,20 +39,25 @@ import net.awan.pipelines.ui.theme.SPACING_S
import net.awan.pipelines.ui.theme.pipelinesText import net.awan.pipelines.ui.theme.pipelinesText
/** /**
* The one collapsible section header shared by both detail screens: the section * The one section header shared by both detail screens and the stage screen's
* title in the theme's section-header style, a trailing chevron that rotates * compact section list: the section title in the theme's section-header style, a
* with the state (animated, no jump cut), an opaque background so content * trailing chevron, an opaque background so content passing underneath a stuck
* passing underneath a stuck header stays readable, and a subtle divider. * header stays readable, and a subtle divider.
*
* [navigation] distinguishes the two behaviours the same row shape carries. A
* disclosure row (the default) toggles [expanded], its chevron rotates with the
* state (animated, no jump cut) and it reads as e.g. "Steps, expanded" with an
* "Expand Steps"/"Collapse Steps" action. A navigation row ([navigation] true)
* opens the section as its own pane instead: [expanded] is ignored, the chevron
* is the static forward arrow (mirrored for RTL) and it reads as "Steps" with an
* "Open Steps" action, so assistive tech is never told the row expands in place
* when it actually opens a surface of its own.
* *
* [containerColor] is the opaque colour the header covers with. It defaults to * [containerColor] is the opaque colour the header covers with. It defaults to
* the screen background so a stuck header on an ordinary page hides the content * the screen background so a stuck header on an ordinary page hides the content
* scrolling under it; a caller whose surface is a different container (the stage * scrolling under it; a caller whose surface is a different container (the stage
* pane) passes that same colour so the header never reads as a differently toned * pane) passes that same colour so the header never reads as a differently toned
* band across its pane. * band across its pane.
*
* Accessibility is exposed without relying on the chevron: the header is a
* single button node described as e.g. "Steps, expanded" and carries the
* `expanded`/`collapsed` state.
*/ */
@Composable @Composable
fun SectionHeader( fun SectionHeader(
@@ -60,12 +66,19 @@ fun SectionHeader(
onToggle: () -> Unit, onToggle: () -> Unit,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
containerColor: Color = MaterialTheme.colorScheme.background, containerColor: Color = MaterialTheme.colorScheme.background,
navigation: Boolean = false,
) { ) {
val rotation = animateFloatAsState( // Only a disclosure row animates its chevron; a navigation row shows the
targetValue = if (expanded) 0f else -90f, // static forward arrow, so no animator is composed for it.
animationSpec = MotionQuick.spec(), val rotation = if (navigation) {
label = "section-chevron", null
) } else {
animateFloatAsState(
targetValue = if (expanded) 0f else -90f,
animationSpec = MotionQuick.spec(),
label = "section-chevron",
)
}
Column( Column(
modifier = modifier modifier = modifier
.fillMaxWidth() .fillMaxWidth()
@@ -73,11 +86,20 @@ fun SectionHeader(
.background(containerColor) .background(containerColor)
.clickable(role = Role.Button, onClick = onToggle) .clickable(role = Role.Button, onClick = onToggle)
.clearAndSetSemantics { .clearAndSetSemantics {
contentDescription = "$title, ${if (expanded) "expanded" else "collapsed"}" if (navigation) {
role = Role.Button contentDescription = title
onClick(label = if (expanded) "Collapse $title" else "Expand $title") { role = Role.Button
onToggle() onClick(label = "Open $title") {
true onToggle()
true
}
} else {
contentDescription = "$title, ${if (expanded) "expanded" else "collapsed"}"
role = Role.Button
onClick(label = if (expanded) "Collapse $title" else "Expand $title") {
onToggle()
true
}
} }
}, },
) { ) {
@@ -96,11 +118,19 @@ fun SectionHeader(
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
) )
Icon( Icon(
imageVector = Icons.Default.KeyboardArrowDown, imageVector = if (navigation) {
Icons.AutoMirrored.Filled.KeyboardArrowRight
} else {
Icons.Default.KeyboardArrowDown
},
contentDescription = null, contentDescription = null,
// Read the animating angle inside the layer so the chevron turns // Read the animating angle inside the layer so the chevron turns
// without recomposing the header on every frame. // without recomposing the header on every frame.
modifier = Modifier.graphicsLayer { rotationZ = rotation.value }, modifier = if (rotation != null) {
Modifier.graphicsLayer { rotationZ = rotation.value }
} else {
Modifier
},
) )
} }
HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant) HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant)
@@ -215,6 +215,7 @@ fun SlidingPaneStack(
compactIcon: ImageVector? = null, compactIcon: ImageVector? = null,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
backContentDescription: (Int) -> String = { "Back" }, backContentDescription: (Int) -> String = { "Back" },
compactStats: Boolean = false,
pane: @Composable (level: Int, covered: Boolean, modifier: Modifier) -> Unit, pane: @Composable (level: Int, covered: Boolean, modifier: Modifier) -> Unit,
) { ) {
BoxWithConstraints(modifier.fillMaxSize()) { BoxWithConstraints(modifier.fillMaxSize()) {
@@ -238,7 +239,7 @@ fun SlidingPaneStack(
// minimum interactive size is the floor for each tappable edge, never a // minimum interactive size is the floor for each tappable edge, never a
// literal. // literal.
val minTouch = LocalMinimumInteractiveComponentSize.current val minTouch = LocalMinimumInteractiveComponentSize.current
val identityWidth = rememberCompactIdentityWidth(compactLabel, compactIcon) val identityWidth = rememberCompactIdentityWidth(compactLabel, compactIcon, compactStats)
val region = if (wide) identityWidth + startInset else 0.dp val region = if (wide) identityWidth + startInset else 0.dp
val edges = coveredEdgesDp(depth, region, minTouch, startInset) val edges = coveredEdgesDp(depth, region, minTouch, startInset)
val edgeByLevel = edges.associateBy { it.level } val edgeByLevel = edges.associateBy { it.level }
@@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.icons.automirrored.filled.ArrowBack
@@ -18,6 +19,7 @@ import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.PrimaryScrollableTabRow import androidx.compose.material3.PrimaryScrollableTabRow
import androidx.compose.material3.Scaffold import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface
import androidx.compose.material3.Tab import androidx.compose.material3.Tab
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBar
@@ -42,7 +44,6 @@ import net.awan.pipelines.ui.AppViewModel
import net.awan.pipelines.ui.components.CodeBlock import net.awan.pipelines.ui.components.CodeBlock
import net.awan.pipelines.ui.components.DetailTabBody import net.awan.pipelines.ui.components.DetailTabBody
import net.awan.pipelines.ui.components.KeyValueRow import net.awan.pipelines.ui.components.KeyValueRow
import net.awan.pipelines.ui.components.LabelChip
import net.awan.pipelines.ui.components.PaneIdentity import net.awan.pipelines.ui.components.PaneIdentity
import net.awan.pipelines.ui.components.SectionHeader import net.awan.pipelines.ui.components.SectionHeader
import net.awan.pipelines.ui.components.paneSafeArea import net.awan.pipelines.ui.components.paneSafeArea
@@ -165,7 +166,7 @@ internal fun headlineFields(fields: List<StageField>): List<StageField> =
internal fun evidenceFields(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" } fields.filter { it.label !in STAGE_HEADLINE_LABELS && it.label != "Input" && it.label != "Output" }
/** The section key of the one stage-definition section (expansion is saved on it). */ /** The section key of the one stage-definition section, addressable by the pane selection. */
internal const val STAGE_DEFINITION_KEY = "definition" internal const val STAGE_DEFINITION_KEY = "definition"
/** The stage-definition section's title, naming clearly what it holds. */ /** The stage-definition section's title, naming clearly what it holds. */
@@ -515,16 +516,18 @@ private fun StageDetailBody(
Text("No details recorded for this node.", style = text.meta) Text("No details recorded for this node.", style = text.meta)
} }
// The compact list of sections: each row is the section's own header, // The compact list of sections: each row opens that section as its own
// and tapping it opens that section as its own pane instead of growing // pane instead of growing this screen inline (which stacked a section's
// this screen inline (which stacked a section's several rows at the // several rows at the top of its header). The row is a navigation row,
// top of its header). // so it reads as "Open Artifacts" with a forward chevron rather than an
// in-place "Expand Artifacts"/collapsed disclosure.
sections.forEach { section -> sections.forEach { section ->
SectionHeader( SectionHeader(
title = section.title, title = section.title,
expanded = false, expanded = false,
onToggle = { onOpenSection(section.key) }, onToggle = { onOpenSection(section.key) },
containerColor = paneContainerColor(), containerColor = paneContainerColor(),
navigation = true,
) )
} }
} }
@@ -845,5 +848,15 @@ internal fun StageFieldRow(field: StageField) {
/** A small rounded chip naming the stage type (model / ntfy / …). */ /** A small rounded chip naming the stage type (model / ntfy / …). */
@Composable @Composable
internal fun StageTypeChip(label: String) { internal fun StageTypeChip(label: String) {
LabelChip(label, STAGE_CHIP_PAD_H, SPACING_XS) Surface(
shape = RoundedCornerShape(50),
color = MaterialTheme.colorScheme.secondaryContainer,
) {
Text(
text = label,
style = MaterialTheme.typography.labelMedium,
color = MaterialTheme.colorScheme.onSecondaryContainer,
modifier = Modifier.padding(horizontal = STAGE_CHIP_PAD_H, vertical = SPACING_XS),
)
}
} }
+4
View File
@@ -258,6 +258,10 @@ queue and settling a failure is the agent's work.
The operator wants the result, not the shift report. The operator wants the result, not the shift report.
- Match the answer's length to the question. A yes/no or one-line question gets one or
two sentences; never answer a narrow question with a sectioned report.
- Answer the question that was asked first. Put any extra fact that changes a decision in
a single clause, not in a new section.
- Answer with the status block for status; do not narrate polling or re-print the - Answer with the status block for status; do not narrate polling or re-print the
queue when nothing changed. queue when nothing changed.
- Report a run by its outcome and evidence (`references/verification.md`), not the - Report a run by its outcome and evidence (`references/verification.md`), not the