Skip to content

Deduplicate Windows Conda environments discovered with casing aliases #518

Description

Problem

On case-insensitive Windows filesystems, authoritative Conda paths such as C:\Users\user\Miniconda3 can be discovered alongside PET's lowercase well-known guess C:\Users\user\miniconda3. Both address the same installation, but get_environments() preserves the caller's install-prefix spelling and final deduplication is case-sensitive, so PET reports every environment twice.

norm_case() does not eliminate this scenario: GetLongPathNameW can restore the final component's spelling while preserving the caller-provided casing of parent components. A direct mixed-case filesystem probe reproduces that behavior on current Windows.

Reported originally in microsoft/vscode-python-environments#1703.

Scope

  • Preserve the actual on-disk spelling of a discovered Conda install root without resolving symlinks or junctions.
  • Ensure a child environment under an install's envs directory is represented through the corrected install-root discovery rather than retaining a differently cased caller prefix.
  • Deduplicate authoritative and well-known casing aliases before environment metadata is loaded/reported.
  • Keep non-Windows path semantics unchanged.
  • Avoid additional interpreter/process spawning and demonstrate no discovery-performance regression.

Acceptance criteria

  • A Windows install physically named Miniconda3 is reported once when discovered as both Miniconda3 and miniconda3.
  • Base and child prefixes use the on-disk Miniconda3 spelling.
  • Junction identity is preserved.
  • Windows regression tests cover base and child environments with casing aliases.
  • Targeted tests, full Rust tests, format, clippy, coverage, and performance gates pass.

Fixes microsoft/vscode-python-environments#1703.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue identified by VS Code Team member as probable bugimportantIssue identified as high-priority

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions