Skip to content

fix(opt-report): report Ptr<Shape> provenance prefilters (#7112) - #7870

Merged
proggeramlug merged 1 commit into
mainfrom
fix/7112-ptr-shape-prefilter-report
Aug 11, 2026
Merged

fix(opt-report): report Ptr<Shape> provenance prefilters (#7112)#7870
proggeramlug merged 1 commit into
mainfrom
fix/7112-ptr-shape-prefilter-report

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • report direct let = new candidates rejected because their binding is boxed or module-global
  • classify both as rule 1 provenance compiler limitations instead of silently omitting them
  • preserve the ordinary-build collector path; the unfiltered rescan only runs while --opt-report recording is enabled

This completes the Ptr half left explicitly untouched by #7819, which covered the Ptr prefilters.

Reproduction

On clean main, the new collector test failed because a boxed allocation and a module-global allocation produced an empty report even though both are recognizable shape candidates. With this change, each produces exactly one local denial naming its prefilter, while neither is promoted.

Validation

  • cargo test -p perry-codegen provenance_prefilters_report_boxed_and_module_global_new_bindings (1 passed)
  • cargo test -p perry-codegen --lib (890 passed, 0 failed)
  • python3 scripts/check_test_registration.py (195 files, 4 registries)
  • bash scripts/check_file_size.sh

Closes #7112

Summary by CodeRabbit

  • New Features

    • Enhanced --opt-report to include boxed and module-global Ptr<Shape> candidates.
    • Reports why eligible candidates were not promoted, including storage-related limitations.
  • Bug Fixes

    • Prevented qualifying candidates from being omitted from optimization reports.
    • Ensured each denied candidate is reported once with the appropriate rule and reason.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9eb49271-2040-4176-b708-1bcd66020cd6

📥 Commits

Reviewing files that changed from the base of the PR and between ed97b9c and aebdd42.

📒 Files selected for processing (3)
  • changelog.d/7870-ptr-shape-prefilter-report.md
  • crates/perry-codegen/src/collectors/ptr_shape_opt_report_tests.rs
  • crates/perry-codegen/src/collectors/ptr_shape_report.rs

📝 Walkthrough

Walkthrough

--opt-report now records boxed and module-global Ptr<Shape> candidates rejected by storage prefilters. Reporting builds perform an additional unfiltered scan, while ordinary builds retain the existing scan. Tests verify denial metadata and the absence of promotion.

Changes

Ptr Shape reporting

Layer / File(s) Summary
Denial descriptors and candidate rescan
crates/perry-codegen/src/collectors/ptr_shape_report.rs
Rule-1 descriptors classify boxed and module-global bindings as compiler limitations. Enabled reports rescan these bindings and record their names, loop depths, class names, and denial reasons.
End-to-end reporting validation
crates/perry-codegen/src/collectors/ptr_shape_opt_report_tests.rs, changelog.d/7870-ptr-shape-prefilter-report.md
Tests verify one denial per candidate, rule-1 metadata, storage-specific reasons, and no promotion. The changelog documents the updated reporting behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • PerryTS/perry#6911: Extends related Ptr<Shape> candidate handling for storage-prefiltered bindings.
  • PerryTS/perry#7037: Introduces related ptr_shape_report candidate-seeding logic and end-to-end tests.
  • PerryTS/perry#7176: Adds related Ptr<Shape> allocation reporting cases and tests.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the opt-report change for Ptr provenance prefilters.
Description check ✅ Passed The description covers the change, related issue, reproduction, validation results, and scope.
Linked Issues check ✅ Passed The changes implement the Ptr prefilter reporting objectives in issue #7112 and preserve ordinary-build behavior.
Out of Scope Changes check ✅ Passed The changelog, implementation, and end-to-end test changes are directly related to the stated opt-report objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/7112-ptr-shape-prefilter-report

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proggeramlug
proggeramlug merged commit bc5426c into main Aug 11, 2026
9 of 53 checks passed
@proggeramlug
proggeramlug deleted the fix/7112-ptr-shape-prefilter-report branch August 11, 2026 17:35
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.

--opt-report: candidate-generation pre-filters for Ptr<Shape> / Ptr<NumArray> record nothing, so "0 candidates" cannot be read

1 participant