fix: normalize filepath in FileTime to prevent Windows path mismatch#20367
Open
JosXa wants to merge 1 commit intoanomalyco:devfrom
Open
fix: normalize filepath in FileTime to prevent Windows path mismatch#20367JosXa wants to merge 1 commit intoanomalyco:devfrom
JosXa wants to merge 1 commit intoanomalyco:devfrom
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Based on my search results, I found two related PRs about Windows path normalization that might be relevant:
These PRs appear to address similar Windows path normalization issues, though they focus on session queries rather than FileTime specifically. However, they're addressing the same underlying problem of path format inconsistencies on Windows. You may want to verify if there's any overlap in scope or if these should be coordinated. |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
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.
Issue for this PR
Closes #20354
Type of change
What does this PR do?
On Windows, the
Readtool normalizes file paths (forward slashes to backslashes, canonical casing viarealpathSync.native) before callingFileTime.read(), which stores the normalized path as a Map key. ButWriteandEdittools pass the raw path (often with forward slashes from LLM output) toFileTime.assert(), which looks up the un-normalized key and fails with a false "must read file before editing/writing" error.The fix adds
Filesystem.normalizePath()at the entry of all fourFileTimeEffect functions (read,get,assert,getLock). This is the single choke point where all file-time operations converge, so normalizing here guarantees consistent Map keys regardless of how callers format the path. On non-Windows platforms,normalizePathis a no-op, so there's no behavioral change.How did you verify your code works?
bun dev runwith the exact repro steps from the issue (Read with forward slashes then Edit/Write with same forward-slash path) - both succeeded without errorScreenshots / recordings
N/A - no UI change
Checklist