script: finish validating sibling links before reporting ambiguity in resolve_script_path #145

Merged
Vonsek merged 2 commits from upstream-pr/146 into main 2026-11-21 17:45:08 +00:00
Vonsek commented 2026-11-21 17:08:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T17:08:03Z.


Change

Keep validating the remaining attributes and sibling links on the current level in tools/script_path_host.cpp (resolve_script_path) before returning -2 (ambiguous).

Previously, resolve_script_path returned -2 as soon as a second matching state id was encountered. Any malformed link or attribute later on the same level (such as a broken previousSibling, a mismatched parent, a cycle in nextSibling, or a duplicate id attribute on the second match) was skipped and masked as -2 instead of returning -3 (malformed).

resolve_script_path now records ambiguous = true and finishes checking the full sibling chain for that level before returning -2.

tests/script_path_check.py adds test_broken_link_after_ambiguous_siblings, which:

  • verifies an intact three-child synthetic tree with two matching siblings still reports ambiguous;
  • corrupts links after the second match (previousSibling, nextSibling cycle, and parent) and requires -3 (malformed) to be reported.

Verification

Tested on Windows 11 x64, VS 2022 Build Tools 17.14 (MSVC 19.44.35230.0), Windows SDK 10.0.26100, Python 3.12.10, at commit a5d9a7d:

  • Before the fix in tools/script_path_host.cpp, all three corrupted-link subtests fail because resolve_script_path returns -2 instead of -3:
    ctest --preset dev --no-tests=error -R '^script_path_links$' -V
    Ran 4 tests in 0.023s
    FAILED (failures=3)
    1/1 Test #64: script_path_links ................***Failed    0.16 sec
    
  • After rebuilding script_path_host.dll with the fix:
    ctest --preset dev --no-tests=error -R '^script_(state_literals|path_links)$' -V
    1/2 Test #64: script_path_links ................   Passed    0.15 sec
    2/2 Test #65: script_state_literals ............   Passed    0.16 sec
    100% tests passed, 0 tests failed out of 2
    

Evidence and follow-up

All new cases use the synthetic source-built state rows in tests/script_path_check.py and the compiled script_path_host.dll. No external files or archive dumps are used.

This change only affects validation ordering when multiple siblings match on a level; intact trees return the same node indices and status codes as before.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6531876814 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/146). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T17:08:03Z. --- ## Change Keep validating the remaining attributes and sibling links on the current level in `tools/script_path_host.cpp` (`resolve_script_path`) before returning `-2` (ambiguous). Previously, `resolve_script_path` returned `-2` as soon as a second matching `state` `id` was encountered. Any malformed link or attribute later on the same level (such as a broken `previousSibling`, a mismatched `parent`, a cycle in `nextSibling`, or a duplicate `id` attribute on the second match) was skipped and masked as `-2` instead of returning `-3` (malformed). `resolve_script_path` now records `ambiguous = true` and finishes checking the full sibling chain for that level before returning `-2`. `tests/script_path_check.py` adds `test_broken_link_after_ambiguous_siblings`, which: - verifies an intact three-child synthetic tree with two matching siblings still reports `ambiguous`; - corrupts links after the second match (`previousSibling`, `nextSibling` cycle, and `parent`) and requires `-3` (malformed) to be reported. ## Verification Tested on Windows 11 x64, VS 2022 Build Tools 17.14 (MSVC 19.44.35230.0), Windows SDK 10.0.26100, Python 3.12.10, at commit `a5d9a7d`: - Before the fix in `tools/script_path_host.cpp`, all three corrupted-link subtests fail because `resolve_script_path` returns `-2` instead of `-3`: ```text ctest --preset dev --no-tests=error -R '^script_path_links$' -V Ran 4 tests in 0.023s FAILED (failures=3) 1/1 Test #64: script_path_links ................***Failed 0.16 sec ``` - After rebuilding `script_path_host.dll` with the fix: ```text ctest --preset dev --no-tests=error -R '^script_(state_literals|path_links)$' -V 1/2 Test #64: script_path_links ................ Passed 0.15 sec 2/2 Test #65: script_state_literals ............ Passed 0.16 sec 100% tests passed, 0 tests failed out of 2 ``` ## Evidence and follow-up All new cases use the synthetic source-built state rows in `tests/script_path_check.py` and the compiled `script_path_host.dll`. No external files or archive dumps are used. This change only affects validation ordering when multiple siblings match on a level; intact trees return the same node indices and status codes as before. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets.
upstream-sync closed this pull request 2026-11-24 06:41:32 +00:00
chatgpt-codex-connector[bot commented 2026-11-24 06:47:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T17:10:10Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T17:11:49.645455Z a5d9a7d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7066263729 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/146#issuecomment-7066263729). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-21T17:10:10Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"a5d9a7d2bd5df9261107b9c5bbb50e96bdac6563","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-21T17:11:49.645455Z">2026-11-21T17:11:49.645455Z</relative-time> | `a5d9a7d` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
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!145
No description provided.