fix(vectorstore): walk and read the brain through brainfs (#157, slice 3)
Sync walked wiki/ and knowledge/ with filepath.WalkDir and read each .md with os.ReadFile. A symlinked note (Syncthing syncs symlinks) had its target embedded into pgvector and served by semantic search; a FIFO stalled the sync. The walk and read now go through brainfs: regular files only, type checked on the opened handle. - Chunks already embedded from a symlinked note are deleted on the next sync, because the note is no longer seen. - A walk error still aborts Sync before the delete pass, so an unreadable subdir does not delete chunks of files that exist. A missing scan dir is skipped as before. - brainfs gains Lstat, used for the mtime staleness check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,12 @@ func (b *Brain) Rel(path string) (string, error) {
|
||||
return filepath.ToSlash(rel), nil
|
||||
}
|
||||
|
||||
// Lstat stats a brain-relative path through the root without following a
|
||||
// final symlink.
|
||||
func (b *Brain) Lstat(rel string) (fs.FileInfo, error) {
|
||||
return b.root.Lstat(filepath.ToSlash(rel))
|
||||
}
|
||||
|
||||
// ReadRegular reads a brain-relative path, refusing anything that is not a
|
||||
// regular file, both before the open and on the opened handle.
|
||||
func (b *Brain) ReadRegular(rel string) ([]byte, error) {
|
||||
|
||||
Reference in New Issue
Block a user