fix(linkcheck): keep the write when the link index cannot be built (#178)
StripUnresolvedLinks runs before every brain_write and brain_update. Any walk error below a linked tree's root (e.g. one unreadable subdirectory) made it return an error, and the write was refused: the learning was lost. Already true on main. It now logs a warning and returns the content unchanged: a partial index cannot tell an invented link from one into the unreadable part, so it unwraps nothing (never inventing a resolution) and the note is written with its links as given. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -47,7 +47,12 @@ var (
|
||||
func StripUnresolvedLinks(brainDir, content string) (string, []string, error) {
|
||||
index, err := entryIndex(brainDir)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
// A partial index cannot tell an invented link from one into the
|
||||
// part it could not read, so unwrap nothing, and do not refuse the
|
||||
// write either: this runs before every brain_write, and a refused
|
||||
// write is a lost learning (hyperguild#178).
|
||||
slog.Warn("link check skipped: cannot index the brain", "err", err)
|
||||
return content, nil, nil
|
||||
}
|
||||
if len(index) == 0 {
|
||||
return content, nil, nil
|
||||
|
||||
Reference in New Issue
Block a user