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

Merged
Vonsek merged 2 commits from upstream-pr/102 into main 2026-11-21 16:48:30 +00:00
Vonsek commented 2026-11-21 15:59:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T15:59:39Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6531084327 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/102). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T15:59:39Z. --- ## 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.
upstream-sync closed this pull request 2026-11-24 06:41:19 +00:00
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
R0Y00/Xbox2Windows!101
No description provided.