Tests: a conformance title checks the runtime against the public platform documentation #2057

Open
github-bot wants to merge 5 commits from github-bot/gh-2057 into main AGit
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 04:14 UTC · original
0xkn0wh3r3:tests/acceptance-suite → main · +3345 −0 · 15 files · 5 commits · open

The problem

VIctory is checked by unit tests inside each crate and by runs of the title. Nothing checks the runtime's platform APIs end to end, the way a title calls them, without a title, game data or the SDK. So a call that answers differently from what the public platform documentation says goes unnoticed until a title trips on it.

The fix

This adds an acceptance layer that needs no title, no game data and no SDK: a conformance title. It is a stand-in Xbox title written from the public platform documentation only, run through VIctory's own loader and runtime (HleResolver). It calls each platform area as a title does and checks what the documentation says the call does. How to run it and what KNOWN means are in the test's module docs.

  • tests/fixtures/conformance: the title (a cdylib outside the workspace, like hle-probe); reports TAP.
  • crates/victory-hle/tests/conformance.rs: builds it, binds it, mounts G:/T: and storage as victory run does, runs it.

No SDK is used: the title links no SDK library and includes no SDK header. Area ids and method slots are VIctory's own, so the binary interface itself is only checked by the title. Behaviour, constants and layouts come from the public pages, cited per test.

Coverage: 152 checks, 147 pass

  • Runtime init and QueryApiImpl.
  • Task queues and async calls: dispatch modes and ports, delayed submits, terminate, XAsyncRun, provider op order, cancel, serialized and composite queues, identity mismatch, no process queue.
  • System info.
  • Physical pages aliased at two addresses.
  • DirectStorage from memory and files: raw, zlib, completion order, failed reads, request reuse, auto-submit.
  • Game saves: names, 16 MB limit, all-or-nothing.
  • The user: silent add, handles, ids, gamertag sizes and errors.
  • Networking hints and port; package; HDR.
  • Files on G:/T: through every path import VIctory binds.
  • Persistent local storage.

Five answers differ from the documentation

They are listed in the test (KNOWN) with why, and reported rather than failed. One of them passing fails the test, so the list stays true.

Check Documentation VIctory
XSystemGetConsoleId on retail 00000000.00000000.00000000.00000000.00 38 digits ending in 1
DirectStorage auto-submit an Enqueue filling more than half the capacity at half
XUserFindUserByLocalId, no such user HRESULT_FROM_WIN32(ERROR_NOT_FOUND) E_GAMEUSER_USER_NOT_FOUND
XUserGetGamertag, invalid component E_INVALIDARG the gamertag
async call, no queue, process queue nullptr E_NO_TASK_QUEUE runs the call

-- --ignored runs a streaming workload (DirectStorage memory sources; file sources and BCPack to come).

Testing

  • cargo test -p victory-hle --test conformance (Windows 11, RTX 5070 Ti): passes, 152 checks, 5 known divergences.
  • cargo clippy -p victory-hle --tests and clippy on the fixture: clean. Asset policy: ok.

#505 (a Wine harness for loader-level checks). This one checks runtime API behaviour against the documentation and runs under cargo test.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 04:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/2057) `0xkn0wh3r3:tests/acceptance-suite` → `main` · +3345 −0 · 15 files · 5 commits · open ## The problem VIctory is checked by unit tests inside each crate and by runs of the title. Nothing checks the runtime's platform APIs end to end, the way a title calls them, without a title, game data or the SDK. So a call that answers differently from what the public platform documentation says goes unnoticed until a title trips on it. ## The fix This adds an acceptance layer that needs no title, no game data and no SDK: a **conformance title**. It is a stand-in Xbox title written from the public platform documentation only, run through VIctory's own loader and runtime (`HleResolver`). It calls each platform area as a title does and checks what the documentation says the call does. How to run it and what `KNOWN` means are in the test's module docs. - `tests/fixtures/conformance`: the title (a cdylib outside the workspace, like `hle-probe`); reports TAP. - `crates/victory-hle/tests/conformance.rs`: builds it, binds it, mounts `G:`/`T:` and storage as `victory run` does, runs it. No SDK is used: the title links no SDK library and includes no SDK header. Area ids and method slots are VIctory's own, so the binary interface itself is only checked by the title. Behaviour, constants and layouts come from the public pages, cited per test. ### Coverage: 152 checks, 147 pass - Runtime init and `QueryApiImpl`. - Task queues and async calls: dispatch modes and ports, delayed submits, terminate, `XAsyncRun`, provider op order, cancel, serialized and composite queues, identity mismatch, no process queue. - System info. - Physical pages aliased at two addresses. - DirectStorage from memory and files: raw, zlib, completion order, failed reads, request reuse, auto-submit. - Game saves: names, 16 MB limit, all-or-nothing. - The user: silent add, handles, ids, gamertag sizes and errors. - Networking hints and port; package; HDR. - Files on `G:`/`T:` through every path import VIctory binds. - Persistent local storage. ### Five answers differ from the documentation They are listed in the test (`KNOWN`) with why, and reported rather than failed. One of them passing fails the test, so the list stays true. | Check | Documentation | VIctory | |---|---|---| | `XSystemGetConsoleId` on retail | `00000000.00000000.00000000.00000000.00` | 38 digits ending in 1 | | DirectStorage auto-submit | an Enqueue filling more than half the capacity | at half | | `XUserFindUserByLocalId`, no such user | `HRESULT_FROM_WIN32(ERROR_NOT_FOUND)` | `E_GAMEUSER_USER_NOT_FOUND` | | `XUserGetGamertag`, invalid component | `E_INVALIDARG` | the gamertag | | async call, no queue, process queue nullptr | `E_NO_TASK_QUEUE` | runs the call | `-- --ignored` runs a streaming workload (DirectStorage memory sources; file sources and BCPack to come). ## Testing - `cargo test -p victory-hle --test conformance` (Windows 11, RTX 5070 Ti): passes, 152 checks, 5 known divergences. - `cargo clippy -p victory-hle --tests` and clippy on the fixture: clean. Asset policy: ok. ## Related #505 (a Wine harness for loader-level checks). This one checks runtime API behaviour against the documentation and runs under `cargo test`.
docs/acceptance.md plans an acceptance and benchmark layer that needs no
title, no game data and no SDK: a stand-in title written from Microsoft's
public GDK reference, run through VIctory's own loader and runtime, that
calls each platform area as a title does and checks what the reference
says the call does. The Microsoft GDK is not used: its license limits it
to Windows titles for Windows and forbids reverse engineering it.

tests/fixtures/conformance is that title (a cdylib outside the workspace,
like hle-probe). crates/victory-hle/tests/conformance.rs builds it, binds
it with HleResolver and runs its 82 checks (TAP):

- runtime initialisation, and QueryApiImpl found as a title's stub finds it;
- task queues and async calls: dispatch modes and ports, delayed submits,
  termination, XAsyncRun, provider operation order, cancellation;
- system information: analytics family, console id and its errors;
- physical pages mapped at two addresses stay coherent and unmap;
- DirectStorage from memory: raw and zlib, completion order, a failed read
  not blocking later notifications, request reuse, automatic submission;
- game saves: container names, updates, the 16 MB update limit and
  all-or-nothing updates.

80 pass. Two answers differ from the reference and are listed in the test
with why, reported rather than failed (one passing fails the test, so the
list stays true): a retail console id is documented as
00000000.00000000.00000000.00000000.00 (VIctory: 38 digits ending in 1),
and a DirectStorage queue submits itself once an Enqueue fills more than
half its capacity (VIctory: at half). An ignored test runs the streaming
workload and prints its throughput.
The conformance title (tests/fixtures/conformance) now runs 143 checks
through VIctory, each from Microsoft's public reference:

- the user: silent default user added twice is the same user, handle
  duplication and comparison, local and network ids found back, state,
  age group, privileges, gamertag components within their documented
  sizes and the short-buffer error;
- DirectStorage from files: raw reads at an offset, zlib at 16-byte
  aligned offsets, a missing file refused;
- files on the console's drives (package at G:, temporary storage at T:)
  through every path-taking import VIctory binds: CreateFileW/-A/2,
  attributes, FindFirstFileW, fopen, _wfopen, _wstat64, directories,
  writes, MoveFileExW, deletes, and Win32's errors for missing paths;
- persistent local storage: the path and its size, consistent space
  figures within the declared quota, a written file counted as used;
- networking hints and the documented default UDP port (sync and async),
  XPackageIsPackagedProcess and the identifier, HDR mode results.

139 pass. Two more answers differ from the reference and join the list in
the test: XUserFindUserByLocalId of no user returns
E_GAMEUSER_USER_NOT_FOUND (the reference: HRESULT_FROM_WIN32
(ERROR_NOT_FOUND)), and XUserGetGamertag answers an invalid component with
the gamertag (the reference: E_INVALIDARG). The harness mounts G: and T:
and makes the storage folder, as `victory run` does.
Nine more checks from the public reference: a SerializedThreadPool port
runs its callbacks one at a time and a ThreadPool port in parallel; a
composite queue's callback is dispatched from the queue owning its port;
XAsyncGetResult with another identity than XAsyncBegin's is E_INVALIDARG;
with the process task queue set to nullptr there is none, and it is put
back after.

One more answer differs from the reference and joins the list in the
test: with no process task queue, an async call whose block names no queue
runs anyway, where XTaskQueueSetCurrentProcessTaskQueue's page says APIs
needing a queue fail with E_NO_TASK_QUEUE. 152 checks, 147 pass.
Review (#2057): the report check passed when a known divergence's check
was gone, also with the TAP plan lowered to match, and when the report
was cut short of its plan.

`accept` now requires the results to be numbered 1 to the plan's count,
in order, each known divergence's check to be there exactly once and to
fail, and nothing else to fail; it returns the known divergences seen.
`reports_missing_or_cut_short_checks_are_refused` runs it on made-up
reports: all present, a skipped check, a known check gone (plan lowered
to match), a report cut short of its plan, a known divergence that
passes, an unknown failure, a known check twice, and no checks.
The conformance title and its harness now say only that they are written
from the public platform documentation, without naming the console SDK.
docs/acceptance.md is gone: how to run the suite and what KNOWN means
are a few lines in crates/victory-hle/tests/conformance.rs's module
docs. The fixture's miniz_oxide is the version the workspace already
uses.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:53:19 +00:00
Author
Owner

@⁠Dathinel on GitHub · 2026-11-25 04:17 UTC · original

The harness catches a known divergence turning green, but it also goes green if that check disappears entirely. This can happen with a well-formed report: the fixture computes its TAP plan from the checks it actually emits, so dropping a call lowers the plan too.

I tested the unchanged acceptance function and KNOWN at 637ba6f9, using the PR's Tap writer and replacing only call() with synthetic reports:

Input to the acceptance function Observed
One ordinary pass + all five known failures Pass
One known failure becomes a pass Fail
An additional, unknown failure Fail
Omit one known check; writer emits a matching 1..5 plan Pass
Keep the 1..6 plan but return only the first passing result Pass

Could the acceptance test require every unconditional KNOWN name to appear exactly once, and check the parsed result count against the TAP plan? The first catches a silently removed check; the second catches a partial transcript. Neither requires pinning the suite to 152 checks.

This tests the report consumer in isolation. I have no evidence that the reported title run skipped a check. AI-assisted.

**@⁠Dathinel** on GitHub · 2026-11-25 04:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/2057#issuecomment-7152704986) The harness catches a known divergence turning green, but it also goes green if that check disappears entirely. This can happen with a well-formed report: the fixture computes its TAP plan from the checks it actually emits, so dropping a call lowers the plan too. I tested the unchanged acceptance function and `KNOWN` at `637ba6f9`, using the PR's `Tap` writer and replacing only `call()` with synthetic reports: | Input to the acceptance function | Observed | |---|---| | One ordinary pass + all five known failures | Pass | | One known failure becomes a pass | Fail | | An additional, unknown failure | Fail | | Omit one known check; writer emits a matching `1..5` plan | **Pass** | | Keep the `1..6` plan but return only the first passing result | **Pass** | Could the acceptance test require every unconditional `KNOWN` name to appear exactly once, and check the parsed result count against the TAP plan? The first catches a silently removed check; the second catches a partial transcript. Neither requires pinning the suite to 152 checks. This tests the report consumer in isolation. I have no evidence that the reported title run skipped a check. AI-assisted.
Author
Owner

@⁠Dathinel on GitHub · 2026-11-25 04:29 UTC · original

Integration result: all 152 checks pass with the five runtime fixes together. I ran the conformance title on Windows build 26200 with Rust 1.98.1 MSVC against #2057 at 637ba6f9. The baseline emitted 147 passes and the five listed divergences.

I also applied each fix individually on that same baseline. Every run emitted the same 152 numbered check names. Exactly one result changed per PR:

Runtime patch Check that changed from failing to passing
#2072 34fe6703 113 — invalid gamertag component
#2073 3dd083a3 102 — unknown local user ID
#2074 2ced7715 80 — queue exactly half full
#2075 7f533796 49 — no supplied or process task queue
#1717 35fb57d4 55 — retail console ID

Stacking #2072 through #2075 produced 151/152, with only the console ID still failing. Adding #1717 produced 152/152. The stacked patches applied cleanly. I retained the fixture assertions throughout and removed only the corresponding entries from the host test's KNOWN list. Leaving that list unchanged in the four-fix stack correctly made the host test fail on the newly passing checks.

Command: cargo test --frozen -p victory-hle --test conformance the_conformance_title_runs_through_victory -- --nocapture. This used the synthetic title through the loader and runtime; the streaming benchmark was outside this run. AI-assisted.

**@⁠Dathinel** on GitHub · 2026-11-25 04:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/2057#issuecomment-7152896231) **Integration result: all 152 checks pass with the five runtime fixes together.** I ran the conformance title on Windows build 26200 with Rust 1.98.1 MSVC against #2057 at `637ba6f9`. The baseline emitted 147 passes and the five listed divergences. I also applied each fix **individually** on that same baseline. Every run emitted the same 152 numbered check names. Exactly one result changed per PR: | Runtime patch | Check that changed from failing to passing | |---|---| | #2072 `34fe6703` | 113 — invalid gamertag component | | #2073 `3dd083a3` | 102 — unknown local user ID | | #2074 `2ced7715` | 80 — queue exactly half full | | #2075 `7f533796` | 49 — no supplied or process task queue | | #1717 `35fb57d4` | 55 — retail console ID | Stacking #2072 through #2075 produced **151/152**, with only the console ID still failing. Adding #1717 produced **152/152**. The stacked patches applied cleanly. I retained the fixture assertions throughout and removed only the corresponding entries from the host test's `KNOWN` list. Leaving that list unchanged in the four-fix stack correctly made the host test fail on the newly passing checks. Command: `cargo test --frozen -p victory-hle --test conformance the_conformance_title_runs_through_victory -- --nocapture`. This used the synthetic title through the loader and runtime; the streaming benchmark was outside this run. AI-assisted.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 06:22 UTC · original

Thanks @⁠Dathinel, both holes were real, and thanks for the integration run across the five fixes.

d594a73 makes the report check strict. accept now requires:

  • results numbered 1 to the plan's count, in order, so a report cut short of its plan fails;
  • each KNOWN check to appear exactly once and still fail, so a check that disappears fails even when the plan was lowered to match;
  • nothing else to fail, as before.

It doesn't pin the total at 152. The new reports_missing_or_cut_short_checks_are_refused runs it on made-up reports covering your table and a few more cases: all present, a skipped check, a known check removed with the plan lowered, a report cut short, a known divergence that now passes, an unknown failure, a known check listed twice, and no checks at all. The title's real run still passes.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 06:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2057#issuecomment-7154726787) Thanks @⁠Dathinel, both holes were real, and thanks for the integration run across the five fixes. `d594a73` makes the report check strict. `accept` now requires: - results numbered 1 to the plan's count, in order, so a report cut short of its plan fails; - each `KNOWN` check to appear exactly once and still fail, so a check that disappears fails even when the plan was lowered to match; - nothing else to fail, as before. It doesn't pin the total at 152. The new `reports_missing_or_cut_short_checks_are_refused` runs it on made-up reports covering your table and a few more cases: all present, a skipped check, a known check removed with the plan lowered, a report cut short, a known divergence that now passes, an unknown failure, a known check listed twice, and no checks at all. The title's real run still passes.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 09:23 UTC · original · edited 2026-11-26 00:26 UTC

Automated triage for the maintainers.

Needs work: needs the maintainer's decision. The content side is still in order on this head: the PR title no longer names the SDK, and a grep of the diff finds only generic "no SDK" mentions and the public Windows header fileapi.h. The run notes and the meaning of KNOWN are short module docs in crates/victory-hle/tests/conformance.rs. The branch merges cleanly into current main.

Only the maintainer can decide on:

  • tests/fixtures/conformance/Cargo.toml and its own Cargo.lock. The lock holds only miniz_oxide 0.9.1 and adler2 2.0.1, which the workspace already uses.
  • build_fixture, which runs Command::new(env!("CARGO")) to build the fixture, the same pattern crates/victory-loader/tests/load_probe.rs uses for hle-probe.

Coordination still applies: #2072 to #2075 and #1717 each turn one KNOWN entry into a pass, so whichever lands second must edit the list.

On your reply: thanks for the title fix. Nothing more is needed from you until the maintainer decides.

CI: passing (check).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 09:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2057#issuecomment-7158272802) · edited 2026-11-26 00:26 UTC <!-- victory-triage v1 head=1434e7254d6d27ecd046e2e60290897497409b8a verdict=needs-work at=2026-11-26T00:26:15Z --> Automated triage for the maintainers. **Needs work: needs the maintainer's decision.** The content side is still in order on this head: the PR title no longer names the SDK, and a grep of the diff finds only generic "no SDK" mentions and the public Windows header `fileapi.h`. The run notes and the meaning of `KNOWN` are short module docs in `crates/victory-hle/tests/conformance.rs`. The branch merges cleanly into current `main`. Only the maintainer can decide on: - `tests/fixtures/conformance/Cargo.toml` and its own `Cargo.lock`. The lock holds only `miniz_oxide` 0.9.1 and `adler2` 2.0.1, which the workspace already uses. - `build_fixture`, which runs `Command::new(env!("CARGO"))` to build the fixture, the same pattern `crates/victory-loader/tests/load_probe.rs` uses for `hle-probe`. Coordination still applies: #2072 to #2075 and #1717 each turn one `KNOWN` entry into a pass, so whichever lands second must edit the list. On your reply: thanks for the title fix. Nothing more is needed from you until the maintainer decides. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 18:37 UTC · original

Thanks, done in c4785e8:

  • Naming the SDK: it's gone from the code, the fixture's manifest and the description. Everything now cites the public platform documentation. The console error codes used (E_NO_TASK_QUEUE, E_GS_INVALID_CONTAINER_NAME, E_GS_UPDATE_TOO_BIG, E_GAMEUSER_USER_NOT_FOUND) are all on the public error-codes page with these values. The rest are standard Win32 codes.

  • Short docs: docs/acceptance.md is deleted. The command to run the suite, and what KNOWN means, are now a few lines in conformance.rs's module docs: a known divergence is reported, not failed, and one that starts passing fails the test.

  • For your decision:

    • miniz_oxide isn't new to the project. It's the same 0.9.1 the workspace already uses: victory-hle inflates DirectStorage zlib requests with it. The fixture only compresses test data with it. Without it the data would have to be stored blocks, which never touch the Huffman decoding the zlib checks are there to test.
    • The cargo spawn builds the fixture into CARGO_TARGET_TMPDIR, because the outer cargo holds the main target dir's lock. A build.rs building a cdylib would avoid the spawn, at the cost of a bigger change.

    I'm happy to change either if you'd rather.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 18:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/2057#issuecomment-7171171442) Thanks, done in c4785e8: - **Naming the SDK:** it's gone from the code, the fixture's manifest and the description. Everything now cites the public platform documentation. The console error codes used (`E_NO_TASK_QUEUE`, `E_GS_INVALID_CONTAINER_NAME`, `E_GS_UPDATE_TOO_BIG`, `E_GAMEUSER_USER_NOT_FOUND`) are all on the public error-codes page with these values. The rest are standard Win32 codes. - **Short docs:** `docs/acceptance.md` is deleted. The command to run the suite, and what `KNOWN` means, are now a few lines in `conformance.rs`'s module docs: a known divergence is reported, not failed, and one that starts passing fails the test. - **For your decision:** - `miniz_oxide` isn't new to the project. It's the same 0.9.1 the workspace already uses: victory-hle inflates DirectStorage zlib requests with it. The fixture only compresses test data with it. Without it the data would have to be stored blocks, which never touch the Huffman decoding the zlib checks are there to test. - The cargo spawn builds the fixture into `CARGO_TARGET_TMPDIR`, because the outer cargo holds the main target dir's lock. A `build.rs` building a cdylib would avoid the spawn, at the cost of a bigger change. I'm happy to change either if you'd rather.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 00:00 UTC · original

Thanks for re-checking. One more rule 2 fix: the PR title still named the SDK, and now reads "…against the public platform documentation". The fixture crate and the cargo build spawn are left for your decision. Both follow the pattern load_probe.rs already uses for hle-probe.

On the KNOWN list: agreed, whichever of #2072–#2075 and #1717 lands after this removes its entry, and I'll do that edit for the ones of mine. The branch is rebased onto current main with CI green.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 00:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/2057#issuecomment-7178295715) Thanks for re-checking. One more rule 2 fix: the PR title still named the SDK, and now reads "…against the public platform documentation". The fixture crate and the `cargo build` spawn are left for your decision. Both follow the pattern `load_probe.rs` already uses for `hle-probe`. On the `KNOWN` list: agreed, whichever of #2072–#2075 and #1717 lands after this removes its entry, and I'll do that edit for the ones of mine. The branch is rebased onto current `main` with CI green.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2057'
git switch 'github-bot/gh-2057'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2057'
git switch 'github-bot/gh-2057'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2057'
git switch 'main'
git merge --squash 'github-bot/gh-2057'
git switch 'main'
git merge --ff-only 'github-bot/gh-2057'
git switch 'main'
git merge 'github-bot/gh-2057'
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!2057
No description provided.