fix(linkcheck): keep the write when the link index cannot be built (#178) #191

Merged
mathias merged 1 commits from fix/linkcheck-keeps-write-178 into main 2026-10-05 21:16:04 +00:00
Owner

Fixes #178. risk/low: data-hygiene behaviour, not a security control. It makes the link check fail open toward keeping the write, and never unwraps or invents a link it cannot verify.

Problem

StripUnresolvedLinks runs before every brain_write and brain_update. Any walk error below a linked tree's root, such as one unreadable subdirectory, returned an error, and the write was refused: the learning was lost. This was already the case on main.

Change

On an index error it logs a warning and returns the content unchanged. A partial index can't tell an invented link from one that points into the unreadable part, so nothing is unwrapped and the note is written with its links as given.

Tests

  • TestStripUnresolvedLinksKeepsContentWhenTheIndexCannotBeBuilt, with a positive control: once the tree is readable again, the strip runs.
  • TestWriteNoteKeepsTheLearningWhenTheLinkCheckCannotIndex: the end-to-end brain_write case.
  • Flip: restoring refuse-on-error turns both red.

🤖 Generated with Claude Code


Created via git-mcp on behalf of @mathias

Fixes #178. risk/low: data-hygiene behaviour, not a security control. It makes the link check fail open toward *keeping the write*, and never unwraps or invents a link it cannot verify. ## Problem `StripUnresolvedLinks` runs before every brain_write and brain_update. Any walk error below a linked tree's root, such as one unreadable subdirectory, returned an error, and the write was refused: **the learning was lost**. This was already the case on main. ## Change On an index error it logs a warning and returns the content **unchanged**. A partial index can't tell an invented link from one that points into the unreadable part, so nothing is unwrapped and the note is written with its links as given. ## Tests - `TestStripUnresolvedLinksKeepsContentWhenTheIndexCannotBeBuilt`, with a positive control: once the tree is readable again, the strip runs. - `TestWriteNoteKeepsTheLearningWhenTheLinkCheckCannotIndex`: the end-to-end brain_write case. - **Flip:** restoring refuse-on-error turns both red. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- _Created via git-mcp on behalf of @mathias_
mathias added 1 commit 2026-10-05 20:44:58 +00:00
fix(linkcheck): keep the write when the link index cannot be built (#178)
CI / Mirror to GitHub (pull_request) Skipped
CI / Lint / Test / Vet (pull_request) Successful in 1m13s
2f8b03fe15
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>
mathias added the risk/low label 2026-10-05 20:45:03 +00:00
mathias merged commit bd989f887f into main 2026-10-05 21:16:04 +00:00
Sign in to join this conversation.