Merge lane-chat4: keep run-title readability and the waiting human decision
Merge lane-chat4 (d13f359, "make a run's title readable: whole in the run view, two lines in the list") into main (cd87982, "answer a run's waiting human decision from the phone"). Both intents are kept. Conflict resolution: - android/README.md (the only conflicted path): kept both sections, HEAD's "Answer a waiting human decision from the phone" first and lane-chat4's "Run title readability" second, with nothing removed. Each heading appears exactly once. - StageDetailPane.kt and RunDetailScreen.kt were changed on both sides and auto-merged: the staged tree carries the incoming title line budgets plus the local DecisionPrompt wiring (the stage pane surfaces a decision only for its own stage; the run detail surfaces it above the tabs). - The remaining incoming files (RunIdentity.kt, RunHistoryScreen.kt, RunIdentityTest.kt, RunTitlesTest.kt) and the local files are one-sided and taken whole. The staged tree differs from HEAD by exactly the incoming diff and from MERGE_HEAD by exactly the local diff, so no side was dropped or duplicated. Checks (JDK 17, ANDROID_HOME=/Users/alan/Library/Android/sdk, Gradle 9.7.1 --no-daemon --offline): - gradle :app:testDebugUnitTest :app:assembleDebug -> BUILD SUCCESSFUL. - 59 result XMLs aggregate to 530 tests, 0 failures, 0 errors, 0 skipped; RunTitlesTest 4/0 and RunIdentityTest 6/0. No conflict markers remain. Staleness check: the incoming work is android/-only. android/README.md is the topic doc and now carries both sections; no packaged template, the repo README, the other topic docs, or the packaged authoring skill references describe this run-title UI, so none needed updating (the delivery reference's Android build/publish example is unchanged and still accurate).
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -50,6 +50,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
|
||||
@@ -428,7 +429,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,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -91,6 +91,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
|
||||
@@ -195,7 +196,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(
|
||||
@@ -447,7 +452,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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user