android: preserve run detail pill correction

This commit is contained in:
2026-10-18 15:23:16 +01:00
parent 5d76cf7885
commit acadbaeb9c
8 changed files with 117 additions and 113 deletions
@@ -189,13 +189,11 @@ fun PipelinesApp(
// read from the chat store, so it flips in the same recomposition that swaps
// the chat list for the conversation.
val conversationOpen by vm.conversationOpen.collectAsStateWithLifecycle()
// Whether a run's pending-decision surface — the decision sheet the operator
// opens from the run summary's Decide action — is currently open. It is a state
// of the run view (reported up by the run detail and its stage pane), not a
// destination, so the pill stands down for exactly as long as it is up and
// returns the moment the decision is answered or dismissed, with no navigation.
var decisionSurfaceOpen by remember { mutableStateOf(false) }
val pillVisible = destinationPillVisible(currentRoute, conversationOpen, decisionSurfaceOpen)
// A run detail owns the lower part of the screen, including its graph, stage,
// artifact and decision surfaces. Hide the pill for the entire detail stack,
// not just one sheet inside it; returning to the run list restores it.
val runDetailOpen = runDetailOpen(currentRoute, runSelection)
val pillVisible = destinationPillVisible(currentRoute, conversationOpen, runDetailOpen)
val searchKind by vm.searchKind.collectAsStateWithLifecycle()
val searchSort by vm.searchSort.collectAsStateWithLifecycle()
@@ -361,7 +359,6 @@ fun PipelinesApp(
listState = runListState,
decisionRequest = decisionRequest,
onDecisionRequestHandled = { decisionRequest = null },
onDecisionSurfaceChange = { decisionSurfaceOpen = it },
)
}
composable("chat") {
@@ -444,10 +441,9 @@ fun PipelinesApp(
onClick = { attentionOpen = true },
modifier = Modifier.align(Alignment.End).padding(bottom = SPACING_S),
)
// The pill stands down while a conversation is open, or while a
// run's pending-decision surface is up; the search field it morphs
// into is unreachable there anyway (the field opens from the pill),
// so nothing is stranded by not drawing it.
// The pill stands down while a conversation or run detail is open;
// the search field it morphs into is unreachable there anyway (the
// field opens from the pill), so nothing is stranded by not drawing it.
if (pillVisible) {
DestinationBar(
destinations = destinations,
@@ -503,28 +499,33 @@ private const val SEARCH_SCRIM_ALPHA = 0.5f
/** The Chat destination's navigation route. */
private const val CHAT_ROUTE = "chat"
private const val RUNS_ROUTE = "runs"
/** A run detail is any non-list level of the Runs pane stack. */
internal fun runDetailOpen(currentRoute: String?, selection: PaneSelection): Boolean =
currentRoute == RUNS_ROUTE && selection.depth >= 1
/**
* Whether the floating destination pill is drawn for [currentRoute]. The pill
* stands down in the two places a deliberate bottom surface owns the foot of the
* stands down in the two places a deliberate detail surface owns the foot of the
* screen and the pill would sit over it:
*
* - while the Chat destination is showing an open conversation — a session's
* transcript and composer — where it would compete with send/stop;
* - while a run's pending-decision surface is open ([decisionOpen], the sheet the
* operator answers from the run summary), where it would cover the options.
* - while a run detail is open ([runDetailOpen]), including its summary, graph,
* stage, artifact and decision surfaces, where it would cover their controls.
*
* Everything else keeps it: the chat list, a run being read, its stage pane, an
* artifact and the graph all draw it exactly as before, and the covered peek strip
* and Back still leave both hiding states, so hiding the pill strands nothing. The
* Everything else keeps it: the chat list and run list both draw it, and the
* covered peek strip and Back still leave both hiding states, so hiding the pill
* strands nothing. The
* clearance and the drawn pill both key off this one predicate. Pure, so the one
* rule is unit-testable without a device.
*/
internal fun destinationPillVisible(
currentRoute: String?,
conversationOpen: Boolean,
decisionOpen: Boolean,
): Boolean = !(currentRoute == CHAT_ROUTE && conversationOpen) && !decisionOpen
runDetailOpen: Boolean,
): Boolean = !(currentRoute == CHAT_ROUTE && conversationOpen) && !runDetailOpen
/**
* Where the bottom overlay — the destination pill and the attention chip above it
@@ -554,7 +555,7 @@ internal fun contentPillPadding(pillVisible: Boolean): Dp = 0.dp
* of the floating bottom stack — the destination pill and the attention chip above
* it — built from the named [DESTINATION_PILL_RESERVE] and [ATTENTION_CHIP_RESERVE]
* while the pill is drawn, and none while it is hidden (an open conversation or a
* run's open decision surface, see [destinationPillVisible]) so a hidden pill
* run detail, see [destinationPillVisible]) so a hidden pill
* leaves no empty band at the end of a list. Published to the content through
* `LocalPillBottomInset` and applied inside
* each scrollable's own scroll content, never as layout padding on the content. It
@@ -34,7 +34,6 @@ internal fun RunsDestination(
listState: LazyListState,
decisionRequest: Long? = null,
onDecisionRequestHandled: () -> Unit = {},
onDecisionSurfaceChange: (Boolean) -> Unit = {},
) {
val depth = selection.depth
val onBack: () -> Unit = { onSelectionChange(backFrom(selection)) }
@@ -104,7 +103,6 @@ internal fun RunsDestination(
covered = covered,
requestDecision = decisionRequest == itemId,
onDecisionRequestHandled = onDecisionRequestHandled,
onDecisionSurfaceChange = onDecisionSurfaceChange,
)
}
2 -> rememberPaneContent(
@@ -128,7 +126,6 @@ internal fun RunsDestination(
wide = wide,
modifier = paneModifier,
covered = covered,
onDecisionSurfaceChange = onDecisionSurfaceChange,
)
}
3 -> rememberPaneContent(
@@ -150,7 +147,6 @@ internal fun RunsDestination(
wide = wide,
modifier = paneModifier,
covered = covered,
onDecisionSurfaceChange = onDecisionSurfaceChange,
)
}
}
@@ -22,7 +22,6 @@ import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
@@ -61,12 +60,6 @@ import net.awan.pipelines.ui.theme.pipelinesText
* [onSend] performs the request; it reports the outcome through its callback so
* this component owns no networking and is unit-testable through the pure
* [DecisionDraft]/[decisionRefusalMessage] model.
*
* [onSurfaceOpenChange] reports whether the decision sheet — the run's pending
* decision surface — is currently open, so the host can tell the app shell to
* stand the floating destination pill down for exactly as long as the operator is
* answering. It is the host's job to route that to the pill (see
* `destinationPillVisible`); this component only says when its own surface is up.
*/
@Composable
fun DecisionPrompt(
@@ -75,7 +68,6 @@ fun DecisionPrompt(
modifier: Modifier = Modifier,
openRequest: Boolean = false,
onOpenRequestHandled: () -> Unit = {},
onSurfaceOpenChange: (Boolean) -> Unit = {},
) {
val shown = rememberPaneContent(decision)
var open by remember { mutableStateOf(false) }
@@ -83,13 +75,6 @@ fun DecisionPrompt(
var sending by remember { mutableStateOf(false) }
var error by remember { mutableStateOf<String?>(null) }
// The decision surface is up exactly while the sheet is open (it can outlive
// the decision, kept open to report a refusal), so the host is told on every
// change. It is cleared when the prompt leaves the composition, so a surface
// that closes with its pane can never leave the pill hidden behind it.
LaunchedEffect(open) { onSurfaceOpenChange(open) }
DisposableEffect(Unit) { onDispose { onSurfaceOpenChange(false) } }
// A notification's tap asks for the decision itself, not just the run:
// open the sheet once the waiting run's detail has loaded. The request is
// consumed here so a recomposition or a dismissal does not reopen it.
@@ -420,7 +420,6 @@ fun StageDetailPane(
runLabel: String? = null,
decision: PendingDecision? = null,
onDecide: (PendingDecision, String, String, (Result<RunDetail>) -> Unit) -> Unit = { _, _, _, _ -> },
onDecisionSurfaceChange: (Boolean) -> Unit = {},
) {
// 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.
@@ -486,7 +485,6 @@ fun StageDetailPane(
runContext = runContext,
decision = decision,
onDecide = onDecide,
onDecisionSurfaceChange = onDecisionSurfaceChange,
modifier = Modifier.padding(padding),
)
}
@@ -507,7 +505,6 @@ private fun StageDetailBody(
runContext: Boolean,
decision: PendingDecision?,
onDecide: (PendingDecision, String, String, (Result<RunDetail>) -> Unit) -> Unit,
onDecisionSurfaceChange: (Boolean) -> Unit,
modifier: Modifier = Modifier,
) {
val text = pipelinesText()
@@ -542,7 +539,6 @@ private fun StageDetailBody(
DecisionPrompt(
decision = decision,
onSend = onDecide,
onSurfaceOpenChange = onDecisionSurfaceChange,
)
// The stage's own name is the app bar's title, so the body does not
// repeat it: the pane leads with the stage's type and facts instead of
@@ -856,7 +852,6 @@ fun RunStagePane(
wide: Boolean,
modifier: Modifier = Modifier,
covered: Boolean = false,
onDecisionSurfaceChange: (Boolean) -> Unit = {},
) {
val state by vm.runDetail.collectAsStateWithLifecycle()
val configuredServerUrl by vm.configuredServerUrl.collectAsStateWithLifecycle()
@@ -892,7 +887,6 @@ fun RunStagePane(
onDecide = { pending, option, feedback, onResult ->
vm.decideRun(pending.runId, pending.stageKey, option, feedback, onResult)
},
onDecisionSurfaceChange = onDecisionSurfaceChange,
)
} else {
StageSectionPane(
@@ -69,7 +69,6 @@ fun RunDetailScreen(
covered: Boolean = false,
requestDecision: Boolean = false,
onDecisionRequestHandled: () -> Unit = {},
onDecisionSurfaceChange: (Boolean) -> Unit = {},
) {
val state by vm.runDetail.collectAsStateWithLifecycle()
val runsState by vm.runs.collectAsStateWithLifecycle()
@@ -218,7 +217,6 @@ fun RunDetailScreen(
modifier = Modifier.padding(horizontal = SPACING_L, vertical = SPACING_S),
openRequest = requestDecision,
onOpenRequestHandled = onDecisionRequestHandled,
onSurfaceOpenChange = onDecisionSurfaceChange,
)
StateCrossfade(
phase = detailLoadPhase(state.error, hasData = run != null),
@@ -83,31 +83,44 @@ class PipelinesNavTest {
}
@Test
fun thePillStandsDownWhileAConversationOrARunDecisionSurfaceIsOpen() {
fun thePillStandsDownWhileAConversationOrRunDetailIsOpen() {
// An open conversation (the chat transcript and composer) hides the pill;
// the chat list keeps it, and so does every other destination.
assertFalse(destinationPillVisible("chat", conversationOpen = true, decisionOpen = false))
assertTrue(destinationPillVisible("chat", conversationOpen = false, decisionOpen = false))
assertFalse(destinationPillVisible("chat", conversationOpen = true, runDetailOpen = false))
assertTrue(destinationPillVisible("chat", conversationOpen = false, runDetailOpen = false))
for (route in listOf("pipelines", "runs", "settings", null)) {
assertTrue(destinationPillVisible(route, conversationOpen = false, decisionOpen = false))
assertTrue(destinationPillVisible(route, conversationOpen = false, runDetailOpen = false))
}
// A conversation only exists on the chat route; even if the flag were set
// elsewhere the pill stays, so a background chat never hides it.
assertTrue(destinationPillVisible("runs", conversationOpen = true, decisionOpen = false))
// A run's pending-decision surface (the decision sheet the operator opens
// from the run summary) hides the pill on the Runs destination, and only
// while it is open: the run being read, its stage pane, an artifact or a
// graph all keep it.
assertFalse(destinationPillVisible("runs", conversationOpen = false, decisionOpen = true))
assertTrue(destinationPillVisible("runs", conversationOpen = false, decisionOpen = false))
// The decision surface is a state of the run view, not a route, so the
// predicate hides it everywhere it were reported, exactly as for a
// conversation — and never for the chat list's own conversation flag.
assertTrue(destinationPillVisible("runs", conversationOpen = true, runDetailOpen = false))
// Every run detail surface owns the bottom of the Runs destination: summary,
// graph, stage, artifact and decision states all hide the pill. Back to the
// list clears the one detail flag and restores it on narrow and wide panes.
assertFalse(destinationPillVisible("runs", conversationOpen = false, runDetailOpen = true))
assertTrue(destinationPillVisible("runs", conversationOpen = false, runDetailOpen = false))
for (route in listOf("pipelines", "runs", "chat", "settings", null)) {
assertFalse(destinationPillVisible(route, conversationOpen = false, decisionOpen = true))
assertFalse(destinationPillVisible(route, conversationOpen = false, runDetailOpen = true))
}
}
@Test
fun aRunDetailCoversEveryNonListLevelAndBackRestoresTheListPill() {
val list = PaneSelection()
val detail = PaneSelection(pane = MasterPane.Detail, itemId = 12)
val stage = detail.copy(pane = MasterPane.Stage, stageKey = "implementer")
val section = stage.copy(pane = MasterPane.Section, sectionKey = "output")
assertFalse(runDetailOpen("runs", list))
assertTrue(destinationPillVisible("runs", conversationOpen = false, runDetailOpen = runDetailOpen("runs", list)))
for (selection in listOf(detail, stage, section)) {
assertTrue(runDetailOpen("runs", selection))
assertFalse(destinationPillVisible("runs", conversationOpen = false, runDetailOpen = runDetailOpen("runs", selection)))
}
assertFalse(runDetailOpen("pipelines", detail))
assertFalse(runDetailOpen("runs", backFrom(detail)))
}
@Test
fun theContentKeepsItsOwnHeightBecauseThePillIsAnOverlay() {
// The pill floats above the content and never takes layout space, so the
@@ -132,15 +145,15 @@ class PipelinesNavTest {
// when hidden.
for (route in listOf("pipelines", "chat", "runs", "settings", null)) {
for (open in listOf(false, true)) {
for (deciding in listOf(false, true)) {
val drawn = destinationPillVisible(route, open, deciding)
for (detailOpen in listOf(false, true)) {
val drawn = destinationPillVisible(route, open, detailOpen)
val inset = pillScrollInset(drawn)
assertTrue(
"scroll clearance held behind a hidden pill on $route (open=$open, deciding=$deciding)",
"scroll clearance held behind a hidden pill on $route (open=$open, detail=$detailOpen)",
drawn || inset.value == 0f,
)
assertTrue(
"list not cleared of a drawn pill on $route (open=$open, deciding=$deciding)",
"list not cleared of a drawn pill on $route (open=$open, detail=$detailOpen)",
!drawn || inset.value == drawnInset.value,
)
}
+32 -46
View File
@@ -1,36 +1,25 @@
# The destinations pill stands down over a run's pending decision
# The destinations pill stands down in a run detail
## What this item changed
`android/` only, the app shell's floating destination pill and the run view's decision surface.
`android/` only, the app shell's floating destination pill and run-detail stack.
- `ui/PipelinesApp.kt` — the pill's one rule gains a second hiding state.
`destinationPillVisible(currentRoute, conversationOpen, decisionOpen)` is now
`!(currentRoute == CHAT_ROUTE && conversationOpen) && !decisionOpen`: the chat conversation
hides it exactly as before (the chat clause is unchanged), and a run's open pending-decision
surface hides it too. Everything downstream is unchanged and still keys off that one
- `ui/PipelinesApp.kt` — the pill's one rule gains a run-detail hiding state.
`destinationPillVisible(currentRoute, conversationOpen, runDetailOpen)` is now
`!(currentRoute == CHAT_ROUTE && conversationOpen) && !runDetailOpen`: the chat conversation
hides it exactly as before (the chat clause is unchanged), and the full run-detail stack hides
it too. `runDetailOpen` derives from the Runs destination's saved selection depth, so it
covers summary, graph, stage, artifact and decision surfaces and Back to the list restores it.
Everything downstream is unchanged and still keys off that one
predicate — `contentPillPadding(pillVisible)` (the named zero) and
`pillScrollInset(pillVisible)` (the named `DESTINATION_PILL_RESERVE` +
`ATTENTION_CHIP_RESERVE`, or `0.dp` while hidden) — so hiding the pill over a decision
leaves no empty band, exactly as hiding it in a conversation already does. The shell holds
the new input as `decisionSurfaceOpen` (`remember { mutableStateOf(false) }`: a transient
state of the run view, not a destination and not saved — the sheet is not saveable either,
so a configuration change closes both together) and passes its setter down the same path
`decisionRequest` already travels.
- `ui/components/DecisionPrompt.kt` — gains `onSurfaceOpenChange: (Boolean) -> Unit = {}`,
reporting `open` on every change (`LaunchedEffect(open)`) and clearing it when the prompt
leaves the composition (`DisposableEffect`) so a surface closed with its pane can never
leave the pill hidden behind it. The component still owns no networking and no pill
knowledge: it only says when its own surface is up.
- `ui/screens/RunDetailScreen.kt`, `ui/RunsDestination.kt`, `ui/graph/StageDetailPane.kt` —
the run detail, the runs destination and the run's stage pane (its section level included)
pass that callback through, so the decision sheet hides the pill wherever it is opened
from. The pipeline-side stage pane gets the default no-op.
`ATTENTION_CHIP_RESERVE`, or `0.dp` while hidden) — so hiding the pill in a run detail
leaves no empty band, exactly as hiding it in a conversation already does.
- Tests — `PipelinesNavTest`: the existing `destinationPillVisible` test is extended in place
(renamed `thePillStandsDownWhileAConversationOrARunDecisionSurfaceIsOpen`) to pin that the
decision surface hides the pill on the runs route, that a run being read keeps it, and that
the chat clause is untouched; and the scroll-inset test's loop gains the decision
dimension, so `pillScrollInset` is proved zero while the decision surface hides the pill
(renamed `thePillStandsDownWhileAConversationOrRunDetailIsOpen`) to pin that the full
run-detail stack hides the pill on the runs route, that the run list restores it, and that
the chat clause is untouched; and the scroll-inset test's loop gains the detail
dimension, so `pillScrollInset` is proved zero while a run detail hides the pill
(no empty band) and the drawn reserve while it is drawn.
No new dimension, so no `ui/theme/Dimens.kt` token was needed (a raw literal would fail
@@ -43,32 +32,29 @@ started from the app.
place; the `docs-fold` writer should update it.
- `android/README.md:6219` — the section headline
"## Destination pill stands down in an open conversation (17 Oct 2026)" and its opening
paragraph ("It now stands down while the Chat destination is showing an open conversation
and stays everywhere else, unchanged") now describe only half the rule. The section should
also record the new item, e.g. append a dated section:
"## Destination pill stands down in an open conversation (17 Oct 2026)" and its opening
paragraph ("It now stands down while the Chat destination is showing an open conversation
and stays everywhere else, unchanged") now describe only half the rule. The section should
also record the new item, e.g. append a dated section:
```markdown
## The destinations pill stands down over a run's pending decision (18 Oct 2026)
## The destinations pill stands down in a run detail (18 Oct 2026)
The floating destinations pill also stood over a run's pending-decision surface — the
decision sheet ("Choose things that need to happen") the operator opens from the run
summary's Decide action — where it covered the options. It now stands down there too,
exactly as it already does inside an open chat conversation, and returns the moment the
decision is answered or dismissed. `android/` only; no new dependency, no run started from
the app, no server/installer/Docker file touched.
The floating destinations pill also stood over run-detail surfaces. It now stands down for
the entire detail stack — summary, graph, stage, artifact and pending-decision surfaces —
exactly as it already does inside an open chat conversation, and returns on Back to the runs
list. `android/` only; no new dependency, no run started from the app, no
server/installer/Docker file touched.
- **The one rule gains a second hiding state.** `destinationPillVisible(currentRoute,
conversationOpen, decisionOpen)` is `!(currentRoute == CHAT_ROUTE && conversationOpen) &&
!decisionOpen`. The chat clause is unchanged; the new `decisionOpen` is reported up by the
run view (`DecisionPrompt.onSurfaceOpenChange`), so the surface is a state of the run view,
not a destination: answering or dismissing it returns the pill with no navigation.
conversationOpen, runDetailOpen)` is `!(currentRoute == CHAT_ROUTE && conversationOpen) &&
!runDetailOpen`. The chat clause is unchanged; `runDetailOpen` derives from the Runs
destination's saved selection depth, so every run-detail surface follows the same rule.
- **Still one predicate, still no band.** `contentPillPadding` and `pillScrollInset` are
unchanged and still derive from `pillVisible` alone, so a hidden pill over the decision
leaves no empty band; the scroll-inset test now loops the decision dimension and pins that.
- **Scoped to the decision surface.** A run being read, its stage pane, an artifact and the
graph all keep the pill; only the open decision sheet hides it. The chat behaviour and the
narrow/wide placement rules are untouched.
unchanged and still derive from `pillVisible` alone, so a hidden pill in a run detail
leaves no empty band; the scroll-inset test now loops the detail dimension and pins that.
- **Scoped to the run detail.** The run list keeps the pill; every run-detail surface hides it.
The chat behaviour and the narrow/wide placement rules are untouched.
```
## Not stale
+31
View File
@@ -0,0 +1,31 @@
# Run summary Changes viewer
Item: Android-only recovery of the run summary's observed file-change evidence.
## What changed
- `RunSummaryTab.kt` adds a separately collapsible **Changes** section after
artifacts. Its header reports the observed file count and `+N -M` statistic.
- `ui/changes/` aggregates per-stage file captures by path, preserves capture
caveats (unavailable, partial, binary, truncated and mode-only), parses unified
patches, and opens a full-screen raw/rendered viewer with file paging, line
gutters, scrolling and copy support.
- `ChatDiffCard.kt` provides shared diff marker and colour helpers so chat and
run evidence render additions, removals and context consistently.
The screen reports observed workspace changes only; it does not claim model
authorship. Large content is scrollable rather than eagerly expanded into the
summary layout.
## Documentation now stale (for `docs-fold`)
- `android/README.md`'s run-summary/artifact documentation does not describe the
Changes disclosure, its raw/rendered viewer, or its capture caveats. Add a
dated Android section describing the observed-file count, `+N -M` totals,
collapse state, and that unavailable/partial/binary/truncated captures are
stated honestly rather than fabricating a diff.
## Not stale
- No packaged OpenCode skill reference, README outside `android/README.md`, or
`internal/author/install.go` inventory documents this Android-only screen.