v0.147.3 — 4c follow-up 3: the run does not end with the last app
Third real run, third thing only a live run could show. The per-app legs finished in ~15 seconds; the remaining 40 of the 57-second run was the shares leg and forget --prune, during which the card sat frozen on "calibre-web — 8 / 8 fájl". The same frozen-looking silence 4c exists to remove, relocated to the end. Progress now carries a phase. The post-app stages announce themselves and the app-scoped counters are cleared when a phase starts, so the last app's finished numbers are never shown against work that is no longer about that app. Starting the next app clears the phase again. Pinned by a test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nn3VgQk9iwEGgyx6QJ2NvE
This commit is contained in:
@@ -274,6 +274,32 @@ func TestProgressKeepsLastKnownCurrentFile(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestSetPhaseClearsAppScopedCounters — a run is not only the per-app loop. The shares leg and
|
||||
// forget --prune follow it and took 40 of a 57-second run on the demo box. Without a phase the card
|
||||
// kept showing the last app's finished counters ("calibre-web 8 / 8") for that whole tail, which is
|
||||
// the same frozen-looking silence 4c exists to remove, just relocated to the end of the run.
|
||||
func TestSetPhaseClearsAppScopedCounters(t *testing.T) {
|
||||
var st offboxProgressState
|
||||
st.begin()
|
||||
st.setApp("calibre-web")
|
||||
st.update(resticProgress{Percent: 100, BytesDone: 850000, TotalBytes: 850000, FilesDone: 8, TotalFiles: 8, CurrentFile: "/data/x"})
|
||||
|
||||
st.setPhase(OffboxPhaseRetention)
|
||||
got := st.snapshot()
|
||||
if got.Phase != OffboxPhaseRetention {
|
||||
t.Errorf("phase = %q, want %q", got.Phase, OffboxPhaseRetention)
|
||||
}
|
||||
if got.CurrentApp != "" || got.FilesDone != 0 || got.TotalFiles != 0 || got.BytesDone != 0 || got.CurrentFile != "" {
|
||||
t.Errorf("app-scoped counters survived the phase switch: %+v — the card would show the last "+
|
||||
"app's finished numbers against retention work", got)
|
||||
}
|
||||
// Starting another app must clear the phase again, or the card would stay on „Karbantartás".
|
||||
st.setApp("immich")
|
||||
if p := st.snapshot(); p.Phase != "" || p.CurrentApp != "immich" {
|
||||
t.Errorf("after setApp: phase=%q app=%q, want phase cleared and app set", p.Phase, p.CurrentApp)
|
||||
}
|
||||
}
|
||||
|
||||
// TestParseResticStatusClampsPercent — restic has been seen to report percent_done slightly above 1
|
||||
// near completion. A bar wider than its track is a visible bug.
|
||||
func TestParseResticStatusClampsPercent(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user