docs checks: validate destinations used by Markdown reference links #2200

Merged
EdenBendheim merged 1 commit from upstream-pr/2200 into main 2026-11-29 03:36:57 +00:00
EdenBendheim commented 2026-11-26 05:26:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by EdenBendheim on 2026-11-26T05:26:16Z.


Claimed in the coordination issue as: TEST-DOCS-REFERENCE-LINKS (claim)

The docs link check let a page pass when [Guide][guide] pointed to a missing file via a separate definition. The checker now resolves common full, collapsed and shortcut reference links and images, passing their destinations through the existing file and anchor checks. It accounts for unused definitions, repeated labels and GFM footnotes.

A synthetic page with four missing destinations reproduced the false pass on a73a57e13. With the patch it reports all four. On macOS with Python 3.12.14, all 18 link tests and the complete docs-only suite (62 tests across 14 files) passed. CI registration, line-ending, compile, diff and changed-file game-data checks also passed.

GPUs tested: n/a. All tests used synthetic inputs.

AI-assisted: yes. Created with gpt-6.2-astra in Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5504536118 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2200). Originally posted by [EdenBendheim](https://github.com/EdenBendheim) on 2026-11-26T05:26:16Z. --- Claimed in the coordination issue as: TEST-DOCS-REFERENCE-LINKS ([claim](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7183419722)) The docs link check let a page pass when `[Guide][guide]` pointed to a missing file via a separate definition. The checker now resolves common full, collapsed and shortcut reference links and images, passing their destinations through the existing file and anchor checks. It accounts for unused definitions, repeated labels and GFM footnotes. A synthetic page with four missing destinations reproduced the false pass on `a73a57e13`. With the patch it reports all four. On macOS with Python 3.12.14, all 18 link tests and the complete docs-only suite (62 tests across 14 files) passed. CI registration, line-ending, compile, diff and changed-file game-data checks also passed. GPUs tested: n/a. All tests used synthetic inputs. AI-assisted: yes. Created with gpt-6.2-astra in Codex.
real-rusher commented 2026-11-26 10:12:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by real-rusher on 2026-11-26T10:12:31Z.


Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly. python -I tests/test_docs_links.py: 18 tests OK, so the tracked documents have no broken reference links today.

The check is new rather than a fix, so I compared it with main's version directly: for a page with "See [the guide][g]." and "[g]: nowhere.md", main's broken_links() returns nothing, and this PR's returns ("page.md", "nowhere.md", "missing file"). compileall clean.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7189053609 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2200#issuecomment-7189053609). Originally posted by [real-rusher](https://github.com/real-rusher) on 2026-11-26T10:12:31Z. --- Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly. python -I tests/test_docs_links.py: 18 tests OK, so the tracked documents have no broken reference links today. The check is new rather than a fix, so I compared it with main's version directly: for a page with "See [the guide][g]." and "[g]: nowhere.md", main's broken_links() returns nothing, and this PR's returns ("page.md", "nowhere.md", "missing file"). compileall clean. AI-assisted: yes (Claude Code)
DeadlyChirp commented 2026-11-26 10:32:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DeadlyChirp on 2026-11-26T10:32:27Z.


Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main.

  • tests/test_docs_links.py: 18 passed (main: 17 passed).

(AI-assisted test run; output checked by hand.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7189501576 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2200#issuecomment-7189501576). Originally posted by [DeadlyChirp](https://github.com/DeadlyChirp) on 2026-11-26T10:32:27Z. --- Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main. - `tests/test_docs_links.py`: 18 passed (main: 17 passed). (AI-assisted test run; output checked by hand.)
sodove commented 2026-11-28 09:14:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T09:14:59Z.


#2200 | head 2a2cc220c146753a55fa7717564e4d9af913b9bc | python3 -I tests/test_docs_links.py -v | red: 18 passed with full file. Methods only: 1 test, 1 assertion failure | green: 18 passed with full file. Same methods: 1 passed | Full file green/green. Isolated check red → green

The reference-link checker lives in the test file. As a separate control I copied only the new test method verbatim onto main, preserving its link checker. Its assertion failed there and passed on the merged tree. The focused invocation was python3 -I tests/test_docs_links.py RepositoryLinksTest.test_checks_referenced_definitions_but_not_unused_ones -v.

Pinned main 4938673668d807bf365b61284bf22b1ff8d02cc4, merged into the PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Full suite: not run. AI-assisted: OpenAI Codex. Batch claim.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7237115530 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2200#issuecomment-7237115530). Originally posted by [sodove](https://github.com/sodove) on 2026-11-28T09:14:59Z. --- #2200 | head `2a2cc220c146753a55fa7717564e4d9af913b9bc` | `python3 -I tests/test_docs_links.py -v` | red: 18 passed with full file. Methods only: 1 test, 1 assertion failure | green: 18 passed with full file. Same methods: 1 passed | **Full file green/green. Isolated check red → green** The reference-link checker lives in the test file. As a separate control I copied only the new test method verbatim onto main, preserving its link checker. Its assertion failed there and passed on the merged tree. The focused invocation was `python3 -I tests/test_docs_links.py RepositoryLinksTest.test_checks_referenced_definitions_but_not_unused_ones -v`. Pinned main `4938673668d807bf365b61284bf22b1ff8d02cc4`, merged into the PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Full suite: not run. AI-assisted: OpenAI Codex. [Batch claim](https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7236982945).
zmasi commented 2026-11-29 01:48:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T01:48:59Z.


Independent verification on Windows 11 (10.0.26200, x64) of 2a2cc220c1 merged onto current origin/main (59e65849b0, 0 merge conflicts), tested under both Python 3.12.10 and Python 3.14.5:

  • Isolated Red -> Green & repository reference-link scan:
    • Isolated Red (origin/main links()): 'See [Guide][g].\n\n[g]: missing.md\n' returns [], missing broken reference-link targets.
    • Green (2a2cc220c1 merged onto origin/main):
      • python -I -B tests/test_docs_links.py RepositoryLinksTest.test_checks_referenced_definitions_but_not_unused_ones: Ran 1 test, OK (0.007 s), and CRLF \r\n multi-line reference definitions resolve cleanly (['missing.md']).
      • Full python -I -B tests/test_docs_links.py (18 tests on both Python 3.12.10 and Python 3.14.5): 17/18 pass — confirming 0 broken reference-style links across all tracked Markdown files (including d3d12/); the single failure matches origin/main's pre-existing inline README.md#project-status / README.md#running-the-loader-on-linux anchor mismatch (16/17 on origin/main).
  • Hygiene: git diff --check, python -I -m compileall -q tests/test_docs_links.py, python -I scripts/check_no_game_data.py tests/test_docs_links.py, python -I tests/test_ci_registration.py (18/18), and python -I tests/test_text_write_line_endings.py (3/3) all exited 0.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249031364 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2200#issuecomment-7249031364). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T01:48:59Z. --- Independent verification on Windows 11 (`10.0.26200`, x64) of `2a2cc220c1` merged onto current `origin/main` (`59e65849b0`, `0` merge conflicts), tested under both `Python 3.12.10` and `Python 3.14.5`: - **Isolated Red -> Green & repository reference-link scan**: - Isolated Red (`origin/main` `links()`): `'See [Guide][g].\n\n[g]: missing.md\n'` returns `[]`, missing broken reference-link targets. - Green (`2a2cc220c1` merged onto `origin/main`): - `python -I -B tests/test_docs_links.py RepositoryLinksTest.test_checks_referenced_definitions_but_not_unused_ones`: `Ran 1 test`, `OK` (`0.007 s`), and CRLF `\r\n` multi-line reference definitions resolve cleanly (`['missing.md']`). - Full `python -I -B tests/test_docs_links.py` (`18` tests on both `Python 3.12.10` and `Python 3.14.5`): `17/18` pass — confirming `0` broken reference-style links across all tracked Markdown files (including `d3d12/`); the single failure matches `origin/main`'s pre-existing inline `README.md#project-status` / `README.md#running-the-loader-on-linux` anchor mismatch (`16/17` on `origin/main`). - **Hygiene**: `git diff --check`, `python -I -m compileall -q tests/test_docs_links.py`, `python -I scripts/check_no_game_data.py tests/test_docs_links.py`, `python -I tests/test_ci_registration.py` (`18/18`), and `python -I tests/test_text_write_line_endings.py` (`3/3`) all exited `0`. AI-assisted.
OreoFR commented 2026-11-29 03:09:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T03:09:09Z.


Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main c8bf0e7b6, PR head 2a2cc220c : red 1 new failure / green 17 OK (+1 pre-existing main failure)

python3.12 -I tests/test_docs_links.py (18 tests):

  • Merge: clean. The test file holds the checker itself, so red = the PR's file with found.extend(reference_links(text)) neutralised on main.
  • Red: test_checks_referenced_definitions_but_not_unused_ones (the new test) fails.
  • Green (main + git merge --no-ff): 17/18 OK, skipped 0. The PR finds no new broken link in the repo.
  • Pre-existing on main, identical on the merge (MEASURED n=3): test_every_relative_link_resolves — 3 missing README.md anchors: #project-status (from d3d12/README.md and docs/i18n/ar/quickstart.md) and #running-the-loader-on-linux (from the Arabic quickstart).
  • Neighbours (test_docs_adjacent_fenced_blocks, _encoding, _repo_paths, _pr_template, _list_items): OK on main and merge. test_docs_cli_flags fails on both (README.md:94 passes -Game to scripts/play-d3d12.ps1), unrelated.
  • Diff: reference definitions only count when used, first definition wins, case-insensitive; inline code, inline links, escapes and [^x] footnotes are excluded and covered by the test. No game data.

Verdict: READY

AI-assisted: Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249872937 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2200#issuecomment-7249872937). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T03:09:09Z. --- Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main c8bf0e7b6, PR head 2a2cc220c : red 1 new failure / green 17 OK (+1 pre-existing main failure) `python3.12 -I tests/test_docs_links.py` (18 tests): - Merge: clean. The test file holds the checker itself, so red = the PR's file with `found.extend(reference_links(text))` neutralised on main. - **Red**: `test_checks_referenced_definitions_but_not_unused_ones` (the new test) fails. - **Green** (main + `git merge --no-ff`): 17/18 OK, skipped 0. The PR finds no new broken link in the repo. - Pre-existing on main, identical on the merge (MEASURED n=3): `test_every_relative_link_resolves` — 3 missing README.md anchors: `#project-status` (from `d3d12/README.md` and `docs/i18n/ar/quickstart.md`) and `#running-the-loader-on-linux` (from the Arabic quickstart). - Neighbours (`test_docs_adjacent_fenced_blocks`, `_encoding`, `_repo_paths`, `_pr_template`, `_list_items`): OK on main and merge. `test_docs_cli_flags` fails on both (`README.md:94` passes `-Game` to `scripts/play-d3d12.ps1`), unrelated. - Diff: reference definitions only count when used, first definition wins, case-insensitive; inline code, inline links, escapes and `[^x]` footnotes are excluded and covered by the test. No game data. **Verdict: READY** AI-assisted: Claude Code
DadaCap commented 2026-11-29 03:36:54 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-29T03:36:54Z.


Merging, thank you @EdenBendheim! OreoFR's agent verified this head merged with current main: the test fails on main and passes with the PR (https://github.com/ProjectLeonida/mandy/pull/2200#issuecomment-7249872937), and it still merges cleanly.

AI-assisted (Claude Code, Claude Opus 5.5), on behalf of DadaCap.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7250154803 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2200#issuecomment-7250154803). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-29T03:36:54Z. --- Merging, thank you @EdenBendheim! OreoFR's agent verified this head merged with current main: the test fails on main and passes with the PR (https://github.com/ProjectLeonida/mandy/pull/2200#issuecomment-7249872937), and it still merges cleanly. AI-assisted (Claude Code, Claude Opus 5.5), on behalf of DadaCap.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!2200
No description provided.