Tests: pin XSTS sign-request header layout and offline token contract #2476
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2486"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by amazedturnip on 2026-11-25T20:08:17Z.
Adds a black-box integration contract suite for crates/xcl/src/hle/xgameruntime/xsign.rs so the XSTS v1 offline-signing path is pinned outside the module: offline_token starts with 'XBL3.0 x=xcl;local-' with a 16-hex-char suffix round-tripping config().user_id; current_filetime is plausible now (>= ~2020, within 1h of now, non-decreasing); base64_encode matches RFC 4648 vectors and decodes round-trip; sign_request_at with a fixed filetime yields a parseable 76-byte [version u32 BE == 1][filetime u64 BE][64-byte sig] header; sign_request returns Ok with a same-shape header within 1h of now. Test-only, 129 lines, no source changes.
What is in it
crates/xcl/tests/xsign_contract.rs: black-box contract suite forxcl::hle::xgameruntime::xsign—offline_token()starts withXBL3.0 x=xcl;local-and ends with 16 hex chars that round-tripconfig().user_id;current_filetime()is a plausible now (>= ~2020, within 1h of now, non-decreasing);base64_encodematches RFC 4648 vectors and round-trips;sign_request_atwith a fixed filetime yields a base64 header whose decoded bytes are exactly [version u32 BE == 1][filetime u64 BE == fixed][64-byte signature] (76 bytes);sign_requestreturns Ok and decodes with version == 1 and 96-byte... wait, 76-byte payload and filetime within 1h of now.Tested
AMD Radeon(TM) Graphics (driver 32.0.21043.19003, DXC 1.9.2609, native wave64),XCL_ADAPTER=radeon):cargo test --workspace -- --test-threads=1— 1297 passed, 1 failed, 26 ignored (SKIPPED GPU tests: 1 (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), 1 (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), 1 (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), 1 (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), 1 (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), 1 (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), 1 (cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D)); pre-existing upstream/main failures excluded: gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1)offline_token_has_xbl3_xcl_prefix_and_hex_user_idFAILED ("token XBL3.0 x=local-0009000000000001 must start with XBL3.0 x=xcl;local-"), 4 other tests passed; thengit checkout -- crates/xcl/src/hle/xgameruntime/xsign.rsto restore.Not tested
AI use
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-25T20:23:46Z.
On head
eaf578bf2b6cd6635c232376100d609b4f85a833, the two FILETIME checks use3_600_000_000_000_000ticks as a claimed one-hour tolerance. FILETIME has 10,000,000 ticks per second, so that value is 100,000 hours (about 11.4 years). The test would accept a signing timestamp years away from now, missing the regression it intends to catch.One hour is
3_600 * 10_000_000 = 36_000_000_000ticks. Please use that value (ideally a shared constant) in bothcurrent_filetime_is_a_plausible_now_claps_2024_plusandsign_request_returns_ok_and_has_xsts_v1_shape, and check that a timestamp more than an hour off fails the assertion.AI use: OpenAI Codex (GPT-6; exact variant unavailable) reviewed the diff and verified the unit conversion; no tests were run for this review.
Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-11-25T20:30:03Z.
Rerun on the new head
33ea27f: fixed on NVIDIA. Withxsign::current_filetimeset 1 day behind,current_filetime_is_plausible_nowandsign_request_returns_ok_and_has_xsts_v1_shapenow fail. 58 minutes behind, they pass.cargo test --workspace --no-fail-fast -- --test-threads=4,33ea27fmerged ontomaine1d84b7(clean)SKIPPEDlinescargo test -p xcl --test xsign_contract, 3 runsA clock 1 h + 1 tick behind still passes: the tests' own "now" is taken in whole seconds (
as_secs()), so the bound is exact only to about a second. That is fine for what the tests check.First run, on
eaf578b: For the slack point above: on NVIDIA the tests passed as they were even with the clock 1 day or 5 years off. With36_000_000_000ticks they still passed on a correct clock and failed when it was 1 day off.Tested:
eaf578b(it ismain6d12f58plus this commit). RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug.cargo test --workspace --no-fail-fast -- --test-threads=4SKIPPEDlines (no wave64, refused per-lane forms)xsign::current_filetimeset 1 day, then 5 years behind (scratch)36_000_000_000in both tests (scratch), 3 runscurrent_filetime_is_a_plausible_now_claps_2024_plusandsign_request_returns_ok_and_has_xsts_v1_shapefailAlso in that test: its comment says "more than a day in the past" while the assert message says 1h, and the name says
2024_pluswhile the floor is 2020-09.Not tested: a release build; the signing path through the
XUserGetTokenAndSignature*thunks.AI use: Claude Code (Claude Opus 5.5) ran the suite and the scratch changes, and wrote this report.
Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T20:52:03Z.
One non-reproducing flake burst, otherwise clean. First cold-cache
gpu_suite run (parallel,--test-threads=2):158 passed / 9 failed, i.e. the usual trio plus six tests that are green on main:gpu_console_textures_upload_every_mip_and_slice,gpu_large_mixed_upload_keeps_tight_staging_and_exact_pixels,copy_scratch_budget_counts_resources_until_gpu_completion,cpu_watchdog_signal_with_inflight_gpu_signal_completes_cleanly,gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes,gpu_retire_queue_holds_heap_until_blocked_queue_passes_mark.164 passed / 3 failed(baseline trio only).gpu_console_textures_upload_every_mip_and_sliceon this head: passed. Solo runs of all six on plain main: all passed.So: not a deterministic red, but every test in the burst touches upload/scratch/lifetime paths this PR changes (retry after lazy mip mapping failures, split scratch reuse). If anyone sees this family go red in a parallel CI job, this PR is the first suspect on the Wine lane.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T20:53:00Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
Imported from ivall/xcl. Originally posted by amazedturnip on 2026-11-25T21:37:45Z.
Fixed: both FILETIME checks now use a shared ONE_HOUR_TICKS constant (36_000_000_000 ticks = 1 hour) instead of 3_600_000_000_000_000 (~11.4 years). Each test also now asserts that a timestamp more than an hour off (+1 tick past the bound, either side) fails the check. Test name/comment cleaned up (claps_2024_plus -> plausible_now_2024_plus, 'more than a day in the past' -> 'more than an hour in the past'). Verified locally:
cargo test -p xcl --test xsign_contractpasses 5/5.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T01:49:56Z.
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T04:15:33Z.
Independent desktop NVIDIA verification of PR #2486 at head
33ea27fbb2bb40ef4ee1227e6e9d9064440d893d(1commit; exact parent & merge-base:6d12f58a229bc73889878a448c64dc3af25eeba0, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted release tests & build (
33ea27fb)cargo test --release -p xcl --test xsign_contract -- --nocapture(3 consecutive runs)5 passed; 0 failed; 0 ignored; 0 filtered out× 3 (0.00s× 3,0skipped:base64_encode_matches_rfc4648_and_decodes_roundtrip,current_filetime_is_plausible_now,offline_token_has_xbl3_xcl_prefix_and_hex_user_id,sign_request_at_produces_parseable_xsts_v1_header,sign_request_returns_ok_and_has_xsts_v1_shape)cargo test --release -p xcl --lib xsign(3 consecutive runs)4 passed; 0 failed; 0 ignored; 1320 filtered out× 3 (0.00s× 3,0skipped)cargo build --release -p xcl0.07sincremental after--test/--libbuild, exit0,0new warnings)Paired quiet 60 s retail smoke (
title: 29640639)Exact parent & merge-base (
6d12f58a229bc73889878a448c64dc3af25eeba0, cached baseline on the same machine):PR #2486 (
33ea27fbb2bb40ef4ee1227e6e9d9064440d893d):Runtime log observations (
xcl.log)9220log lines,0[ERROR]/ device-removal / panic lines (dxil_cache:460hits,0misses,0compilation failures;228background pipelines,0failures).19519 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample14022 MB committed by the process; video memory 6115 MB local, 4683 MB non-local.Limits of coverage
crates/xcl/tests/xsign_contract.rs,+141/-0,0production-code changes); all 5 new black-box XSTS signing/offline-token contract tests and all 4 existinghle::xgameruntime::xsign::testsunit tests passed3/3in--releaseon Windows 11.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by throny on 2026-11-29T00:47:34Z.
merge-check claim
head:
33ea27fbb2Imported from ivall/xcl. Originally posted by throny on 2026-11-29T01:08:46Z.
merge-check
base:
fa204595head:
33ea27fbb2merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2613 passed, 0 failed, 49 ignored (27 SKIPPED lines). Base alone at
fa204595: 2608 passed, 0 failed, 49 ignored. (A first run of this tree had no lib counts: the lib test binary was ended by the uma_driver fail-stop that #3187 addresses; this is the rerun.)review: no blocking finding; tests only, all hunks read with the project's rules in mind. The token in the test is a synthetic local one and the key is the throw-away key main already makes; nothing touches the network (the URLs are plain strings) and nothing serves to get around a protection. The point from the thread about the time slack is fixed. Minor: it largely repeats unit tests the module already has and adds one more integration-test binary to link.
performance: none (tests only; a little build time).
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-30T02:22:47Z.
releasing: my merge-check claim for head
33ea27fbb2(someone else took this slot after my claim)Imported from ivall/xcl. Originally posted by relativespace2K on 2026-11-30T02:22:48Z.
merge-check
base:
53e85fb1head:
33ea27fbb2merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2793 passed, 6 failed, 49 ignored; failing: gpu::dxil::compact_tests::gpu_compact_form_with_micro_blocks_and_literal_table_runs_as_the_plain_form, gpu::recomp::pso::shader_cache_tests::console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk, hle::d3d12x::standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline, ram_budget::tests::windows_takes_a_working_set_maximum_and_lifts_it, and two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (in
--test gpu_two_pass_cache_e2e, so 5 failing tests give 6 failures). The same five fail on base53e85fb1alone (2788 passed, 6 failed, 49 ignored there), so none comes from this PR; its five new tests passed. 13 SKIPPED lines, all environmental: no D3D12 debug layer / d3d12SDKLayers.dll, no heap windows, no GPU_UPLOAD, per-lane f16/f32 forms refused.review: no blocking finding; a new test file,
crates/xcl/tests/xsign_contract.rs, every line read. It pins the offline token prefix and that its 16 hex characters round-tripstate::config().user_id(read from the config, not hard-coded), the FILETIME's shape and that two readings do not go backwards, RFC 4648 base64 through the publicbase64_encodewith an independent decoder written in the test (so it does not merely echo the module's own), and the XSTS v1 header: 76 bytes, version1big-endian, the FILETIME big-endian, andsign_request_atreproducing the FILETIME it was handed. Asserting that the 64-byte signature is not all zeros rather than a fixed byte string is the right trade here: it catches a signing path that returns nothing without freezing a key into the test. One note, not blocking: the 76-byte shape pins the signature to raw ECDSA P-256, so a change of curve inxsignwould fail this test before the module, which is the contract it is meant to state. No duplicate: nothing else testsxsignat this level.performance: none: tests only.
verdict: safe to merge
hardware / tool and model: AMD Radeon RX 6800 XT 16 GB (RDNA2, wave64), driver 32.0.21045.29003; Ryzen 5 5600, 32 GB RAM; Windows 10 IoT Enterprise LTSC 2024, 10.0.26100 build 26100.9974; Rust 1.100.0; DXC 1.9.2602.17; debug build. DeepSeek Harness coding agent, model DeepSeek V4.1 Flash. The first full run aborted in
-p xcl --libwith0xc0000005(STATUS_ACCESS_VIOLATION) before that target printed a result, which is the intermittent abort under parallel scheduling (#1978); the lib target then passed twice on its own and the numbers above are the clean rerun.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:10:00Z.
Triage (#1607) – head
33ea27fNo open PR adds these tests. Part of it repeats main's own unit tests in
hle/xgameruntime/xsign.rs:base64_encode_matches_rfc4648_and_decodes_roundtripuses the same RFC 4648 vectors asbase64_matches_rfc4648_vectors, andsign_request_at_produces_parseable_xsts_v1_headeris a weaker copy ofsignature_header_verifies_with_ephemeral_p256_key, which also verifies the signature. The!within_one_hour(...)asserts only test the test's own helper. What is new: the format ofoffline_token, the range ofcurrent_filetime, and the shape ofsign_request.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.