Preserve reviewed incomplete-diff labels before controlled UI acceptance
This commit is contained in:
@@ -247,6 +247,7 @@ internal data class RunChanges(
|
|||||||
val partial: Boolean,
|
val partial: Boolean,
|
||||||
val unavailable: Boolean,
|
val unavailable: Boolean,
|
||||||
val pending: Boolean,
|
val pending: Boolean,
|
||||||
|
val missingCaptures: Int,
|
||||||
val skipped: Int,
|
val skipped: Int,
|
||||||
val omitted: Int,
|
val omitted: Int,
|
||||||
val diagnostic: String,
|
val diagnostic: String,
|
||||||
@@ -273,6 +274,7 @@ internal fun runChanges(steps: List<RunStep>): RunChanges {
|
|||||||
var stepsPending = 0
|
var stepsPending = 0
|
||||||
var partial = false
|
var partial = false
|
||||||
var unavailable = false
|
var unavailable = false
|
||||||
|
var missingCaptures = 0
|
||||||
var skipped = 0
|
var skipped = 0
|
||||||
var omitted = 0
|
var omitted = 0
|
||||||
val diagnostics = LinkedHashSet<String>()
|
val diagnostics = LinkedHashSet<String>()
|
||||||
@@ -281,6 +283,7 @@ internal fun runChanges(steps: List<RunStep>): RunChanges {
|
|||||||
val changes = step.fileChanges
|
val changes = step.fileChanges
|
||||||
if (changes == null) {
|
if (changes == null) {
|
||||||
if (step.status == "running" || step.status == "waiting") stepsPending++
|
if (step.status == "running" || step.status == "waiting") stepsPending++
|
||||||
|
else missingCaptures++
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
stepsWithChanges++
|
stepsWithChanges++
|
||||||
@@ -338,6 +341,7 @@ internal fun runChanges(steps: List<RunStep>): RunChanges {
|
|||||||
partial = totalPartial,
|
partial = totalPartial,
|
||||||
unavailable = unavailable,
|
unavailable = unavailable,
|
||||||
pending = pending,
|
pending = pending,
|
||||||
|
missingCaptures = missingCaptures,
|
||||||
skipped = skipped,
|
skipped = skipped,
|
||||||
omitted = omitted,
|
omitted = omitted,
|
||||||
diagnostic = diagnostics.joinToString(" "),
|
diagnostic = diagnostics.joinToString(" "),
|
||||||
@@ -356,7 +360,9 @@ internal fun runChangesHeader(changes: RunChanges): String {
|
|||||||
if (changes.isEmpty) {
|
if (changes.isEmpty) {
|
||||||
return when {
|
return when {
|
||||||
changes.pending -> "Changes · capture pending"
|
changes.pending -> "Changes · capture pending"
|
||||||
|
changes.partial -> "Changes · partial capture"
|
||||||
changes.stepsWithChanges == 0 -> "Changes · not recorded for this run"
|
changes.stepsWithChanges == 0 -> "Changes · not recorded for this run"
|
||||||
|
changes.missingCaptures > 0 -> "Changes · capture incomplete"
|
||||||
else -> "Changes · no changes observed"
|
else -> "Changes · no changes observed"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -366,7 +372,11 @@ internal fun runChangesHeader(changes: RunChanges): String {
|
|||||||
} else {
|
} else {
|
||||||
"${changes.fileCount} ${if (changes.fileCount == 1) "file" else "files"} changed · $stat"
|
"${changes.fileCount} ${if (changes.fileCount == 1) "file" else "files"} changed · $stat"
|
||||||
}
|
}
|
||||||
return if (changes.partial) "$label · partial capture" else label
|
return when {
|
||||||
|
changes.partial -> "$label · partial capture"
|
||||||
|
changes.missingCaptures > 0 -> "$label · capture incomplete"
|
||||||
|
else -> label
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -378,7 +388,6 @@ internal fun runChangesNote(changes: RunChanges): String = when {
|
|||||||
changes.unavailable -> changes.diagnostic.ifBlank {
|
changes.unavailable -> changes.diagnostic.ifBlank {
|
||||||
"The workspace snapshot could not be compared; the changes below may be incomplete."
|
"The workspace snapshot could not be compared; the changes below may be incomplete."
|
||||||
}
|
}
|
||||||
changes.isEmpty -> ""
|
|
||||||
else -> buildString {
|
else -> buildString {
|
||||||
if (changes.partial) {
|
if (changes.partial) {
|
||||||
append("Partial capture: some changes may be missing.")
|
append("Partial capture: some changes may be missing.")
|
||||||
@@ -390,6 +399,12 @@ internal fun runChangesNote(changes: RunChanges): String = when {
|
|||||||
if (caveats.isNotEmpty()) append(" (" + caveats.joinToString(", ") + ")")
|
if (caveats.isNotEmpty()) append(" (" + caveats.joinToString(", ") + ")")
|
||||||
if (changes.diagnostic.isNotBlank()) append(" ${changes.diagnostic}")
|
if (changes.diagnostic.isNotBlank()) append(" ${changes.diagnostic}")
|
||||||
}
|
}
|
||||||
|
if (changes.missingCaptures > 0) {
|
||||||
|
if (isNotEmpty()) append(" ")
|
||||||
|
append("Missing capture: ${changes.missingCaptures} ")
|
||||||
|
append(if (changes.missingCaptures == 1) "stage did" else "stages did")
|
||||||
|
append(" not record changes.")
|
||||||
|
}
|
||||||
}.trim()
|
}.trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -303,6 +303,63 @@ class RunChangesTest {
|
|||||||
assertTrue(note.contains("1 truncated"))
|
assertTrue(note.contains("1 truncated"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun emptyIncompleteCapturesDoNotReadAsNoChangesObserved() {
|
||||||
|
val partial = runChanges(
|
||||||
|
listOf(
|
||||||
|
step(changes = StageFileChanges(status = "partial", skipped = 2, diagnostic = "Capture limit reached.")),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
assertEquals("Changes · partial capture", runChangesHeader(partial))
|
||||||
|
assertEquals(
|
||||||
|
"Partial capture: some changes may be missing. (2 files skipped) Capture limit reached.",
|
||||||
|
runChangesNote(partial),
|
||||||
|
)
|
||||||
|
|
||||||
|
val unavailable = runChanges(listOf(step(changes = StageFileChanges(status = "unavailable"))))
|
||||||
|
assertEquals("Changes · capture unavailable", runChangesHeader(unavailable))
|
||||||
|
assertTrue(runChangesNote(unavailable).contains("could not be compared"))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun aMissingCaptureAlongsideACompleteOneRemainsExplicit() {
|
||||||
|
val changes = runChanges(
|
||||||
|
listOf(
|
||||||
|
step(stage = "historical", changes = null),
|
||||||
|
step(stage = "committer", changes = StageFileChanges(status = "complete")),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
assertEquals("Changes · capture incomplete", runChangesHeader(changes))
|
||||||
|
assertEquals("Missing capture: 1 stage did not record changes.", runChangesNote(changes))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun allHistoricalMissingCapturesAreNotReportedAsNoChanges() {
|
||||||
|
val changes = runChanges(listOf(step(stage = "old-one", changes = null), step(stage = "old-two", changes = null)))
|
||||||
|
assertEquals("Changes · not recorded for this run", runChangesHeader(changes))
|
||||||
|
assertEquals("Missing capture: 2 stages did not record changes.", runChangesNote(changes))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun aCleanCompleteEmptyCaptureStillReportsNoChangesObserved() {
|
||||||
|
val changes = runChanges(listOf(step(changes = StageFileChanges(status = "complete"))))
|
||||||
|
assertEquals("Changes · no changes observed", runChangesHeader(changes))
|
||||||
|
assertEquals("", runChangesNote(changes))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun anEarlierPatchSurvivesALaterCompleteEmptyCapture() {
|
||||||
|
val changes = runChanges(
|
||||||
|
listOf(
|
||||||
|
step(stage = "implementer", changes = capture(file("a.txt", "modified", patch))),
|
||||||
|
step(stage = "committer", changes = StageFileChanges(status = "complete")),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
assertEquals(1, changes.fileCount)
|
||||||
|
assertEquals("1 file changed · +2 -1", runChangesHeader(changes))
|
||||||
|
assertEquals(patch, changes.files.single().patch)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun aRunWithNoRecordedChangesSaysSoRatherThanShowingAFabricatedDiff() {
|
fun aRunWithNoRecordedChangesSaysSoRatherThanShowingAFabricatedDiff() {
|
||||||
// A capture that ran and observed nothing.
|
// A capture that ran and observed nothing.
|
||||||
|
|||||||
@@ -7,9 +7,12 @@ Item: Android-only recovery of the run summary's observed file-change evidence.
|
|||||||
- `RunSummaryTab.kt` adds a separately collapsible **Changes** section after
|
- `RunSummaryTab.kt` adds a separately collapsible **Changes** section after
|
||||||
artifacts. Its header reports the observed file count and `+N -M` statistic.
|
artifacts. Its header reports the observed file count and `+N -M` statistic.
|
||||||
- `ui/changes/` aggregates per-stage file captures by path, preserves capture
|
- `ui/changes/` aggregates per-stage file captures by path, preserves capture
|
||||||
caveats (unavailable, partial, binary, truncated and mode-only), parses unified
|
caveats (unavailable, partial, missing historical captures, binary, truncated
|
||||||
|
and mode-only), parses unified
|
||||||
patches, and opens a full-screen raw/rendered viewer with file paging, line
|
patches, and opens a full-screen raw/rendered viewer with file paging, line
|
||||||
gutters, scrolling and copy support.
|
gutters, scrolling and copy support.
|
||||||
|
- An empty partial capture remains labelled partial and retains its skipped-file
|
||||||
|
count and diagnostic; an empty complete capture remains the only no-change state.
|
||||||
- `ChatDiffCard.kt` provides shared diff marker and colour helpers so chat and
|
- `ChatDiffCard.kt` provides shared diff marker and colour helpers so chat and
|
||||||
run evidence render additions, removals and context consistently.
|
run evidence render additions, removals and context consistently.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user