McRogueFace/tools
John McCardle 30abb0b7ec fix(engine): headless step() is a full simulation frame; --exec can no longer hang
step() advanced animations and timers only. It never called updatePythonScenes(),
which lives solely in doFrame() -- so headless Scene.update(dt) overrides never
fired. That was the filed bug, but it was one of twelve omissions: the C++ scene
update never ran, scene transitions never progressed or COMPLETED, and
current_frame never advanced. Headless behaved measurably differently from a real
frame, and any game with per-frame logic in update() was untestable.

step() is now a full simulation frame: scene update, timers, Python scene update,
animations, transitions (including completion), frame-time metrics, currentFrame++.
Render and input stay out, deliberately -- rendering is orthogonal to the clock and
costs zero simulation time (see renderScene(); a screenshot draws arbitrary state
without time passing). Timers remain on simulation_time: explicit, deterministic
time is the entire point of driving a headless test with step().

This exposed the deeper bug. testTimers() reads simulation_time when headless, and
simulation_time is advanced ONLY by step() -- the doFrame run loop never touched it.
So the headless run loop spun forever on a frozen clock: any headless script that
registered a timer and did not call step() hung until killed. And a script that died
during setup registered no timers, hit the auto-exit-when-no-timers path, exited 0,
and was scored as a PASSING test.

So headless --exec now exits when its scripts finish, nonzero if a script fell off
the end without calling sys.exit(). step() is the clock; the engine cannot advance
time on its own, and pretending otherwise is what produced the hang. A genuinely
long-lived headless process (server, REPL host) opts in with the new --run-forever.

run_tests.py additionally refuses to pass any test whose output contains a
Traceback. Between the two, 82 tests that were being scored green while asserting
nothing are now correctly red; they are repaired in the following commits.

closes #350
2026-07-14 06:37:52 -04:00
..
hooks Untrack generated docs; add API manifest infra and pre-commit hook 2026-07-11 20:57:31 -04:00
api_delta.py fix(bindings): make dynamic module attributes dir()-discoverable 2026-07-13 23:47:04 -04:00
audit_pymethoddef.py Add tools/audit_pymethoddef.py - MCRF_METHOD/MCRF_PROPERTY compliance auditor 2026-04-18 12:30:25 -04:00
build_debug_libs.sh Fix build_debug_libs.sh flag quoting so --asan/--tsan can rebuild 2026-06-21 16:44:33 -04:00
capture_audio_synth_header.py Fix capture_audio_synth_header.py for headless --exec mode 2026-04-18 23:25:17 -04:00
check_frozen_docstrings.sh Add docstring-macro validation scripts for #314 F15 2026-06-21 00:11:15 -04:00
generate_all_docs.sh Wire strict frozen-docstring gate into the doc pipeline (#314 F15) 2026-06-21 06:45:11 -04:00
generate_api_manifest.py fix(bindings): make dynamic module attributes dir()-discoverable 2026-07-13 23:47:04 -04:00
generate_color_table.py Squashed commit of the following: [alpha_presentable] 2025-07-15 21:30:49 -04:00
generate_dynamic_docs.py fix(engine): headless step() is a full simulation frame; --exec can no longer hang 2026-07-14 06:37:52 -04:00
generate_man_page.sh docs: Complete Phase 7 documentation system with parser fixes and man pages 2025-10-30 21:20:50 -04:00
generate_stubs.py Squashed commit of the following: [alpha_presentable] 2025-07-15 21:30:49 -04:00
generate_stubs_v2.py fix(engine): headless step() is a full simulation frame; --exec can no longer hang 2026-07-14 06:37:52 -04:00
package.sh Untrack generated docs; add API manifest infra and pre-commit hook 2026-07-11 20:57:31 -04:00
package_stdlib.py distribution packaging 2026-01-09 12:00:59 -05:00
stdlib_modules.yaml distribution packaging 2026-01-09 12:00:59 -05:00
test_link_transform.py feat: add link transformation to documentation generator 2025-10-30 11:39:54 -04:00
test_vector_docs.py feat: convert PyVector properties to use macros 2025-10-30 11:33:49 -04:00
ui_methods_documentation.py Squashed commit of the following: [alpha_presentable] 2025-07-15 21:30:49 -04:00
untrack_generated_docs.sh Untrack generated docs; add API manifest infra and pre-commit hook 2026-07-11 20:57:31 -04:00
validate_file_docstrings.sh Add docstring-macro validation scripts for #314 F15 2026-06-21 00:11:15 -04:00