fix: pipeline, backfill, watcher and archive writes go through the brain root (#158 part B)
The remaining writers created or rewrote brain files by path: - pipeline buildAndWrite: os.MkdirAll + os.WriteFile of every page. - BackfillRefs: os.WriteFile of each concept page; a page swapped for a symlink after the read was written through (the race test overwrote an in-brain target before this change). - watcher: the raw/processed and raw/failed archive copies (os.Create), the .processed/.failed markers and the log.md entry (os.OpenFile). - cmd/server: the claude-session archive. All now go through brainfs PutRegular/AppendRegular (new package-level PutFile/AppendFile for one-off writers: the watcher's call-site lint bans .Open calls in that file so raw/ reads stay on OpenRegular). Stacked on #189 (needs PutRegular/AppendRegular). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,8 +7,6 @@ import (
|
||||
"fmt"
|
||||
"github.com/mathiasbq/hyperguild/ingestion/internal/brainfs"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/mathiasbq/hyperguild/ingestion/internal/wiki"
|
||||
@@ -90,8 +88,7 @@ func BackfillRefs(ctx context.Context, brainDir string) (int, error) {
|
||||
}
|
||||
|
||||
for relPath, page := range pending {
|
||||
dest := filepath.Join(brainDir, filepath.FromSlash(relPath))
|
||||
if err := os.WriteFile(dest, []byte(page.Content), 0o644); err != nil {
|
||||
if err := bfs.PutRegular(relPath, []byte(page.Content)); err != nil {
|
||||
return 0, fmt.Errorf("write %s: %w", relPath, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user