Skip to content

Tests for check_broken_links and freeze(), explainer structure check (3 issues) - #1120

Merged
yakew7 merged 1 commit into
yakew7:mainfrom
propcgamer20-png:work/scripts-tests
Oct 22, 2026
Merged

yakew7 merged 1 commit into
yakew7:mainfrom
propcgamer20-png:work/scripts-tests

Conversation

@propcgamer20-png

Copy link
Copy Markdown
Collaborator

Three scripts/ issues, all tests or checks, no behaviour changes to existing scripts.

  • scripts/check_broken_links.py has no tests (0% coverage) #1109: tests/test_check_broken_links.py (23 tests, 96% coverage of the script, issue asked for 85%). It builds a temporary tree and covers a resolving link, a missing file, in-page and cross-file anchors, directories, external URLs, images, fenced and inline code, link titles, percent-encoding, blob permalinks, untracked files, escaping the repo, duplicate headings and the slugifier. Every bad-link test asserts exit code 1 and the file:line message, so it fails if the script stops reporting.
  • scripts/freeze_paper_results.py freeze() is untested (39% coverage) #1111: freeze() and its helpers are now tested against a temporary tree with the directory constants monkeypatched and git stubbed (coverage of the script 99%). Covers the copied CSVs, figures and lock file, every MANIFEST.md field (commit, dirty flag, versions, audit list, tag section), replacing an existing snapshot, both MCP mirrors, missing optional inputs, the missing-results/ error, that --tag prints a command and never runs a git tag, and that nothing is written outside the intended directories.
  • Add a lint check that every explainer has the required sections #1118: scripts/check_explainer_structure.py, run by make lint (and so the lint workflow) and pre-commit. Each explainer needs the seven sections from CONTRIBUTING.md section 8, in that order, a python block, two Further Reading entries and the footer line. Accepted heading variants are in a table in the script, taken from the real headings (82 pages). Ten pages have existing gaps, so they are in KNOWN_EXCEPTIONS: the four missing a Limitations section named in the issue, plus neural-networks (also detection code), sampling-bias (also related concepts), differential-privacy (concrete example), disparate-impact, fairness-metric-conflicts and shap-values (detection code), and two with the example and detection sections in the other order. An exception that is no longer needed fails the check, so the list can only shrink. 27 tests, 97% coverage. CONTRIBUTING's "Checks you may meet" table and the CHANGELOG are updated.

Fixing those ten pages is a follow-up; I did not want to rewrite explainers in this PR. Fast suite: 1157 passed; the same 6 failures as on a clean checkout on this Windows machine (path separators). The ROADMAP issue-reference warning from check_issue_refs.py is separate and informational.

Closes #1109, closes #1111, closes #1118

Not included: #1098 (running the explainers' Python blocks), which needs a marking convention, and #1110/#1104, which I will take separately if wanted.

Tests for scripts/check_broken_links.py (96% coverage, yakew7#1109) and the whole freeze() flow in scripts/freeze_paper_results.py against a temporary tree with git stubbed (99%, yakew7#1111). New scripts/check_explainer_structure.py enforces the CONTRIBUTING.md section list, a python block, two Further Reading entries and the footer, with the existing gaps in a shrink-only KNOWN_EXCEPTIONS list; wired into make lint and pre-commit (yakew7#1118).
@vercel

vercel Bot commented Oct 22, 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

Copy link
Copy Markdown

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

@yakew7
yakew7 merged commit 5560472 into yakew7:main Oct 22, 2026
16 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants