Skip to content

feat: validate uv workspace members/excludes and discover parent workspaces (Fixes #290)#352

Draft
karthiknadig wants to merge 2 commits intomainfrom
feature/issue-290
Draft

feat: validate uv workspace members/excludes and discover parent workspaces (Fixes #290)#352
karthiknadig wants to merge 2 commits intomainfrom
feature/issue-290

Conversation

@karthiknadig
Copy link
Member

Addresses the TODO items in pet-uv for workspace member/exclude validation.

Changes

  • Parse [tool.uv.workspace] members and exclude fields instead of using IgnoredAny
  • Add is_workspace_member() with glob pattern matching (using require_literal_separator so * doesn't cross directory boundaries)
  • Walk up parent directories via find_workspace_for_project() to discover workspace roots
  • Stop at the first workspace found — if the project isn't a member of it, it's not part of any workspace
  • Add glob dependency to pet-uv
  • 9 new tests covering member matching, exclusion, implicit members, parent discovery, and deserialization

Fixes #290

cc @zsol — would appreciate your input since you authored the original pet-uv workspace support in #263.

@github-actions
Copy link

github-actions bot commented Feb 24, 2026

Performance Report (Linux) ➖

Metric PR (P50) PR (P95) Baseline (P50) Delta Change
Server Startup 1ms 1ms 1ms 0ms 0%
Full Refresh 97ms 311ms 97ms 0ms 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

github-actions bot commented Feb 24, 2026

Test Coverage Report (Linux)

Metric Value
Current Coverage 64.8%
Base Branch Coverage 64.0%
Delta .8% ✅

Coverage increased! Great work!

@github-actions
Copy link

github-actions bot commented Feb 24, 2026

Performance Report (Windows) ✅

Metric PR (P50) PR (P95) Baseline (P50) Delta Change
Server Startup 9ms 12ms 11ms -2ms -18.2%
Full Refresh 150ms 1606ms 229ms -79ms -34.5%

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

github-actions bot commented Feb 24, 2026

Test Coverage Report (Windows)

Metric Value
Current Coverage 61.09%
Base Branch Coverage 60.21%
Delta 0.88% ✅

Coverage increased! Great work!

@karthiknadig
Copy link
Member Author

@zsol This is my attempt at addressing the TODOs in the uv crate. Let me know what you think.

@github-actions
Copy link

github-actions bot commented Feb 24, 2026

Performance Report (macOS)

Metric PR (P50) PR (P95) Baseline (P50) Delta
Server Startup 78ms 781ms 47ms 31ms
Full Refresh 154ms 34236ms 101ms 53ms

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
Contributor

@zsol zsol left a comment

Choose a reason for hiding this comment

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

looks good to me, I had one comment

Address @zsol's review: find_workspace_for_project now iterates from
project_path (not parent) so a project that also defines
[tool.uv.workspace] is discovered. The workspace root is always
considered a member of its own workspace (early return on empty
relative path). Two new tests cover the self-workspace case.
Copy link

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 completes pet-uv’s uv workspace support by parsing and validating [tool.uv.workspace] members/exclude rules and by discovering workspace roots by walking up parent directories, improving correctness in monorepo/workspace layouts.

Changes:

  • Parse [tool.uv.workspace] into a structured UvWorkspace (instead of IgnoredAny) and add membership validation via glob matching.
  • Add parent-directory workspace discovery (find_workspace_for_project) and factor workspace env construction into build_workspace_env.
  • Add the glob dependency and extend the test suite with coverage for matching/exclusion and parent discovery.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
crates/pet-uv/src/lib.rs Implements workspace member/exclude validation, parent workspace discovery, and adds tests for the new behavior.
crates/pet-uv/Cargo.toml Adds the glob dependency needed for workspace glob matching.
Cargo.lock Locks the new glob dependency for pet-uv.

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.

Feature: Complete TODO items in pet-uv for workspace support

3 participants