tests: handle inline external URLs and CommonMark fences in doc validators #2421
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2421"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-27T03:17:12Z.
Claimed in the coordination issue as: DOC-VALIDATOR-FENCES-AND-URLS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7208856827)
What and why
tests/test_docs_repo_paths.py: previously skipped any entire line containing://, creating a false negative whenever a broken local repo path appeared on the same line as an external link. Mask only inline external Markdown links ([...](scheme://...)) instead.tests/test_docs_repo_paths.pyandtests/test_docs_table_ids.py: track CommonMark opening/closing fences (```,````,~~~) by marker character and length instead of toggling only on triple backticks, preventing false failures on tilde-fenced or longer-backtick-fenced examples.Tested
maind1dff7949and pass with this change.python -I tests/test_docs_repo_paths.pyandpython -I tests/test_docs_table_ids.py: OK.tests/test_docs_*.py+tests/test_text_write_line_endings.py+compileall): OK.python -I scripts/check_no_game_data.py: exit 0.GPUs tested: n/a
AI-assisted: yes (Antigravity gemini-4-neon)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a — not a translator rule)Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-27T05:49:16Z.
Review: APPROVED
Approving. Checked on
43128a9c1, which merges cleanly onto main.tests/test_docs_repo_paths.pyandtests/test_docs_table_ids.py: 8 passed, including the whole-docs checks. That matters here, because the change makes the path check stricter (a URL elsewhere on a line no longer hides the repo paths next to it), and every current page still passes.Read the diff. The fence tracking follows CommonMark where it matters: a backtick opener's info string may not contain a backtick (so
```inline```on one line is not a fence), the closer must be the same character, at least as long and followed only by whitespace, and tilde fences and longer backtick fences nest the way the tests show.EXTERNAL_LINKstrips only the inline link (angle-bracketed destinations and the three title forms included), so a bare URL in prose no longer hides anything.Two small things, not blockers.
_update_fenceandFENCE_OPENare now copied in both files, so a shared helper module intests/would stop them drifting. Andlstrip(" \t")accepts a fence at any indentation, while CommonMark makes 4+ spaces an indented code block. That only matters for a fence line inside an indented code block, which the docs don't seem to have.Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T10:03:37Z.
#2421 | head
43128a9c1b(merged cleanly with main33db04a70) |python -I tests/test_docs_table_ids.py && python -I tests/test_docs_repo_paths.py -k "not test_docs_name_existing_paths"| red on main:missing_pathsskips whole lines containing://([] != [('docs/u.md:1', 'tools/gone.py')]) andrepeated_idstoggles on inner backticks inside~~~fences ([(2, 3, '**M3**')] != []) | green on PR+main:3 tests OKand4 tests OK| Windows 11, Python 3.12.10 | AI-assisted: yesAudited
_update_fenceandEXTERNAL_LINKintests/test_docs_repo_paths.pyandtests/test_docs_table_ids.py. OnPR + main(33db04a70),test_docs_name_existing_pathsreports the exact same 14 pre-existing missing-path entries (docs/port_plan.md,docs/port_status.md,docs/ultrawide.md,docs/victory_gap_*.md) as plainmainand introduces zero new doc-path failures; note an adjacent hunk overlap intests/test_docs_repo_paths.pyif combined with open#2552. Also passedtests/test_docs_links.py(17 OK),tests/test_text_write_line_endings.py(3 OK),tests/test_runner_calls_all_tests.py(3 OK), andscripts/check_no_game_data.py.Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T10:58:08Z.
Merged, thank you @Andretuta! This PR (tests: handle inline external URLs and CommonMark fences in doc validators) was checked by zmasi or sodove and then by our own local run of its tests with main merged in, and it passed cleanly, so it went in with its reviewed batch.
AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.