| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2f537bc5-b389-4ee2-aac2-e2b83be47f5c
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2f537bc5-b389-4ee2-aac2-e2b83be47f5c
| Back | FazBrowse Home | New Git URL |
Summary
Fixes microsoft/vscode-python-environments#1681
Related to microsoft/vscode-python-environments#1671
Context
The Python Environments extension can discover and manage Conda environments that do not currently have Python installed. It intentionally exposes those entries to its Environment Manager UI as placeholders:
That is useful in the management UI, but the entry is not a selectable Python interpreter.
Users reported that PET and Environment Manager showed every Conda environment while both Python: Select Interpreter and Jupyter's Python-environment kernel picker showed only System Python and the current project environment. Both users confirmed that Python was delegating discovery to the Python Environments extension, ruling out the legacy discovery path.
One user then performed a reversible A/B test:
Root cause
src/client/envExt/envExtApi.ts translates Python Environments API objects into the legacy PythonEnvInfo format consumed by Python and Jupyter.
The adapter previously parsed every version unconditionally:
parseVersion('no-python') throws invalid version no-python.
Environment-list changes arrive as a batch and were processed by an unguarded forEach. When the no-Python placeholder appeared before valid Conda environments, its conversion exception aborted the callback, so every valid item later in that batch was lost:
System environments arrive through a separate valid batch, and individually resolved/current environments can use separate paths, explaining the restricted list users observed.
Refresh did not self-heal because each Conda refresh sent another batch containing the same placeholder and failed at the same conversion point.
Fix
Safe version conversion
A shared EnvExt conversion helper now:
Both discovery-list conversion and active-interpreter compatibility conversion use this boundary.
Per-item fault isolation
Every environment-list change is processed independently. A malformed runtime item is logged and skipped without preventing later valid items from reaching Python/Jupyter.
Active-environment events are emitted only when every supplied side can be converted, avoiding synthetic partial clear/set transitions while preserving normal valid set, clear, and change behavior.
Consistent removal identity
Adds are keyed by the Python executable path. Removals now derive the same executable identity from the source environment. Previously Conda removals used the environment prefix, so they generally could not remove an entry stored by interpreter executable.
Behavior and compatibility
The valid hot path adds only a helper call and the existing version parse. There are no new filesystem operations, environment discovery calls, or background tasks.
Tests
New adapter coverage includes:
Validation performed:
The complete diff also went through two code-review passes and a design-focused review; no production issues remained after addressing malformed-event and active set/clear coverage.
Follow-up
The EnvExt adapter currently relies on change events rather than hydrating an authoritative initial snapshot. That is a separate resilience concern; this PR intentionally targets the user-confirmed no-python batch-abort failure.