HLE: validate XPackage chunk selectors #412

Open
github-bot wants to merge 1 commit from github-bot/gh-412 into main AGit
Owner

@⁠enzoduarte1 on GitHub · 2026-11-24 03:01 UTC · original
enzoduarte1:hle/xpackage-selector-validation → main · +257 −24 · 1 files · 1 commits · open

What

IXPackageImpl accepted any selector array and returned success for nonsense the console rejects. This adds the public XPackageChunkSelector ABI (u32 type tag plus the language/tag/chunk-id/feature union) and one validate_selectors helper used by all six selector-taking methods:

  • XPackageCreateInstallationMonitor
  • XPackageFindChunkAvailability
  • XPackageChangeChunkInstallOrder
  • XPackageInstallChunksAsync
  • XPackageEstimateDownloadSize
  • XPackageUninstallChunks

Zero selectors still mean the whole installation. A nonzero count with a null array, an unknown selector type, or a null/empty string attribute now returns E_INVALIDARG. A foreign package id still returns NO_PACKAGE before selector validation. The “own package is completely installed” model is unchanged for well-formed selectors.

The layout and enum values come from the public GDK XPackage.h / XPackageChunkSelector documentation; no title data is involved.

Tested

  • Windows 11, Rust 1.98.1, x86_64-pc-windows-gnu (this machine has no MSVC linker).
  • cargo test -p victory-hle --lib xpackage::tests: 3 passed, including new direct validation and vtable-level tests for every changed method.
  • cargo test -p victory-hle: 88 unit tests + 1 integration test passed.
  • cargo test --workspace --exclude victory-loader -- --test-threads=1: all suites passed.
  • cargo clippy -p victory-hle --all-targets -- -A clippy::field_reassign_with_default -D warnings: clean. The allowed lint is the pre-existing warning fixed in PR #355.
  • rustfmt --edition 2024 --check crates/victory-hle/src/modules/xpackage.rs and git diff --check: clean.
  • cargo xtask policy: 151 files ok. No game files or data taken from them were added.
  • Not tested: cargo test -p victory-loader --test load_probe. Its fixture passes MSVC's /DELAYLOAD flag, which MinGW rejects here; the same failure occurs on unmodified main. A parallel run of the whole suite hit the known WARP flake from #181; rerunning serially and rerunning victory-shader alone both passed.

Checklist

  • cargo fmt, cargo clippy --workspace --all-targets and cargo test --workspace pass — see the toolchain limitations above; the changed crate is clean.
  • cargo xtask policy passes. The change adds no game files or data taken from them (docs/asset-policy.md).
  • If an AI tool wrote part of this change, the description says so: an AI tool assisted with the code and tests; I reviewed and ran them.
**@⁠enzoduarte1** on GitHub · 2026-11-24 03:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/412) `enzoduarte1:hle/xpackage-selector-validation` → `main` · +257 −24 · 1 files · 1 commits · open ## What `IXPackageImpl` accepted any selector array and returned success for nonsense the console rejects. This adds the public `XPackageChunkSelector` ABI (`u32` type tag plus the language/tag/chunk-id/feature union) and one `validate_selectors` helper used by all six selector-taking methods: - `XPackageCreateInstallationMonitor` - `XPackageFindChunkAvailability` - `XPackageChangeChunkInstallOrder` - `XPackageInstallChunksAsync` - `XPackageEstimateDownloadSize` - `XPackageUninstallChunks` Zero selectors still mean the whole installation. A nonzero count with a null array, an unknown selector type, or a null/empty string attribute now returns `E_INVALIDARG`. A foreign package id still returns `NO_PACKAGE` before selector validation. The “own package is completely installed” model is unchanged for well-formed selectors. The layout and enum values come from the public GDK `XPackage.h` / `XPackageChunkSelector` documentation; no title data is involved. ## Tested - Windows 11, Rust 1.98.1, `x86_64-pc-windows-gnu` (this machine has no MSVC linker). - `cargo test -p victory-hle --lib xpackage::tests`: 3 passed, including new direct validation and vtable-level tests for every changed method. - `cargo test -p victory-hle`: 88 unit tests + 1 integration test passed. - `cargo test --workspace --exclude victory-loader -- --test-threads=1`: all suites passed. - `cargo clippy -p victory-hle --all-targets -- -A clippy::field_reassign_with_default -D warnings`: clean. The allowed lint is the pre-existing warning fixed in PR #355. - `rustfmt --edition 2024 --check crates/victory-hle/src/modules/xpackage.rs` and `git diff --check`: clean. - `cargo xtask policy`: 151 files ok. No game files or data taken from them were added. - Not tested: `cargo test -p victory-loader --test load_probe`. Its fixture passes MSVC's `/DELAYLOAD` flag, which MinGW rejects here; the same failure occurs on unmodified `main`. A parallel run of the whole suite hit the known WARP flake from #181; rerunning serially and rerunning `victory-shader` alone both passed. ## Checklist - [ ] `cargo fmt`, `cargo clippy --workspace --all-targets` and `cargo test --workspace` pass — see the toolchain limitations above; the changed crate is clean. - [x] `cargo xtask policy` passes. The change adds no game files or data taken from them (`docs/asset-policy.md`). - [x] If an AI tool wrote part of this change, the description says so: an AI tool assisted with the code and tests; I reviewed and ran them.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:02:52 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-24 04:36 UTC · original

Thanks @⁠enzoduarte1 for validating chunk selectors across the XPackage API. I tested head d2c7d4a329abb59d669867c5b5020776eb7963a9 with:

cargo test --locked -p victory-hle --lib xpackage::tests:: -- --test-threads=1

Result: 3 passed, 0 failed (85 filtered out). The tests cover selector validation, malformed selectors being refused through the API, and the unchanged complete-installation behavior for valid requests. This validates the synthetic HLE object cases, not a title package installation.

**@⁠jeremygold02** on GitHub · 2026-11-24 04:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/412#issuecomment-7122168305) Thanks @⁠enzoduarte1 for validating chunk selectors across the XPackage API. I tested head `d2c7d4a329abb59d669867c5b5020776eb7963a9` with: ``` cargo test --locked -p victory-hle --lib xpackage::tests:: -- --test-threads=1 ``` Result: 3 passed, 0 failed (85 filtered out). The tests cover selector validation, malformed selectors being refused through the API, and the unchanged complete-installation behavior for valid requests. This validates the synthetic HLE object cases, not a title package installation.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:32 UTC · original

Automated triage for the maintainers.

Needs rebase. This PR does not merge cleanly into current main (4118f33b). Conflicting files: crates/victory-hle/src/modules/xpackage.rs.

The content will be reviewed once the branch is rebased onto main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/412#issuecomment-7148605781) <!-- victory-triage v1 head=d2c7d4a329abb59d669867c5b5020776eb7963a9 verdict=needs-rebase at=2026-11-25T00:24:46Z --> Automated triage for the maintainers. **Needs rebase.** This PR does not merge cleanly into current `main` (4118f33b). Conflicting files: `crates/victory-hle/src/modules/xpackage.rs`. The content will be reviewed once the branch is rebased onto `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request has changes conflicting with the target branch.
  • crates/victory-hle/src/modules/xpackage.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/412/head:github-bot/gh-412'
git switch 'github-bot/gh-412'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-412'
git switch 'github-bot/gh-412'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-412'
git switch 'github-bot/gh-412'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-412'
git switch 'main'
git merge --squash 'github-bot/gh-412'
git switch 'main'
git merge --ff-only 'github-bot/gh-412'
git switch 'main'
git merge 'github-bot/gh-412'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!412
No description provided.