Skip to content

refactor(dlp): split pii.rs into cards/iban/bic (T-SP-4 #10)#243

Merged
Destynova2 merged 3 commits intomainfrom
refactor/dlp-pii-split
Apr 21, 2026
Merged

refactor(dlp): split pii.rs into cards/iban/bic (T-SP-4 #10)#243
Destynova2 merged 3 commits intomainfrom
refactor/dlp-pii-split

Conversation

@Destynova2
Copy link
Copy Markdown
Contributor

Summary

Split monolithic src/features/dlp/pii.rs by PII type per audit item #10 Tier 2.

  • Extract CreditCard regex, Luhn check, canary generator → cards.rs
  • Extract Iban regex, ISO 7064 mod-97 check, canary generator → iban.rs
  • Extract Bic regex, ISO 9362 format check, country codes table, canary generator → bic.rs
  • pii.rs keeps the PiiType enum, PiiScanner orchestrator, canary dispatch, and integration tests

Notes

Initial audit suggested extracting emails and names, but those already live in separate modules (dlp::names). Actual decomposable content was the three validators above.

All mutation-testing-targeted tests (`test_kill_mutant_*`) are preserved — structural tests moved with their subject, dispatch tests stay in pii.rs.

LOC before: pii.rs 1143. After: pii.rs 627, cards.rs 256, iban.rs 193, bic.rs 187.

Test plan

  • `cargo fmt`
  • `cargo clippy --all-features -- -D warnings`
  • `cargo test --all-features --lib` (959 passed)
  • Doc tests for `bic.rs` and `pii.rs`

commis-ci-fix added 3 commits April 21, 2026 22:10
Move credit card regex, Luhn validation, and CC canary generation into
src/features/dlp/cards.rs. pii.rs re-exports luhn_check for backward
compat with external doctests.

First of three splits to slim pii.rs from 1250 LoC toward orchestration-
only (audit item #10 Tier 2).
Move IBAN regex, ISO 7064 mod-97 validation, and IBAN canary generator
into src/features/dlp/iban.rs. pii.rs re-exports iban_mod97_check for
backward compat with external doctests.

Second of three splits to slim pii.rs toward orchestration-only.
@Destynova2 Destynova2 enabled auto-merge (squash) April 21, 2026 20:23
@Destynova2 Destynova2 merged commit 3aa9ad3 into main Apr 21, 2026
42 checks passed
@Destynova2 Destynova2 deleted the refactor/dlp-pii-split branch April 21, 2026 20:31
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.

1 participant