fix(model): resolve a dangling link's parent before judging where it points - #27
Merged
Conversation
…points Coverage found this. src/loaders.ts had one unreachable branch — the verdict for a CLAUDE.md symlink orly cannot resolve — and it was unreachable because the write guard refused the install first, naming the file as "outside the target repository" while it pointed squarely inside. safeRealpath resolved a dangling link lexically: `resolve(dirname(path), readlink(path))` against a caller that compares the answer to a realpath'd root. Wherever the repository itself sits behind a symlink — every macOS temporary directory, and plenty of real checkouts — the two sides were never comparable, and an in-repo link lost the comparison. Resolving the parent makes both sides canonical. A link that genuinely points out of the repository is refused exactly as before. src/loaders.ts is now at 100% line and function coverage: the stale-block replacement, the refresh of a CLAUDE.md orly wrote itself, and the dangling link the guard used to swallow. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DTMFyrbXJo3UrzQygaNtcn
…olve The loader section promised orly leaves your own CLAUDE.md alone, symlink included. Until the previous commit a dangling one refused the install instead, so the sentence was aspirational — and it did not say which links are refused and why. Both halves are now stated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DTMFyrbXJo3UrzQygaNtcn
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Chasing
src/loaders.tsto 100% coverage turned up a bug rather than a missing test.One branch was unreachable — the verdict for a
CLAUDE.mdsymlink orly cannot resolve — and it was unreachable because the write guard refused the whole install before ever reaching it, reporting a link that pointed squarely inside the repository as "outside the target repository".safeRealpathresolved a dangling link lexically:while its caller compares that answer against a realpath'd root:
Wherever the repository itself sits behind a symlink — every macOS temporary directory, and plenty of real checkouts — the two sides were never comparable and the in-repo link lost. Resolving the parent makes both canonical. A link that genuinely points out of the repository is refused exactly as before, and the existing escape test still proves it.
Coverage
src/loaders.tsgoes from 95.38% to 100% line and function coverage. Three tests, one per path that had none:CLAUDE.mdorly wrote itself is refreshed rather than left staleCLAUDE.mdsymlink is left alone, not written throughThe third is the one that found the bug.
Session notes 1
The README's loader section promised orly leaves your own
CLAUDE.mdalone, "symlink included" — which a dangling one disproved. It now says which links are left alone and which are refused, and why.src/model.tskeeps its two uncovered lines: they are theRulesModelclass declaration, and they were uncovered before this branch.Review
No findings.
orly gate prgreen on every criterion,make conformgreen, 173 tests pass.Make
Ships as 0.9.1.
🤖 Generated with Claude Code
https://claude.ai/code/session_01DTMFyrbXJo3UrzQygaNtcn