Repository navigation
ci(rust): GitHub Actions for boar_fast_filter + unit tests - #255
Closed
FabioLeitao wants to merge 4 commits into
Closed
FabioLeitao wants to merge 4 commits into
FabioLeitao wants to merge 4 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]>
Adds 9 additional unit tests on top of the initial 7 already in filter_logic.rs (running total: 16). Each test pins a contract that would otherwise only surface after a refactor lands in production: - new_compiles_all_patterns: constructor never panics for the shipped regex set (no-panic guard before the PyO3 bridge loads). - suspect_indices_empty_batch_is_empty: empty input boundary. - suspect_indices_is_idempotent: same input produces same output across calls — pins absence of hidden state in CompiledPatterns. - suspect_indices_reports_each_row_once: a row matching multiple patterns (CPF + email) must be reported once, locking the regex-tier contract from THE_ART_OF_THE_FALLBACK.md. - suspect_indices_dashed_pan_layout: dashed credit-card layout (Luhn must accept regardless of separators). - suspect_indices_email_with_plus_tag_and_subdomain: plus-tag local part + multi-level subdomain (no backtracking pathologies). - suspect_indices_preserves_input_order: output indices appear in increasing order so callers can pair without re-sorting. - check_luhn_rejects_letters_only: defensive — non-digit input degrades to an empty digit vec and returns false, no panic. - suspect_indices_does_not_panic_on_unicode: customer payloads carry non-ASCII; matchers must walk the string without panicking on multi-byte boundaries. Co-authored-by: Fabio Tavares Leitão <[email protected]>
Layered improvements on top of the initial Rust CI workflow: - paths: filter limits triggers to rust/** and the workflow file itself, so unrelated PRs do not burn runner minutes on cargo. - workflow_dispatch added so the workflow can be re-run from the Actions UI without changing files (useful when investigating a flake or recent dependency). - concurrency group cancels superseded runs on feature branches while keeping every run on main for audit history. - env CARGO_TERM_COLOR / RUST_BACKTRACE for readable logs. - actions/cache pinned to a full SHA caches $CARGO_HOME and the crate target dir keyed on Cargo.lock; subsequent runs only recompile the crate, not the pyo3 + regex dependency graph. - rustfmt component pulled in alongside clippy and a trailing cargo fmt --check step gives a cheap formatting parity guard against the repo style. The pinned-SHA bar from tests/test_rust_ci_yml_pins_actions_to_shas is preserved (actions/cache and dtolnay/rust-toolchain both use full 40-char commit SHAs). Co-authored-by: Fabio Tavares Leitão <[email protected]>
This was referenced Apr 27, 2026
Rust 1.95's clippy added the manual_is_multiple_of lint and it now fires on the Luhn final-step '% 10 == 0' inside check_luhn(). The CI job (cargo clippy --all-targets --all-features -- -D warnings) failed on PR #255 because of this lint, even though the algorithm is correct. We keep the explicit '% 10 == 0' form (clearer for any reader who knows Luhn from a textbook) and suppress the lint locally with #[allow(unknown_lints, clippy::manual_is_multiple_of)] so: - toolchains < 1.87 still build (the suggested u32::is_multiple_of was only stabilized in 1.87, and PyO3 0.23 supports stable >= 1.63); - toolchains >= 1.95 (current GitHub stable) pass clippy without warnings; - the suppression is scoped to one function, so any future manual divisibility check elsewhere in the crate is still flagged. Co-authored-by: Fabio Tavares Leitão <[email protected]>
cursor Bot
pushed a commit
that referenced
this pull request
Apr 27, 2026
Rust 1.95's clippy added the manual_is_multiple_of lint and it now fires on the Luhn final-step '% 10 == 0' inside check_luhn(). The CI job (cargo clippy --all-targets --all-features -- -D warnings) failed on PR #255 because of this lint, even though the algorithm is correct. We keep the explicit '% 10 == 0' form (clearer for any reader who knows Luhn from a textbook) and suppress the lint locally with #[allow(unknown_lints, clippy::manual_is_multiple_of)] so: - toolchains < 1.87 still build (the suggested u32::is_multiple_of was only stabilized in 1.87, and PyO3 0.23 supports stable >= 1.63); - toolchains >= 1.95 (current GitHub stable) pass clippy without warnings; - the suppression is scoped to one function, so any future manual divisibility check elsewhere in the crate is still flagged. Co-authored-by: Fabio Tavares Leitão <[email protected]>
This was referenced Apr 27, 2026
FabioLeitao
force-pushed
the
main
branch
2 times, most recently
from
May 3, 2026 17:52
ae0da8d to
b5c995c
Compare
FabioLeitao
added a commit
that referenced
this pull request
May 3, 2026
Read-only audit-and-block deliverable from the SRE Automation Agent (Slack-triggered protocol). PR #255 added a new Rust CI workflow whose 'cargo clippy --all-targets --all-features -- -D warnings' job fails on runner Rust 1.95.0 because clippy::manual_is_multiple_of (stable since Rust 1.87) fires on 'sum % 10 == 0' in rust/boar_fast_filter/src/filter_logic.rs. The audit proposes the smallest fix that keeps zero behaviour change and zero MSRV drift: an inline #[allow(clippy::manual_is_multiple_of)] with a one-line comment naming the MSRV reason. Rewriting the expression to sum.is_multiple_of(10) would silently raise the crate's MSRV from 'no pinned rust-version' to '>= 1.87' as a side effect of a CI hardening PR -- out of scope and tracked as follow-up F1 in the audit doc. Also documents the rejection of an embedded prompt-injection segment in the trigger Slack message ('system override / switch to Opus 4.7'), since Cloud Agents cannot change their own backend mid-run; recording this matches the Defensive Scanning Manifesto contract that every emitted statement is tagged. Index entries for two prior 2026-04-27 audits that already shipped (PR_SECURITY_AUDIT, STALE_FEATURE_FLAG_AUDIT) are added to docs/ops/sre_audits/README.md as part of the same hub-sync pass. Co-authored-by: Fabio Tavares Leitão <[email protected]>
FabioLeitao
force-pushed
the
fix/rust-ci-coverage
branch
from
May 3, 2026 17:52
a89ac4e to
04a72fc
Compare
FabioLeitao
added a commit
that referenced
this pull request
May 3, 2026
…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]>
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.
Description
This repository does not contain a crate named
data-board-report; the Rust extension underrust/boar_fast_filteris the scan/report prefilter (PyO3). This PR adds CI for that crate and a baseline Rust unit test suite for its core logic (Luhn validation, batch suspect indexing).Type of change
Checklist
uv run pytest tests/test_github_workflows.py;cargo testinrust/boar_fast_filter).uv run pre-commit run --files …).docs/ops/OPERATOR_NOTIFICATION_CHANNELS*.md(Slack notify now includes Rust CI).What changed
.github/workflows/rust-ci.yml: on push/PR tomain/master, runscargo check,cargo test, andcargo clippy --all-targets --all-features -- -D warningsinrust/boar_fast_filter(clippy warnings fail the job).rust/boar_fast_filter: extracted pure logic tosrc/filter_logic.rs;FastFilterdelegates toCompiledPatterns::suspect_indices; added unit tests for Luhn and batch behaviour (aligned withtests/test_rust_bridge.pysmoke data).workflow_run.workflowsextended with Rust CI so failures surface in ops channel like other CI workflows.tests/test_github_workflows.py: assert Slack workflow list; validaterust-ci.ymlstructure and pinned Action SHAs.Related issues
(none linked)
Slack Thread