tools: provide one-command synthetic source-only smoke suite (DX-07) #705

Merged
abnalstlll-byte merged 3 commits from upstream-pr/705 into main 2026-11-28 08:02:06 +00:00
abnalstlll-byte commented 2026-11-24 12:25:55 +00:00 (Migrated from github.com)

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


Summary

Implements DX-07: One-command synthetic source-only smoke suite.

Provides developers and CI with a quick, deterministic, zero-asset validation mechanism across Windows, Linux, and macOS without requiring retail game packages, carved shaders, or specific GPU hardware.

Key Capabilities

  • Prerequisites Discovery: \python -I scripts/smoke.py --prereqs-only\ audits Python 3.10+ satisfaction and detects optional toolchains (CMake, Ninja, MSVC, GCC, Clang, Vulkan SDK, Node, .NET).
  • Sub-Second Quick Mode: \python -I scripts/smoke.py --quick\ runs compilation (\compileall), clean-room validation (\check_no_game_data.py), and root CLI entry points in < 1 second.
  • Unified Developer Forwarding: Integrates seamlessly into \scripts/dev.py smoke.
  • Machine-Readable JSON: Supports --json\ for automated pipeline gating.
  • Documentation: Usage guide added to \docs/testing.md.

Verification

  • Ran standard-library test suite: \python -I tests/test_smoke_suite.py\ (7/7 PASS in 11.6s).
  • 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:5472112421 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/705). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T12:25:55Z. --- ### Summary Implements **DX-07**: One-command synthetic source-only smoke suite. Provides developers and CI with a quick, deterministic, zero-asset validation mechanism across Windows, Linux, and macOS without requiring retail game packages, carved shaders, or specific GPU hardware. ### Key Capabilities - **Prerequisites Discovery**: \python -I scripts/smoke.py --prereqs-only\ audits Python 3.10+ satisfaction and detects optional toolchains (CMake, Ninja, MSVC, GCC, Clang, Vulkan SDK, Node, .NET). - **Sub-Second Quick Mode**: \python -I scripts/smoke.py --quick\ runs compilation (\compileall\), clean-room validation (\check_no_game_data.py\), and root CLI entry points in < 1 second. - **Unified Developer Forwarding**: Integrates seamlessly into \scripts/dev.py smoke\. - **Machine-Readable JSON**: Supports \--json\ for automated pipeline gating. - **Documentation**: Usage guide added to \docs/testing.md\. ### Verification - Ran standard-library test suite: \python -I tests/test_smoke_suite.py\ (7/7 PASS in 11.6s). - 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:47:10 +00:00 (Migrated from github.com)

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


Independent Windows 10 check of 0c3ea1a with CPython 3.14.7 and a process-local PATH pointing to an empty directory, with VULKAN_SDK unset. All seven smoke tests passed. Both scripts/smoke.py --quick --json and scripts/dev.py smoke --quick --json exit 0, report all five checks as PASS, and produce a parseable JSON document.

The JSON failure path is broken. I appended an invalid Python statement to make_game.py in a disposable copy and ran python -I scripts/smoke.py --quick --json. Exit 1 and the trailing JSON verdict FAIL are correct, but compileall(..., quiet=1) writes *** Error compiling ... to stdout before JSON, so json.loads(stdout) fails at line 1. This leaves CI without machine-readable output for the failure it needs to inspect.

I locally redirected run_checks() stdout to stderr in JSON mode. The same syntax-error fixture then produced one parseable FAIL document on stdout and the compiler diagnostic on stderr for both entry points. A failure-mode test could assert that the entire stdout parses, regardless of exit code.

Source-only synthetic check. AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7131916043 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/705#issuecomment-7131916043). Originally posted by [Dezmonius](https://github.com/Dezmonius) on 2026-11-24T12:47:10Z. --- Independent Windows 10 check of `0c3ea1a` with CPython 3.14.7 and a process-local PATH pointing to an empty directory, with `VULKAN_SDK` unset. All seven smoke tests passed. Both `scripts/smoke.py --quick --json` and `scripts/dev.py smoke --quick --json` exit 0, report all five checks as PASS, and produce a parseable JSON document. The JSON failure path is broken. I appended an invalid Python statement to `make_game.py` in a disposable copy and ran `python -I scripts/smoke.py --quick --json`. Exit 1 and the trailing JSON verdict `FAIL` are correct, but `compileall(..., quiet=1)` writes `*** Error compiling ...` to stdout before JSON, so `json.loads(stdout)` fails at line 1. This leaves CI without machine-readable output for the failure it needs to inspect. I locally redirected `run_checks()` stdout to stderr in JSON mode. The same syntax-error fixture then produced one parseable `FAIL` document on stdout and the compiler diagnostic on stderr for both entry points. A failure-mode test could assert that the entire stdout parses, regardless of exit code. Source-only synthetic check. AI-assisted (Codex).
GeorgiyDemo commented 2026-11-24 13:03:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by GeorgiyDemo on 2026-11-24T13:03:46Z.


Tested 0c3ea1ad8 on Apple M5 Pro, macOS 26.7.3 (25G342), arm64, Python 3.15.2 (CI uses 3.12):

  • tests/test_smoke_suite.py: 7 tests OK.
  • python3 -I scripts/smoke.py (full, not --quick) runs and passes on macOS: python_compileall, clean_room_no_game_data, cli_help_make_game.py, cli_help_tools/rdna2spirv.py, cli_help_scripts/dev.py, test_test_dev_discovery, test_test_shader_ir_parse — all PASS, Verdict: PASS, about 1.3 s end to end.

No GPU leg (the suite is source-only by design). No game data. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7132294994 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/705#issuecomment-7132294994). Originally posted by [GeorgiyDemo](https://github.com/GeorgiyDemo) on 2026-11-24T13:03:46Z. --- Tested `0c3ea1ad8` on Apple M5 Pro, macOS 26.7.3 (25G342), arm64, Python 3.15.2 (CI uses 3.12): - `tests/test_smoke_suite.py`: 7 tests OK. - `python3 -I scripts/smoke.py` (full, not `--quick`) runs and passes on macOS: `python_compileall`, `clean_room_no_game_data`, `cli_help_make_game.py`, `cli_help_tools/rdna2spirv.py`, `cli_help_scripts/dev.py`, `test_test_dev_discovery`, `test_test_shader_ir_parse` — all PASS, `Verdict: PASS`, about 1.3 s end to end. No GPU leg (the suite is source-only by design). No game data. AI-assisted.
abnalstlll-byte commented 2026-11-24 18:45:20 +00:00 (Migrated from github.com)

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


Thank you for catching that @Dezmonius! Fixed in da7881260:
un_checks() now redirects compileall stdout into a buffer (printing compilation diagnostics to stderr on failure) and --json mode guards
un_checks() with contextlib.redirect_stdout(sys.stderr). Added est_compile_failure_keeps_json_stdout_clean covering both scripts/smoke.py --quick --json and scripts/dev.py smoke --quick --json; all 8 tests pass (python -I tests/test_smoke_suite.py).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7141105847 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/705#issuecomment-7141105847). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T18:45:20Z. --- Thank you for catching that @Dezmonius! Fixed in da7881260: un_checks() now redirects compileall stdout into a buffer (printing compilation diagnostics to stderr on failure) and --json mode guards un_checks() with contextlib.redirect_stdout(sys.stderr). Added est_compile_failure_keeps_json_stdout_clean covering both scripts/smoke.py --quick --json and scripts/dev.py smoke --quick --json; all 8 tests pass (python -I tests/test_smoke_suite.py).
Poussistar commented 2026-11-24 18:48:09 +00:00 (Migrated from github.com)

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


Two repository-wide guard tests are red at head da7881260, and neither is a pre-existing red: I applied this PR's diff to a clean worktree at 6293c1c4f (origin/main) and ran the same files on clean main, where both are green.

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

tests/test_tool_stdout_encoding.py:

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

scripts/smoke.py ends with a bare raise SystemExit(main()); every program under tools/, scripts/ and viewer/ is expected to start its __main__ block with the guard. scripts/dev.py already has that block, so the shape is one file away.

tests/test_docs_cli_flags.py:

FAIL: test_fenced_commands_use_the_flags_of_their_tool
AssertionError: Lists differ: [('docs/testing.md:75', 'scripts/dev.py', '--quick')] != []
 : fenced commands using a flag their script lacks: docs/testing.md:75 scripts/dev.py --quick
FAILED (failures=1)

docs/testing.md:75 runs python -I scripts/dev.py smoke --quick. It works at runtime, because dev.py forwards smoke to the producer before argparse, but the guard maps a dev.py subcommand to its producer through DEV_PRODUCERS in tests/test_docs_cli_flags.py:163, which only knows boot-trace and guest-scene. The new smoke subcommand has to be added there; otherwise the guard reads --quick as a flag of dev.py itself.

Both fixes verified in the same worktree:

  • the four-line try/except guard at the end of scripts/smoke.py, as in scripts/dev.py, and "smoke": "scripts/smoke.py" in DEV_PRODUCERS:
    tests/test_docs_cli_flags.py 4 tests OK, tests/test_tool_stdout_encoding.py 4 tests OK, tests/test_smoke_suite.py 8 tests OK, tests/test_text_write_line_endings.py 3 tests OK.
  • negative control, each change reverted on its own: Lists differ: ['scripts/smoke.py'] != [] and Lists differ: [('docs/testing.md:75', 'scripts/dev.py', '--quick')] != [] come back.

One caveat on my own method, in case you reproduce it: I first saw docs/testing.md:63 --prereqs-only reported too. That one is an artifact of testing a git apply worktree, where the new scripts/smoke.py is untracked and tracked_files() cannot see it; after git add -A it disappears. Only the two failures above are real.

AI-assisted review; no game files were used.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7141171983 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/705#issuecomment-7141171983). Originally posted by [Poussistar](https://github.com/Poussistar) on 2026-11-24T18:48:09Z. --- Two repository-wide guard tests are red at head `da7881260`, and neither is a pre-existing red: I applied this PR's diff to a clean worktree at `6293c1c4f` (`origin/main`) and ran the same files on clean main, where both are green. Linux x86-64, 4 vCPU, CPython 3.14.7 (system), no game files, no GPU. `tests/test_tool_stdout_encoding.py`: ``` FAIL: test_every_main_block_reconfigures_stdout AssertionError: Lists differ: ['scripts/smoke.py'] != [] : programs whose __main__ block doesn't set errors='replace' on stdout Ran 4 tests in 0.322s FAILED (failures=1) ``` `scripts/smoke.py` ends with a bare `raise SystemExit(main())`; every program under `tools/`, `scripts/` and `viewer/` is expected to start its `__main__` block with the guard. `scripts/dev.py` already has that block, so the shape is one file away. `tests/test_docs_cli_flags.py`: ``` FAIL: test_fenced_commands_use_the_flags_of_their_tool AssertionError: Lists differ: [('docs/testing.md:75', 'scripts/dev.py', '--quick')] != [] : fenced commands using a flag their script lacks: docs/testing.md:75 scripts/dev.py --quick FAILED (failures=1) ``` `docs/testing.md:75` runs `python -I scripts/dev.py smoke --quick`. It works at runtime, because `dev.py` forwards `smoke` to the producer before argparse, but the guard maps a `dev.py` subcommand to its producer through `DEV_PRODUCERS` in `tests/test_docs_cli_flags.py:163`, which only knows `boot-trace` and `guest-scene`. The new `smoke` subcommand has to be added there; otherwise the guard reads `--quick` as a flag of `dev.py` itself. Both fixes verified in the same worktree: - the four-line `try/except` guard at the end of `scripts/smoke.py`, as in `scripts/dev.py`, and `"smoke": "scripts/smoke.py"` in `DEV_PRODUCERS`: `tests/test_docs_cli_flags.py` 4 tests OK, `tests/test_tool_stdout_encoding.py` 4 tests OK, `tests/test_smoke_suite.py` 8 tests OK, `tests/test_text_write_line_endings.py` 3 tests OK. - negative control, each change reverted on its own: `Lists differ: ['scripts/smoke.py'] != []` and `Lists differ: [('docs/testing.md:75', 'scripts/dev.py', '--quick')] != []` come back. One caveat on my own method, in case you reproduce it: I first saw `docs/testing.md:63 --prereqs-only` reported too. That one is an artifact of testing a `git apply` worktree, where the new `scripts/smoke.py` is untracked and `tracked_files()` cannot see it; after `git add -A` it disappears. Only the two failures above are real. AI-assisted review; no game files were used.
abnalstlll-byte commented 2026-11-25 16:29:39 +00:00 (Migrated from github.com)

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


Thank you for the detailed review and reproduction steps @Poussistar! Both items have been resolved in commit b3ed59406:

  • Added sys.stdout.reconfigure(errors="replace") in scripts/smoke.py's __main__ block (test_tool_stdout_encoding.py now passes for scripts/smoke.py).
  • Added "smoke": "scripts/smoke.py" to DEV_PRODUCERS in tests/test_docs_cli_flags.py so subcommand --quick is properly mapped (test_docs_cli_flags.py now passes cleanly, 4/4 tests OK).

AI-assisted (Claude Code)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7168069651 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/705#issuecomment-7168069651). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-25T16:29:39Z. --- Thank you for the detailed review and reproduction steps @Poussistar! Both items have been resolved in commit `b3ed59406`: - Added `sys.stdout.reconfigure(errors="replace")` in `scripts/smoke.py`'s `__main__` block (`test_tool_stdout_encoding.py` now passes for `scripts/smoke.py`). - Added `"smoke": "scripts/smoke.py"` to `DEV_PRODUCERS` in `tests/test_docs_cli_flags.py` so subcommand `--quick` is properly mapped (`test_docs_cli_flags.py` now passes cleanly, 4/4 tests OK). AI-assisted (Claude Code)
DadaCap commented 2026-11-28 08:02:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T08:02:08Z.


Merged into main (merge commit 17eb74947), approved by DadaCap (maintainer). Thanks!

Checked before merging: Tested in our local release candidate (main + 41 PRs): translator suite 512 files / 6,442 tests clean, Python suite with no new failure versus main, and 360 s game runs on an RTX 5080 with no regression. The merge was pinned to the head commit that was tested (a9692a8c9).

AI-assisted (Claude Code), posted for DadaCap.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7236319036 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/705#issuecomment-7236319036). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-28T08:02:08Z. --- Merged into `main` (merge commit 17eb74947), approved by DadaCap (maintainer). Thanks! Checked before merging: Tested in our local release candidate (main + 41 PRs): translator suite 512 files / 6,442 tests clean, Python suite with no new failure versus main, and 360 s game runs on an RTX 5080 with no regression. The merge was pinned to the head commit that was tested (a9692a8c9). _AI-assisted (Claude Code), posted for DadaCap._
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!705
No description provided.