Skip to content

Make /review and /profile refactor-aware - #262

Merged
Vilin97 merged 1 commit into
mainfrom
vasily/refactor-aware-review-profile
Jul 20, 2026
Merged

Vilin97 merged 1 commit into
mainfrom
vasily/refactor-aware-review-profile

Conversation

@Vilin97

@Vilin97 Vilin97 commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Makes /review and /profile detect whether a PR adds a new project or refactors projects already in the pool — the same added-vs-modified split /profile already uses — and handle each appropriately.

/review — refactor vs. new-project

classify_pr() (python/lean_pool/review.py) reads PR file statuses via the GitHub API. A project directory that appears only through added .lean files is a new project → the existing fit/significance review (.github/REVIEW_RULES.md, unchanged). A PR that only changes projects already in the pool is a refactor → a new tech-debt review (.github/REFACTOR_REVIEW_RULES.md): brittle automation (structured proof → opaque simp_all that breaks on Mathlib bumps), lost proof structure, compile-cost regressions, reusability lost. The comment header, assessment table (scope / tech-debt / maintainability / brittleness / risk), and rules-link switch by kind. No workflow change needed — classification runs inside review.py.

/profile — statement-change stat

New scripts/proof-profile/statements.py: a stdlib-only port of physlib's check_golf.py declaration parser, trimmed to statement comparison. It ignores proof golf, definition-body edits, and by-blocks embedded in a type, flagging only genuine type changes. render.py reports, for modified files, "✅ No statements changed — all N tracked declarations kept their type" or "⚠️ K changed" with the list — the reassurance that a refactor restated no theorem. It runs on pure text (no build), so it shows even when the heartbeat comparison is skipped, and is absent for new-project PRs. The report job fetches the new module.

Two fixes over the check_golf original (both also affect the live parser upstream):

  1. A line-leading absolute-value bar in a type (|x| ≤ ε, common in analysis/number theory) is no longer misread as an equation-compiler arm — an arm's => must precede any top-level :=/where.
  2. _-prefixed unused-hypothesis renames (hM → _hM) are alpha-equivalent, so they're reported in a separate binder_renamed bucket (proposition unchanged) rather than as statement changes.

Validation

Ran both on the two large golfs on main:

156 pytest pass (new: classification + refactor rendering in test_review.py, parser in test_statements.py); ruff clean. Infra/tooling/docs only — no LeanPool/ content.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QDRfjJLhVEoZ9WQaYwGUgC

Detect whether a PR adds a new project or refactors projects already in the
pool — the same added-vs-modified split /profile uses — and handle each
appropriately.

/review (python/lean_pool/review.py): classify_pr() reads PR file statuses
and routes new-project PRs to the existing fit/significance rules
(.github/REVIEW_RULES.md) and refactor PRs to new tech-debt rules
(.github/REFACTOR_REVIEW_RULES.md) — brittle automation, lost structure,
perf regressions, reusability lost. The comment header, assessment table,
and rules link switch by kind.

/profile statement stat (scripts/proof-profile/statements.py): a stdlib-only
port of physlib's check_golf.py declaration parser, trimmed to statement
comparison, reporting how many declarations — and which — changed their
statement rather than only their proof/body. render.py surfaces it for
modified files ("N statements changed" / "no statements changed"); the
report job fetches the new module. Two fixes over the check_golf original:
a line-leading absolute-value bar in a type is no longer misread as an
equation-compiler arm, and _-prefixed unused-hypothesis renames are reported
separately (proposition unchanged) rather than as statement changes.

Tested on the two large golfs on main, #246 (simp_all sweep) and #187
(whole-library compression): both show 0 real statement changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QDRfjJLhVEoZ9WQaYwGUgC
Copilot AI review requested due to automatic review settings July 20, 2026 06:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Vilin97
Vilin97 merged commit fa4dd7f into main Jul 20, 2026
10 checks passed
@Vilin97
Vilin97 deleted the vasily/refactor-aware-review-profile branch July 20, 2026 06:40
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.

2 participants