Repository navigation
[codex] Add deterministic partial-port audit - #110
Merged
Merged
Conversation
This was referenced May 18, 2026
Vilin97
marked this pull request as ready for review
May 18, 2026 12:21
There was a problem hiding this comment.
Pull request overview
Adds a deterministic Partial Port Audit that catches the "importer stopped early" failure mode for content PRs. For each changed LeanPool project whose source.github_repo is set, the checker clones the upstream repo and compares non-comment Lean LOC and filenames against the imported files; it fails the PR with a concrete report when the import is suspiciously incomplete (LOC ratio below tolerance, or a sufficiently large upstream file with no matching import stem).
Changes:
- New
lean_pool.partial_port_auditmodule implementing diff scan, upstream clone, stem normalization, LOC counting (reuses_strip_lean_commentsfromquality), and the suspicion heuristic inevaluate_stats. - New pytest suite covering LOC counting, stem normalization, LOC-ratio gap, missing-large-file detection, ratio-gap fallback to largest unmatched files, and acceptance of near-complete imports.
- New
Partial Port AuditGitHub Actions workflow that runs the audit on PRs touchingLeanPool/**.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| python/lean_pool/partial_port_audit.py | Core auditor: diff parsing, projects.yml loading, shallow clone, stats, evaluation, CLI. |
| python/tests/test_partial_port_audit.py | Unit tests for LOC counting, stem matching, and the partial-import heuristics. |
| .github/workflows/partial-port-audit.yml | PR workflow that syncs Python deps and invokes the audit against the PR base. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a deterministic Partial Port Audit workflow for content PRs. For each changed LeanPool project with
source.github_repo, the checker clones the upstream GitHub repo, counts non-comment Lean files/LOC, compares that with the imported project files in the PR, and fails with a concrete report when the import is suspiciously incomplete.The check is intentionally outside the LLM reviewer: it catches the importer-stopped-early failure mode before model judgment, including cases where a headline file is omitted even if total LOC is close.
Validation
uv run ruff checkuv run --group test pytestorigin/import/fineqsby LOC ratioorigin/import/directed-topology-lean-4for missingLean4/directed_van_kampen.leanorigin/import/virasoroproject