Skip to content

chore: reduce tokio features to rt+macros#37

Merged
graykode merged 6 commits intograykode:mainfrom
tbouquet:chore/reduce-tokio-features
Apr 18, 2026
Merged

chore: reduce tokio features to rt+macros#37
graykode merged 6 commits intograykode:mainfrom
tbouquet:chore/reduce-tokio-features

Conversation

@tbouquet
Copy link
Copy Markdown
Contributor

Summary

  • Reduce tokio features from "full" to ["rt", "macros"]
  • The codebase is fully synchronous (fn main, std::thread::spawn, std::sync::mpsc) with zero uses of async/.await/tokio:: anywhere in src/
  • "full" pulls in unused modules (net, fs, io-util, signal, sync::broadcast) and ~9 transitive crates that only increase compile time and attack surface

Test plan

  • cargo build --release passes
  • cargo clippy -- -D warnings passes
  • cargo test - all 25 tests pass
  • Verified: grep -r "async\|tokio\|\.await" src/ returns zero matches

Additional note

A cargo-audit CI job (rustsec/audit-check@v2) would also be valuable but requires the workflow scope to modify .github/workflows/ci.yml. Happy to add it in a follow-up if you prefer, or you can add it directly:

  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: rustsec/audit-check@v2
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

tokio is declared with features = ["full"] but the codebase is fully
synchronous (fn main, std::thread::spawn, std::sync::mpsc). Zero uses
of async/.await/tokio:: anywhere in src/.

Reducing to ["rt", "macros"] eliminates unused modules (net, fs,
io-util, signal, sync::broadcast) and their transitive dependencies,
shrinking the attack surface. Build, clippy, and all tests pass.
Pre-existing clippy lint in codex.rs:454 - collapse `if` guard into
the match arm pattern. Unrelated to the tokio feature change but
needed for CI to pass on the upstream clippy 1.95 runner.
@graykode
Copy link
Copy Markdown
Owner

Thanks @tbouquet — nice catch and the analysis is spot-on.

One suggestion before we merge: since grep -rn "tokio\|async\|\.await" src/ returns zero matches, tokio is effectively an unused dependency. Trimming features to ["rt", "macros"] is an improvement, but the logical conclusion is to drop the dependency entirely rather than keep an unused crate around.

Could you:

  1. Remove the tokio = ... line from Cargo.toml altogether
  2. Update the tokio — included but currently sync I/O note in CLAUDE.md accordingly

Also, the user_message match-guard refactor in src/collector/codex.rs is unrelated to the tokio change — ideally that would be a separate PR (or at least mentioned in the description), but it's a small stylistic win so no blocker.

cargo-audit CI addition sounds great as a follow-up PR, thanks for offering.

@graykode
Copy link
Copy Markdown
Owner

@tbouquet One more thing — the change in src/collector/codex.rs looks unrelated to this PR's scope (reducing tokio features). Could you revert that file so this PR stays focused on the Cargo.toml change? Happy to review the match-guard refactor in a separate PR.

Codebase is fully synchronous (no async/.await/tokio:: usage),
so drop the crate entirely rather than keep unused features.
Keep this PR focused on the tokio change; the match-guard
refactor will be reviewed separately.
Rust 1.95 stable added the collapsible_match lint that rejects the
nested 'if' inside this 'Some("user_message")' arm. Move the empty
check into a match guard to unbreak CI (same failure affects main).
@graykode graykode merged commit b341aa8 into graykode:main Apr 18, 2026
7 checks passed
@graykode graykode mentioned this pull request Apr 18, 2026
6 tasks
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