Skip to content

Fix public-only coverage for excluded re-export origins#4048

Open
WilliamK112 wants to merge 1 commit into
facebook:mainfrom
WilliamK112:codex/pyrefly-public-reexports-4034
Open

Fix public-only coverage for excluded re-export origins#4048
WilliamK112 wants to merge 1 commit into
facebook:mainfrom
WilliamK112:codex/pyrefly-public-reexports-4034

Conversation

@WilliamK112

Copy link
Copy Markdown

Summary:

  • keep project-local origins of public re-exports in coverage check --public-only even when the origin file is matched by --project-excludes
  • preserve the inverse case: if the public re-export location itself is excluded, the private origin is not counted as public
  • add production-shape coverage tests that exercise file-args mode, where package __init__.py may be loaded as __unknown__

Closes #4034.

Duplicate/ownership checks:

Validation:

  • cargo +stable-x86_64-pc-windows-gnu test -p pyrefly --lib commands::coverage::collect::tests::test_public_only -- --nocapture
  • cargo +stable-x86_64-pc-windows-gnu test -p pyrefly --lib commands::coverage::collect::tests::test_compute_public_fqns -- --nocapture
  • cargo +stable-x86_64-pc-windows-gnu test -p pyrefly --lib coverage -- --nocapture (65 passed)
  • real temp-project smoke: pyrefly coverage check foo --public-only --project-excludes foo/_something_private.py now reports foo._something_private.bar as coverage-partial and exits 1 at 50% coverage instead of reporting 100.00% (0 of 0 typable)
  • cargo +stable-x86_64-pc-windows-gnu fmt --all --check
  • git diff --check

I also ran cargo +stable-x86_64-pc-windows-gnu test -p pyrefly --lib; it reached 6185 passed before 5 existing shape_dsl tests hit their internal > 20s watchdog under the full Windows run. Each of those five tests passed when rerun individually.

@meta-cla meta-cla Bot added the cla signed label Jul 5, 2026
@github-actions github-actions Bot added the size/l label Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pyrefly coverage check --public-only: --project-excludes shouldn't exclude public re-exports

1 participant