Repository navigation
fix(index): resolve sibling refs of files outside BasePath - #738
Open
pcbeingused333 wants to merge 1 commit into
Open
pcbeingused333 wants to merge 1 commit into
pcbeingused333 wants to merge 1 commit into
Conversation
A relative ref in a file outside every local file system root was rejected by pathExistsInFS even though the file exists next to it, so resolution fell back to BasePath and could pick a different document with the same name. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #738 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 316 316
Lines 40239 40247 +8
=========================================
+ Hits 40239 40247 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Fixes #735
Root cause:
resolveRelativeFilePathonly accepted the path relative to the current file when it was inside a configured local file system root. For a file outsideBasePath,pathExistsInFSrejected the correct sibling, and resolution moved on toBasePath+ ref. If a file with that name existed there (here, the root spec), the ref silently resolved to the wrong document.Fix: before trying
BasePathand the other roots, the sibling of the current file is used if it exists on disk. This only applies when the current file's directory is absolute and a local file system reads straight from the OS (noDirFS). It does not widen what can be read: that same path is already returned, and opened, whenever no file of that name exists under a root. Virtual file systems behave as before.Tests:
TestIssue735_RelativeRefOutsideBasePathreproduces the layout from the issue and fails without the change.TestResolveRelativeFilePath_SiblingOutsideRootscovers the OS file system, aDirFSand a relative base directory.go test ./...passes.This change was prepared with the help of an AI coding assistant.