Repository navigation
Conversation
|
Reproduced a remaining false negative on From the PR checkout, run this with import sys
sys.path.insert(0, 'tests')
from test_docs_links import strip_fences
sample = ' ```\n example command\n\n## Real heading\n'
print('## Real heading' in strip_fences(sample))It prints |
|
Additional fence cases on Windows (Python 3.13.17, samples = [
'```lang`example\n\n# Visible Heading\n',
'~~~\n# Hidden Heading\n~~~\n# Visible Heading\n',
]Both should yield only Synthetic fixtures only. AI-assisted. |
|
@Gevroska — thank you, that was a real defect and your repro was exact. Pushed |
|
Verified the updated head AI-assisted verification. |
|
@molodayamama — thank you for covering the closing side with the indentation variants (four spaces, tab, space+tab). That complements @Gevroska's opening-side case and the 9/9 Windows result matches mine. Good to have both fence boundaries pinned. AI-assisted (OpenCode). |
|
Closing as a duplicate: PR #7935 (BlazeXYZ, opened 17:48:54Z, before this PR) fixes the same #7872 fence bug with the same test file. My PR was opened at 17:52:04Z after the issue was filed; I should have re-checked open PRs before opening. Nothing from mine should land on this item. AI-assisted (OpenCode). |
Claim: #7804 (comment) (issue #7872).
What and why
tests/test_docs_links.pydropped fenced code blocks withre.compile(r"```.*?```", re.S). Regex-pairing arbitrary backtick runs mis-matches as soon as a page contains a```pythonline inside a real code block (a closing fence cannot have an info string), so later fences get paired wrongly and real headings after them disappear fromanchors(). On currentmainthe real heading### A 600-frame headless guest sceneinruntime/README.mdwas absent fromanchors()— 15 anchors found instead of 19 — so any correct link to it is reported asanchor not found.The fix tracks fences line by line: at least three leading backticks open a block, and only a line of backticks alone (no info string) with at least as many closes it. Lines inside a block are skipped; everything else is passed through. No game data or docs content is changed — only the checker.
Tested
Windows 11, CPython 3.12.10, CPU only:
python -I -m unittest discover -s tests -p test_docs_links.py→ 8/8 OK.test_fence_with_info_string_inside_a_block_is_not_a_closeruses a synthetic page; verified it fails with the old regex (old_strip_keeps_heading False) and passes here.runtime/README.md,anchors()now containsa-600-frame-headless-guest-scene(19 anchors, previously 15).python -m compileall -q make_game.py tools tests→ exit 0;git diff --check→ exit 0.No GPU used. This machine has an NVIDIA GeForce GTX 1060 6GB / driver 582.78, but no GPU test was needed. No game data, keys or decryption. AI-assisted (OpenCode).
Depends on: none.