Skip to content

ci(rust): add build/test/clippy gate; make crates clippy-clean#300

Merged
hyperpolymath merged 3 commits into
mainfrom
claude/determined-cerf-s4zaob
Jun 21, 2026
Merged

ci(rust): add build/test/clippy gate; make crates clippy-clean#300
hyperpolymath merged 3 commits into
mainfrom
claude/determined-cerf-s4zaob

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Items #2 (clippy sweep) and #1 (close the CI gap) from the follow-up list, as one PR — the lint fixes and the gate that enforces them belong together so CI is self-consistent.

Why

The only Rust CI was CodeQL in build-mode none (buildless) — nothing compiled or tested robot-repo-automaton / shared-context / dashboard. That's exactly how the non-compiling content-match path reached main before #299 fixed it. This closes that gap.

The gate — .github/workflows/rust.yml

Per-crate matrix (modeled on e2e.yml: SHA-pinned checkout, permissions: contents: read, SPDX header):

  • cargo build --all-targets
  • cargo test
  • cargo clippy --all-targets -- -D warnings (blocking)
  • cargo fmt --check (informational, continue-on-error) — there's ~180 hunks of pre-existing formatting drift; gating it would mean a giant reformat that buries this change, so it's surfaced but not yet enforced. A dedicated cargo fmt pass can flip it to blocking later.

Clippy fixes (to make the gate green)

File Finding Fix
fixer.rs .replace("hyperpolymath", "hyperpolymath") no-op — removed
registry_guard.rs manual splitn(2, '/') split_once('/')
exclusion_registry.rs from_str shadows FromStr rename inherent from_strparse (matches Catalog::parse; 2 internal call sites)
exclusion_registry.rs .ok() + if let Some if let Ok(..)
hypatia.rs, main.rs &PathBuf arg &Path
Cargo.toml ×2 toml = "1.1.2+spec-1.1.0" drop ignored +spec build-metadata (resolution-neutral; silences cargo warning)
benches/fleet_benchmarks.rs deprecated criterion::black_box import std::hint::black_box (one import swap covers all call sites)

Verification

All three crates: clippy -D warnings clean, build clean. Tests: 101 (robot-repo-automaton) + 84 (shared-context) pass. Locally simulated the full matrix (build + test + clippy) green per crate; rust.yml parses as valid YAML.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RozeeLxpJsd3WWFngaZWz3


Generated by Claude Code

claude added 2 commits June 20, 2026 20:03
`detect_content_match` read file contents with `std::fs::read` (→ `Vec<u8>`)
and passed `&content` to a string `regex::Regex::is_match`, which wants
`&str`. The crate therefore never compiled and the whole
`DetectionMethod::ContentMatch` detection path was dead code.

Switch to `std::fs::read_to_string`. This fixes the type error and also
implements the "skip non-UTF8" intent already stated in the comment just
above (`read_to_string` returns `Err` on non-UTF8 bytes, which the
`if let Ok` then skips), matching the sibling content scan in
`hypatia.rs`.

Add a regression test for the previously-uncompilable path: a positive
regex match, a non-match, and a non-UTF8 file that must be skipped
without panicking. `cargo build` is clean and all 101 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RozeeLxpJsd3WWFngaZWz3
The only Rust CI was CodeQL in build-mode `none` (buildless), so nothing
ever compiled or tested robot-repo-automaton / shared-context / dashboard
— which is how the non-compiling content-match path reached `main` before
it was fixed in the prior PR. Add `.github/workflows/rust.yml`: a per-crate
matrix running `cargo build --all-targets`, `cargo test`, and
`cargo clippy --all-targets -- -D warnings` (blocking), with
`cargo fmt --check` informational (there is pre-existing formatting drift —
~180 hunks — that is intentionally not gated yet).

To make the clippy gate pass, fix the existing findings:
- fixer.rs: drop a no-op `.replace("hyperpolymath", "hyperpolymath")`.
- registry_guard.rs: use `split_once('/')` instead of a manual `splitn(2)`.
- exclusion_registry.rs: rename the inherent `from_str` -> `parse` (it is
  not a `FromStr` impl; matches `Catalog::parse`) and use `if let Ok(..)`
  instead of `.ok()` + `if let Some(..)`.
- hypatia.rs / main.rs: accept `&Path` instead of `&PathBuf`.
- Cargo.toml (robot-repo-automaton + shared-context): drop the ignored
  `+spec-1.1.0` build metadata from the `toml` version requirement
  (resolution-neutral; silences the cargo warning).
- benches: import `std::hint::black_box` (criterion's re-export is deprecated).

All three crates are clippy `-D warnings` clean; 101 + 84 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RozeeLxpJsd3WWFngaZWz3
@hyperpolymath hyperpolymath marked this pull request as ready for review June 21, 2026 00:50
@hyperpolymath hyperpolymath merged commit 0f9cd87 into main Jun 21, 2026
9 checks passed
@hyperpolymath hyperpolymath deleted the claude/determined-cerf-s4zaob branch June 21, 2026 00:50
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