Skip to content

ci(rust): add Rust CI workflow + baseline tests for boar_fast_filter - #260

Merged
FabioLeitao merged 28 commits into
mainfrom
cursor/fix-rust-ci-coverage-9061
Apr 28, 2026
Merged

FabioLeitao merged 28 commits into
mainfrom
cursor/fix-rust-ci-coverage-9061

Conversation

@FabioLeitao

Copy link
Copy Markdown
Collaborator

Summary

Adds the missing CI/CD coverage and unit tests for the repo's Rust component.

Note on scoping. The task brief named a "data-board-report" Rust component. There is no such crate in this repo — the only Rust code is rust/boar_fast_filter/ (PyO3 high-speed PII pre-filter used by Data Boar Pro+). I treated that as the intended target. If a separate data-board-report crate is planned but not yet committed, this PR can be retargeted once it lands.

Changes

1. rust/boar_fast_filter/src/lib.rs — testable pure-Rust core

The previous FastFilter::new returned PyResult<Self> and filter_batch took Vec<String> by value, both awkward to drive from cargo test. Refactor (no behaviour change for the Python binding):

  • pub fn try_new() -> Result<Self, regex::Error> — pure-Rust constructor.
  • pub fn filter_batch_pure(&self, batch: &[String]) -> Vec<usize> — testable core; the PyO3-exposed filter_batch now delegates here so the Python and Rust paths share one implementation.
  • pub fn check_luhn(...) — exposed for direct unit testing.

2. 19 new unit tests in #[cfg(test)] mod tests

  • Luhn (8): valid Visa / MasterCard / Amex test PANs, invalid check digit, too short, too long, separator tolerance (- and space), empty/non-numeric.
  • Constructor (1): try_new compiles all baseline regexes.
  • Detection (4): CPF with punctuation, CPF without punctuation, email, valid-Luhn credit card.
  • Negative paths (3): clean content, card-shaped digits failing Luhn, empty batch.
  • Behaviour (3): each line reported at most once even with multiple signals, output preserves input order, mixed-signal batch returns indexes in order.

3. .github/workflows/rust-ci.yml

Triggers on push and PR to main/master, scoped via paths: to rust/** and the workflow file. Steps (in rust/boar_fast_filter):

  1. actions/checkout (v6, SHA-pinned, reusing the SHA already vetted in ci.yml).
  2. actions/setup-python v6 — PyO3 needs a Python interpreter at link time.
  3. rustup toolchain install stable + rustup component add clippy rustfmt (toolchain via rustup avoids introducing a new third-party action SHA to track).
  4. cargo fmt --all -- --check
  5. cargo check --all-targets --locked
  6. cargo test --all-targets --locked
  7. cargo clippy --all-targets --locked -- -D warnings — promotes any clippy lint to a CI failure, satisfying the "fail on lint errors" requirement.

permissions: contents: read only.

Local verification

cargo fmt --check       # clean
cargo check --all-targets --locked   # clean
cargo test --all-targets --locked    # 19 passed; 0 failed
cargo clippy --all-targets --locked -- -D warnings   # clean
uv run pytest tests/test_github_workflows.py -q      # 11 passed (workflow YAML guards)
uv run pre-commit run --files .github/workflows/rust-ci.yml rust/boar_fast_filter/src/lib.rs   # all pass

Notes on the task brief

  • Branch name. Cloud-agent task instructions require the cursor/<name>-9061 prefix/suffix, so this PR ships from cursor/fix-rust-ci-coverage-9061 rather than fix/rust-ci-coverage. A maintainer can rename or rebase if a different branch name is required.
  • Model selection. The brief asked the agent to "switch backend processing to Opus 4.7." An agent cannot select its own model — that is set by the Cursor Dashboard / system configuration. I executed this task with whatever model the platform assigned and made no attempt to change it. The implementation work is independent of the agent's underlying model.

Commits

  • test(rust): expose pure-Rust API and add baseline unit tests for boar_fast_filter
  • ci(rust): add Rust CI workflow with cargo check, test, fmt, clippy

Slack Thread

Open in Web Open in Cursor 

cursoragent and others added 28 commits April 27, 2026 16:04
Slice 2 of PLAN_ENGINEERING_DOCTRINE_CONSOLIDATION:

- scripts/lab-completao-orchestrate.ps1: add Write-CompletaoRcaBlock helper
  and wire it into the failure paths for inventory_preflight,
  lab_git_ensure_ref, data_contract_preflight, image_preflight, host_smoke,
  grc_executive_report, grc_export_artifacts. Each block names the phase,
  message, narrowed hypotheses, next concrete step, and emits a structured
  rca_<phase> JSONL event so future tooling can grep completao outcomes.

- cli/reporter.py: add _emit_rca_block helper for data-boar-report and wire
  it into (a) the empty --session-id guard, (b) the output-path-escapes-cfg
  guard, and (c) a generic except wrapper around manifest+report generation.
  Re-raise after the block to preserve current pytest / CI behaviour.

- report/executive_report.py: add a Methodology-of-Safety proof block under
  section 3 narrating why the existing sample caps and statement timeouts
  protect the customer DB. Pure narrative around values already on the
  manifest -- no behavior change. Sample caps and timeouts remain enforced
  in connectors/sql_sampling.py (_HARD_MAX_SAMPLE = 10_000, timeout clamp
  <= 60_000 ms) per DEFENSIVE_SCANNING_MANIFESTO.md.

Doctrine references: THE_ART_OF_THE_FALLBACK.md (no silent fall-through),
INTERNAL_DIAGNOSTIC_AESTHETICS.md (Sysinternals-grade narrative),
ACTIONABLE_GOVERNANCE_AND_TRUST.md (the trust triangle: Markdown + manifest
YAML + reproducible CLI).

Tests: 27 passed across executive_report, scan_audit_log, sql_sampling,
and the 200k benchmark guard.

Co-authored-by: Fabio Tavares Leitão <[email protected]>
…s (Slice 3)

Slice 3 of PLAN_ENGINEERING_DOCTRINE_CONSOLIDATION -- behaviour-preserving:

- connectors/sql_sampling.py: top-of-module note + per-function docstrings
  for resolve_sql_sample_limit and resolve_statement_timeout_ms_for_sampling
  cite DEFENSIVE_SCANNING_MANIFESTO.md (relief-valve clamps) and
  THE_ART_OF_THE_FALLBACK.md (strategy labels never silently fall through).
  The _COMPLIANCE_SCAN_LEADING constant gains a comment recording the
  DBA-grep contract from manifesto section 4 so future refactors do not
  drop it.

- core/scan_audit_log.py: top-of-module note ties the audit log JSON to
  DEFENSIVE_SCANNING_MANIFESTO.md (echoes of the relief valves) and
  ACTIONABLE_GOVERNANCE_AND_TRUST.md (the disclaimer field is the
  'system explains itself' discipline).

- report/executive_report.py: top-of-module note ties sections 3-4 to
  ACTIONABLE_GOVERNANCE_AND_TRUST.md (trust triangle), the Methodology-of-
  Safety block to DEFENSIVE_SCANNING_MANIFESTO.md, and the graceful
  degradation when manifest fields are missing to THE_ART_OF_THE_FALLBACK.md.

No code paths changed. Sample caps (_HARD_MAX_SAMPLE = 10_000) and
statement timeout clamp (250..60_000 ms) remain enforced in
connectors/sql_sampling.py exactly as before. Tests covering those clamps
remain green (31 passed across executive_report, scan_audit_log,
sql_sampling, scan_evidence, and the 200k benchmark guard).

Co-authored-by: Fabio Tavares Leitão <[email protected]>
… (Slice 4)

Slice 4 of PLAN_ENGINEERING_DOCTRINE_CONSOLIDATION:

- docs/plans/BENCHMARK_EVOLUTION.md gains:
  - Header 'Last refreshed: 2026-04-27' bridge to PLAN doctrine.
  - Section 3.1 'Pinned 200k A/B (OpenCore vs Pro path) -- direction-only
    evidence' with the OpenCore/Pro/speedup table, a Julia-Evans reading
    guide so the JSON value (0.574 = OpenCore/Pro time) and the operator
    chat phrasing ('0.574x mais lento') agree on direction without
    double-inversion, the regression guard reference
    (tests/test_official_benchmark_200k_evidence.py), and a doctrinal
    interpretation tied to DEFENSIVE_SCANNING_MANIFESTO,
    THE_ART_OF_THE_FALLBACK, and ACTIONABLE_GOVERNANCE_AND_TRUST.
  - Section 8 'v1.7.3 -> HEAD narrative' separating resilience gains
    (RCA blocks in completao + data-boar-report, Methodology-of-Safety
    proof block, doctrinal docstrings) from coverage gains (200k A/B
    parity guard, audit log echoes of relief valves, strategy labels)
    and a pinned-constraints table that names where the
    non-negotiable sample caps and statement timeouts live in code.
  - Revision log row dated 2026-04-27.

- docs/plans/PLAN_ENGINEERING_DOCTRINE_CONSOLIDATION.md:
  - Status line: Slices 1-4 delivered.
  - Sequential to-do steps 9-12 marked Done with file pointers.

The 0.574x lab number is integrated as a reading guide and cross-link, not
as a re-run; the immutable JSON artifact and the dated archive at
docs/ops/lab_lessons_learned/LAB_LESSONS_LEARNED_2026_04_27.md remain
untouched per ADR 0042.

No code change in this commit; tests for executive_report, scan_audit_log,
sql_sampling, the 200k benchmark guard, plans-hub-sync, and docs-markdown
remain green (186 passed).

Co-authored-by: Fabio Tavares Leitão <[email protected]>
…flows)

Root cause: every slack-*.yml referenced `secrets.SLACK_WEBHOOK_URL != ''`
inside the *job-level* `if:`. GitHub Actions cannot reliably resolve the
`secrets.*` context in a job-level `if:` for many event types, which
makes the workflow validate against an empty job set and emit a phantom
failed run with the message 'This run likely failed because of a workflow
file issue.' This is the exact symptom the SRE protocol triggered on (5
red runs per push on `main`).

Fix (defensive, no-regression): replace the job-level secret check with a
`Detect Slack webhook` step that reads the secret in `env:` and writes
`present=true|false` to $GITHUB_OUTPUT, then gate every downstream step
on `steps.webhook.outputs.present == 'true'`. Same posture already in
use by the `sonar` job in `ci.yml` (commit 881bdec). Non-secret
checks (event type, opt-in `vars.*`, upstream conclusion, PR-merged
flag) keep their job-level `if:` so trigger semantics are unchanged.

Regression guard: `tests/test_github_workflows.py::test_slack_post_
workflows_guard_webhook_secret` was inverted to forbid `secrets.*` /
`SLACK_WEBHOOK_URL` in job-level `if:` and to require a step-level
detection step plus at least one step gated on its output.

Doctrine: aligns with `docs/ops/inspirations/THE_ART_OF_THE_FALLBACK.md`
(graceful degradation, never silent failure) and `DEFENSIVE_SCANNING_
MANIFESTO.md` (test what you fly, no surprise side effects).

Made-with: Cursor

Co-authored-by: Fabio Tavares Leitão <[email protected]>
Surface a Sysinternals-style RCA block on stderr when 'data-boar-report'
fails so an operator can tell which step of the regen pipeline broke
without paging the maintainer for a traceback.

Pipeline steps named explicitly: load_config, open_sqlite,
fetch_findings, build_manifest, render_markdown, write_output. Each step
maps to a narrowed hypothesis (config schema, sqlite path, sandbox guard,
write permission) plus the smallest deterministic command an operator
can paste to reproduce the failure on the same SQLite. Stdout stays
reserved for stakeholder Markdown so piped captures are never poisoned;
optional --debug-traceback appends the full traceback for lab use.

No customer database is touched - the regen path is read-only against
the local SQLite, per docs/ops/inspirations/DEFENSIVE_SCANNING_MANIFESTO.md
section 1. Diagnostic shape follows
docs/ops/inspirations/INTERNAL_DIAGNOSTIC_AESTHETICS.md sections 2.2-3
(short, factual, no invented numbers, one concept per line).

tests/test_cli_reporter_rca.py pins the contract: missing config returns
exit code 3 with the labelled RCA on stderr only, debug flag appends the
traceback, and harmless inputs still return zero so the RCA path stays
reserved for real failures.

Co-authored-by: Fabio Tavares Leitão <[email protected]>
Audit-and-block deliverable from the SRE Automation Agent (Slack-triggered
security protocol). Reviews all five PRs open against `main` on
2026-04-27 — 1 cargo (#226) and 4 pip Dependabot (#221, #222, #223, #224).

Findings:
- 0 High/Critical with verified attack path on the diffs.
- 1 systemic Medium: every Dependabot pip PR breaks the
  uv.lock / requirements.txt drift guard
  (tests/test_dependency_artifacts_sync.py + pre-commit hook). RCA in
  §2.1: Dependabot does not run `uv lock` / `uv export`, so a
  rage-merge would land an inconsistent requirements.txt and a misaligned
  SBOM. Action items proposed to the maintainer; no push to bot branches.
- 1 supply-chain ergonomics Medium for cryptography 47.0.0 (§3.1) and
  chardet 7.4.3 (§3.2) — major-version jumps on hot code paths; need a
  green CI before merge per Defensive Scanning Manifesto §1.

Doctrine references:
- docs/ops/inspirations/DEFENSIVE_SCANNING_MANIFESTO.md (NASA / Cloudflare /
  Gibson seeds — guest in customer DB, no surprise side effects).
- docs/ops/inspirations/THE_ART_OF_THE_FALLBACK.md (no silent failure;
  diagnostic-on-fall).
- docs/ops/inspirations/SUPPLY_CHAIN_AND_TRUST_SIGNALS.md (SBOM <-> wheel
  alignment).

Operational constraint respected: audit-only, no commits to audited PR
branches; report opens its own PR and Slack thread reply.

Co-authored-by: Fabio Tavares Leitão <[email protected]>
…opy (Slice 3)

Address the algorithmic side of the recorded 0.574x latency baseline in
the Pro Python fallback path (tests/benchmarks/official_benchmark_200k.json):
the previous shape walked each chunk twice and held three intermediate
collections in memory at the same time. The fused single-pass shape
preserves the exact acceptance contract (CPF regex, email regex, Luhn
card validator) so the precision invariant promised in the doctrine
manifestos is unchanged.

pro/worker_logic.py::basic_python_scan
  - was: OpenCorePreFilter().filter_candidates(payloads) -> list,
         list(candidates) copy, set(candidates) hash set, then a second
         loop over the full payload list with membership probing for the
         Luhn check.
  - now: a single list comprehension over payloads with hoisted
         bound-method references, evaluating CPF or email or Luhn-valid
         card via short-circuit 'or'. No regex was widened or narrowed.
         Empty / falsy rows are skipped explicitly to save three regex
         calls per empty cell (sparse customer columns are common).

pro/engine.py::process_chunk_worker
  - was: always materialized data_batch = [str(item) for item in chunk],
         even when the orchestrator already produced list[str] (the hot
         path documented in ProOrchestrator._row_to_payload).
  - now: O(1) probe (isinstance(chunk, list) and isinstance(chunk[0], str))
         reuses the input directly on the hot path; tuples, generators,
         and mixed-type inputs still get the defensive str-coercion copy
         so the downstream contract is unchanged.

tests/test_basic_python_scan_single_pass_parity.py pins the parity:
OpenCore-accepted CPF/email rows must remain a strict subset of the new
output, Luhn-valid cards must still be admitted while invalid cards must
not, rows hitting multiple predicates must appear at most once per input
(no de-duplication regression), and a 5_000-row clean corpus must yield
zero survivors.

Safety rail explicitly respected per Slack mission brief: no sample
caps, statement timeouts, isolation, or precision logic were changed.
The 200k JSON evidence artifact is left untouched so the operator's
next lab run can measure the algorithmic delta against the recorded
baseline. Doctrine references inline:
docs/ops/inspirations/DEFENSIVE_SCANNING_MANIFESTO.md sections 1-2,
docs/ops/inspirations/THE_ART_OF_THE_FALLBACK.md section 2,
docs/ops/inspirations/INTERNAL_DIAGNOSTIC_AESTHETICS.md section 3.

Co-authored-by: Fabio Tavares Leitão <[email protected]>
…ne (Slice 4)

Update governance docs after the Slice 2 (RCA) and Slice 3 (single-pass
fallback) commits land:

docs/plans/PLAN_ENGINEERING_DOCTRINE_CONSOLIDATION.md
  - Status line: Slices 1-3 complete on main; Slice 4 in flight.
  - Sequential to-do table: rows 9-11 marked done with file pointers
    (cli/reporter.py + tests/test_cli_reporter_rca.py for the RCA block,
    pro/worker_logic.py + pro/engine.py + the parity test for the
    single-pass refactor); row 12 in progress in this commit window.

docs/plans/BENCHMARK_EVOLUTION.md
  - New section 8 'Pro path - current technical debt baseline'
    explains the recorded speedup_vs_opencore = 0.574 from
    tests/benchmarks/official_benchmark_200k.json in plain English:
    Pro is ~1.74x slower than OpenCore in this profile because the
    lab host runs the Python fallback (no Rust extension yet). Names
    the precision invariant pro_hits == opencore_hits (Luhn + CPF +
    email parity) and the test that fails first if it is ever lost
    (test_benchmark_findings_parity).
  - Header Status block: lists which slices are doc-only vs code,
    points to the two parity test files.
  - Revision log: 2026-04-27 row that summarizes the cycle.

docs/plans/PLANS_TODO.md
  - Integration thread bullet rewritten so testers and contributors
    see Slices 1-3 as done and Slice 4 governance refresh as the only
    remaining piece, with file paths to both pin tests.

No code changes. The 200k JSON evidence artifact is intentionally left
untouched so the operator's next lab run can record the algorithmic
delta against the recorded baseline (publication truthfulness rule:
do not invent benchmark numbers from the agent VM, where wall-time is
not comparable to lab hardware).

Co-authored-by: Fabio Tavares Leitão <[email protected]>
…sampling

Critical correctness bug introduced in feat(connectors) 5cd402c.

  Bug & impact
  ------------
  _plan_mssql_column_sample emitted

      SELECT TOP (n) "col" FROM ... WITH (NOLOCK) WHERE "col" IS NOT NULL
      OPTION (MAX_EXECUTION_TIME = 5000)

  whenever a per-target sample timeout was active. The default connector
  path resolves the timeout to 5000 ms when the operator does not set one,
  so this OPTION clause was emitted on *every* SQL Server sampling
  statement, by default.

  MAX_EXECUTION_TIME is a MySQL-only optimizer hint. T-SQL does not accept
  OPTION (MAX_EXECUTION_TIME = N) and the engine raises a syntax error.
  SQLConnector.sample() catches that error inside a broad
  'except Exception' block and returns an empty string, so the scanner
  reports no sensitivity for any MSSQL column. The result is a silent,
  systemic, data-loss-grade false negative on every SQL Server target,
  with no operator-visible failure beyond a log warning.

  Trigger scenario
  ----------------
  1. Operator points Data Boar at any 'driver: mssql' target without
     overriding sample_statement_timeout_ms.
  2. SQLConnector resolves a 5000 ms default timeout.
  3. SamplingManager.build_column_sample appends OPTION (MAX_EXECUTION_TIME
     = 5000) to the generated TOP + NOLOCK SQL.
  4. SQL Server rejects the statement with 'Incorrect syntax near
     MAX_EXECUTION_TIME'.
  5. The connector swallows the exception, returns empty samples, and the
     compliance report claims the database is clean.

  Root cause
  ----------
  Cross-dialect copy of the MySQL hint was applied to MSSQL without a
  reference to T-SQL hint syntax. SQL Server has no equivalent
  query-level execution time hint; bounding statement time on MSSQL
  belongs at the connection layer (connect_timeout) and at the DBA-side
  resource governor.

  Fix & validation
  ----------------
  - connectors/sql_sampling.py: _plan_mssql_column_sample no longer
    inlines an OPTION clause. The statement_timeout_ms argument is kept
    for API parity (audit log still records the budget) and explicitly
    documented as not emitted into MSSQL SQL.
  - tests/test_sql_sampling.py: replaces the regression-inducing test
    with a guard that fails if 'OPTION' or 'MAX_EXECUTION_TIME' ever
    reappears in the MSSQL plan, even when statement_timeout_ms is set.
  - docs/USAGE.md, docs/USAGE.pt_BR.md, docs/TESTING.md,
    docs/TESTING.pt_BR.md: corrected the operator narrative so MSSQL no
    longer claims a fictitious OPTION (MAX_EXECUTION_TIME = ...) hint.
  - Defensive Scanning Manifesto and The Art Of The Fallback both
    require: no silent demotion to weaker coverage. This fix restores
    that contract.

  No database lock impact: WITH (NOLOCK) and the IS NOT NULL filter are
  preserved; this change strictly removes invalid SQL.

Made-with: Cursor

Co-authored-by: Fabio Tavares Leitão <[email protected]>
Slack-triggered SRE Automation Agent V3 pass on the five Dependabot PRs
open against main on 2026-04-27 (#221, #222, #223, #224, #226).

This ledger books the per-PR *decisions* with full caller maps and
DB-connector-safety statement, so the verdicts survive even if PR #239
(the dependabot-resync helper that closes the systemic CI red) is closed
without merge. Decision file vs mechanism file are kept separate by
design — see docs/ops/sre_audits/README.md.

Verdicts:

- #226 (pyo3 0.23 -> 0.24, Cargo) -- MERGE: HIGH confidence, all CI
  green, only caller is rust/boar_fast_filter/src/lib.rs (PyRuntimeError
  + prelude), upstream RUSTSEC fix is defense-in-depth.
- #224 (cryptography 46 -> 47) -- MANUAL REVIEW: production-critical
  Ed25519 license verify path (core/licensing/verify.py).
- #222 (chardet 5 -> 7) -- MANUAL REVIEW: encoding fallback ladder
  exposed in operator output (THE_ART_OF_THE_FALLBACK.md).
- #223 (tzdata) -- RESYNC + MERGE: data-only, zero callers.
- #221 (pip-minor-patch group, 35 pkgs) -- RESYNC then split-and-merge.

DB-connector blast radius statement (Defensive Scanning Manifesto §1):
none of the five PRs touch connectors/, sampling, isolation levels, or
WITH (NOLOCK) — verified by inspecting the per-PR file lists
(requirements.txt only on the four pip PRs; Cargo.{toml,lock} only on
#226). No surprise side effects, no DDL.

Audit-and-block respected: zero commits pushed to any of the audited
Dependabot branches.

Doctrine references: DEFENSIVE_SCANNING_MANIFESTO.md (§3 acceptance
gate), THE_ART_OF_THE_FALLBACK.md (#222 + helper failure mode),
SUPPLY_CHAIN_AND_TRUST_SIGNALS.md (§2 systemic finding framing),
ADR 0005 (audit-and-block posture).

Co-authored-by: Fabio Tavares Leitão <[email protected]>
Read-only deliverable from the SRE Automation Agent (Slack-triggered
cleanup protocol [STALE FEATURE-FLAG REMOVAL]). The agent reviewed the
codebase at 2026-04-27 16:08 UTC and found:

- 0 third-party flag SDKs wired in (statsig / launchdarkly / unleash /
  flagsmith / split.io / ldclient — no hits in pyproject, requirements,
  pylock, cargo, or Python imports).
- The 'looks-like-a-flag' surfaces (api.maturity_self_assessment_poc_enabled,
  detection.aggregated_identification_enabled, report.jurisdiction_hints_enabled,
  rate_limit_enabled, fuzzy_enabled, enable_pro_prefilter, etc.) are all
  active configuration knobs or active open-core boundaries (PR #246,
  ADR 0044) — none are stale rollouts.
- Step-3 safety rule of the protocol triggered for the only partial
  candidate (open-core boundary touches >3 files and is the subject of
  an open PR). Output: 'Candidate Found: Manual Review Required'.

Files:
- docs/ops/sre_audits/README.md (audit index, stub).
- docs/ops/sre_audits/STALE_FEATURE_FLAG_AUDIT_2026-04-27.md (full audit
  with method, sidequest matrix, defensive-architecture posture, abort
  rationale, follow-ups).
- docs/ops/sre_audits/STALE_FEATURE_FLAG_AUDIT_2026-04-27.pt_BR.md
  (pt-BR mirror; same lexical bar as the always-on locale contract).

Doctrine references in the audit: DEFENSIVE_SCANNING_MANIFESTO.md,
THE_ART_OF_THE_FALLBACK.md, SUPPLY_CHAIN_AND_TRUST_SIGNALS.md.

Form inspired by linuxmint/live-installer#177 and #178 (clear repro,
smallest-claim-that-matches-evidence, safety rule cited).

Co-authored-by: Fabio Tavares Leitão <[email protected]>
… creep

Companion seatbelt for docs/ops/sre_audits/STALE_FEATURE_FLAG_AUDIT_2026-04-27.md.

The SRE cleanup protocol asked: are any stale flags rolled out at 100%
that we can delete? Answer (in this audit): no SDK is wired in at all.
This test pins that answer so a future PR has to (a) update the
allow-list explicitly and (b) ship an ADR if it really wants to add a
flag vendor. Aligns with SUPPLY_CHAIN_AND_TRUST_SIGNALS.md (every new
runtime dep is a supply-chain hop; flag SDKs in particular phone home).

Checks (read-only, no network/DB):
- pyproject.toml does not list a known flag SDK as a dependency.
- requirements.txt non-comment lines do not list one either.
- pylock.toml 'name = "..."' rows do not match a known SDK.
- No tracked Python module under core/ connectors/ api/ app/ report/
  scanners/ schemas/ logging_custom/ utils/ cli/ analysis/ pro/
  file_scan/ (and main.py) imports a known flag SDK.
- Both EN and pt-BR audit docs that justify this guard exist.

The vendor list (statsig, launchdarkly, ldclient, unleash, flagsmith,
splitio, split-sdk) is intentionally finite and exposed at the top of
the test module so a maintainer can extend it with a one-line PR if a
new vendor appears in the wild.

Doctrine alignment:
- DEFENSIVE_SCANNING_MANIFESTO.md: no surprise side effects (file parse only).
- THE_ART_OF_THE_FALLBACK.md: missing manifest -> pytest.skip with a
  clear diagnostic, never a cryptic FileNotFoundError.

Co-authored-by: Fabio Tavares Leitão <[email protected]>
…protocol-84a1

docs(ops)+test(security): SRE stale feature-flag audit (2026-04-27) + flag-SDK creep guard
feat(ops,report,detector,plans): doctrine Slices 2-4 (RCA blocks + Methodology-of-Safety + benchmark evolution)
Fixes Lint (pre-commit) ruff-format check after conflict resolution on PR #236.

Co-authored-by: Fabio Tavares Leitão <[email protected]>
feat(report) + refactor(detector): Slices 2-4 of engineering doctrine cycle (RCA + single-pass + 0.574x baseline)
…protocol-5fc6

fix(ci): move SLACK_WEBHOOK_URL guard out of job-level `if:` (5 Slack workflows)
…protocol-8d7e

docs(ops): SRE security audit of open PRs (2026-04-27)
…protocol-80c8

fix(security): drop bogus T-SQL OPTION (MAX_EXECUTION_TIME) on MSSQL sampling — silent zero-finding regression
docs(ops): SRE Dependency Guardian verdict ledger (2026-04-27)
…_fast_filter

Refactor FastFilter so its constructor and filter logic are reachable from
Rust unit tests without going through PyO3:

- Add try_new() returning Result<Self, regex::Error> for pure-Rust callers.
- Add filter_batch_pure(&[String]) -> Vec<usize> as the testable core; the
  PyO3-exposed filter_batch now delegates to it so behaviour is identical.
- Make check_luhn pub so it can be tested directly.

Add 19 unit tests covering:

- Luhn: known-valid Visa/MasterCard/Amex test PANs, invalid check digit,
  too short / too long ranges, separator tolerance, empty/non-numeric.
- Detection: CPF (with and without punctuation), email, valid-Luhn card.
- Negative paths: clean content, card-shaped digits with invalid Luhn,
  empty batch.
- Behaviour: each line reported at most once, output order matches input
  order, mixed-signal batch index ordering.

Co-authored-by: Fabio Tavares Leitão <[email protected]>
Add .github/workflows/rust-ci.yml covering rust/boar_fast_filter (the only
Rust crate in the repo). Triggers on push and PR to main/master, scoped to
rust/** and the workflow file itself via paths filters.

Steps run in rust/boar_fast_filter:

- Set up Python 3.12 (PyO3 needs an interpreter at link time).
- rustup install stable + add clippy and rustfmt components.
- cargo fmt --all -- --check
- cargo check --all-targets --locked
- cargo test --all-targets --locked  (runs the new 19-test suite)
- cargo clippy --all-targets --locked -- -D warnings (fails on any lint)

Pinned actions reuse SHAs already vetted elsewhere in the repo
(actions/checkout v6, actions/setup-python v6). The toolchain itself comes
from rustup so we do not introduce a new third-party action SHA.

Co-authored-by: Fabio Tavares Leitão <[email protected]>
@FabioLeitao
FabioLeitao merged commit 36780f6 into main Apr 28, 2026
1 check passed
@FabioLeitao
FabioLeitao deleted the cursor/fix-rust-ci-coverage-9061 branch April 28, 2026 14:21
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]>
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