Skip to content

tests: fail when a design.md table has the same row twice - #3132

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
jakeefr:fix/design-rows-test
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
jakeefr:fix/design-rows-test

Conversation

@jakeefr

@jakeefr jakeefr commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: #1218 (comment)

What and why

When two PRs edit the same row of the contract table, the merge keeps both versions one under the other, and the older text then contradicts the newer one. That has been cleaned up by hand several times (#1108, then 8b606c2, 935edd4 and cb467ea today), and it keeps coming back because nothing notices.

I had a dedupe ready for this claim, but main already removed every duplicate row while it waited, so this PR is just the test that keeps them out.

tests/test_design_contract_rows.py reads docs/design.md and fails when a table has two rows with the same first cell, listing the row names and line numbers. Rows are counted per table, so two different tables may each have a row with the same name, and separator rows and empty first cells don't count. Standard library only.

Tested

  • python -I tests/test_design_contract_rows.py: 4 pass on main at ec8ec4c.
  • Before today's dedupes (main at f85582e) the design.md test fails and lists all twelve duplicated rows with their line numbers.

Checklist

  • 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: a test only)

When two pull requests edit the same row of the contract table, the merge keeps both versions one under the other,
and the older text then contradicts the newer one. That has been cleaned up by hand several times (ItsNotRexed#1108,
8b606c2, 935edd4, cb467ea), and it keeps coming back because nothing notices.

tests/test_design_contract_rows.py reads docs/design.md and fails when a table has two rows with the same first cell,
listing the row names and line numbers. Rows are counted per table, so two tables may each have a row with the same
name, and separator rows and empty first cells don't count. It passes on main today. Standard library only.
@tupacfan04

Copy link
Copy Markdown
Contributor

Tested at the head on Windows 11 / Python 3.13.0: the new file is tests/test_design_contract_rows.py (not ..._table_dupes.py as the description suggested); its 4 tests pass with py -3 -I, compileall clean, and tests/test_ci_registration.py still passes so CI's stdlib loop will pick it up.

Negative control: duplicating the | CPU code | ... row in docs/design.md fails with AssertionError: {'CPU code': [20, 21]}, exit 1, with line numbers. main has no duplicates today, so the post-merge state passes. Merge clean (the branch is 14 commits behind but MERGEABLE).

Note, not a defect: ~17 open PRs edit docs/design.md, so this test will gate their merges - that is its purpose.

Minor: only rows starting at column 0 are counted (:29,31), so an indented table inside a list is missed, and a pipe line inside a fenced block would count (currently none). Two tables each duplicating the same name collapse to the later table's line numbers (message quality only).

Merge-ready. AI-assisted review, docs/tests only.

@chpeu

chpeu commented Nov 22, 2026

Copy link
Copy Markdown

Tested b8907a4d on Linux (Linux Mint 22 / Ubuntu 24.04 base, Python 3.12.3, no game files).

  • python -I tests/test_design_contract_rows.py: 4 tests pass, and the checker reports no repeated row on
    current main (f847748c) — it also passes over docs/design.md as it stands.
  • One thing to weigh before this merges: tests/test_docs_design_rows.py is already on main, CI runs it, and it
    covers the same rule over design.md, README.md and testing.md, counts per table, ignores separator rows
    and empty first cells, and skips rows inside fenced code blocks. Your file covers one of those pages with a
    slightly different parser, so the repository would have two checkers for one rule.
  • What both of them miss is the case that keeps coming back. Counting topics with the trailing (...) ignored on
    f847748c, docs/design.md still has four repeated topics: lines 232/233 (Images and samplers /
    Images and samplers (core), different scopes), 273/275 (No-op SOPP/SMEM with two different instruction
    lists), 304/305 (Output modifiers on hardware, one row still ends with “RDNA2 itself is unmeasured” next to
    the gfx1031/gfx1036 measurements) and 342/348 (Scalar select and pack). The last three are exactly the pairs
    docs: drop the two narrow No-op SOPP/SMEM copies the 12-op row supersedes #3081, docs/design.md: one no-op row, one output-modifiers row, no stale tails #2945 and docs/design.md: merge duplicated Scalar select and pack contract rows #3212 are merging by hand right now — because the first cells differ by their parenthetical
    list, neither checker can see them.
  • A parser difference worth knowing, though it costs nothing today: yours counts a table run that starts inside a
    ``` fence, the existing test skips those. docs/design.md currently has 0 pipe rows inside fences, so nothing
    changes with today's text.

Suggestion: rather than a second test file, put the idea into tests/test_docs_design_rows.py as a second,
tolerant comparison — first cell with the trailing (...) stripped — plus a short allow-list for genuinely
different topics (Images and samplers (core) being the obvious one), and have the failure message name both
line numbers like yours does. That gives CI one place to look and covers the pair shape that actually returns
every few merges. Your repeated_row_names() unit tests are a good fit for that too.

AI-assisted testing and reading, checked by hand.

@ItsNotRexed
ItsNotRexed merged commit fe56ae5 into ItsNotRexed:main Nov 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants