Skip to content

Main's lint-python is green again: the NUP survey's three pyright findings are fixed - #1294

Closed
maceopark wants to merge 1 commit into
seedds:mainfrom
maceopark:fix/tool-tests-after-fast-path
Closed

maceopark wants to merge 1 commit into
seedds:mainfrom
maceopark:fix/tool-tests-after-fast-path

Conversation

@maceopark

Copy link
Copy Markdown
Contributor

What and why

main's checks have been red since the shader builder's instruction scan (#1036), and every pull request based on it inherits the failures: ruff and pyright (ratchet) reports two findings, and Tool tests fails two test files. Neither comes from a branch's own change.

Lint. Ruff B023 at dm/games/settings.py:115: offered() closes over the loop's row number n, so the row is now a default argument. Pyright's reportOptionalIterable in dm/tools/tests/test_split_linkdata.py: linkdata_jobs() returns None for a file it cannot read, so the test narrows the result before iterating it. This is the same fix as #1235, which covers the first finding alone; if #1235 lands first, this branch rebases to the two test files.

test_dmsh_pool_arrays. The test loads dmsh_build.py by executing only the functions it names. reflect() gained a call to has_word(), which calls in_word(), and neither was in the list, so reflect() raised NameError: name 'has_word' is not defined. load() now pulls in every function the named ones call, so the next helper a tested function gains comes with it.

test_image_atomic_bounds. The test pinned uses_image_atomics() raising on a zero-length instruction in a module that holds no OpImageTexelPointer. Since the instruction scan, a module without that word is answered "no image atomics" without being walked, so the malformed check runs only where the walk does. The test now pins both halves: the walk's ValueError, on a module with the opcode's word before the malformed instruction, and the fast path's False for the module without it.

Making the malformed check exact again would put a scan for a zero instruction word in front of the walk, in dmsh_atomic.py, which is a chain file: the new chain version would rebuild every game's shader library to change nothing on a well-formed module. So the fast path's contract is pinned instead. That is open if a malformed module's error message matters. Nothing here changes what the chain computes, so dmsh_chain.h is untouched.

Checked

  • Tests: python3 -m unittest dm.tools.tests.test_dmsh_pool_arrays dm.tools.tests.test_image_atomic_bounds dm.tools.tests.test_split_linkdata (21 tests, OK, 7 skipped locally: the Metal compiles CI runs), and dm/tools/tests/test_settings*.py (19 tests, OK).
  • dm/tools/lint_python.py --against origin/main with the pinned tools from .github/requirements/lint.txt: 389 findings, 389 in the baseline, 0 new.
  • Not run: scripts/regress.py, which reports nothing for a chain that does not change; no game was run.

Docs

  • No reference entry: the chain's outputs do not change on a well-formed module, and the contract the two tests pin is now written in the tests.
  • No chain tool changed: dmsh_chain.py --header was not run.
  • No game files, keys or data extracted from a game in the change.

@github-actions github-actions Bot added the tools Tools and scripts (dm/tools, scripts) label Nov 5, 2026
…ipt's module global with an ignore and its reason, and pack_quiet's quiet time is a float, as its test passes a fraction of a day
@maceopark maceopark changed the title Main's Python checks are red: two lint findings and two tool tests the instruction scan broke Main's lint-python is green again: the NUP survey's three pyright findings are fixed Nov 5, 2026
@maceopark
maceopark force-pushed the fix/tool-tests-after-fast-path branch from 6ead327 to 9c24382 Compare November 5, 2026 08:21
@seedds

seedds commented Nov 10, 2026

Copy link
Copy Markdown
Owner

Thanks for the lint and fixture repairs. The remaining two-file diff is now covered on main by 58a77cc2: pack_quiet has the days: float annotation, and the NSP test patches NSP_FOLDER with mock.patch.object instead of assigning the module global in its callbacks.

Closing as superseded by the current implementation; no additional changes from this remaining diff need to land.

@seedds seedds closed this Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tools Tools and scripts (dm/tools, scripts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants