Accept only label-kind state IDs in the script state probe and cover more synthetic trees #102

Manually merged
github merged 2 commits from gh-pr/102/head into gh-pr/102/base 2026-11-26 21:27:01 +00:00
Owner

@⁠Vonsek on GitHub · 2026-11-21 15:59 UTC · original
Vonsek:script-state-synthetic → main · +41 −11 · 3 files · 2 commits · merged 2026-11-21 16:48 UTC

Change

tools/script_state_probe.py accepted a state id attribute of any kind, while the replay's state_index requires kind 5. An integer id whose hash equals a label could therefore return a camera example for --state <label>. The probe now treats only a kind-5 id as a state ID. The Script states item in "Choose an experiment" gains Linux-runnable synthetic cases covering a non-state parent, a missing camera attribute, a root with a parent, a label that selects nothing, and the integer-id regression. The paragraph in docs/experiments.md ("State-linked settings in a script archive") is updated to match.

Verification

python -B tests/script_state_check.py: all 8 tests pass. On Windows, ctest --preset dev --no-tests=error -R '^script_state_literals$' -V at 195042e on Windows 11 build 26200.9974, VS Build Tools 2022 17.14 (MSVC 14.44.35207), Windows SDK 10.0.26100, Python 3.12, RTX 5080 (driver 32.0.16.1692) passed (Ran 8 tests, OK). With the tools/ change reverted, test_state_id_must_be_a_label fails and the rest pass.

Evidence and follow-up

The fixtures are generated in the test from synthetic bytes, so there is no game data and no license concern. The sibling-link and ambiguity cases remain in tests/script_path_check.py, which needs the Windows-built host. inspect_tree still lets the last duplicate id win silently, while state_index raises; another contributor could align the two. No local-data result changes.

**@⁠Vonsek** on GitHub · 2026-11-21 15:59 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/102) `Vonsek:script-state-synthetic` → `main` · +41 −11 · 3 files · 2 commits · merged 2026-11-21 16:48 UTC ## Change `tools/script_state_probe.py` accepted a state `id` attribute of any kind, while the replay's `state_index` requires kind 5. An integer `id` whose hash equals a label could therefore return a camera example for `--state <label>`. The probe now treats only a kind-5 `id` as a state ID. The Script states item in "Choose an experiment" gains Linux-runnable synthetic cases covering a non-state parent, a missing camera attribute, a root with a parent, a label that selects nothing, and the integer-`id` regression. The paragraph in docs/experiments.md ("State-linked settings in a script archive") is updated to match. ## Verification `python -B tests/script_state_check.py`: all 8 tests pass. On Windows, `ctest --preset dev --no-tests=error -R '^script_state_literals$' -V` at 195042e on Windows 11 build 26200.9974, VS Build Tools 2022 17.14 (MSVC 14.44.35207), Windows SDK 10.0.26100, Python 3.12, RTX 5080 (driver 32.0.16.1692) passed (Ran 8 tests, OK). With the `tools/` change reverted, `test_state_id_must_be_a_label` fails and the rest pass. ## Evidence and follow-up The fixtures are generated in the test from synthetic bytes, so there is no game data and no license concern. The sibling-link and ambiguity cases remain in `tests/script_path_check.py`, which needs the Windows-built host. `inspect_tree` still lets the last duplicate `id` win silently, while `state_index` raises; another contributor could align the two. No local-data result changes.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:27:00 +00:00
github manually merged commit 2dbc264243 into gh-pr/102/base 2026-11-26 21:27:01 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.