runtime: add main(argv), csv.Error/directory guards, and CLI suite in startup_audio_timeline #2432
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2440"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-25T16:52:46Z.
Change
Add a testable
main(argv=None) -> intentrypoint, upfront directory guards forpacketsandinputs, andcsv.Errorhandling totools/startup_audio_timeline.py, together with a standalone pure-Python CLI test suite registered inCMakeLists.txt(startup_audio_timeline_cli_check).tools/startup_audio_timeline.py:argv: list[str] | None = Noneinmain, forwardargvtoparser.parse_args(argv), return0on success, and invokeraise SystemExit(main())under__main__.packets(args.packets.is_dir()) andinputs(args.inputs.is_dir()) before reading files.(OSError, ValueError, csv.Error)viaparser.error(str(error)), preserving exit status2and the error reporting expected bytests/startup_audio_timeline_check.pywith zero raw tracebacks while preserving exact JSON stdout schema.tests/startup_audio_timeline_cli_check.py: standalone unittest suite using synthetic UTF-8-BOM CSV packet files and JSONL input events covering repeatable--action, custom--sample-rate/--before/--after,flags & 4skip, zero-coverage silence windows,main(None)/__main__forwarding, and negative/mutation controls (missing/directorypacketsandinputs, NUL-byte and field-limitcsv.Error, non-UTF-8 inputs, malformed/non-object JSONL rows, NaN/Inf values, and zero-length/negative window bounds).CMakeLists.txt: registerstartup_audio_timeline_cli_checkimmediately afterstartup_audio_timeline(tests/startup_audio_timeline_check.pyleft untouched).Verification
Verified on rebased commit
1e9ccd5e(based onupstream/maine06aca8b) usingout/pe-env/Scripts/python.exe -B:out/pe-env/Scripts/python.exe -B tests/startup_audio_timeline_cli_check.py -v->Ran 5 tests,OK(exit 0).out/pe-env/Scripts/python.exe -B tests/startup_audio_timeline_check.py -v->Ran 3 tests,OK(exit 0).out/pe-env/Scripts/python.exe -B tests/form_coverage_check.py->form coverage checks passed(exit 0).out/pe-env/Scripts/python.exe -B tests/docs_links_check.py->Self-test passed.(exit 0).out/pe-env/Scripts/python.exe -B tests/bidi_controls_check.py->Self-test passed.(exit 0).tools/startup_audio_timeline.py: 8/8 mutations killed (argvforwarding,packets.is_dir(),inputs.is_dir(),csv.Errorguard,OSErrorguard, zero-length window check,flags & 4skip, integer0return).Evidence and follow-up
All CSV and JSONL fixtures in
tests/startup_audio_timeline_cli_check.pyare synthetic byte arrays generated in-memory under the repository MIT license; no external binaries or game files are used. Contributors can run the suite directly viaout/pe-env/Scripts/python.exe -B tests/startup_audio_timeline_cli_check.pyor through CTest (startup_audio_timeline_cli_check).Checklist
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T18:24:57Z.
Review: COMMENTED
Review of head
1e9ccd5e(comment only, no Windows run from me).Checked:
tools/startup_audio_timeline.py:main(argv)forwards toparse_args(argv)and returns 0. The__main__path usesraise SystemExit(main()).csvis already imported, andcsv.Erroris now caught, so a bad CSV exits 2 throughparser.errorinstead of a traceback. The JSON output is unchanged.CMakeLists.txt: the new test is registered right afterstartup_audio_timeline. It is pure Python, so no WARP or hardware run is needed. The author's body lists Windowspython -Bruns on this head, and the PR checks are green. I did not re-run those.Commands run (Linux):
python3 -B tests/startup_audio_timeline_cli_check.py: 5 tests OKpython3 -B tests/startup_audio_timeline_check.py: OKgit diff --check origin/main...HEAD: cleanpython3 tests/bidi_controls_check.py: passcsv.Errorfrom the except tuple. The new suite fails.is_dir()guards. The new suite fails.git checkout -- ..Non-blocking note: on Linux and Windows, opening a directory already raises an
OSError(IsADirectoryError/PermissionError), which the existingexceptturns into exit 2. So theis_dir()guards only change the message text. If you want less code, you could drop them and keep the test on the exit code. Fine to keep as is.No blocking findings.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T19:28:04Z.
Review: COMMENTED
Review of head
d596e5ba(after update-branch with main). Comment only.Checked:
tools/startup_audio_timeline.py:main(argv)forwards toparse_args, returns 0,raise SystemExit(main()); directory guards andcsv.Errorgo throughparser.error(exit 2). JSON stdout unchanged.tests/startup_audio_timeline_cli_check.pyguards the new behavior through the CLI (stdout, exit code), including missing/directory inputs, NUL/field-limit csv errors, bad JSONL, NaN/Inf.startup_audio_timelinetest. No other open or merged PR covers this slice (#1870 only added the CI hook).Commands run (Linux, worktree at this head):
python3 tests/startup_audio_timeline_cli_check.py-> 5 tests OKpython3 tests/startup_audio_timeline_check.py-> 3 tests OKpython3 tests/docs_links_check.pyandpython3 tests/bidi_controls_check.py-> OKgit diff --check origin/main...HEAD-> cleancsv.Errorfrom the except tuple -> new suite fails.inputsdirectory guard -> new suite fails.No blocking findings. Pure Python tooling, no game or startup claim.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T19:40:29Z.
Win2025 WARP receipt for head
d596e5baafter updating with main.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
d596e5baea9defdda35f403344a61d5cf13e9ffb:--preset dev):cmake --build --preset dev -- -j 2):255.22s(configure7.96s)ctest --preset dev -R 'startup_audio_timeline' --parallel 2 --no-tests=error --output-on-failure): 2/2 passed (7.31s:startup_audio_timeline2.32s,startup_audio_timeline_cli_check7.14s)/O2(--preset release):cmake --build --preset release -- -j 2):211.67s(configure3.63s)ctest --preset release -R 'startup_audio_timeline' --parallel 2 --no-tests=error --output-on-failure): 2/2 passed (5.09s:startup_audio_timeline1.83s,startup_audio_timeline_cli_check4.93s)tests/startup_audio_timeline_check.pyok (6.2s)sccache: 53/-172 hits; wall519.1sAI-assisted; commands listed were executed locally.