Show the progress rate over the last 5 seconds, and what a phase is doing after 10 seconds with no item done (closes #125)
check / check (push) Canceled after 0s

The rate was the phase's average, so a burst after a long wait read as
over 1,000 files a second. It now covers the items completed over the
last 5 seconds, or since the line before off a terminal, and falls to 0
while nothing completes; the ETA still comes from the average. Once no
item has completed for 10 seconds, the line says so and what the phase
is doing, a phrase each phase gives where it is defined. A narrow
terminal leaves that out after the rate, keeping the phase, progress,
elapsed time and ETA whole. The tests set the display's clock by hand.

Judgement call: the line reads "no files finished", in the phase's unit.
Judgement call: trees' group phase says "grouping directories".

Model: opus-5-5
This commit is contained in:
2026-10-16 21:01:05 +00:00
parent e9e09effc6
commit 69dbbfc1d7
9 changed files with 403 additions and 99 deletions
+3 -2
View File
@@ -72,7 +72,7 @@ func runTrees(ctx context.Context, stdout io.Writer) error {
prog = newProgress(progressParams{
label: treesPhase("read"), unit: "records", total: -1,
waitingFor: countingRecords,
waitingFor: countingRecords, doing: readingDatabase,
})
records, super, allDirs, err := readTree(ctx, db, prog)
@@ -84,7 +84,7 @@ func runTrees(ctx context.Context, stdout io.Writer) error {
prog = newProgress(progressParams{
label: treesPhase("group"), unit: "directories",
total: int64(len(allDirs)),
total: int64(len(allDirs)), doing: "grouping directories",
})
dupes := collectTreeGroups(allDirs, super, prog)
@@ -92,6 +92,7 @@ func runTrees(ctx context.Context, stdout io.Writer) error {
prog = newProgress(progressParams{
label: treesPhase("write"), unit: "groups", total: int64(len(dupes)),
doing: "writing the report",
})
dupeTrees, reclaimable, err := writeTreeGroups(stdout, dupes, prog)