Skip to content

[codex] Add deterministic partial-port audit - #110

Merged
Vilin97 merged 3 commits into
mainfrom
codex/partial-port-audit
May 19, 2026
Merged

Vilin97 merged 3 commits into
mainfrom
codex/partial-port-audit

Conversation

@Vilin97

@Vilin97 Vilin97 commented May 18, 2026

Copy link
Copy Markdown
Collaborator

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 check
  • uv run --group test pytest
  • Manual smoke checks:
    • flags origin/import/fineqs by LOC ratio
    • flags origin/import/directed-topology-lean-4 for missing Lean4/directed_van_kampen.lean
    • does not flag origin/import/virasoroproject

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.

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_audit module implementing diff scan, upstream clone, stem normalization, LOC counting (reuses _strip_lean_comments from quality), and the suspicion heuristic in evaluate_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 Audit GitHub Actions workflow that runs the audit on PRs touching LeanPool/**.

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.

@Vilin97
Vilin97 merged commit 14535cd into main May 19, 2026
9 checks passed
@Vilin97
Vilin97 deleted the codex/partial-port-audit branch May 19, 2026 05:58
@Vilin97
Vilin97 restored the codex/partial-port-audit branch May 19, 2026 07:01
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