fix(core): match session directory case by filesystem identity - #49530
Closed
pascalandr wants to merge 1 commit into
Closed
pascalandr wants to merge 1 commit into
pascalandr wants to merge 1 commit into
Conversation
Directory-scoped session lists currently compare stored paths as exact SQL strings. A session moved to D:\codenomad disappears from a D:\CodeNomad listing even though both names refer to the same Windows directory. Resolve existing case variants at read time so historical sessions remain discoverable without rewriting their location or durable events. Use case folding only to identify candidate spellings among distinct directories matching the other selectors, then require filesystem resolution to establish identity. Reuse native Windows normalization because Bun's callback realPath can preserve caller spelling. Keep exact missing-directory histories readable, preserve workspace/search/parent and anchor filters, and apply the accepted directory set before LIMIT in both paging directions. This adds one distinct-directory query to directory-scoped lists and performs bounded filesystem resolution only for candidate aliases; project-wide lists keep their existing path. Add real-filesystem regressions for ASCII, accented and Greek names, pagination, selector isolation and missing directories. Determine the expected filesystem behavior by directory enumeration rather than reusing the resolution logic under test. Restoring the old exact predicate makes three tests fail on default Windows; the fix passes seven store tests on default and explicitly case-sensitive Windows directories. Core move/store tests pass (23 passed, one existing skip), four server instance/import tests pass, core typecheck and LF-normalized Prettier validation pass.
Contributor
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our 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.
Summary
Fix directory-scoped session discovery when a stored session location and the requested directory differ only by a spelling that the filesystem considers equivalent.
On a normal Windows filesystem, a session stored or moved to
D:\codenomadwas omitted fromGET /api/session?directory=D%3A%5CCodeNomad, despite both paths referring to the same directory and project.SessionStore.listused an exact SQL string comparison. This was observed through CodeNomad and reproduced directly against the native API.Implementation
NOCASEcomparison.FSUtil.normalizePathfor native Windows resolution: Bun's callback-basedrealPathcan preserve the caller's case even when the disk contains only one directory.LIMIT, retaining ordering and forward/backward page boundaries.Directory-scoped lists gain one distinct-directory query. Filesystem work is limited to candidate case variants with bounded concurrency and no persistent alias cache. Project-wide lists keep their existing query path. There is no public API/schema change.
Validation
Checkoutandcheckoutare two distinct entries there.Checkout/checkout,ÉQUIPE/équipe,Σ/ς, search/parent/workspace isolation, both paging directions and missing directories. The test oracle uses directory enumeration rather than the resolution implementation under test.git diff --checkpassed.Related discovery: NeuralNomadsAI/CodeNomad#649. This is a separate native-runtime fix, independent of that PR's worktree conversation-placement instruction.