Repository navigation
fix(rust-ci): clippy 1.95 manual_is_multiple_of blocks PR #255 — keep classic Luhn % 10 - #258
Closed
cursor[bot] wants to merge 2 commits into
Closed
cursor[bot] wants to merge 2 commits into
cursor[bot] wants to merge 2 commits into
Conversation
- Add GitHub Actions rust-ci.yml: cargo check, test, clippy (-D warnings) on main/master - Extract prefilter logic to filter_logic.rs with Luhn + batch suspect tests - Include Rust CI in Slack workflow_run notify list; sync ops docs and workflow guards Co-authored-by: Fabio Tavares Leitão <[email protected]>
…ability The Rust CI job introduced in #255 fails on the GitHub Actions `stable` toolchain (clippy 1.95) with `manual_is_multiple_of`: error: manual implementation of `.is_multiple_of()` --> src/filter_logic.rs:74:5 | 74 | sum % 10 == 0 | ^^^^^^^^^^^^^ help: replace with: `sum.is_multiple_of(10)` `u32::is_multiple_of` only stabilized in Rust 1.87. Rewriting the function to use it would silently break older toolchains used by contributors and the homelab. The classic Luhn modulo arithmetic is also the canonical form every reviewer recognizes, so flipping it for a brand-new lint trades clarity for churn. Fix: keep `% 2` / `% 10` and silence the lint locally with a documented `#[allow]`. `unknown_lints` is included so older clippys (which do not know this lint name yet) do not error on the attribute either. No behavior change: the 7 existing unit tests in `filter_logic` (Luhn valid / invalid, length bounds, CPF/email/card batch suspects) pass on local clippy 1.83 and should pass on CI 1.95. Refs: PR #255 Rust CI failure. Co-authored-by: Fabio Tavares Leitão <[email protected]>
1 of 3 tasks
FabioLeitao
force-pushed
the
cursor/sre-automation-agent-protocol-27ea
branch
from
May 3, 2026 17:52
8601d71 to
78cf8c7
Compare
FabioLeitao
added a commit
that referenced
this pull request
May 3, 2026
… merges Maintainer Slack message in thread 1777319823.055829 (channel C0AN7HY3NP9) asks to halt new Rust PRs based on origin/main and rebase/wait for the auditoria-ia branch (claimed 27 commits ahead; origin currently shows 2, implying ~25 unpushed local commits). This commit is doc-only, additive, zero blast radius: - New file docs/ops/sre_audits/STOP_DIRECTIVE_AUDITORIA_IA_REBASE_2026-04-27.md records the directive verbatim, the reproducible gh/git trace that established ground truth, the open-PR surface this STOP applies to (#255, #256, #258, #260, #263), and the maintainer-side resolution recommendation. Pattern matches neighbouring dated SRE audit ledgers. - Index docs/ops/sre_audits/README.md gets one new row pointing at the STOP ledger so the next Slack-triggered SRE agent reads it before trying to base another Rust PR on the old main. No Rust crate, workflow, connector, DB, or customer payload was touched. Defensive Scanning Manifesto and The Art of the Fallback respected: audit-only, diagnostic-on-fall, paper trail before silence. Co-authored-by: Fabio Tavares Leitão <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Companion fix to #255 (
fix/rust-ci-coverage) — the newRust CIjob introduced there fails on GitHub Actions because clippy 1.95 added themanual_is_multiple_oflint, and-D warningsturns it into a hard error. This PR carries the same Rust CI scaffolding plus the one-line#[allow]needed to make the gate green without sacrificing toolchain portability or readability.This is opened as a separate PR (per the SRE protocol: never commit directly, always open a PR) so the operator can pick whichever route — merge here, or cherry-pick the fix commit
8601d71ontofix/rust-ci-coverageand close this one as superseded.Steps to reproduce
fix/rust-ci-coverage(PR ci(rust): GitHub Actions for boar_fast_filter + unit tests #255).rust/boar_fast_filter/, runcargo clippy --all-targets --all-features -- -D warningson stable Rust 1.95 (whatdtolnay/rust-toolchain@stableresolves to today on GitHub Actions).Observed behaviour (CI run 25015144504, job cargo (check, test, clippy))
The Rust CI status check for #255 is therefore failure — Semgrep / CodeQL pass, but the Rust gate that the PR itself adds blocks itself.
Expected behaviour
Rust CIpasses on the same commit that introduces it, so the gate can be enabled onmaingoing forward without a self-inflicted red baseline.Root cause analysis (Julia Evans style — what's really going on)
There are two facts colliding here:
manual_is_multiple_of. The lint suggests rewritingx % n == 0asx.is_multiple_of(n). The PR's Luhn implementation has two textbook examples of that pattern (i % 2 == 1andsum % 10 == 0), so the lint fires.u32::is_multiple_ofonly stabilized in Rust 1.87. Older stable toolchains (and our local lab pin at 1.83) do not have it; if we follow clippy's auto-suggestion the code stops compiling on those toolchains witherror[E0658]: use of unstable library feature 'unsigned_is_multiple_of'.So the choices are:
if-elsechained oni % 2 == 0— works, but obscures the canonical Luhn shape every reviewer recognizes.% 2/% 10arithmetic and tell clippy this is intentional. This is what production-quality codebases do for style lints with portability cost.We pick (c), with a comment explaining why (so the next reviewer doesn't try to "clean it up" again).
unknown_lintsis paired with the lint name so older clippys (which haven't seenmanual_is_multiple_ofyet) don't bail out on the attribute itself.Defensive architecture review (per
DEFENSIVE_SCANNING_MANIFESTO.mdandTHE_ART_OF_THE_FALLBACK.md)rust/boar_fast_filter/src/filter_logic.rs, a pure-CPU regex+Luhn prefilter. It does not open connections, hold locks, or change any DB-bound code path.% 2/% 10produce identical bits to the lint's suggestedis_multiple_of. The 7 existing unit tests (luhn_valid_visa_test_pattern,luhn_invalid_single_digit_flip,luhn_rejects_too_short,luhn_rejects_too_long,suspect_indices_*) cover the exact code path; all pass locally on clippy 1.83, and the lint allow makes them pass on 1.95+.#[allow(unknown_lints, ...)]is itself a fallback — older clippys that don't know the new lint name still accept the attribute and keep compiling. This is the same belt-and-suspenders posture The Art of the Fallback recommends for forward-compat shims.The fix
Plus the full Rust CI scaffolding from #255 (workflow file, extracted
filter_logic.rs, slack notify wiring, workflow guard tests) — this branch carries both commits so it can stand alone if the operator prefers to merge this one and close #255.Local verification
From
rust/boar_fast_filter/:Repo pre-commit hooks (
ruff,plans-stats,markdown,pt-BR locale,commercial guard,pii history guard, …) all passed on the commit.Commits
aea3cf4—ci(rust): add Rust CI workflow and boar_fast_filter unit tests(cherry-picked from ci(rust): GitHub Actions for boar_fast_filter + unit tests #255 /fe3a0a1)8601d71—fix(rust): unblock clippy 1.95 on Luhn arithmetic without losing portabilityRisk / rollback
#[allow]and adoptis_multiple_of. That's a one-liner once the toolchain decision is made.git revert 8601d71restores the pre-fix state of ci(rust): GitHub Actions for boar_fast_filter + unit tests #255 (red CI). Revertingaea3cf4removes the Rust CI gate entirely.Refs: #255, CI run 25015144504.