Summary
is_poetry_cache_environment in crates/pet-poetry/src/lib.rs checks if a path contains the substrings "pypoetry" and "virtualenvs" using .contains(). This could false-match on unusual directory names like C:\Users\pypoetry_user\virtualenvs_backup\something.
Details
The function combines substring matching with POETRY_ENV_NAME_PATTERN (regex on the final directory name), which adds precision. However, the path containment check is overly permissive.
Proposed Fix
Check actual path components rather than substring matching — e.g., verify that "pypoetry" and "virtualenvs" appear as separate path segments.
Impact
Low in practice, since the regex pattern on the directory name provides additional filtering. But it's a defense-in-depth improvement.