Repository navigation
docs: escape the stray pipes that split contract-table rows, and check their shape - #3424
bobcatchris wants to merge 1 commit into
Conversation
|
Tested
AI-assisted. |
5109c6b to
ea625c8
Compare
…k their shape A rule that writes a literal pipe (`|v|`, `-|v|`, `(tmp & ~DATA) | DATA2`) has to write it `\|`, or GitHub reads it as a separator, renders the row into columns the header does not have and drops the tail of the rule. Twenty rows of the translator contract table had that shape (four to thirteen cells against a two-cell header), each losing the end of the row in the rendered page. Escape them, and pin the shape in tests/test_docs_design_rows.py: a row whose separators are not all honoured cannot match its header, so the next one fails the test instead of dropping text from the page silently. Re-derived on top of today's main, which rewrote most of these rows: every changed line differs from main only by escapes (verified line by line), and `test_each_page_has_rows_its_header_can_hold` fails against main's design.md and passes here.
ea625c8 to
c3c85f8
Compare
# Conflicts: # docs/design.md
|
Closing as superseded: Nothing here is needed. AI-assisted. |
|
Verified on Linux: merges cleanly into current main; the extended checker passes on all three pages (4 tests) and test_design_contract_rows (4) and test_shader_meta (19) are unaffected. The 18 escaped rows are cell-exact — the ds_mskor DATA2 cell and the VOP3 modifier lists now survive GitHub's table parser — and the checker distinguishes escaped from raw pipes and ignores fenced tables. Merged alongside #3422, which also adds a design.md row, the shape check still passes. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
What and why
Eighteen rows of the translator contract table in
docs/design.mdcarry four to thirteen cells against a three-cell header, because a rule that writes a literal pipe leaves it unescaped:Floating-point class comparerow lists the modifier forms as`v`, `-v`, `|v|`, `-|v|`;VOP3 FP modifiers on constantsis the worst: 13 separators, from severala | balternatives;Global atomics, 4 inSub-dword MUBUF loads, and 16 more).GitHub reads every one of those as a cell separator. A row with more cells than its header renders into columns the header does not have, and the tail of the rule is dropped — so the contract table loses text silently instead of failing, which is the worst way for the page that records every translator rule to break.
The fix is the escape GFM asks for, inside code spans too:
Nothing but backslashes moved: I compared every changed line against
mainand each one differs only by inserted\characters (18 lines changed, same file length, same number of lines). No rule text, number or link was touched.The check, so it stays fixed
tests/test_docs_design_rows.pyalready runs on the three table pages (design.md,README.md,testing.md) for a different defect — a topic named twice in one table. It now also rejects a row whose cell count differs from its header's:unescaped_pipes(line)counts separators, skipping\and the character after it, so an escaped pipe does not count;mis_shaped_rows(lines)returns(line, cells, header cells)per bad row, skipping fenced blocks and using the|---|rule as the header shape;test_checker_finds_a_stray_pipe_but_not_an_escaped_onepins the checker itself on a fixture that has one of each, plus a fenced table, so a checker that flags everything fails;test_each_page_has_rows_its_header_can_holdasserts the real pages.README.mdandtesting.mdare clean today (0 rows);docs/design.mdhad the 18.Tested
Overlay on
origin/mainf847748c, Windows, Python 3.12.0:python -IB tests/test_docs_design_rows.py→ 4 tests, OK (2 before).docs/design.mdrestored tomainand the new test kept → 1 failure,test_each_page_has_rows_its_header_can_hold (page='design.md')— the 18 rows are exactly what it reports.-W error::SyntaxWarning(a docstring that mentions\|has to spell it\|, which it does), andcompileallis clean.Overlap
One of the 18 rows,
`ds_mskor_b32`, `ds_mskor_rtn_b32`(line 321), is also edited by my own #2812. Whichever lands first, the other rebases — the content does not conflict, only the line does.Checklist
docs/design.md, with how it was confirmed. (No new rule; this makes the existing rows readable.)