Tests: pin XSTS sign-request header layout and offline token contract #2486
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2486
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@amazedturnip on GitHub · 2026-11-25 20:08 UTC · original
amazedturnip:xcl/tests-xsign-header-layout-and-offline-token-cont-035747→main· +141 −0 · 1 files · 1 commits · openAdds 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
@luckyteagirl on GitHub · 2026-11-25 20:23 UTC · original
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.
@SlopTart on GitHub · 2026-11-25 20:52 UTC · original
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.
@DavidM1911 on GitHub · 2026-11-25 20:53 UTC · original
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!
@amazedturnip on GitHub · 2026-11-25 21:37 UTC · original
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.@fromthemoonx on GitHub · 2026-11-25 20:30 UTC · original · edited 2026-11-25 22:07 UTC
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.
@DavidM1911 on GitHub · 2026-11-26 01:49 UTC · original
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
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.