report: show its phases as N of M, with progress, elapsed time and ETA (closes #114) #122

Merged
clawbot merged 1 commits from issue-114-report-progress into next 2026-10-16 21:44:55 +02:00
Collaborator

Implements #114.

report now shows [1/2] open and [2/2] read on the display scan and trees use, from the line naming the database until the summary line:

  • open covers a wait on a busy database.
  • read counts the records, then reads every record in the same read-only transaction, in signature order. That is the files_signature index read backwards, selecting only its columns, so SQLite neither sorts nor looks anything up in the table, and the read ends at exactly its count. TestSignatureRowsNeedNoSort checks the query plan.

report.go forms the groups from runs of records with one signature and holds only the groups of the size being read, writing them by first path before the next size. Records without a content hash are read and counted, then skipped. Rows go through the display's stdout writer from #113.

What the diff does not make obvious:

  • TestReportStdoutFailsWhileReading now gives each pair a size of its own, because rows are written only once their size has been read; it also checks that the read stopped short.
  • The test helper dupeGroups now reads the groups back from the rows readReport writes.
  • countingRecords is a constant because the linter asked for one once a third phase used the text; scan and trees use it too.

Judgement call: writing is part of read, not a phase of its own, since each size's rows are written while the read goes on.

Model: opus-5-5

Implements https://git.eeqj.de/sneak/sfdupes/issues/114. `report` now shows `[1/2] open` and `[2/2] read` on the display `scan` and `trees` use, from the line naming the database until the summary line: - `open` covers a wait on a busy database. - `read` counts the records, then reads every record in the same read-only transaction, in signature order. That is the `files_signature` index read backwards, selecting only its columns, so SQLite neither sorts nor looks anything up in the table, and the read ends at exactly its count. `TestSignatureRowsNeedNoSort` checks the query plan. `report.go` forms the groups from runs of records with one signature and holds only the groups of the size being read, writing them by first path before the next size. Records without a content hash are read and counted, then skipped. Rows go through the display's stdout writer from https://git.eeqj.de/sneak/sfdupes/issues/113. What the diff does not make obvious: - `TestReportStdoutFailsWhileReading` now gives each pair a size of its own, because rows are written only once their size has been read; it also checks that the read stopped short. - The test helper `dupeGroups` now reads the groups back from the rows `readReport` writes. - `countingRecords` is a constant because the linter asked for one once a third phase used the text; `scan` and `trees` use it too. Judgement call: writing is part of `read`, not a phase of its own, since each size's rows are written while the read goes on. Model: opus-5-5
clawbot added 1 commit 2026-10-16 21:15:05 +02:00
report now runs in two phases, open and read, under the progress
display scan and trees use, until the summary line. open covers a wait
on a busy database. read counts the records, then reads them in the
same read-only transaction in signature order, the files_signature
index read backwards, so SQLite sorts nothing and the read ends at
exactly its count. The duplicate groups are formed in Go from runs of
equal signatures; only those of the size being read are held, and they
are written, ordered by first path, before the next size. The rows go
through the display's stdout writer. stdout and the summary line are
unchanged.

Judgement call: writing is part of read, not a phase of its own, since each size's rows are written while the read goes on.

Model: opus-5-5
clawbot added the needs-review label 2026-10-16 21:15:08 +02:00
clawbot self-assigned this 2026-10-16 21:15:09 +02:00
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit ebe4d4dbeb into next 2026-10-16 21:44:55 +02:00
clawbot deleted branch issue-114-report-progress 2026-10-16 21:44:56 +02:00
Sign in to join this conversation.