Build: pin the Rust toolchain and enforce Cargo.lock in CI and scripts/test.ps1 #2214
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#2214
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@itsonewi on GitHub · 2026-11-25 10:01 UTC · original
The build inputs are not pinned, so a green run cannot be reproduced later and CI can validate a dependency set that is not in the repository.
What is missing
rust-toolchain.tomlat the repository root (the root listing hasCargo.toml,Cargo.lock,README.md, ... but no toolchain file and no.cargo/config.toml).rust-versioninCargo.toml([workspace.package]hasversion,editionandlicense, lines 5-8) or incrates/xcl/Cargo.toml,tests/testtitle/Cargo.toml,tests/testgamedll/Cargo.toml..github/workflows/ci.ymlinstalls whateverstableis that day:rustup toolchain install stable --profile minimalrustup default stableIt prints
rustc --version(line 40) but nothing compares it with a committed value.scripts/test.ps1runs Cargo without--locked:cargo build --workspacecargo test --workspace -- --test-threads=4 @argsCargo.lockis committed (15 KB), so the intent is clearly to build a fixed dependency set. Without--locked, a build after aCargo.tomlchange (a dependency added or a version bumped) updates the lock in the working tree; CI passes, but the lock in the PR may still be the old one. A fresh clone then builds a different graph, and a later--lockedbuild fails.cargo build --lockedwould fail immediately on a stale lock instead of silently rewriting it.The same applies to contributors:
scripts/test.ps1is the documented local command (HANDOFF.md), and it does not tell Cargo to reject a lock update.Why it matters
PR checks/CIresult is tied to a moving compiler. A new stable release can change lints, codegen, or a dependency's MSRV between the PR run and the merge, with no record of the version that was tested.HANDOFF.mdnames Rust 1.96x86_64-pc-windows-msvc; #265 measured 1.97.1. The repository does not encode either.Suggested fix
rust-toolchain.tomlwith the version the last green run used:rust-version = "<version>"to[workspace.package]and inherit it in the three crates (rust-version.workspace = true).cargo build --locked --workspaceandcargo test --locked --workspace ...inscripts/test.ps1, and the same flags in any other Cargo invocation in CI.continue-on-errorleg) onstableso a future compiler break is seen early, while the required check stays on the pinned version.rustc --versionandcargo --versionin the workflow summary, and note the pinned version in CONTRIBUTING.Related
actions/cachekeyed on the compiler, clippy, cargo-deny and action-version bumps. It does not pin the toolchain or add--locked; this is the remaining part.scripts/test_*.pyto CI; unrelated to the toolchain, but it is the other half of "CI runs what the scripts run".Scope
Read through the GitHub API at
568e7db; nothing was cloned, built or run, so the--lockedbehaviour above is from Cargo's documented behaviour, not from a failing run in this repository.@WASDeKeys on GitHub · 2026-11-25 10:33 UTC · original · edited 2026-11-25 10:39 UTC
I'd like to take this one, unless someone is already on it. I searched open PRs for rust-toolchain, --locked and rust-version and found none.
Plan for a first, small PR:
The scheduled non-blocking job on stable, and the version printout in the workflow summary, I would leave for a second PR if you want them.
Question: which version should be pinned? HANDOFF.md names 1.96 and #265 measured 1.97.1. The latest green CI run on main used [version from the Actions log, or delete this sentence]. I build locally with 1.100.0. @itsonewi
I will check the --locked claim on a scratch branch (stale Cargo.lock fails with --locked, is rewritten without it) and post the result in the PR. I am on Windows with NVIDIA, so I can run scripts/test.ps1 but cannot run CI itself.
AI use: Claude helps run tests and draft description/comments; I code and check all outputs and compilations myself.
@luckyteagirl on GitHub · 2026-11-25 10:42 UTC · original
@WASDeKeys Please take #2214; your comment arrived while I was validating the same change, so I will not open a duplicate PR. These independent Windows results may help choose the versions and describe the test limits.
On current
main568e7db7729c8fa6c8f0f4b32d798faaf11462bb, I made an uncommitted local scratch edit withrust-toolchain.tomlset to1.100.0(minimal profile),rust-version = "1.99.0"inherited by the three workspace packages, and--lockedin both calls inscripts/test.ps1. The CI workflow edit was present locally but was not run on Actions.cargo metadata --locked --no-depsshowed Rust version1.99.0for all three packages, andCargo.lockremained unchanged.Hardware: Windows 11 build 26200, Ryzen 9 5980HX, RX 6800M driver
30.0.13002.13003, DXC/DXIL 1.9.2609.5. The installed localstablealias is Rust 1.99.0; the explicit pinned toolchain is Rust 1.100.0.cargo +stable build --locked --workspace -j 2passed in a separate target directory.XCL_ADAPTER=XCL-NO-SUCH-ADAPTER): the editedscripts/test.ps1passed. Across 21 targets: 1,154 passed, 0 failed, 46 ignored, with 294 explicitSKIPPEDlines. This exercises the locked script and the no-GPU fallback on this PC; it is not a GitHub Actions runner.XCL_ADAPTER=6800M: the edited script built the workspace, then stopped at the library test target: 937 passed, 161 failed, 26 ignored. A separatecargo test --locked --workspace --no-fail-fast -- --test-threads=4reached all 21 targets: 993 passed, 161 failed, 46 ignored, with six explicit skips. The broad RX 6800M failure cluster includes D3D12 device suspension (0x887A0005) and was observed before this config-only edit; these counts are not a green GPU run.No scratch branch was pushed and no PR was opened. The result supports 1.99.0 as a tested minimum on this machine and 1.100.0 as a buildable pinned toolchain. It does not establish that older Rust versions fail, nor that the GitHub CI environment passes.
AI use: OpenAI Codex (GPT-6; exact variant not exposed) made the local scratch edit, ran and checked these commands, and drafted this report.
@itsonewi on GitHub · 2026-11-25 10:49 UTC · original
On the version: there is no declared MSRV in the tree, and the three numbers are different things:
HANDOFF.md:8says the project is developed on Rust 1.96 (the maintainer's machine, not a policy).9ab7d76for its cache/warning numbers.rustc --versionin the "Rust (stable, MSVC)" step; the last green main run is the only version CI has actually tested.I would pin the oldest version the tree builds with, not the newest:
1.96.0first, because HANDOFF names it. On a scratch branch:rustup toolchain install 1.96.0,cargo +1.96.0 build --workspace --locked, thencargo +1.96.0 test --workspaceif time allows. If a dependency now needs newer, go to1.97.1and then to the lowest that passes; say in the PR which crate set the floor.Cargo.lockis format 4 (Cargo 1.78+), so that is not the constraint, andedition = "2021"only needs 1.56 - the dependencies decide.rust-versionto the version you pinned, and addrust-version.workspace = trueto each member (crates/xcl,tests/testtitle,tests/testgamedll);[workspace.package]is not inherited automatically.rust-versionis a minimum check, not a selector, so do not set 1.100 just because you build with it locally.rust-toolchain.tomloverridesrustup default stable, so therustc --versionline will print the pin. That is fine; keep the scheduled stable job (or aRUSTUP_TOOLCHAIN=stablestep) for future-stable breakage, as you planned. Note that rustup will auto-install the pinned toolchain on first use, so the "install stable" step no longer describes what runs.--lockeddoes what you expect: if a manifest is newer than the lock,cargo build --lockedfails and without--lockedCargo rewritesCargo.lock. Forscripts/test.ps1, that means a contributor who adds a dependency must update the lock before the script passes; worth one line in CONTRIBUTING if it is not obvious.If you would rather not test 1.96, pin the stable version printed by the last green main CI run; it is the only one with evidence behind it today. A comment in
rust-toolchain.tomlwith the date makes the next bump easier.@WASDeKeys on GitHub · 2026-11-25 10:57 UTC · original
@itsonewi
Thank you for your detailed feedback. I've revised the
approach based on your instructions:
version
[workspace.package]
specific version
checks
dependencies
clear
I'll proceed with these changes and verify the build with the pinned
version.
Claude AI was used to solely draft this reply.
@WASDeKeys on GitHub · 2026-11-25 11:16 UTC · original
@itsonewi
Thanks for the independent Windows
▎ results — this is exactly the kind of
▎ cross-check #2214 needs, and I
▎ appreciate you not opening a
▎ duplicate PR.
▎
▎ A few things from my side on the
▎ pin-rust-toolchain branch:
▎ - It pins rust-toolchain.toml to
▎ 1.100.0 (minimal profile), sets
▎ workspace rust-version = "1.100.0",
▎ and uses --locked in both calls in
▎ scripts/test.ps1, matching the
▎ approach you validated locally. The
▎ CI workflow edit mirrors yours
▎ (rust-toolchain.toml selects the
▎ compiler; cache key includes
▎ rust-toolchain.toml).
▎ - Your numbers line up with what I'd
▎ expect: 1.99.0 builds cleanly as a
▎ tested minimum, 1.100.0 builds as the
▎ pinned toolchain, and the RX 6800M
▎ GPU failure cluster you saw is
▎ pre-existing and unrelated to this
▎ config-only change (device removal
▎ 0x887A0005, not a toolchain/compile
▎ issue).
▎ - What's still outstanding: a real
▎ GitHub Actions CI run (the workflow
▎ edit exists locally but hasn't run on
▎ Actions), and a green full-GPU test
▎ run on supported hardware. Your
▎ results are from a local machine, not
▎ Actions, so they support the
▎ direction but don't establish
▎ CI-passing.
▎
▎ One heads-up before this becomes a
▎ PR: I noticed a couple of things on
▎ the branch worth cleaning up first so
▎ the diff stays config-only and
▎ within the size/scope rules:
▎ - each crate manifest now has
▎ rust-rust-version.workspace = true,
▎ which looks like a typo/dead line (no
▎ such Cargo key), and
▎ version.workspace = true was dropped
▎ — Cargo.lock shows all three packages
▎ falling from 0.1.0 to 0.0.0;
▎ - the
▎ crates/xcl/src/hle/d3d12x/vram.rs
▎ test change (VRAM lock reorder + < 8
▎ GB VRAM skip) is unrelated to
▎ toolchain pinning.
▎
▎ I'd fold those out before opening the
▎ PR. Happy to hand off or stack
▎ however works for you — I won't push
▎ or open a PR unless you'd like me to.
Heads-up on the branch (what I saw in
git diff main..HEAD)
appears in all three crate manifests
(crates/xcl, tests/testtitle,
tests/testgamedll). That isn't a
real Cargo manifest key — it looks
like an accidental duplication/typo.
Cargo may accept it with a warning
or ignore it, but it's dead weight
and should be removed. (WASDeKeys's
scratch edit only added rust-version
= "1.99.0" inherited via the
workspace — no per-crate
rust-version lines at all.)
testgame-mw, xcl, and xcl-testtitle
all moved 0.1.0 → 0.0.0. This
follows from removing
version.workspace = true from each
crate — they no longer inherit the
workspace version. The workspace
Cargo.toml still says version =
"0.1.0", so this drift is almost
certainly unintended and should be
reverted (restore version.workspace
= true).
this test change has nothing to do
with pinning the toolchain. Per the
project's one-change-per-PR rule, it
belongs in its own PR, not here.
(per WASDeKeys), so the "CI green"
requirement isn't satisfied yet —
that's a next step, not something to
claim.
I will be making a new PR after i push these changes to my commit, i will be referencing #2214, thank you for the help @itsonewi
Sonnet 5.5 was used to draft this reply while I myself made the changes and ran tests
@itsonewi on GitHub · 2026-11-25 11:19 UTC · original
Good, 1.96 first is the right order. Three notes:
components = ["rustfmt", "clippy"]inrust-toolchain.toml. The tree is not rustfmt-clean and AGENTS.md tells contributors never to runcargo fmton it, so shipping rustfmt invites exactly the drive-by reformat the rules forbid.profile = "minimal"is enough for CI.rustc --versionstep alone. With the pin it prints the pinned version, which is the record that the run used it; the scheduled stable leg stays the early-warning job for a future compiler break.@WASDeKeys on GitHub · 2026-11-25 11:22 UTC · original · edited 2026-11-25 11:24 UTC
@itsonewi
also, i assume i will have to run smoke tests before i make the PR @itsonewi ?
@itsonewi on GitHub · 2026-11-25 11:27 UTC · original
Short answer: no smoke blocks for this one. CONTRIBUTING item 3 requires the regression run only for a PR that changes the runtime (
crates/xcl/srcoutside tests). Your diff isrust-toolchain.toml, the threeCargo.tomls,scripts/test.ps1and.github/workflows/ci.yml- nothing incrates/xcl/src- sopr_check.pywill not ask for the twoxcl-smokeblocks. Two things that still apply:test.ps1pass--locked, run it through the edited script at least once, so the counts come from the command the PR changes rather than from a barecargo test.crates/xcl/srcfor anything (even a test), the smoke requirement comes back. Keep it out of this PR.On the version: pinning 1.100.0 with
rust-version = "1.99.0"is coherent (a minimum is not a selector), but the body should say why, becauseHANDOFF.mdnames 1.96 - a reader will see three numbers and no explanation. And "we validated 1.99.0 builds" is@luckyteagirlmeasurement on an RX 6800M, not yours; attribute it or drop the claim, since Tested has to be a run you made.@WASDeKeys on GitHub · 2026-11-25 11:33 UTC · original
@itsonewi
So when i make the PR without smoke blocks in its description, I just tag a maintainer so that the PR doesnt get flagged as failing the checks?
@itsonewi on GitHub · 2026-11-25 11:34 UTC · original
Correction to what I said above: the smoke pair is required for this PR. I answered from the CONTRIBUTING wording instead of checking
pr_check.py, and the checker is wider than ".rsfiles undercrates/xcl/src". It has two predicates:check()then asks for the regression run if any changed path matches either. Your branch touchesCargo.toml(root, +1) andCargo.lock(+3/-3), and both are inRUNTIME_BUILD, so the section is required: one cleanmainblock and one on the PR head, same title and sameseconds. That is deliberate - the workspace manifest and the lock file pickxcl.exes dependencies and release profile, so the binary changes even when no source file moves. Sorry for the wrong first answer.The tagging part still holds: the decision comes from the diff, never from a mention, so nobody needs to be tagged and tagging does not make the check pass.
Second thing I noticed while comparing the branch - it also changes
AGENTS.md,CONTRIBUTING.mdandREADME.md. For a toolchain pin those read as scope creep, andCONTRIBUTING.md+9/-1 is a policy change that a maintainer makes, not a side effect of a pin. I would drop all three from this PR (a one-line version note in the body covers it), and if the CONTRIBUTING line is really needed, ask a maintainer for it separately - otherwise the PR competes with its own purpose.@WASDeKeys on GitHub · 2026-11-25 15:51 UTC · original
@itsonewi I have added a fix to this issue : #2295 .