Show a run's title beside its pipeline name
Surface the operator's title for a run so two runs of the same pipeline read as clearly different goals, with the pipeline name kept as context. - protocol: optional nullable `title` on RunSummary and RunDetail; absent or blank degrades to the pipeline name. - ui/RunIdentity.kt: one shared fallback (`runLabel`) and two-line identity (`runIdentity`) so the list, detail header and stage pane never spell a run differently; a titled run shows the pipeline name + version as a second line, an untitled run keeps the pipeline name as its only line. - runs list / run detail / stage pane use the shared identity; the status chip, duration and metadata layout are unchanged. - no rename affordance: the server exposes no title and no `set_run_title`, so the app does not fake renaming. - tests: RunIdentityTest (5) plus ProtocolModelTest cases for a present and an absent title; README documents the change and its verification.
This commit is contained in:
@@ -3662,3 +3662,58 @@ inner display rather than a physical fold, then reset; `:app:lintDebug` was not
|
||||
re-run (its only known findings remain the two pre-existing `NewApi` errors for
|
||||
`android:windowLightNavigationBar`).
|
||||
|
||||
## Run title beside the pipeline name (16 Oct 2026)
|
||||
|
||||
A run now shows the operator's title for the goal, with the pipeline it ran on as
|
||||
the secondary line, so two runs of the same pipeline are distinguishable.
|
||||
`android/` only; no dependency was added, no run was started from the app, and no
|
||||
device command was run (build + unit tests only).
|
||||
|
||||
- **Protocol.** `data/protocol/Message.kt` gains an optional `title` on both
|
||||
`RunSummary` and `RunDetail` (the server's `RunSummary.title`). It is nullable
|
||||
and defaults to absent, so a server that does not send it degrades cleanly.
|
||||
- **One shared fallback.** New `ui/RunIdentity.kt` holds `runLabel(title, name)`
|
||||
(mirroring the server's `RunSummary.Label`) and `runIdentity(title, name)`: the
|
||||
label is the title, or the pipeline name when the title is absent/blank, and the
|
||||
pipeline is a second line only when a title exists — never an empty line.
|
||||
- **Runs list.** `RunHistoryScreen.RunRow` shows the label as the primary line and,
|
||||
only for a titled run, the pipeline name plus its version chip on a second line;
|
||||
an untitled run keeps the pipeline name and version chip as its single identity
|
||||
line. The status chip, progress, id/start/duration line and diagnostic are
|
||||
unchanged.
|
||||
- **Run detail + stage panes.** The run detail app bar and the Summary lead with
|
||||
the label and, when titled, name the pipeline (`name · vN`) on a second line; the
|
||||
covered peek uses the label too. `StageDetailPane` takes an optional `runLabel`
|
||||
and shows it under the stage name, so a stage/visit pane keeps the run context.
|
||||
- **Renaming is not offered.** The authoritative server does not expose it: it has
|
||||
no `set_run_title` command and `list_runs`/`get_run` return no `title` field, so
|
||||
the app does not fake a rename. The protocol field is parsed for the server that
|
||||
does send it; until then the title falls back to the pipeline name.
|
||||
|
||||
Evidence (macOS, JDK 17 from Homebrew `openjdk@17`, Gradle 8.11.1 from the wrapper
|
||||
cache, `ANDROID_HOME=/Users/alan/Library/Android/sdk`, `--offline`, `--no-daemon`):
|
||||
|
||||
- `:app:testDebugUnitTest` → `BUILD SUCCESSFUL`; the 32 result XMLs aggregate to
|
||||
**276 tests, 0 failures, 0 errors, 0 skipped**. The new `RunIdentityTest` (5
|
||||
cases) covers the title/fallback/trim logic, and `ProtocolModelTest` gained a
|
||||
case for a present and one for an absent title on both the run summary and the
|
||||
run detail.
|
||||
- `:app:assembleDebug` → `app-debug.apk` **18,257,214 bytes**, sha256
|
||||
`bce661069b2bd013f0802545402766a3ae8fed97e1bbe0109f81a4bfb6233601`.
|
||||
- Server capability probe (read-only, through the installed CLI):
|
||||
`pipelines runs` and `pipelines rpc '{"type":"get_run","run_id":155}'` return no
|
||||
`title` field, and the running `pipelines-server` binary contains no
|
||||
`set_run_title` string. So renaming is deliberately not offered and the title
|
||||
falls back to the pipeline name until a server carrying the field is deployed.
|
||||
- **APK publish.** `app-debug.apk` copied to
|
||||
`…/artifacts/162/1/pipelines-debug-wip-e1c531a.apk` (`e1c531a` = 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/162/1/pipelines-debug-wip-e1c531a.apk`
|
||||
returned `HTTP/1.1 200 OK`, `Content-Type:
|
||||
application/vnd.android.package-archive`, `Content-Length: 18257214`.
|
||||
|
||||
Not verified in this pass: device captures of the runs list and run detail (the
|
||||
visual review owns the device); no server that actually sends `title` was
|
||||
available, so the titled layout is exercised by the unit tests and the fallback
|
||||
path only.
|
||||
|
||||
|
||||
@@ -238,6 +238,10 @@ data class RunSummary(
|
||||
val id: Long = 0,
|
||||
@SerialName("pipeline_id") val pipelineId: Long = 0,
|
||||
val name: String = "",
|
||||
// The operator-facing, bounded description of what the run is for, generated
|
||||
// by the server from its prompt. Null/blank on a server that predates the
|
||||
// field, so the UI falls back to [name] rather than showing an empty line.
|
||||
val title: String? = null,
|
||||
val version: Int = 0,
|
||||
@SerialName("content_hash") val contentHash: String = "",
|
||||
val status: String = "",
|
||||
@@ -283,6 +287,8 @@ data class RunDetail(
|
||||
val id: Long = 0,
|
||||
@SerialName("pipeline_id") val pipelineId: Long = 0,
|
||||
val name: String = "",
|
||||
// Mirrors the embedded RunSummary.title (see internal/protocol/runs.go).
|
||||
val title: String? = null,
|
||||
val version: Int = 0,
|
||||
@SerialName("content_hash") val contentHash: String = "",
|
||||
val status: String = "",
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package net.awan.pipelines.ui
|
||||
|
||||
/**
|
||||
* The operator-facing name of a run: the server's stored title when it sent one,
|
||||
* otherwise the pipeline name (a run predating the title field, or one the server
|
||||
* could not title). Mirrors the server's `RunSummary.Label`, so the runs list, the
|
||||
* run detail header and the stage pane never spell the same run differently.
|
||||
*/
|
||||
fun runLabel(title: String?, name: String): String {
|
||||
val stored = title?.trim().orEmpty()
|
||||
return if (stored.isEmpty()) name else stored
|
||||
}
|
||||
|
||||
/**
|
||||
* The runs list's two identity lines: [label] is the run's primary line and
|
||||
* [pipeline] is the pipeline the run belongs to, shown as a second line only when
|
||||
* the label is a stored title (so two runs of one pipeline read as different
|
||||
* goals). A run with no title falls back to the pipeline name as its only line —
|
||||
* never a title line followed by an empty one.
|
||||
*/
|
||||
data class RunIdentity(val label: String, val pipeline: String?)
|
||||
|
||||
fun runIdentity(title: String?, name: String): RunIdentity {
|
||||
val stored = title?.trim().orEmpty()
|
||||
return if (stored.isEmpty()) RunIdentity(name, null) else RunIdentity(stored, name)
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.semantics.heading
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import net.awan.pipelines.data.protocol.ControlEvidence
|
||||
@@ -55,6 +56,7 @@ import net.awan.pipelines.ui.fileChangeLine
|
||||
import net.awan.pipelines.ui.fileChangesSummary
|
||||
import net.awan.pipelines.ui.formatDuration
|
||||
import net.awan.pipelines.ui.notificationLine
|
||||
import net.awan.pipelines.ui.runLabel
|
||||
import net.awan.pipelines.ui.screens.runTimeline
|
||||
import net.awan.pipelines.ui.theme.SPACING_L
|
||||
import net.awan.pipelines.ui.theme.SPACING_S
|
||||
@@ -326,6 +328,7 @@ fun StageDetailPane(
|
||||
modifier: Modifier = Modifier,
|
||||
covered: Boolean = false,
|
||||
runContext: Boolean = false,
|
||||
runLabel: String? = null,
|
||||
) {
|
||||
// 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.
|
||||
@@ -366,7 +369,26 @@ fun StageDetailPane(
|
||||
containerColor = paneContainerColor(),
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
title = { Text(GraphSemantics.nodeLabel(stageKey)) },
|
||||
title = {
|
||||
// The stage's own name leads, with the run it belongs to on a
|
||||
// second line when the caller has one, so opening a stage never
|
||||
// loses which run it is a visit of.
|
||||
Column {
|
||||
Text(
|
||||
GraphSemantics.nodeLabel(stageKey),
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
runLabel?.takeIf { it.isNotBlank() }?.let { label ->
|
||||
Text(
|
||||
label,
|
||||
style = pipelinesText().meta,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
navigationIcon = {
|
||||
IconButton(onClick = onBack) {
|
||||
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
|
||||
@@ -575,6 +597,7 @@ fun RunStagePane(
|
||||
modifier = modifier,
|
||||
covered = covered,
|
||||
runContext = true,
|
||||
runLabel = run?.let { runLabel(it.title, it.name) },
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -84,6 +84,8 @@ import net.awan.pipelines.ui.graph.outcomeColor
|
||||
import net.awan.pipelines.ui.graph.rememberArtifactSelection
|
||||
import net.awan.pipelines.ui.runArtifactGroups
|
||||
import net.awan.pipelines.ui.runArtifactsHeader
|
||||
import net.awan.pipelines.ui.runIdentity
|
||||
import net.awan.pipelines.ui.runLabel
|
||||
import net.awan.pipelines.ui.theme.ICON_INLINE_DP
|
||||
import net.awan.pipelines.ui.theme.ICON_STATUS_DP
|
||||
import net.awan.pipelines.ui.theme.SPACING_L
|
||||
@@ -159,7 +161,7 @@ fun RunDetailScreen(
|
||||
// graphs must never be drawn squeezed into the peek strip.
|
||||
if (covered) {
|
||||
PaneIdentity(
|
||||
title = run?.name ?: "Run",
|
||||
title = run?.let { runLabel(it.title, it.name) } ?: "Run",
|
||||
subtitle = run?.status?.takeIf { it.isNotBlank() },
|
||||
modifier = modifier.fillMaxSize(),
|
||||
)
|
||||
@@ -178,7 +180,28 @@ fun RunDetailScreen(
|
||||
enabled = summaryTab == "summary",
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
title = { Text(run?.let { "Run ${it.id}" } ?: "Run") },
|
||||
title = {
|
||||
// The header names the run by its title and keeps the pipeline
|
||||
// it belongs to on a second line, so a stage pane opened from
|
||||
// here carries the same context. Without a title the pipeline
|
||||
// name is the single identity, never a blank first line.
|
||||
val identity = run?.let { runIdentity(it.title, it.name) }
|
||||
Column {
|
||||
Text(
|
||||
identity?.label ?: "Run",
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
identity?.pipeline?.let { pipeline ->
|
||||
Text(
|
||||
"$pipeline · v${run?.version}",
|
||||
style = pipelinesText().meta,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
navigationIcon = {
|
||||
IconButton(onClick = onBack) {
|
||||
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
|
||||
@@ -396,7 +419,7 @@ private fun RunSummaryTab(
|
||||
modifier = Modifier.fillMaxWidth().padding(horizontal = SPACING_L),
|
||||
verticalArrangement = Arrangement.spacedBy(SPACING_XS),
|
||||
) {
|
||||
Text(run.name, style = text.screenTitle)
|
||||
Text(runLabel(run.title, run.name), style = text.screenTitle)
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(SPACING_S),
|
||||
|
||||
@@ -67,6 +67,7 @@ import net.awan.pipelines.ui.components.paneSafeArea
|
||||
import net.awan.pipelines.ui.components.runStateColor
|
||||
import net.awan.pipelines.ui.components.runStateOf
|
||||
import net.awan.pipelines.ui.formatDuration
|
||||
import net.awan.pipelines.ui.runIdentity
|
||||
import net.awan.pipelines.ui.theme.ICON_LIST_DP
|
||||
import net.awan.pipelines.ui.theme.ICON_STATUS_DP
|
||||
import net.awan.pipelines.ui.theme.PipelinesTextStyles
|
||||
@@ -376,10 +377,12 @@ private fun Metric(label: String, value: String, color: Color, text: PipelinesTe
|
||||
}
|
||||
|
||||
/**
|
||||
* One run as a row of the shared real list: a leading status glyph, the run name
|
||||
* as the title with its version chip, and a secondary line carrying the status
|
||||
* chip, progress and id/start/duration. The row is selected when its run is the
|
||||
* one open in the detail pane.
|
||||
* One run as a row of the shared real list: a leading status glyph, the run's
|
||||
* title as the primary line (falling back to the pipeline name when the server
|
||||
* stored no title) with its version chip, the pipeline name on a second line only
|
||||
* when a title exists, then a secondary line carrying the status chip, progress
|
||||
* and id/start/duration. The row is selected when its run is the one open in the
|
||||
* detail pane.
|
||||
*/
|
||||
@Composable
|
||||
private fun RunRow(
|
||||
@@ -390,6 +393,7 @@ private fun RunRow(
|
||||
) {
|
||||
val text = pipelinesText()
|
||||
val state = runStateOf(run.status)
|
||||
val identity = runIdentity(run.title, run.name)
|
||||
ListRow(
|
||||
selected = selected,
|
||||
onClick = onClick,
|
||||
@@ -407,13 +411,32 @@ private fun RunRow(
|
||||
horizontalArrangement = Arrangement.spacedBy(SPACING_S),
|
||||
) {
|
||||
Text(
|
||||
run.name,
|
||||
identity.label,
|
||||
style = text.cardTitle,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
modifier = Modifier.weight(1f),
|
||||
)
|
||||
VersionChip("v${run.version}")
|
||||
// Without a title the pipeline name is the only identity line, so the
|
||||
// version stays beside it; with one the pipeline drops to the second
|
||||
// line and takes the version with it.
|
||||
if (identity.pipeline == null) VersionChip("v${run.version}")
|
||||
}
|
||||
|
||||
if (identity.pipeline != null) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(SPACING_S),
|
||||
) {
|
||||
Text(
|
||||
identity.pipeline,
|
||||
style = text.meta,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
modifier = Modifier.weight(1f),
|
||||
)
|
||||
VersionChip("v${run.version}")
|
||||
}
|
||||
}
|
||||
|
||||
Row(
|
||||
|
||||
@@ -257,4 +257,37 @@ class ProtocolModelTest {
|
||||
assertEquals(2, pipeline.succeeded)
|
||||
assertEquals(3.5, pipeline.averageSeconds, 0.0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun runSummariesAndDetailsCarryTheOperatorTitleWhenTheServerSendsIt() {
|
||||
val json = """
|
||||
{
|
||||
"type": "runs",
|
||||
"runs": [
|
||||
{"id": 1, "pipeline_id": 7, "name": "demo", "title": "Add a dark mode toggle", "version": 2, "status": "succeeded"}
|
||||
],
|
||||
"run_detail": {
|
||||
"id": 1,
|
||||
"pipeline_id": 7,
|
||||
"name": "demo",
|
||||
"title": "Add a dark mode toggle",
|
||||
"version": 2,
|
||||
"steps": []
|
||||
}
|
||||
}
|
||||
""".trimIndent()
|
||||
val message = PipelinesJson.decodeFromString(Message.serializer(), json)
|
||||
assertEquals("Add a dark mode toggle", message.runs!!.single().title)
|
||||
assertEquals("Add a dark mode toggle", message.runDetail!!.title)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun anAbsentRunTitleStaysNullSoTheUiFallsBackToThePipelineName() {
|
||||
val json = """
|
||||
{"type": "runs", "runs": [{"id": 1, "name": "demo"}], "run_detail": {"id": 1, "name": "demo"}}
|
||||
""".trimIndent()
|
||||
val message = PipelinesJson.decodeFromString(Message.serializer(), json)
|
||||
assertNull(message.runs!!.single().title)
|
||||
assertNull(message.runDetail!!.title)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package net.awan.pipelines.ui
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNotEquals
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Test
|
||||
|
||||
class RunIdentityTest {
|
||||
|
||||
@Test
|
||||
fun aStoredTitleIsThePrimaryLineWithThePipelineOnASecondLine() {
|
||||
val identity = runIdentity("Add a dark mode toggle", "android-app")
|
||||
assertEquals("Add a dark mode toggle", identity.label)
|
||||
assertEquals("android-app", identity.pipeline)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun twoRunsOfOnePipelineReadAsDifferentGoals() {
|
||||
val first = runIdentity("Add a dark mode toggle", "android-app")
|
||||
val second = runIdentity("Fix the crash on rotate", "android-app")
|
||||
// Same pipeline on the second line, different title on the first.
|
||||
assertEquals("android-app", first.pipeline)
|
||||
assertEquals(first.pipeline, second.pipeline)
|
||||
assertNotEquals(first.label, second.label)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aMissingOrBlankTitleFallsBackToThePipelineNameWithNoSecondLine() {
|
||||
for (title in listOf(null, "", " ", "\t")) {
|
||||
val identity = runIdentity(title, "android-app")
|
||||
assertEquals("android-app", identity.label)
|
||||
assertNull(identity.pipeline)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theStoredTitleIsTrimmed() {
|
||||
val identity = runIdentity(" Add a dark mode toggle ", "android-app")
|
||||
assertEquals("Add a dark mode toggle", identity.label)
|
||||
assertEquals("android-app", identity.pipeline)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun runLabelMirrorsTheRowsPrimaryLine() {
|
||||
assertEquals("Add a dark mode toggle", runLabel("Add a dark mode toggle", "android-app"))
|
||||
assertEquals("Add a dark mode toggle", runLabel(" Add a dark mode toggle ", "android-app"))
|
||||
assertEquals("android-app", runLabel(null, "android-app"))
|
||||
assertEquals("android-app", runLabel(" ", "android-app"))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user