Commit graph

2 commits

Author SHA1 Message Date
chopratejas
62301a2d68 fix(rust): clippy 1.95 unnecessary_sort_by + pin toolchain
Two-part fix for the CI break that followed the previous push.

Lint fix:
`crates/headroom-core/src/transforms/smart_crusher/analyzer.rs:779` used
`pairs.sort_by(|a, b| b.1.cmp(&a.1))`. Clippy 1.95 introduced
`unnecessary_sort_by` and prefers `sort_by_key(|b|
std::cmp::Reverse(b.1))` for the same desc-sort by a single field.
Replaced. Functionally identical (both stable sorts on the count field
descending; first-occurrence tie order preserved either way).

Drift fix:
The same lint passed locally on rust 1.92 / clippy 0.1.92 because the
dev box hadn't been updated since December. CI runners use
`dtolnay/rust-toolchain@stable` which always grabs the latest stable
(1.95 today), so any lint added between local's last update and CI's
runner image breaks the pre-push gate. Two ways to close this:
1. Pin a specific Rust version in `rust-toolchain.toml`.
2. Run `rustup update stable` before every push.

Option 1 is more robust — `rust-toolchain.toml` is auto-respected by
`cargo`, so any local check (or CI check using the same project) syncs
to the pinned version automatically. Pinned to `1.95.0`. Bump procedure
documented in the file: edit channel, `rustup update`, `make
ci-precheck`, fix any new lints, commit.

Verification:
- `rustup` synced the dev box to 1.95.0 on the next `cargo` invocation.
- `cargo clippy --workspace -- -D warnings` clean on 1.95.
- `make ci-precheck` green (388 rust + 185 python + commitlint).
2026-04-27 12:11:49 -07:00
chopratejas
0414cb70e4 feat(rust): scaffold workspace + parity harness (phase-0)
Bootstrap the Rust port of Headroom. Additive only — no existing Python
code modified. Ships the workshop, not the widgets.

Layout
  Cargo.toml (workspace) + rust-toolchain.toml
  crates/headroom-core    — transform library, stub only
  crates/headroom-proxy   — axum binary, /healthz only
  crates/headroom-py      — PyO3 cdylib, exposes headroom._core.hello()
  crates/headroom-parity  — Rust-vs-Python oracle harness + parity-run CLI

Tooling
  Makefile: test, test-parity, bench, build-proxy, build-wheel, fmt, lint
  .github/workflows/rust.yml: test, wheels (linux/mac), audit, parity-nightly
  deny.toml for cargo-deny

Parity corpus
  tests/parity/recorder.py + scripts/record_fixtures.py
  125 recorded fixtures across 5 leaf transforms (ccr, tokenizer,
  log_compressor, diff_compressor, cache_aligner)

Docs
  RUST_DEV.md — developer setup and workspace reference
  docs/spec/022-rust-migration.md — migration plan and stage breakdown

.gitignore: whitelist scripts/record_fixtures.py; ignore target/

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 13:39:48 -07:00