android: show the run title whole in the run view, two lines in the list

A run's title is derived from its prompt, so it is often long. Give it the
room it needs where the operator reads the run, and a deliberate clamp where
it is one of many. Android only; no new dependency (the declared
material-icons-extended only), no Pipelines server/Go/installer/Docker file
touched, and no run started from the app.

- Run view shows the whole title. The run-summary title line states its
  intent with RUN_VIEW_TITLE_LINES (Int.MAX_VALUE) and TextOverflow.Clip, so
  it wraps over as many lines as it needs and is never ellipsised; the
  fixed-height M3 app-bar copy stays a compact one-line label.
- Runs-list rows grow, then clamp. RunRow's title went from maxLines = 1 to
  RUN_ROW_TITLE_LINES (2): a longer title takes a second line before it
  ellipsises, with the glyph, status chip and meta line still aligned and the
  selection highlight and tap target unchanged.
- Stage-pane context line. StageDetailPane's run-label line went from
  maxLines = 1 to STAGE_RUN_LABEL_LINES (2); the pane is compact context, not
  where the whole title lives.
- Named budgets. ui/RunIdentity.kt holds the three budgets so the choice is
  deliberate at each call site. RunTitlesTest (4 cases) pins them and asserts
  a clamping place is never more generous than the run view; RunIdentityTest
  gained a case that runLabel/runIdentity never shorten a long title.

Checked for stale copies: android/README.md gained a dated section for this
change (its existing "Run title beside the pipeline name" section still holds,
it just did not describe line budgets). The top-level README and docs/ do not
document the app's run-title rendering, and the packaged templates and
internal/author/skill/references/ packaged skill describe Pipelines authoring
and Android APK delivery, not this UI, so none of them needed updating.

Evidence (JDK 17, Gradle 9.7.1 --offline --no-daemon): :app:testDebugUnitTest
BUILD SUCCESSFUL, 57 classes / 513 tests / 0 failures / 0 errors / 0 skipped
(RunTitlesTest 4/0, RunIdentityTest 6/0); :app:assembleDebug BUILD SUCCESSFUL,
app-debug.apk 18,486,624 bytes sha256 2b23762b54f0..., published as this run's
pipelines-debug-wip-2bc00a2.apk and served at
http://10.0.0.75:8080/artifacts/278/4/pipelines-debug-wip-2bc00a2.apk.
This commit is contained in:
2026-10-17 15:49:55 +01:00
parent 2bc00a2a94
commit d13f359e7b
7 changed files with 143 additions and 4 deletions
@@ -24,3 +24,22 @@ fun runIdentity(title: String?, name: String): RunIdentity {
val stored = title?.trim().orEmpty()
return if (stored.isEmpty()) RunIdentity(name, null) else RunIdentity(stored, name)
}
/**
* The line budget for a run's title in each place the app shows it. A title is
* derived from the run's prompt, so it is often long, and the places it appears
* have different jobs: the run view exists to let the operator read the run, so
* its own title is complete, while a runs-list row (one of many) and the stage
* pane's compact run-context line may clamp because the run view still carries
* the whole title. Kept here, named, so the budgets are a deliberate choice the
* tests pin rather than a bare `maxLines` literal at each call site.
*/
/** The run view's own title never elides: it wraps over as many lines as it needs. */
internal const val RUN_VIEW_TITLE_LINES: Int = Int.MAX_VALUE
/** A runs-list row's title grows to two lines for a longer title, then ellipsises. */
internal const val RUN_ROW_TITLE_LINES: Int = 2
/** The stage pane's compact run-context line shows at most two lines, then ellipsises. */
internal const val STAGE_RUN_LABEL_LINES: Int = 2
@@ -47,6 +47,7 @@ import net.awan.pipelines.ui.components.KeyValueRow
import net.awan.pipelines.ui.components.PaneIdentity
import net.awan.pipelines.ui.components.SectionHeader
import net.awan.pipelines.ui.components.paneSafeArea
import net.awan.pipelines.ui.STAGE_RUN_LABEL_LINES
import net.awan.pipelines.ui.displayMap
import net.awan.pipelines.ui.fileChangeLine
import net.awan.pipelines.ui.fileChangesSummary
@@ -422,7 +423,10 @@ fun StageDetailPane(
Text(
label,
style = pipelinesText().meta,
maxLines = 1,
// The run's own complete title lives in the run
// view; here it is a compact context line, so it may
// take a second line but not run away with the pane.
maxLines = STAGE_RUN_LABEL_LINES,
overflow = TextOverflow.Ellipsis,
)
}
@@ -89,6 +89,7 @@ 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.RUN_VIEW_TITLE_LINES
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
@@ -193,7 +194,11 @@ fun RunDetailScreen(
// 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.
// name is the single identity, never a blank first line. This
// app-bar copy is a compact one-line label (the M3 app bar is a
// fixed height, so it cannot grow); the run's own complete,
// wrapping title is the summary's title line below, which is
// never elided.
val identity = run?.let { runIdentity(it.title, it.name) }
Column {
Text(
@@ -429,7 +434,17 @@ private fun RunSummaryTab(
modifier = Modifier.fillMaxWidth().padding(horizontal = SPACING_L),
verticalArrangement = Arrangement.spacedBy(SPACING_XS),
) {
Text(runLabel(run.title, run.name), style = text.screenTitle)
// The run view's own copy of the title: the operator must be
// able to read what the run is called, so it is never elided -
// it wraps over as many lines as it needs. The compact app-bar
// copy above stays a one-line label for context while this
// scrollable, complete one is what the operator reads.
Text(
runLabel(run.title, run.name),
style = text.screenTitle,
maxLines = RUN_VIEW_TITLE_LINES,
overflow = TextOverflow.Clip,
)
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(SPACING_S),
@@ -70,6 +70,7 @@ import net.awan.pipelines.ui.components.paneSafeArea
import net.awan.pipelines.ui.components.rememberLiveNowMillis
import net.awan.pipelines.ui.components.runStateColor
import net.awan.pipelines.ui.components.runStateOf
import net.awan.pipelines.ui.RUN_ROW_TITLE_LINES
import net.awan.pipelines.ui.formatDuration
import net.awan.pipelines.ui.runDurationText
import net.awan.pipelines.ui.runIdentity
@@ -529,7 +530,7 @@ private fun RunRow(
Text(
identity.label,
style = text.cardTitle,
maxLines = 1,
maxLines = RUN_ROW_TITLE_LINES,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f),
)
@@ -47,4 +47,16 @@ class RunIdentityTest {
assertEquals("android-app", runLabel(null, "android-app"))
assertEquals("android-app", runLabel(" ", "android-app"))
}
@Test
fun aVeryLongTitleIsKeptWholeAtTheDataLevel() {
// The run view's own title is rendered from this value with no line limit,
// so the identity itself must never silently shorten it: a prompt-derived
// title stays complete and the view, not this function, decides the
// layout. Guards against re-introducing a truncating helper here.
val long = "Implement the whole thing carefully, then review it ".repeat(40).trim()
assertEquals(long, runLabel(long, "android-app"))
assertEquals(long, runIdentity(long, "android-app").label)
assertEquals("android-app", runIdentity(long, "android-app").pipeline)
}
}
@@ -0,0 +1,38 @@
package net.awan.pipelines.ui
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
/**
* The run title's line budget in each place it is shown. A title is derived from
* the run's prompt and is often long, so the run view - the place whose whole job
* is to let the operator read the run - must show it complete, while the places
* that are one of many (a runs-list row) or a compact label (the stage pane's
* run-context line) clamp. The budgets are pinned here so a change to one is a
* deliberate, reviewed decision and the run view can never become the most
* generous place by accident.
*/
class RunTitlesTest {
@Test
fun theRunViewShowsTheWholeTitleNeverEliding() {
assertEquals(Int.MAX_VALUE, RUN_VIEW_TITLE_LINES)
}
@Test
fun aRunsListRowGrowsForALongTitleThenClampsAtTwoLines() {
assertEquals(2, RUN_ROW_TITLE_LINES)
}
@Test
fun theStagePaneRunContextTakesASecondLineThenClamps() {
assertEquals(2, STAGE_RUN_LABEL_LINES)
}
@Test
fun aClampingPlaceIsNeverMoreGenerousThanTheCompleteOne() {
assertTrue("a list row may not outlive the run view", RUN_ROW_TITLE_LINES < RUN_VIEW_TITLE_LINES)
assertTrue("a stage context line may not outlive the run view", STAGE_RUN_LABEL_LINES < RUN_VIEW_TITLE_LINES)
}
}