Skip to content

fix: tighten Poetry cache path matching#417

Open
karthiknadig wants to merge 3 commits intomainfrom
fix/issue-398
Open

fix: tighten Poetry cache path matching#417
karthiknadig wants to merge 3 commits intomainfrom
fix/issue-398

Conversation

@karthiknadig
Copy link
Copy Markdown
Member

Summary:

  • Match Poetry cache paths by ordered path components instead of raw substrings.
  • Preserve support for Linux/macOS cache layouts and the Windows pypoetry/Cache/virtualenvs layout.
  • Add tests for exact components, ordering, mixed case, substring false positives, and invalid Poetry environment names.

Validation:

  • cargo test -p pet-poetry
  • cargo fmt --all
  • cargo clippy --all -- -D warnings

Fixes #398

@karthiknadig karthiknadig requested a review from Copilot April 12, 2026 06:56
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 12, 2026

Performance Report (Linux) ✅

Metric PR (P50) PR (P95) Baseline (P50) Delta Change
Server Startup 1ms 1ms 1ms 0ms 0%
Full Refresh 95ms 210ms 96ms -1ms 0%

Results based on 10 iterations. P50 = median, P95 = 95th percentile.


Legend
  • 🚀 Significant speedup (>100ms faster)
  • ✅ Faster than baseline
  • ➖ No significant change
  • 🔺 Slower than baseline (>100ms)
  • ⚠️ Significant slowdown (>500ms)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 12, 2026

Performance Report (macOS)

Metric PR (P50) PR (P95) Baseline (P50) Delta
Server Startup 68ms 524ms 58ms 10ms
Full Refresh 121ms 27485ms 99ms 22ms

Results based on 10 iterations. P50 = median, P95 = 95th percentile.


Legend
  • 🚀 Significant speedup (>100ms faster)
  • ✅ Faster than baseline
  • ➖ No significant change
  • 🔺 Slower than baseline (>100ms)
  • ⚠️ Significant slowdown (>500ms)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 12, 2026

Test Coverage Report (Linux)

Metric Value
Current Coverage 73.8%
Base Branch Coverage 73.6%
Delta .2% ✅

Coverage increased! Great work!

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 12, 2026

Test Coverage Report (Windows)

Metric Value
Current Coverage 70.08%
Base Branch Coverage 69.86%
Delta 0.22% ✅

Coverage increased! Great work!

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 12, 2026

Performance Report (Windows) ➖

Metric PR (P50) PR (P95) Baseline (P50) Delta Change
Server Startup 10ms 13ms 8ms 2ms 25%
Full Refresh 180ms 1561ms 128ms 52ms 40.6%

Results based on 10 iterations. P50 = median, P95 = 95th percentile.


Legend
  • 🚀 Significant speedup (>100ms faster)
  • ✅ Faster than baseline
  • ➖ No significant change
  • 🔺 Slower than baseline (>100ms)
  • ⚠️ Significant slowdown (>500ms)

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Tightens Poetry cache environment detection in pet-poetry by replacing substring-based path checks with ordered path-component matching, addressing false positives described in #398 while keeping support for common Linux/macOS and Windows cache layouts.

Changes:

  • Replaced raw substring checks (.contains("pypoetry"), .contains("virtualenvs")) with ordered path-component detection.
  • Added targeted unit tests covering exact components, ordering, case-insensitivity, substring false positives, and invalid Poetry env names.
Show a summary per file
File Description
crates/pet-poetry/src/lib.rs Implements component-based cache path matching and adds unit tests to prevent regressions and false positives.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens Poetry cache-environment detection in pet-poetry by switching from raw substring checks to ordered path-component matching, reducing false positives for unusual directory names while preserving support for common Linux/macOS and Windows cache layouts.

Changes:

  • Replace substring-based cache path detection with ordered path-component matching (pypoetryvirtualenvs).
  • Add unit tests covering exact component matching, ordering, mixed case, and substring false positives.
  • Update comments to reflect the Poetry env naming pattern that includes a Python version suffix.
Show a summary per file
File Description
crates/pet-poetry/src/lib.rs Implements component-based Poetry cache path detection and adds tests for the new behavior.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens Poetry cache environment detection in pet-poetry by switching from substring-based path matching to ordered path-component matching, reducing false positives while keeping support for common Linux/macOS and Windows cache layouts.

Changes:

  • Replace Path substring checks with an ordered component scan (pypoetryvirtualenvs) via a new helper.
  • Update inline documentation around Poetry cache env naming to reflect the expected -py<major>.<minor> suffix.
  • Add unit tests covering exact component matching, ordering, mixed case, substring false positives, and invalid env names.
Show a summary per file
File Description
crates/pet-poetry/src/lib.rs Tightens Poetry cache path detection logic and adds focused regression tests to prevent substring false positives.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new

@karthiknadig karthiknadig marked this pull request as ready for review April 13, 2026 02:47
@karthiknadig karthiknadig enabled auto-merge (squash) April 13, 2026 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Poetry cache detection uses substring matching on path instead of path components

2 participants