fix: ensure workspace environments are found when searchKind is provided#346
Draft
karthiknadig wants to merge 5 commits intomainfrom
Draft
fix: ensure workspace environments are found when searchKind is provided#346karthiknadig wants to merge 5 commits intomainfrom
karthiknadig wants to merge 5 commits intomainfrom
Conversation
Test Coverage Report (Linux)
Coverage increased! Great work! |
Performance Report (Linux) ✅
Legend
|
Test Coverage Report (Windows)
Coverage increased! Great work! |
Performance Report (Windows) ✅
Legend
|
Performance Report (macOS)
Legend
|
There was a problem hiding this comment.
Pull request overview
Fixes environment discovery when refresh is called with searchKind but without searchPaths, ensuring workspace-based environments (notably Venv) are still discoverable (Issue #151).
Changes:
- Adjust
handle_refreshto keepworkspace_directorieswhen onlysearchKindis provided, instead of restricting discovery to global locations only. - Add a regression test intended to validate
searchKindbehavior with workspace venv discovery.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
crates/pet/src/jsonrpc.rs |
Updates refresh-scoping logic so searchKind doesn’t inadvertently prevent workspace environment discovery. |
crates/pet/src/find.rs |
Adds a new test attempting to cover the reported searchKind/workspace discovery regression. |
Addresses PR review comments:
1. Extract the refresh-option→config/search_scope logic into a helper
function �uild_refresh_config that can be unit tested
2. Add fast, deterministic unit tests that directly test the bug fix:
- test_search_kind_preserves_workspace_directories: verifies the
critical fix that workspace_directories are NOT cleared when only
searchKind is provided
- test_search_paths_replaces_workspace_directories: verifies
searchPaths still correctly replaces workspace_directories
- test_no_options_preserves_config: verifies default behavior
3. Remove the slow integration-style test from find.rs that was
environment-dependent and didn't actually test the bug in handle_refresh
Fixes #151
- Change build_refresh_config from pub to pub(crate) to avoid expanding API surface - Use tempfile::TempDir in test for deterministic is_dir() behavior
searchKind now preserves workspace_directories so workspace-based environments (venvs, virtualenvs) can be discovered.
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 #151