Reject duplicate state ID attributes in the script state probe #122

Merged
Vonsek merged 2 commits from upstream-pr/123 into main 2026-11-21 17:20:21 +00:00
Vonsek commented 2026-11-21 16:39:25 +00:00 (Migrated from github.com)

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


Change

Follow-up to #102. inspect_tree in tools/script_state_probe.py let the last of several id attributes on one state node win silently, while state_index in tools/script_path_replay.py raises Duplicate state ID attribute. The probe now raises the same error for a state node with more than one label-kind id attribute, so both tools treat duplicate state IDs the same way. A sentence in the state-probe section of docs/experiments.md describes this for contributors who run the probe.

Verification

python -B tests/script_state_check.py: 4 tests, OK. The new DuplicateStateIdTests case fails without the probe change and passes with it. It merges cleanly with #102.

Windows: at 3a24823 on Windows 11 build 26200.9974, VS Build Tools 2022 17.14 (MSVC 14.44.35207), Windows SDK 10.0.26100, Python 3.12: python -B tests/script_state_check.py ran 4 tests, OK, and ctest --preset dev --no-tests=error -R script_state_literals -V passed (1/1).

Evidence and follow-up

The regression is a synthetic node and attribute list built in the test, with no external fixture and no local data. Assumption: only label-kind (5) id attributes count as state IDs, matching the replay and #102. Duplicates of other kinds are ignored, as in the replay.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6531538789 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/123). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T16:39:25Z. --- ## Change Follow-up to #102. `inspect_tree` in `tools/script_state_probe.py` let the last of several `id` attributes on one state node win silently, while `state_index` in `tools/script_path_replay.py` raises `Duplicate state ID attribute`. The probe now raises the same error for a state node with more than one label-kind `id` attribute, so both tools treat duplicate state IDs the same way. A sentence in the state-probe section of `docs/experiments.md` describes this for contributors who run the probe. ## Verification `python -B tests/script_state_check.py`: 4 tests, OK. The new `DuplicateStateIdTests` case fails without the probe change and passes with it. It merges cleanly with #102. Windows: at 3a24823 on Windows 11 build 26200.9974, VS Build Tools 2022 17.14 (MSVC 14.44.35207), Windows SDK 10.0.26100, Python 3.12: `python -B tests/script_state_check.py` ran 4 tests, OK, and `ctest --preset dev --no-tests=error -R script_state_literals -V` passed (1/1). ## Evidence and follow-up The regression is a synthetic node and attribute list built in the test, with no external fixture and no local data. Assumption: only label-kind (5) `id` attributes count as state IDs, matching the replay and #102. Duplicates of other kinds are ignored, as in the replay.
upstream-sync closed this pull request 2026-11-24 06:41:25 +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!122
No description provided.