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

Merged
abnalstlll-byte merged 3 commits from upstream-pr/707 into main 2026-11-29 14:38:27 +00:00
abnalstlll-byte commented 2026-11-24 12:27:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T12:27:34Z.


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).
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5472138068 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/707). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T12:27:34Z. --- ### 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).
Dezmonius commented 2026-11-24 12:55:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Dezmonius on 2026-11-24T12:55:07Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7132095825 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/707#issuecomment-7132095825). Originally posted by [Dezmonius](https://github.com/Dezmonius) on 2026-11-24T12:55:07Z. --- 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).
abnalstlll-byte commented 2026-11-24 18:47:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T18:47:15Z.


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).
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7141151181 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/707#issuecomment-7141151181). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T18:47:15Z. --- 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).
Poussistar commented 2026-11-24 18:48:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Poussistar on 2026-11-24T18:48:11Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7141172486 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/707#issuecomment-7141172486). Originally posted by [Poussistar](https://github.com/Poussistar) on 2026-11-24T18:48:11Z. --- 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.
abnalstlll-byte commented 2026-11-25 16:31:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-25T16:31:03Z.


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)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7168106314 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/707#issuecomment-7168106314). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-25T16:31:03Z. --- 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)
OreoFR commented 2026-11-28 21:43:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:43:18Z.


Verified by OreoFR

  • Base: main 5cb45921e + PR head 52f1da288
  • Test: python -I tests/test_test_inventory.py
  • Red on main: ModuleNotFoundError test_inventory: the whole tool is new, the missing module is the feature itself (no test runs)
  • Green with the PR: 6 OK (26 s)
  • Verdict: READY
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246223280 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/707#issuecomment-7246223280). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T21:43:18Z. --- **Verified by OreoFR** - Base: main `5cb45921e` + PR head `52f1da288` - Test: `python -I tests/test_test_inventory.py` - Red on main: ModuleNotFoundError test_inventory: the whole tool is new, the missing module is the feature itself (no test runs) - Green with the PR: 6 OK (26 s) - Verdict: READY - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
zmasi commented 2026-11-29 01:38:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T01:38:47Z.


#707 | head 52f1da2884 (merged cleanly onto origin/main d8c10dd5e1) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes

Independent Verification (Windows 11)

  • Diff & safety audit: Inspected 100% of the diff across docs/test_inventory.md, tools/test_inventory.py, and tests/test_test_inventory.py. python -I scripts/check_no_game_data.py docs/test_inventory.md tools/test_inventory.py tests/test_test_inventory.py passed (rc=0).
  • Verification on Windows 11 (#707 + origin/main d8c10dd5e1):
    • python -I tests/test_test_inventory.py -v -> 6/6 passed (OK, 2.281s)
    • python -I -B tools/test_inventory.py --summary -> cataloged 1,526 test files (1,524 synthetic = 99.9%: runtime 353, shader 707, tools 427, viewer 39; rc=0)
    • python -I tests/test_ci_registration.py -> 18/18 passed (OK)
    • Doc verification suites: test_docs_table_rows.py (2/2), test_docs_repo_paths.py (5/5), test_docs_encoding.py (1/1), test_docs_env_vars.py (5/5) -> all OK.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248920983 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/707#issuecomment-7248920983). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T01:38:47Z. --- #707 | head 52f1da2884eef59071aee358226cbdaeaa5b9c56 (merged cleanly onto origin/main d8c10dd5e1) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes ### Independent Verification (Windows 11) - **Diff & safety audit**: Inspected 100% of the diff across `docs/test_inventory.md`, `tools/test_inventory.py`, and `tests/test_test_inventory.py`. `python -I scripts/check_no_game_data.py docs/test_inventory.md tools/test_inventory.py tests/test_test_inventory.py` passed (`rc=0`). - **Verification on Windows 11 (`#707 + origin/main` `d8c10dd5e1`)**: - `python -I tests/test_test_inventory.py -v` -> `6/6` passed (`OK`, `2.281s`) - `python -I -B tools/test_inventory.py --summary` -> cataloged `1,526` test files (`1,524` synthetic = `99.9%`: `runtime` `353`, `shader` `707`, `tools` `427`, `viewer` `39`; `rc=0`) - `python -I tests/test_ci_registration.py` -> `18/18` passed (`OK`) - Doc verification suites: `test_docs_table_rows.py` (`2/2`), `test_docs_repo_paths.py` (`5/5`), `test_docs_encoding.py` (`1/1`), `test_docs_env_vars.py` (`5/5`) -> all `OK`.
MoonEyes commented 2026-11-29 14:38:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T14:38:30Z.


Merged at head 52f1da2. Tested on this head by OreoFR, zmasi: the new test fails on main and passes with the PR (results in the comments above). AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7257461546 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/707#issuecomment-7257461546). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T14:38:30Z. --- Merged at head 52f1da2. Tested on this head by OreoFR, zmasi: the new test fails on main and passes with the PR (results in the comments above). AI-assisted: yes.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!707
No description provided.