fix(project): use directory root for non-git projects#33668
Open
lin-hongkuan wants to merge 1 commit into
Open
fix(project): use directory root for non-git projects#33668lin-hongkuan wants to merge 1 commit into
lin-hongkuan wants to merge 1 commit into
Conversation
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 #24694
Type of change
What does this PR do?
When
ProjectV2.resolve()returns no VCS,Project.fromDirectory()was using/as the global project worktree/sandbox. That makes tool permission paths relative to the filesystem root, so a project file such assrc/secret.tscan be checked as a long root-relative path fragment instead of the project-relative rule users configured.This keeps git behavior unchanged, but normalizes the opened directory once and uses it as the non-git worktree/sandbox.
containsPath()keeps its/guard for legacy persisted rows so old data cannot make the filesystem root count as in-project.Regression coverage now checks that:
Project.fromDirectory()returns the opened directory for non-git worktree/sandbox.InstanceStore.load()exposes the opened directory as the non-git instance worktree.src/secret.ts.How did you verify your code works?
bun test test/project/project.test.tsbun test test/project/instance.test.tsbun test test/tool/read.test.tsbun run typecheckgit diff --checkScreenshots / recordings
Not applicable, no UI change.
Checklist