Repository navigation
🐛 fix(device-control): keep nested Windows project files in their folders - #21755
Open
markjoin123 wants to merge 1 commit into
Open
markjoin123 wants to merge 1 commit into
markjoin123 wants to merge 1 commit into
Conversation
…ders Git for Windows reports the repo root with forward slashes, while path.resolve uses backslashes. The directory walk compared those forms directly, so parent folders were dropped and nested files flattened onto the project root. Normalize both paths before the containment check, and stop at the root.
|
@markjoin123 is attempting to deploy a commit to the LobeHub OSS Team on Vercel. A member of the Team first needs to authorize it. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This branch has not been deployed
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
Contribution source: AI-assisted
On Windows, the conversation Files tree showed nested project files directly under the project root. The files were in the right repository, but their parent folders were missing.
collectProjectDirectoriescompared the Git root fromgit rev-parse --show-toplevel(D:/repo) with parents produced bypath.resolve(D:\repo\src\nested). Those strings use different separators, socurrent.startsWith(`${root}${path.sep}`)never matched and no parent directory entries were emitted. The tree then attached each file to the project root.The walk now normalizes the root and each candidate before the containment check, and it stops at the normalized root without emitting the root itself. POSIX behavior is unchanged.
Test
Tested locally
Added/updated tests
No tests needed
Acceptance:
packages/device-control/src/__tests__/projectFileIndex.test.tsruns the collector withpath.win32and a Git-style rootD:/repoplussrc/nested/example.ts. Before normalization those cases returned no parents. After the fix they returnsrc/andsrc/nested/, the root is not an entry, shared parents are deduped, and a root-level file adds no directory. The same assertions withpath.posixstill returnsrc/andsrc/nested/and do not emit/repo. Package suite: 14 files, 165 tests passed.bun run check --lint --test --typeon the two touched files was lint clean, 19 tests passed, types clean. A Windows desktop UI pass was not run.🔗 Related Issue
Fixes #21699
AI assistance
path.resolvemakes the existing prefix walk match, and stopping at the normalized root keeps the project root itself out of the child list. Injecting the path API lets Linux CI run that walk withpath.win32without changing POSIX results.