tools: provide synthetic test inventory and subsystem map (DX-10) #707

Open
github-bot wants to merge 3 commits from github-bot/gh-707 into main AGit
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 12:27 UTC · original
abnalstlll-byte:feat/dx10-test-inventory → main · +430 −0 · 3 files · 3 commits · open

Summary

Implements DX-10: Synthetic test inventory and subsystem map tool.

Provides an authoritative CLI scanner (\ ools/test_inventory.py) and comprehensive architectural reference (\docs/test_inventory.md) that catalogs all 1,177 repository tests across four major subsystems (\shader,
untime, \ ools, \ iewer), verifying that 99.2% (1,168 tests) are fully synthetic and executable without retail game packages.

Features

  • Authoritative Subsystem Taxonomy: Classifies test suites into \shader\ (600), \ ools\ (315),
    untime\ (228), and \ iewer\ (34).
  • Runner Categorization: Analyzes runner requirements across \python_unittest\ (918), \ctest_cpp\ (226), \pytest\ (31), and
    ode_test\ (2).
  • Prerequisite Detection: Identifies optional hardware/software prerequisites (\ ulkan, \wine, \llvm, \pytest,
    ode, \dotnet).
  • Retail Dependency Isolation (Gaps): Flags the 9 tests that require \LEONIDA_GAME_DIR\ or \LEONIDA_MOVIE.
  • Machine-Readable Reports: Supports --json\ and --summary\ flags.

Verification

  • Tested with standard library: \python -I tests/test_test_inventory.py\ (5/5 PASS in 9.9s).
  • Clean-room check: \python -I scripts/check_no_game_data.py\ clean (0 issues).
  • Zero dependencies outside the Python standard library.
  • AI-assisted (Claude Code).
**@⁠abnalstlll-byte** on GitHub · 2026-11-24 12:27 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/707) `abnalstlll-byte:feat/dx10-test-inventory` → `main` · +430 −0 · 3 files · 3 commits · open ### Summary Implements **DX-10**: Synthetic test inventory and subsystem map tool. Provides an authoritative CLI scanner (\ ools/test_inventory.py\) and comprehensive architectural reference (\docs/test_inventory.md\) that catalogs all 1,177 repository tests across four major subsystems (\shader\, \ untime\, \ ools\, \ iewer\), verifying that 99.2% (1,168 tests) are fully synthetic and executable without retail game packages. ### Features - **Authoritative Subsystem Taxonomy**: Classifies test suites into \shader\ (600), \ ools\ (315), \ untime\ (228), and \ iewer\ (34). - **Runner Categorization**: Analyzes runner requirements across \python_unittest\ (918), \ctest_cpp\ (226), \pytest\ (31), and \ ode_test\ (2). - **Prerequisite Detection**: Identifies optional hardware/software prerequisites (\ ulkan\, \wine\, \llvm\, \pytest\, \ ode\, \dotnet\). - **Retail Dependency Isolation (Gaps)**: Flags the 9 tests that require \LEONIDA_GAME_DIR\ or \LEONIDA_MOVIE\. - **Machine-Readable Reports**: Supports \--json\ and \--summary\ flags. ### Verification - Tested with standard library: \python -I tests/test_test_inventory.py\ (5/5 PASS in 9.9s). - Clean-room check: \python -I scripts/check_no_game_data.py\ clean (0 issues). - Zero dependencies outside the Python standard library. - AI-assisted (Claude Code).
Address review feedback from @Poussistar on #707:
Reconfigure sys.stdout with errors='replace' in tools/test_inventory.py's
__main__ block to satisfy repository-wide test_tool_stdout_encoding.py.

AI-assisted (Claude Code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:17:18 +00:00
Author
Owner

@⁠Dezmonius on GitHub · 2026-11-24 12:55 UTC · original

Independent Windows 10 check of 36c8e30 with CPython 3.14.7. All five inventory tests passed. The clean source archive reports 1,211 candidates and 1,202 marked synthetic (the docs quote 1,177 and 1,168).

I compared the inventory to the actual parallel semantic runner on a temporary tree:

  • With only tests/semantic/test_sample.py, both see one test file. Compiling that file creates __pycache__/test_sample.cpython-314.pyc. The inventory reports two entries (the cache entry's runner is unknown), while the semantic runner still selects one.
  • Adding passing tests in testCase.py and pkg/__init__.py leaves the inventory count at two, including the cache entry. The actual semantic runner executes all three tests and exits 0. Its default is test*.py and it explicitly schedules package initializers.

There is also an optional/required distinction in --gaps: pe_loader_test.cpp is flagged as requiring retail because it mentions LEONIDA_GAME_DIR, but the source describes that as an optional section and skips that section when the variable is unset. The file-level marker is useful as a hint if labelled as such.

Could the inventory restrict candidates to source file types, ignore cache directories, and share the semantic runner's discovery rules for that subtree? The cache and filename/package cases can be covered with temporary-tree tests.

Synthetic fixtures and source inspection only. AI-assisted (Codex).

**@⁠Dezmonius** on GitHub · 2026-11-24 12:55 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/707#issuecomment-7132095825) Independent Windows 10 check of `36c8e30` with CPython 3.14.7. All five inventory tests passed. The clean source archive reports 1,211 candidates and 1,202 marked synthetic (the docs quote 1,177 and 1,168). I compared the inventory to the actual parallel semantic runner on a temporary tree: - With only `tests/semantic/test_sample.py`, both see one test file. Compiling that file creates `__pycache__/test_sample.cpython-314.pyc`. The inventory reports two entries (the cache entry's runner is `unknown`), while the semantic runner still selects one. - Adding passing tests in `testCase.py` and `pkg/__init__.py` leaves the inventory count at two, including the cache entry. The actual semantic runner executes all three tests and exits 0. Its default is `test*.py` and it explicitly schedules package initializers. There is also an optional/required distinction in `--gaps`: `pe_loader_test.cpp` is flagged as requiring retail because it mentions `LEONIDA_GAME_DIR`, but the source describes that as an optional section and skips that section when the variable is unset. The file-level marker is useful as a hint if labelled as such. Could the inventory restrict candidates to source file types, ignore cache directories, and share the semantic runner's discovery rules for that subtree? The cache and filename/package cases can be covered with temporary-tree tests. Synthetic fixtures and source inspection only. AI-assisted (Codex).
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 18:47 UTC · original

Thank you for the detailed review @⁠Dezmonius! Addressed all three items in 3c31992f2:

  • Restricted discovery to valid source extensions and excluded pycache/cache directories.
  • Mirrored scripts/run_semantic_tests.py inside ests/semantic/ ( est*.py + package init.py modules).
  • Distinguished
    etail_requirement (optional vs
    equired) so synthetic tests with optional SKIP retail legs remain counted as synthetic while still inspectable under --gaps, and replaced static doc counts with live discovery notes.
  • Added temporary-tree regression tests covering cache exclusion, estCase.py/pkg/init.py, and optional vs required retail flags; python -I tests/test_test_inventory.py passes (6/6 OK).
**@⁠abnalstlll-byte** on GitHub · 2026-11-24 18:47 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/707#issuecomment-7141151181) Thank you for the detailed review @⁠Dezmonius! Addressed all three items in 3c31992f2: - Restricted discovery to valid source extensions and excluded __pycache__/cache directories. - Mirrored scripts/run_semantic_tests.py inside ests/semantic/ ( est*.py + package __init__.py modules). - Distinguished etail_requirement (optional vs equired) so synthetic tests with optional SKIP retail legs remain counted as synthetic while still inspectable under --gaps, and replaced static doc counts with live discovery notes. - Added temporary-tree regression tests covering cache exclusion, estCase.py/pkg/__init__.py, and optional vs required retail flags; python -I tests/test_test_inventory.py passes (6/6 OK).
Author
Owner

@⁠Poussistar on GitHub · 2026-11-24 18:48 UTC · original

One repository-wide guard is red at head 36c8e308f: tests/test_tool_stdout_encoding.py. I applied the diff to a clean worktree at 6293c1c4f (origin/main), where the same file is green.

Linux x86-64, 4 vCPU, CPython 3.14.7, no game files, no GPU.

FAIL: test_every_main_block_reconfigures_stdout
AssertionError: Lists differ: ['tools/test_inventory.py'] != []
 : programs whose __main__ block doesn't set errors='replace' on stdout
Ran 4 tests in 0.329s
FAILED (failures=1)

tools/test_inventory.py ends with if __name__ == "__main__": raise SystemExit(main()). Every program under tools/, scripts/ and viewer/ starts that block with the stdout guard, for the reason the test file spells out: under python -I a redirected stdout is encoded with the console ANSI code page, PYTHONUTF8/PYTHONIOENCODING are ignored, and printing an inventory path that the code page cannot write ends the run with UnicodeEncodeError. The inventory lists file paths, so it is exactly the tool that will meet such a name.

Verified fix, copied from the sibling tools:

if __name__ == "__main__":
    try:  # a redirected stdout is strict ANSI code page under -I; write '?' for what it cannot encode
        sys.stdout.reconfigure(errors="replace")
    except (AttributeError, ValueError, OSError):
        pass
    raise SystemExit(main())

With it: tests/test_tool_stdout_encoding.py 4 tests OK, tests/test_test_inventory.py 5 tests OK, tests/test_text_write_line_endings.py 3 tests OK. Negative control, guard removed again: the ['tools/test_inventory.py'] != [] failure above returns.

The five inventory tests and both docs guards (test_docs_links.py, test_docs_cli_flags.py) pass as the PR stands; this is the only red I found.

AI-assisted review; no game files were used.

**@⁠Poussistar** on GitHub · 2026-11-24 18:48 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/707#issuecomment-7141172486) One repository-wide guard is red at head `36c8e308f`: `tests/test_tool_stdout_encoding.py`. I applied the diff to a clean worktree at `6293c1c4f` (`origin/main`), where the same file is green. Linux x86-64, 4 vCPU, CPython 3.14.7, no game files, no GPU. ``` FAIL: test_every_main_block_reconfigures_stdout AssertionError: Lists differ: ['tools/test_inventory.py'] != [] : programs whose __main__ block doesn't set errors='replace' on stdout Ran 4 tests in 0.329s FAILED (failures=1) ``` `tools/test_inventory.py` ends with `if __name__ == "__main__": raise SystemExit(main())`. Every program under `tools/`, `scripts/` and `viewer/` starts that block with the stdout guard, for the reason the test file spells out: under `python -I` a redirected stdout is encoded with the console ANSI code page, `PYTHONUTF8`/`PYTHONIOENCODING` are ignored, and printing an inventory path that the code page cannot write ends the run with `UnicodeEncodeError`. The inventory lists file paths, so it is exactly the tool that will meet such a name. Verified fix, copied from the sibling tools: ```python if __name__ == "__main__": try: # a redirected stdout is strict ANSI code page under -I; write '?' for what it cannot encode sys.stdout.reconfigure(errors="replace") except (AttributeError, ValueError, OSError): pass raise SystemExit(main()) ``` With it: `tests/test_tool_stdout_encoding.py` 4 tests OK, `tests/test_test_inventory.py` 5 tests OK, `tests/test_text_write_line_endings.py` 3 tests OK. Negative control, guard removed again: the `['tools/test_inventory.py'] != []` failure above returns. The five inventory tests and both docs guards (`test_docs_links.py`, `test_docs_cli_flags.py`) pass as the PR stands; this is the only red I found. AI-assisted review; no game files were used.
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-25 16:31 UTC · original

Thank you for the review @⁠Poussistar! Resolved in commit 8fc6e427f: added sys.stdout.reconfigure(errors="replace") to tools/test_inventory.py's __main__ block; test_tool_stdout_encoding.py now passes for test_inventory.py.

AI-assisted (Claude Code)

**@⁠abnalstlll-byte** on GitHub · 2026-11-25 16:31 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/707#issuecomment-7168106314) Thank you for the review @⁠Poussistar! Resolved in commit `8fc6e427f`: added `sys.stdout.reconfigure(errors="replace")` to `tools/test_inventory.py`'s `__main__` block; `test_tool_stdout_encoding.py` now passes for `test_inventory.py`. AI-assisted (Claude Code)
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/707/head:github-bot/gh-707'
git switch 'github-bot/gh-707'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-707'
git switch 'github-bot/gh-707'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-707'
git switch 'github-bot/gh-707'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-707'
git switch 'main'
git merge --squash 'github-bot/gh-707'
git switch 'main'
git merge --ff-only 'github-bot/gh-707'
git switch 'main'
git merge 'github-bot/gh-707'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.