Skip to content

fix: check_generated_files_current.py now rebuilds from source, not f… - #508

Merged
yakew7 merged 1 commit into
yakew7:mainfrom
propcgamer20-png:fix-check-generated-files-rebuild
Sep 9, 2026
Merged

fix: check_generated_files_current.py now rebuilds from source, not f…#508
yakew7 merged 1 commit into
yakew7:mainfrom
propcgamer20-png:fix-check-generated-files-rebuild

Conversation

@propcgamer20-png

Copy link
Copy Markdown
Collaborator

…rom HEAD

It only ever diffed the working tree against 'git show HEAD:' - so editing a source .md without running 'make build-explainers' afterward still reported "up to date", as long as nothing was committed yet. Confirmed exactly the issue's repro (git worktree add + append a line to explainers/demographic-parity.md) now correctly fails with 'content differs from a fresh regeneration' where it used to pass.

_fresh_build_dir() now does the real regeneration: a git worktree checked out to HEAD (shares this repo's object database/history, so git-log-derived dates resolve identically to a build done in ROOT itself), with every currently-tracked file's working-tree content copied on top before running build_explainers.py, generate_og_images.py, and freeze_paper_results.mirror_for_mcp() inside it - the same sequence build-explainers.yml runs, now run by this script itself instead of assumed to have already happened. The worktree is cleaned up via ExitStack regardless of what happens after.

Updated tests/test_check_generated_files_current.py to monkeypatch _fresh_build_dir directly (pre-populated stub directory) instead of faking 'git show', per the file's own stated testing philosophy of avoiding a real git repo in unit tests. Added a regression test for the exact scenario in the bug report.

Verification: reproduced the issue's exact repro against the unmodified script (confirmed it passed when it shouldn't), then against the fixed script (confirmed it now fails with the right reason). All 9 tests/test_check_generated_files_current.py tests pass; full suite is 402 passed, 1 skipped, 4 failed - the 4 failures are tests/test_xlsx_edge_cases.py, confirmed identical on unmodified main (SheetJS CDN returns HTTP 403 in this sandbox), unrelated to this change.

Fixes #502

Summary

Type

  • Audit
  • Explainer
  • Bug fix
  • Other

Audit checklist

  • I opened or linked a corresponding issue first
  • The folder is named after the domain, not the dataset
  • unfair.py includes protected attributes and prints the required output format
  • fair.py removes protected attributes and identified proxy variables
  • Both scripts use random_state=42 and an 80/20 train/test split
  • Proxy variables were actually tested, not just guessed
  • unfair.png and fair.png are included as PNG screenshots
  • The dataset is public and accessible without login or payment
  • The dataset file is included, or DATA.md is included if the file is too large
  • README.md includes the new results row and audit section
  • A notebook was added if the audit benefits from one

Before fairness gap:

After fairness gap:

Reduction:

Protected attribute(s):

Proxy variables dropped:


Explainer checklist

  • The file is in explainers/ and uses lowercase hyphenated naming
  • It includes a plain-language definition
  • It uses a real example from this repo or a documented real-world case
  • It includes runnable Python detection or measurement code
  • It acknowledges limitations or trade-offs
  • It links to related explainers or repo projects
  • It includes 2-3 primary sources
  • The Explainers table in README.md was updated

Linked issue

Closes #

…rom HEAD

It only ever diffed the working tree against 'git show HEAD:<path>' - so
editing a source .md without running 'make build-explainers' afterward
still reported "up to date", as long as nothing was committed yet.
Confirmed exactly the issue's repro (git worktree add + append a line to
explainers/demographic-parity.md) now correctly fails with 'content
differs from a fresh regeneration' where it used to pass.

_fresh_build_dir() now does the real regeneration: a git worktree
checked out to HEAD (shares this repo's object database/history, so
git-log-derived dates resolve identically to a build done in ROOT
itself), with every currently-tracked file's *working-tree* content
copied on top before running build_explainers.py, generate_og_images.py,
and freeze_paper_results.mirror_for_mcp() inside it - the same sequence
build-explainers.yml runs, now run by this script itself instead of
assumed to have already happened. The worktree is cleaned up via
ExitStack regardless of what happens after.

Updated tests/test_check_generated_files_current.py to monkeypatch
_fresh_build_dir directly (pre-populated stub directory) instead of
faking 'git show', per the file's own stated testing philosophy of
avoiding a real git repo in unit tests. Added a regression test for the
exact scenario in the bug report.

Verification: reproduced the issue's exact repro against the unmodified
script (confirmed it passed when it shouldn't), then against the fixed
script (confirmed it now fails with the right reason). All 9
tests/test_check_generated_files_current.py tests pass; full suite is
402 passed, 1 skipped, 4 failed - the 4 failures are
tests/test_xlsx_edge_cases.py, confirmed identical on unmodified main
(SheetJS CDN returns HTTP 403 in this sandbox), unrelated to this
change.

Fixes yakew7#502
@vercel

vercel Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

@propcgamer20-png is attempting to deploy a commit to the yashkewlani2020-gmailcom's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

@yakew7 @ahmdkaml - new PR touching a path you own, please review.

@yakew7
yakew7 merged commit 27b52cf into yakew7:main Sep 9, 2026
17 of 18 checks passed
yakew7 added a commit that referenced this pull request Sep 10, 2026
They wrote the Makefile originally (#125) and added the 'audits' target
(#506), and are the most active external contributor to scripts/ after
the maintainer (check_em_dash.py extensions in #362,
check_generated_files_current.py's rebuild-from-source fix in #508 and
its follow-up regen in #540). Write access accepted.
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.

check_generated_files_current.py never rebuilds from source - it only diffs the working tree against the last git commit

2 participants