Preserve reviewed Clear all change for leased UI verification

This commit is contained in:
2026-10-18 23:22:28 +01:00
parent 1b5b581de8
commit dad89493de
4 changed files with 37 additions and 0 deletions
@@ -179,6 +179,12 @@ internal fun attentionHeadline(entries: List<AttentionEntry>): String = when {
else -> "${entries.size} runs need you"
}
/**
* Captures the entries shown when the attention sheet opens. Bulk dismissal uses
* this snapshot so entries that arrive while the sheet is open are not removed.
*/
internal fun attentionDismissalSnapshot(entries: List<AttentionEntry>): List<AttentionEntry> = entries.toList()
/**
* Parses the run id from a `pipelines://run/<id>` deep link, or null for
* anything else. Pure and total, so a malformed link simply opens nothing rather
@@ -17,8 +17,10 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@@ -27,6 +29,7 @@ import androidx.compose.ui.unit.dp
import net.awan.pipelines.ui.AttentionEntry
import net.awan.pipelines.ui.AttentionKind
import net.awan.pipelines.ui.attentionHeadline
import net.awan.pipelines.ui.attentionDismissalSnapshot
import net.awan.pipelines.ui.theme.ICON_INLINE_DP
import net.awan.pipelines.ui.theme.SPACING_L
import net.awan.pipelines.ui.theme.SPACING_M
@@ -105,6 +108,7 @@ fun AttentionSheet(
onDismiss: () -> Unit,
) {
val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)
val dismissalSnapshot = remember { attentionDismissalSnapshot(entries) }
ModalBottomSheet(onDismissRequest = onDismiss, sheetState = sheetState) {
Column(
modifier = Modifier.fillMaxWidth().padding(bottom = SPACING_L),
@@ -124,6 +128,13 @@ fun AttentionSheet(
)
return@Column
}
TextButton(
onClick = { dismissalSnapshot.forEach(onDismissEntry) },
enabled = dismissalSnapshot.isNotEmpty(),
modifier = Modifier.padding(horizontal = SPACING_L),
) {
Text("Clear all")
}
entries.forEach { entry ->
AttentionRow(
entry = entry,
@@ -194,6 +194,16 @@ class AttentionTest {
assertEquals("A run failed", attentionHeadline(singleFailed))
}
@Test
fun dismissalSnapshotDoesNotIncludeEntriesThatArriveLater() {
val original = attentionEntries(listOf(run(1, "waiting")), AttentionState())
val snapshot = attentionDismissalSnapshot(original)
val current = original + attentionEntries(listOf(run(2, "failed")), AttentionState())
assertEquals(listOf(1L), snapshot.map { it.runId })
assertEquals(listOf(1L, 2L), current.map { it.runId })
}
// --- persistence -----------------------------------------------------------
@Test
+10
View File
@@ -0,0 +1,10 @@
# Needs you: Clear all
The Needs you bottom sheet now exposes **Clear all** when it has entries. It
dismisses only the entries present when the sheet opened through the existing
individual dismissal path; entries arriving while it is open remain visible.
The action is absent from the empty state. UI verification remains the next
stage's responsibility.
The packaged author skill/reference documentation should be folded to mention
this user-facing behavior rather than being edited in this item.