oficina / memoria Public

fix(seed): an unchanged re-seed is success, and now says so

It reported '0 passages indexed', which is its own fresh index holding
only what that run chunked — so a re-seed of an unchanged tree read like
a total failure rather than a no-op.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SiWVaR69Vb2Lzc9wgfit1v
Paul Campbell pushed by paul@keymail.dev b7b89d2c867ba06a674b8d5142db7621fcdba37b parent ac6b90a
1 file changed, +17 −3
  • tools/seed/main.go +17 −3
diff --git a/tools/seed/main.go b/tools/seed/main.go
index 007655a..c668eba 100644
--- a/tools/seed/main.go
+++ b/tools/seed/main.go
@@ -81,7 +81,7 @@ func main() {
store := memoria.NewStore(d, sealer, ix)
ctx := context.Background()
- var n, skipped int
+ var n, skipped, indexed int
err = filepath.WalkDir(*root, func(p string, e fs.DirEntry, err error) error {
if err != nil {
return err
@@ -119,7 +119,13 @@ func main() {
return fmt.Errorf("ingest %s: %w", rel, err)
}
n++
- fmt.Printf("seeded %s\n", rel)
+ // Report per file only when something actually changed, so a
+ // re-seed of an unchanged tree is quiet rather than looking like
+ // 60 successful writes.
+ if before, _ := store.Count(); before != indexed {
+ indexed = before
+ fmt.Printf("seeded %s\n", rel)
+ }
return nil
})
if err != nil {
@@ -127,5 +133,13 @@ func main() {
os.Exit(1)
}
count, _ := store.Count()
- fmt.Printf("\n%d documents seeded, %d skipped, %d passages indexed\n", n, skipped, count)
+ // count is this process's own index, which holds only what THIS run
+ // chunked. A re-seed of an unchanged tree therefore reports zero, and
+ // that is success, not failure — so say which it is.
+ switch {
+ case count == 0 && n > 0:
+ fmt.Printf("\n%d documents checked, all unchanged — nothing to re-index\n", n)
+ default:
+ fmt.Printf("\n%d documents seeded, %d skipped, %d passages indexed\n", n, skipped, count)
+ }
}