Compare commits

1 Commits
Author SHA1 Message Date
sneak 7cbb2d7f20 Stream report and trees instead of loading every record (closes #14)
check / check (push) Failing after 46s
report now has SQLite group the records and put the rows in report
order, helped by a new files_signature index on (size, head, tail,
content), and writes each row as it reads it. trees reads the records
in path order, where all the paths under a directory come together, so
it computes each directory's digest as soon as the stream leaves it and
keeps only its path, parent, digest and totals. Output is unchanged.

The tests that called the removed in-memory grouping functions now group
records stored in a database. New tests check that both commands give
the same output whatever order the records were inserted in, and that a
stdout failure partway through a long report is reported as one.

Model: opus-5-5
2026-10-04 03:16:46 +00:00
+4 -4
View File
@@ -122,12 +122,12 @@ func TestReportStdoutFailsWhileReading(t *testing.T) {
// still being read, not at the final flush.
dir := "/" + strings.Repeat("d", 4096)
recs := make([]scanRec, ioBufSize/len(dir))
for i := range recs {
recs[i] = scanRec{
var recs []scanRec
for i := range ioBufSize / len(dir) {
recs = append(recs, scanRec{
size: 1, head: "h", tail: "t", content: "c",
path: fmt.Sprintf("%s/%d", dir, i),
}
})
}
t.Setenv(databaseEnv, seedDatabase(t, recs))