tests/docs: read an indented code block as code, not prose (OLD-9836) #1781

Manually merged
github merged 1 commit from gh-pr/1781/head into gh-pr/1781/base 2026-11-26 10:04:53 +00:00
Owner

@⁠Ch1mpleo on GitHub · 2026-11-25 12:02 UTC · original
Ch1mpleo:carry/old-9836 → main · +18 −1 · 1 files · 1 commits · merged 2026-11-25 21:24 UTC

Claimed in the coordination issue as: OLD-9836 (#1608)

What and why

Carries forward old-pr/9836 (draft #104, keeping
oosko21-a11y's original commit rebased onto current main). Fixes ests/test_docs_repeated_lines.py::repeated_lines to treat 4-space and tab-indented Markdown code blocks as code rather than prose, and adds est_checker_ignores_indented_code_blocks.

Tested

  • python -I tests/test_docs_repeated_lines.py — 3 tests, OK (Windows 11 x64, Python 3.14.7, CPU-only, no game files).
  • python -I scripts/check_no_game_data.py tests/test_docs_repeated_lines.py — exit 0.
  • python -m compileall -q tests/test_docs_repeated_lines.py — exit 0.

GPUs tested: n/a (CPU-only standard-library unit test)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled
    eeds rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a — unit test fix only)
**@⁠Ch1mpleo** on GitHub · 2026-11-25 12:02 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1781) `Ch1mpleo:carry/old-9836` → `main` · +18 −1 · 1 files · 1 commits · merged 2026-11-25 21:24 UTC Claimed in the coordination issue as: OLD-9836 (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why Carries forward old-pr/9836 (draft #104, keeping oosko21-a11y's original commit rebased onto current main). Fixes ests/test_docs_repeated_lines.py::repeated_lines to treat 4-space and tab-indented Markdown code blocks as code rather than prose, and adds est_checker_ignores_indented_code_blocks. ### Tested - python -I tests/test_docs_repeated_lines.py — 3 tests, OK (Windows 11 x64, Python 3.14.7, CPU-only, no game files). - python -I scripts/check_no_game_data.py tests/test_docs_repeated_lines.py — exit 0. - python -m compileall -q tests/test_docs_repeated_lines.py — exit 0. GPUs tested: n/a (CPU-only standard-library unit test) AI-assisted: yes ### Checklist - [x] Based on current main and merges cleanly (a conflicting pull request is labeled eeds rebase). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a — unit test fix only)
tests/semantic/README.md shows two commands in an indented code block (four spaces, no fence) whose first
forty characters are identical:

    python -I scripts/run_semantic_tests.py tests/semantic
    python -I scripts/run_semantic_tests.py tests/semantic -j 4 -p 'test_image_*.py'

repeated_lines() skips fenced blocks and said so in its own docstring ("neither a list item, table row, heading or
code"), but it only recognised the fenced kind, so the two command lines were compared as prose and the check went
red on main:

    AssertionError: Lists differ: ['tests/semantic/README.md:5 and :7'] != []

The same-merge habit is what this file exists to catch, so the report was worth a look, but a command block is not a
sentence kept twice and editing the README to dodge the check would leave the next indented block to trip it again.
An indented line is now skipped the way a fenced one already was: four spaces (Markdown's code block) or a tab.

Measured over every tracked Markdown file, old check against new, so this does not quietly buy green by hiding
duplicates:

    files scanned          104
    lines scanned          37,350
    lines indented 4+      1,375
    reported by both       0
    reported by old only   1   tests/semantic/README.md:5:7   (the false positive)
    reported by new only   0

The one report the fix removes is the one that was wrong. No real duplicate was lost.

The test gains the case directly: an indented two-command block is not reported, and a tab-indented one is not
either.

python -I tests/test_docs_repeated_lines.py -> Ran 3 tests, OK  (main: Ran 2, FAILED at tests/semantic/README.md:5)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:04:51 +00:00
github manually merged commit 41639e8997 into gh-pr/1781/base 2026-11-26 10:04:53 +00:00
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-25 19:00 UTC · original

Reviewed 41639e899: ran python -I tests/test_docs_repeated_lines.py on main (Ran 2 tests, OK) and on the PR (Ran 3 tests, OK), and a probe comparing the old and new checker over all tracked .md files (both report zero today). The motivating failure is already historical: #10002 fenced that README block on 24 Nov, before this PR's base, so main is green and no indented code block remains in the docs. The new rule also skips 4-space list continuations, which CommonMark reads as prose, not code (reproduced: old reports (2,4), new skips it); no live duplicate is hidden today. The new test pins the fix (it fails under main's checker). Sound as written; the direction (checker vs fenced doc) and the list-continuation exemption need the maintainer's call.

AI-assisted review.

Recommendation: Needs discussion

**@⁠PierreEbele** on GitHub · 2026-11-25 19:00 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1781#issuecomment-7171701414) Reviewed 41639e899: ran `python -I tests/test_docs_repeated_lines.py` on main (Ran 2 tests, OK) and on the PR (Ran 3 tests, OK), and a probe comparing the old and new checker over all tracked .md files (both report zero today). The motivating failure is already historical: #10002 fenced that README block on 24 Nov, before this PR's base, so main is green and no indented code block remains in the docs. The new rule also skips 4-space list continuations, which CommonMark reads as prose, not code (reproduced: old reports (2,4), new skips it); no live duplicate is hidden today. The new test pins the fix (it fails under main's checker). Sound as written; the direction (checker vs fenced doc) and the list-continuation exemption need the maintainer's call. AI-assisted review. **Recommendation:** Needs discussion
Author
Owner

@⁠MSedgeMC on GitHub · 2026-11-25 19:03 UTC · original · approved these changes

Verified on the PR branch (clean, 1 commit ahead of main): python3 -m unittest tests.test_docs_repeated_lines -v -> 3 tests OK, including the new indented/tabbed code-block case and the full docs corpus check. The fix correctly treats Markdown indented code blocks like fenced ones in the repeated-lines docs test, removing false positives while keeping the prose check intact. Python-only, no game data.

**@⁠MSedgeMC** on GitHub · 2026-11-25 19:03 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1781#pullrequestreview-6063357268) · **approved these changes** Verified on the PR branch (clean, 1 commit ahead of main): python3 -m unittest tests.test_docs_repeated_lines -v -> 3 tests OK, including the new indented/tabbed code-block case and the full docs corpus check. The fix correctly treats Markdown indented code blocks like fenced ones in the repeated-lines docs test, removing false positives while keeping the prose check intact. Python-only, no game data.
This discussion has been locked. Commenting is limited to contributors.
No description provided.