Skip to content

Commit a1d0076

Browse files
Owie6789arena-agent
andcommitted
fix: allow the fetch_update deprecation the MSRV cannot adopt yet
Rust Lints (fmt, clippy) has been red on this branch since Rust 1.99.0 reached the runner images, on a line no commit here touched: error: use of deprecated method `Atomic::<u64>::fetch_update`: renamed to `try_update` for consistency --> src/core/turn_order.rs:13:10 The line is byte-identical at the branch point ae262b9. The cause is a floating toolchain: no rust-toolchain.toml, `toolchain: stable` in .github/actions/setup/action.yml, and `-D warnings` in ci.yml. ci.yml does not run on pushes to mega/absorb-all, so this PR is the first CI run ever to lint that branch's Rust and it surfaced a failure that was already sitting there. The rename clippy suggests is not available to this crate. try_update is stable only from 1.95.0, while src-tauri/Cargo.toml declares rust-version = "1.89.0" and engineering/rust-toolchain.md:69-70 records the vendored sandbox toolchain as 1.89.0 to match, as is [email protected]'s own rust-version. Renaming would break the declared MSRV, break the vendored toolchain agents fetch in blocked sandboxes, and be rejected by clippy's own incompatible_msrv lint. It trades a deprecation error for a compile error on 1.89 through 1.94. So the attribute goes on the one function that needs it, scoped to that function rather than the module or the crate, with the removal condition in the doc comment. In std, fetch_update is an alias whose body is self.try_update(set_order, fetch_order, f), so the two are semantically identical and behaviour does not change. This is what sub-1.95 projects did upstream: valkey-glide#7253, apache/datafusion-comet#6507, cheerc/agend-terminal#4, sturnus-dev/sturnus#80 and google-cloud-rust#7108 all suppressed and deferred rather than raised their floor. Raising the MSRV and pinning the toolchain were both considered and rejected here. Raising it invalidates the 4 GB vendor branch that cannot be regenerated from a sandbox. Pinning is the real root-cause fix, because a pinned toolchain cannot drift under a -D warnings gate, but it is a repo-wide policy change that interacts with dtolnay/rust-toolchain's explicit `toolchain: stable` and needs someone who can run cargo to verify it. Both are recorded with their tradeoffs in .dump/global/floating-rust-stable-breaks-ci-with-no-commit.md so the exposure is not re-diagnosed by the next person, and so the pinning decision gets made deliberately instead of by accident. Co-authored-by: arena-agent <[email protected]>
1 parent 5a1cb9b commit a1d0076

2 files changed

Lines changed: 107 additions & 0 deletions

File tree

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Floating Rust stable under `-D warnings` breaks CI with no commit
2+
3+
Recorded 24 October 2026 from PR #52, where `Rust Lints (fmt, clippy)` failed on
4+
a line this PR never touched.
5+
6+
## The trap
7+
8+
Three facts combine so that CI can go red with zero commits to the repository:
9+
10+
- `src-tauri/Cargo.toml:9` declares `rust-version = "1.89.0"`.
11+
- There is no `rust-toolchain.toml` anywhere in the tree, and
12+
`.github/actions/setup/action.yml:76` installs `toolchain: stable` through
13+
`dtolnay/rust-toolchain`. The toolchain therefore floats.
14+
- `.github/workflows/ci.yml:248` runs
15+
`cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets --all-features -- -D warnings`,
16+
so any new deprecation in a newer stable becomes a hard error.
17+
18+
`ci.yml` triggers on `pull_request` and on `push: branches: [main]`. It does not
19+
run on pushes to `mega/absorb-all`, so work absorbed there is never linted until
20+
someone opens a PR based on it. PR #52 was the first PR based on
21+
`mega/absorb-all`, and it surfaced a failure that had been sitting in that
22+
branch's Rust since Rust 1.99.0 reached the runner images.
23+
24+
## The instance
25+
26+
```
27+
error: use of deprecated method `std::sync::atomic::Atomic::<u64>::fetch_update`:
28+
renamed to `try_update` for consistency
29+
--> src/core/turn_order.rs:13:10
30+
= note: `-D deprecated` implied by `-D warnings`
31+
```
32+
33+
Rust 1.99.0, stable from 2026-10-01, deprecated `Atomic*::fetch_update`. The
34+
line is byte-identical at commit `ae262b9b`, so no change in PR #52 caused it.
35+
The same job passed 14 minutes earlier on an older runner image in an unrelated
36+
project (`peters/horizon#1348`), and a re-run stays on the new image, so
37+
retrying does not help (`warmblood-kr/remuda#608`).
38+
39+
## Why the suggested fix is wrong here
40+
41+
Clippy offers a one-line rename, and most projects took it. This one cannot.
42+
43+
- `try_update` is `#[stable(feature = "atomic_try_update", since = "1.95.0")]`.
44+
- `fetch_update` is `#[stable(since = "1.53.0")]` plus
45+
`#[deprecated(since = "1.99.0", note = "renamed to `try_update` for consistency")]`,
46+
and in std its body is literally `self.try_update(set_order, fetch_order, f)`,
47+
so the two are semantically identical.
48+
- This project's declared MSRV is 1.89.0, below 1.95.0, and
49+
`engineering/rust-toolchain.md:69-70` records that the vendored sandbox
50+
toolchain on `vendor/sandbox-toolchain` is 1.89.0 specifically to match that
51+
pin, as is `[email protected]`'s own `rust-version`.
52+
53+
Renaming would break the declared MSRV, break the documented sandbox toolchain,
54+
and be rejected by clippy's own `incompatible_msrv` lint. It trades a
55+
`deprecated` error for a compile error on 1.89 through 1.94.
56+
57+
Upstream splits exactly on this line. Projects at MSRV 1.95 or above did the
58+
pure rename (`peters/horizon#1351`, `atusy/kakehashi#1182`,
59+
`diazoxide/charter#831`, `ricktaylor/hardy#761`). Projects below 1.95 suppressed
60+
and deferred (`valkey-io/valkey-glide#7253`, `apache/datafusion-comet#6507`,
61+
`cheerc/agend-terminal#4`, `sturnus-dev/sturnus#80`,
62+
`googleapis/google-cloud-rust#7108`, which keeps `fetch_update` with
63+
`#[allow(deprecated)]` plus a TODO until its MSRV moves).
64+
65+
## The options, none applied
66+
67+
1. `#[allow(deprecated)]` on `advance` in `src-tauri/src/core/turn_order.rs`
68+
with a TODO naming the removal condition, MSRV reaching 1.95. Smallest change,
69+
keeps the MSRV honest, matches what sub-1.95 projects did. It is a
70+
suppression, which `FULL-REVIEW.md` section 7.4 lists as an anti-pattern when
71+
added to pass CI, so it needs a recorded reason rather than being silent.
72+
2. Raise `rust-version` to 1.95.0 and rename. Correct long term, but it moves
73+
the MSRV, invalidates the 1.89.0 vendored toolchain and
74+
`engineering/rust-toolchain.md`, and needs `notify-rust` and the vendor
75+
branch checked against the new floor.
76+
3. Add a `rust-toolchain.toml` pin. This addresses the root cause rather than
77+
the symptom, because a pinned toolchain cannot drift under a `-D warnings`
78+
gate. It costs security fixes and can diverge from whatever the release jobs
79+
use.
80+
81+
Whichever is chosen, the underlying exposure stays: an unpinned `stable` plus
82+
`-D warnings` means any future Rust release can red the build with no commit, on
83+
any branch, and the failure will look like the current PR's fault. Expect this
84+
to recur and expect it to be misattributed.
85+
86+
## How to tell this class apart from a real failure
87+
88+
- `git diff --name-only <base>..HEAD -- '*.rs'` is empty, so the PR changed no
89+
Rust.
90+
- `git show <base>:<path>` shows the offending line unchanged at the branch
91+
point.
92+
- `Test Rust (Cargo)` passes while `Rust Lints` fails, so the crate compiles and
93+
only a lint gate is red.
94+
- The workflow posts the full clippy output as a PR comment
95+
(`ci.yml`, step `Comment clippy results on PR`), which is the way to read it
96+
when the job log blob host is unreachable from a sandbox.

‎src-tauri/src/core/turn_order.rs‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ pub fn next_turn_sequence() -> Option<u64> {
88
advance(&NEXT_TURN)
99
}
1010

11+
/// `fetch_update` is deprecated as of Rust 1.99 in favour of `try_update`,
12+
/// which is stable only from 1.95. This crate declares `rust-version =
13+
/// "1.89.0"` and the vendored sandbox toolchain on `vendor/sandbox-toolchain`
14+
/// is 1.89.0 to match, so the rename is not available yet and CI's `-D
15+
/// warnings` turns the deprecation into a hard error on any runner new enough
16+
/// to have it. The two are semantically identical: in std, `fetch_update` is an
17+
/// alias whose body is `self.try_update(set_order, fetch_order, f)`.
18+
///
19+
/// Drop this attribute and rename once the MSRV reaches 1.95. See
20+
/// `.dump/global/floating-rust-stable-breaks-ci-with-no-commit.md`.
21+
#[allow(deprecated)]
1122
fn advance(counter: &AtomicU64) -> Option<u64> {
1223
counter
1324
.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |n| n.checked_add(1))

0 commit comments

Comments
 (0)