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

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

@⁠abnalstlll-byte on GitHub · 2026-11-24 12:25 UTC · original
abnalstlll-byte:feat/dx07-smoke-suite → main · +497 −0 · 5 files · 3 commits · open

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).
**@⁠abnalstlll-byte** on GitHub · 2026-11-24 12:25 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/705) `abnalstlll-byte:feat/dx07-smoke-suite` → `main` · +497 −0 · 5 files · 3 commits · open ### 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).
Address review feedback from @Poussistar on #705:
1. Reconfigure sys.stdout with errors='replace' in scripts/smoke.py's
   __main__ block to satisfy repository-wide test_tool_stdout_encoding.py.
2. Register 'smoke': 'scripts/smoke.py' in tests/test_docs_cli_flags.py
   DEV_PRODUCERS map so fenced docs commands invoking 'dev.py smoke --quick'
   do not report --quick as an unknown flag of dev.py.

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

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

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

**@⁠Dezmonius** on GitHub · 2026-11-24 12:47 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/705#issuecomment-7131916043) 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).
Author
Owner

@⁠GeorgiyDemo on GitHub · 2026-11-24 13:03 UTC · original

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.

**@⁠GeorgiyDemo** on GitHub · 2026-11-24 13:03 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/705#issuecomment-7132294994) 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.
Author
Owner

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

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

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 18:45 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/705#issuecomment-7141105847) 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).
Author
Owner

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

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.

**@⁠Poussistar** on GitHub · 2026-11-24 18:48 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/705#issuecomment-7141171983) 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.
Author
Owner

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

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)

**@⁠abnalstlll-byte** on GitHub · 2026-11-25 16:29 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/705#issuecomment-7168069651) 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)
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/705/head:github-bot/gh-705'
git switch 'github-bot/gh-705'

Merge

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