HLE: fix self-closing XML element body parsing in runtime.rs and add unit tests #1028

Open
opened 2026-11-24 15:11:24 +00:00 by geiyiliyabumo · 2 comments
geiyiliyabumo commented 2026-11-24 15:11:24 +00:00 (Migrated from github.com)
Contributor

Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T15:11:24Z.


Summary

Fixes a manifest XML parsing bug in crates/victory-hle/src/runtime.rs and expands deterministic synthetic unit tests across runtime.rs (1 -> 15 tests) and crates/victory-hle/src/modules/d3d12x.rs (1 -> 6 tests).

Because external PR creation is currently restricted (collaborators_only), the CI-green branch is ready on my fork for cherry-pick / review:

  • Branch: geiyiliyabumo/VIctory@test/hle-runtime-d3d12x
  • Commit: geiyiliyabumo/VIctory@a4a94d7 (based on main ffe310e)

Changes

  • crates/victory-hle/src/runtime.rs:
    • Bug fix: the manifest XML elements parser previously attributed trailing text after a self-closing element (<Flag/>text) to that element; it now records an empty body as documented.
    • Added 14 unit tests (15 total): nested paths, self-closing ownership, comments/CDATA/declarations skipped, single-pass entity decoding, unterminated markup, missing/invalid fields, lowercase hex IDs, store-ID trim+decode, saves(), and image registry lifecycle.
  • crates/victory-hle/src/modules/d3d12x.rs:
    • Added 5 unit tests (6 total): IID data binding, case-insensitive d3d12_xs.dll serving, export set + Provenance::Hle resolution, device::IID export pointer, and D3D12XboxCreateDevice null-arg E_INVALIDARG rejection.

Verification (Windows 11 x64 MSVC)

  • rustfmt --edition 2024 --check: PASS
  • cargo xtask policy: PASS (154 files ok)
  • cargo clippy -p victory-hle --all-targets --locked -- -D warnings (default + --features diagnostics): PASS (0 warnings)
  • cargo test -p victory-hle --locked -- runtime:: (15/15 PASS) & -- d3d12x:: (6/6 PASS)

AI-assisted; synthetic tests only, no game files.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6584963474 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/1028). Originally posted by [geiyiliyabumo](https://github.com/geiyiliyabumo) on 2026-11-24T15:11:24Z. --- ### Summary Fixes a manifest XML parsing bug in `crates/victory-hle/src/runtime.rs` and expands deterministic synthetic unit tests across `runtime.rs` (1 -> 15 tests) and `crates/victory-hle/src/modules/d3d12x.rs` (1 -> 6 tests). Because external PR creation is currently restricted (`collaborators_only`), the CI-green branch is ready on my fork for cherry-pick / review: - **Branch**: `geiyiliyabumo/VIctory@test/hle-runtime-d3d12x` - **Commit**: `geiyiliyabumo/VIctory@a4a94d7` (based on `main` `ffe310e`) ### Changes - **`crates/victory-hle/src/runtime.rs`**: - **Bug fix**: the manifest XML `elements` parser previously attributed trailing text after a self-closing element (`<Flag/>text`) to that element; it now records an empty body as documented. - Added 14 unit tests (15 total): nested paths, self-closing ownership, comments/CDATA/declarations skipped, single-pass entity decoding, unterminated markup, missing/invalid fields, lowercase hex IDs, store-ID trim+decode, `saves()`, and image registry lifecycle. - **`crates/victory-hle/src/modules/d3d12x.rs`**: - Added 5 unit tests (6 total): IID data binding, case-insensitive `d3d12_xs.dll` serving, export set + `Provenance::Hle` resolution, `device::IID` export pointer, and `D3D12XboxCreateDevice` null-arg `E_INVALIDARG` rejection. ### Verification (Windows 11 x64 MSVC) - `rustfmt --edition 2024 --check`: **PASS** - `cargo xtask policy`: **PASS** (`154 files ok`) - `cargo clippy -p victory-hle --all-targets --locked -- -D warnings` (default + `--features diagnostics`): **PASS** (0 warnings) - `cargo test -p victory-hle --locked -- runtime::` (**15/15 PASS**) & `-- d3d12x::` (**6/6 PASS**) *AI-assisted; synthetic tests only, no game files.*
Marvisak commented 2026-11-25 07:03:24 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T06:52:06Z.


Automated triage for the maintainers.

Confirmed on current main (940d32f): in crates/victory-hle/src/runtime.rs, elements takes field_text(rest) as the body of every element, including a self-closing one (closed). So the text after <Flag/> is recorded as that element's body before the path is popped. The fix and the added runtime.rs / d3d12x.rs tests are now open as PR #1196, so review can continue there; it may need a rebase onto current main.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7155242234 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/1028#issuecomment-7155242234). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T06:52:06Z. --- <!-- victory-issue-triage v1 verdict=confirmed seen=2026-11-25T09:09:27Z at=2026-11-25T09:50:38Z --> Automated triage for the maintainers. Confirmed on current `main` (940d32f): in `crates/victory-hle/src/runtime.rs`, `elements` takes `field_text(rest)` as the body of every element, including a self-closing one (`closed`). So the text after `<Flag/>` is recorded as that element's body before the path is popped. The fix and the added `runtime.rs` / `d3d12x.rs` tests are now open as PR #1196, so review can continue there; it may need a rebase onto current `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
StExpeditus commented 2026-11-25 10:07:30 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by StExpeditus on 2026-11-25T09:09:27Z.


Validated the fork branch on Windows 11 Pro 26200 (Intel Core i5-14600K, Rust 1.98.1 MSVC), commit 00d5c62: cargo test -p victory-hle --locked --no-fail-fast -> 162 passed, 0 failed, 0 ignored. Synthetic tests only, no game files.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7157950468 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/1028#issuecomment-7157950468). Originally posted by [StExpeditus](https://github.com/StExpeditus) on 2026-11-25T09:09:27Z. --- Validated the fork branch on Windows 11 Pro 26200 (Intel Core i5-14600K, Rust 1.98.1 MSVC), commit `00d5c62`: `cargo test -p victory-hle --locked --no-fail-fast` -> **162 passed, 0 failed, 0 ignored**. Synthetic tests only, no game files.
Sign in to join this conversation.
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
Marvisak/VIctory#1028
No description provided.