-
Notifications
You must be signed in to change notification settings - Fork 36
Description
Problem
When a venv's prefix path is a symlink, the telemetry prefix comparison in report_inaccuracies_identified_after_resolving produces a false positive "Prefix is incorrect" warning.
Example: A venv at /usr/local/venvs/myvenv is a symlink to /usr/local/venvs/versioned/myvenv-1.0.51. During discovery, PET sets the prefix from the filesystem path (/usr/local/venvs/myvenv), but when resolving by spawning Python, sys.prefix returns the canonical path (/usr/local/venvs/versioned/myvenv-1.0.51). The direct path equality check flags this as an inaccuracy even though both paths refer to the same directory.
Root Cause
In crates/pet-telemetry/src/lib.rs, the prefix comparison does a direct != check:
let mut invalid_prefix = env.prefix.clone().unwrap_or_default() != resolved.prefix.clone()?;On Unix, norm_case is a no-op, so symlinks are never resolved before comparison.
Fix
Canonicalize both prefix paths before comparing so that symlinked venvs are correctly identified as the same location.
Related: #357