Skip to content

fix(mcp): replace deprecated fetch_update with a compare-exchange loop - #16

Merged
neurolabusc merged 1 commit into
mainfrom
fix/allow-deprecated-fetch-update
Oct 14, 2026
Merged

neurolabusc merged 1 commit into
mainfrom
fix/allow-deprecated-fetch-update

Conversation

@cdrake

@cdrake cdrake commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Why

The Windows cargo check (warnings gate) job builds with RUSTFLAGS=-D warnings on the latest stable Rust. Rust 1.99 deprecates AtomicU64::fetch_update (renamed try_update), so charge_egress in src-tauri/src/ai/mcp/server.rs now fails that job. main last ran CI on 2026-07-15, before that release, so any PR opened now fails, e.g. #11.

Fix

charge_egress now uses a plain compare_exchange_weak loop, which is what fetch_update does internally. There is no deprecated call and no #[allow]. Behavior is unchanged:

  • the check-and-add is still a single atomic step;
  • an overflowing or over-cap charge is refused with the same message;
  • a refused charge leaves the counter untouched.

We didn't switch to try_update because it doesn't exist in Rust 1.85 (rust-version in Cargo.toml).

Side note, not changed here: Rust 1.85 can't build the crate anyway. darling 0.23 needs 1.88, and the icu_* 2.2 crates need 1.86. So rust-version is already behind the real minimum, and could be raised separately.

Test

  • RUSTFLAGS="-D warnings" cargo +stable check --lib (rustc 1.99.0): fails on main, passes here.
  • cargo test --lib egress: 3 pass, including egress_cap_refuses_once_session_budget_exhausted.
  • cargo fmt --check is clean.

Once this merges, #11 (and the rest of the NeuroFlow stack #12–#15) rebase onto it.

🤖 Generated with Claude Code

Rust 1.99 deprecates AtomicU64::fetch_update in favour of try_update. The
Windows cargo check builds with -D warnings, so every PR now fails there.
try_update needs a newer compiler than our rust-version (1.85), so
charge_egress now does the same compare-exchange loop fetch_update did:
the check-and-add stays one atomic step, an overflowing or over-cap
charge is refused, and a refused charge leaves the counter untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cdrake
cdrake force-pushed the fix/allow-deprecated-fetch-update branch from 5ec6f9c to 8e6f956 Compare October 13, 2026 20:07
@cdrake cdrake changed the title fix(mcp): allow fetch_update deprecation so the Windows warnings gate passes fix(mcp): replace deprecated fetch_update with a compare-exchange loop Oct 13, 2026
@neurolabusc
neurolabusc merged commit 5ed7340 into main Oct 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants