Skip to content

chore(dx): enforce clippy and rustfmt in CI - #45

Open
duyet wants to merge 1 commit into
mainfrom
cursor/007-ci-lint-gates-4ce0
Open

chore(dx): enforce clippy and rustfmt in CI#45
duyet wants to merge 1 commit into
mainfrom
cursor/007-ci-lint-gates-4ce0

Conversation

@duyet

@duyet duyet commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Closes #22 (Plan 007).

Why

CI ran cargo fmt --check with continue-on-error and never ran clippy. Formatting drifted and the 13-plus style warnings hid real ones. The test job now fails the PR when fmt or clippy is dirty.

Scope

  • .github/workflows/ci.yml lint job installs clippy, runs cargo fmt --check without continue-on-error, and runs cargo clippy --locked --all-targets -- -D warnings before llvm-cov.
  • Mechanical fixes for the live baseline on current main (line numbers in the issue are stale).
    • src/commands.rs &PathBuf params become &Path. catalog_lookup_enabled uses matches!.
    • src/help.rs thread_local initializer is const { RefCell::new(String::new()) }.
    • src/spawn.rs ToolConfig derives Default. Test uses contains_key.
    • src/term.rs uses div_ceil.
    • src/tui/view.rs drops a useless format!.
    • src/upgrade.rs uses unwrap_or_default.
    • src/http.rs test helper getKeyPrefixStyleMask keeps the JS-mirrored name behind #[allow(non_snake_case)]. That warning is new since the plan was written. Without the allow, -D warnings cannot pass.

Out of scope: pedantic clippy groups, wasm clippy, behavior changes.

Tradeoffs

The allow on getKeyPrefixStyleMask keeps the helper name aligned with the server's getKeyPrefix() instead of renaming a test-only JS mirror.

Blast radius

Every PR now fails on new clippy warnings and unformatted Rust. Contributors need cargo fmt and cargo clippy --locked --all-targets -- -D warnings locally. Existing tests are unchanged.

Verification

  • cargo clippy --locked --all-targets -- -D warnings — exit 0
  • cargo fmt --check — exit 0
  • cargo test --locked --all-targets — 186 lib + 68 cli + 7 release_lock passed
  • YAML parse of ci.yml — exit 0
  • grep shows clippy -D warnings and no continue-on-error on fmt

Checklist

  • Version stays on 0.1.x (do not introduce 0.2 / 1.0)
  • Do not auto-merge release-please PRs
Open in Web Open in Cursor 

CI now fails on `cargo fmt --check` and
`cargo clippy --locked --all-targets -- -D warnings`.

The live baseline is fixed so the gate is green. `&PathBuf` params become
`&Path`, `catalog_lookup_enabled` uses `matches!`, `term` uses `div_ceil`,
`persist_channel` uses `unwrap_or_default`, `ToolConfig` derives Default,
and the help thread_local initializer is const. The JS-mirrored test helper
`getKeyPrefixStyleMask` keeps its name behind `#[allow(non_snake_case)]`.

Closes #22

Co-authored-by: Duyet Le <me@duyet.net>
Co-authored-by: duyetbot <bot@duyet.net>
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

anyr size and startup

Startup is wall time for a cold anyr --version / anyr --help (median of 21 runs). Size is the stripped release binary, or the .wasm for the browser demo.

Size budget: anyr-linux-x86_64 must stay ≤ 4.0 MiB (4194304 bytes) stripped.

Asset Kind Size --version median --help median
anyr-darwin-arm64 native 2.8 MiB 4.51 ms 4.27 ms
anyr-darwin-x86_64 native 3.0 MiB 37.14 ms 38.74 ms
anyr-linux-arm64 native 2.8 MiB 0.71 ms 0.72 ms
anyr-linux-x86_64 native 3.1 MiB 0.65 ms 0.63 ms
anyr-windows-x86_64.exe native 2.5 MiB 9.29 ms 9.22 ms
anyr.wasm wasm 176.3 KiB

Budget check: ok

raw timings
[
  {
    "asset": "anyr-darwin-arm64",
    "kind": "native",
    "path": "/Users/runner/work/cli/cli/anyr-darwin-arm64",
    "bytes": 2921688,
    "size": "2.8 MiB",
    "version": "0.1.11 (built 2026-09-03 18:03:41)",
    "target": "aarch64-apple-darwin",
    "os": "macos-latest",
    "startup_version": {
      "n": 21,
      "min_ms": 3.23,
      "median_ms": 4.51,
      "p95_ms": 7.26,
      "mean_ms": 4.94
    },
    "startup_help": {
      "n": 21,
      "min_ms": 2.98,
      "median_ms": 4.27,
      "p95_ms": 6.56,
      "mean_ms": 4.49
    }
  },
  {
    "asset": "anyr-darwin-x86_64",
    "kind": "native",
    "path": "/Users/runner/work/cli/cli/anyr-darwin-x86_64",
    "bytes": 3119528,
    "size": "3.0 MiB",
    "version": "0.1.11 (built 2026-09-03 18:03:43)",
    "target": "x86_64-apple-darwin",
    "os": "macos-latest",
    "startup_version": {
      "n": 21,
      "min_ms": 33.35,
      "median_ms": 37.14,
      "p95_ms": 41.3,
      "mean_ms": 37.91
    },
    "startup_help": {
      "n": 21,
      "min_ms": 34.91,
      "median_ms": 38.74,
      "p95_ms": 42.54,
      "mean_ms": 38.53
    }
  },
  {
    "asset": "anyr-linux-arm64",
    "kind": "native",
    "path": "/home/runner/work/cli/cli/anyr-linux-arm64",
    "bytes": 2888744,
    "size": "2.8 MiB",
    "version": "0.1.11 (built 2026-09-03 18:02:59)",
    "target": "aarch64-unknown-linux-gnu",
    "os": "ubuntu-24.04-arm",
    "startup_version": {
      "n": 21,
      "min_ms": 0.69,
      "median_ms": 0.71,
      "p95_ms": 0.79,
      "mean_ms": 0.73
    },
    "startup_help": {
      "n": 21,
      "min_ms": 0.67,
      "median_ms": 0.72,
      "p95_ms": 0.75,
      "mean_ms": 0.71
    }
  },
  {
    "asset": "anyr-linux-x86_64",
    "kind": "native",
    "path": "/home/runner/work/cli/cli/anyr-linux-x86_64",
    "bytes": 3216552,
    "size": "3.1 MiB",
    "version": "0.1.11 (built 2026-09-03 18:03:02)",
    "target": "x86_64-unknown-linux-gnu",
    "os": "ubuntu-latest",
    "startup_version": {
      "n": 21,
      "min_ms": 0.6,
      "median_ms": 0.65,
      "p95_ms": 0.72,
      "mean_ms": 0.66
    },
    "startup_help": {
      "n": 21,
      "min_ms": 0.61,
      "median_ms": 0.63,
      "p95_ms": 0.75,
      "mean_ms": 0.64
    }
  },
  {
    "asset": "anyr-windows-x86_64.exe",
    "kind": "native",
    "path": "D:\\a\\cli\\cli\\anyr-windows-x86_64.exe",
    "bytes": 2665984,
    "size": "2.5 MiB",
    "version": "0.1.11 (built 2026-09-03T18:04:36Z)",
    "target": "x86_64-pc-windows-msvc",
    "os": "windows-latest",
    "startup_version": {
      "n": 21,
      "min_ms": 9.07,
      "median_ms": 9.29,
      "p95_ms": 9.59,
      "mean_ms": 9.32
    },
    "startup_help": {
      "n": 21,
      "min_ms": 9.01,
      "median_ms": 9.22,
      "p95_ms": 9.43,
      "mean_ms": 9.21
    }
  },
  {
    "asset": "anyr.wasm",
    "kind": "wasm",
    "path": "/home/runner/work/cli/cli/target/wasm-pkg/anyr_cli_bg.wasm",
    "bytes": 180519,
    "size": "176.3 KiB",
    "version": "wasm",
    "target": "wasm32-unknown-unknown",
    "os": ""
  }
]

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.

Plan 007: Make clippy and rustfmt real CI gates

2 participants