openpay/ (+3 crates)
op-bnpl/ Affirm + Klarna + Afterpay/Clearpay rails. Full lifecycle
typestate (Initiated→Approved→Captured→Settled→Refunded).
Per-provider sandbox+production base URLs, regions (NA/EU/OC
for Klarna; US/AuNz/Gb/Ca/Eu for Afterpay). HMAC-SHA256
webhook verification with constant-time compare. 61 tests.
op-batch/ NACHA ACH (94-char records, PPD/CCD/WEB/TEL/CTX, R01-R99
return codes, Same-Day ACH cutoffs); SEPA pain.001.001.09
(CT) + pain.008.001.08 (DD) with SCT-Inst flagging; Fedwire
MT103/MT202/CHIPS + pacs.008.001.12 / pacs.009.001.10 +
UETR; Bacs Standard 18. Per-rail cutoff scheduler. Exception
taxonomy unified across rails. 51 tests.
op-screening/ OFAC SDN + EU consolidated + UN consolidated + HMT UK
consolidated + Australia DFAT + Canada SEMA + Japan MOF.
Levenshtein + Jaro-Winkler + Soundex + Metaphone + token
Jaccard scoring. Unicode NFKD normalisation + Cyrillic /
Arabic transliteration. Ed25519-signed BLAKE3-chained
audit log. BSA helpers: CTR + SAR pattern detection
(structuring, round-dollar, rapid-in-out). 43 tests.
smart-byte/smart-byte-rs/ (+3 crates)
smart-byte-bbs/ BBS+ signatures (IETF draft-irtf-cfrg-bbs-signatures-08).
BLS12-381 keys, signatures, disclosure proofs with
cryptographic unlinkability. bbs-2023 Data Integrity
cryptosuite. AnonCreds-shaped link secrets +
predicate proofs. SecretKey zeroize-on-drop. 49 tests.
smart-byte-didcomm/ DIDComm v2 messaging per DIF spec. Pack-encrypted
(ECDH-1PU + ECDH-ES via X25519), pack-signed (JWS),
pack-plaintext. Aries protocols: issue-credential v3,
present-proof v3, basic-message, trust-ping, discover-
features, out-of-band, coordinate-mediation, message-
pickup. Mediator role with pluggable storage. 23 tests.
smart-byte-mdl/ ISO/IEC 18013-5 mobile driver's licence + 18013-7
online presentment. mDoc + MSO with salted-hash
selective disclosure (per item; SHA-256 digest tree).
org.iso.18013.5.1 namespace + AAMVA add-on. ES256
device-auth + issuer-auth. QR-code device-engagement
scaffolding. 28 tests.
eoc/eoc-rs/ (+3 crates)
eoc-local/ Local-inference backends behind one NeuralBackend:
llama.cpp (GGUF, Q4/Q5/Q6/Q8/F16/F32 quantisation),
MLX (Apple Silicon, feature-gated), MLC-LLM (TVM, feature-
gated marker), ONNX Runtime. GGUF file-format reader.
HuggingFace tokenizers. Greedy / top-k / top-p / temperature /
Mirostat samplers. Model registry scanning ~/.eoc/models/.
Joule attribution via eoc-meter. 39 tests.
eoc-rerank/ BM25 sparse + HNSW dense + RRF + min-max hybrid fusion.
Cohere v3.5 + Voyage v2 + bge-reranker v2-m3 + ms-marco
MiniLM + ColBERT v2 rerankers. Two-stage pipeline:
retrieve top-K hybrid → cross-encoder rerank → top-N.
KV-stage recovery shim into the cascade. 31 tests.
eoc-eval/ 15 canonical eval harnesses: MMLU, MMLU-Pro, GPQA,
HumanEval (pass@1 with python3 sandbox), BBH, IFEval (25
verifiable constraints), AlpacaEval, AGIEval, HellaSwag,
ARC (Easy + Challenge), TruthfulQA (MC1+MC2), BoolQ,
GSM8K, MATH (boxed-answer equivalence), Winogrande. Real
questions in BuiltinSamples. EvalRunner emits joules-per-
correct alongside accuracy. 49 tests.
Quality:
- cargo check across all three workspaces: clean
- cargo clippy --all-targets -- -D warnings on every new crate: clean
- 374 new tests, all passing
- #![forbid(unsafe_code)] across every new crate
- No unwrap/expect outside #[cfg(test)]
Rust 1.95.0 edition 2024 (inherited via root rust-toolchain.toml).
134 lines
4.2 KiB
Rust
134 lines
4.2 KiB
Rust
//! End-to-end integration tests against fixture data.
|
|
//!
|
|
//! Tests never hit a real list endpoint. The parser tests under
|
|
//! `src/updater.rs` cover schema-level concerns; this file covers
|
|
//! the cross-module path: parse fixture → build index → screen →
|
|
//! audit-log integrity.
|
|
|
|
use chrono::Utc;
|
|
use op_screening::{
|
|
AuditLog, EntityType, OfacUpdater, SanctionedEntity, SanctionsIndex, SanctionsList,
|
|
ScreenDecision, ScreenRequest, Screener, ScreenerConfig,
|
|
};
|
|
|
|
fn synthetic_entities(n: usize) -> Vec<SanctionedEntity> {
|
|
let mut out = Vec::with_capacity(n);
|
|
for i in 0..n {
|
|
out.push(SanctionedEntity {
|
|
id: format!("id-{i:04}"),
|
|
name: format!("Person Number {i}"),
|
|
name_aliases: vec![format!("Alias of {i}")],
|
|
entity_type: EntityType::Individual,
|
|
dob: None,
|
|
place_of_birth: None,
|
|
addresses: vec![],
|
|
nationalities: vec![],
|
|
identifications: vec![],
|
|
programs: vec!["TEST".to_string()],
|
|
last_updated: Utc::now(),
|
|
source_list: SanctionsList::OfacSdn,
|
|
});
|
|
}
|
|
// Splice in a single distinguished record we can hit.
|
|
out.push(SanctionedEntity {
|
|
id: "TARGET".to_string(),
|
|
name: "Vladimir Konstantin Petrov".to_string(),
|
|
name_aliases: vec!["V.K. Petrov".to_string(), "Vlad Petrov".to_string()],
|
|
entity_type: EntityType::Individual,
|
|
dob: None,
|
|
place_of_birth: None,
|
|
addresses: vec![],
|
|
nationalities: vec![],
|
|
identifications: vec![],
|
|
programs: vec!["RUSSIA-EO14024".to_string()],
|
|
last_updated: Utc::now(),
|
|
source_list: SanctionsList::OfacSdn,
|
|
});
|
|
out
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn end_to_end_near_match_hits() {
|
|
let entities = synthetic_entities(1_000);
|
|
let idx = SanctionsIndex::build(entities);
|
|
assert_eq!(idx.len(), 1_001);
|
|
|
|
let screener = Screener::new(
|
|
idx,
|
|
ScreenerConfig {
|
|
threshold: 0.80,
|
|
..ScreenerConfig::default()
|
|
},
|
|
AuditLog::new(),
|
|
);
|
|
|
|
// Near-match (single-character typo) of the distinguished record.
|
|
let r = screener
|
|
.screen(&ScreenRequest {
|
|
name: "Vladimir Konstantin Petrove".to_string(),
|
|
dob: None,
|
|
address: None,
|
|
additional_ids: vec![],
|
|
})
|
|
.await
|
|
.expect("screen ok");
|
|
|
|
assert!(!r.hits.is_empty(), "expected near-match to land");
|
|
assert_eq!(r.hits[0].entity.id, "TARGET");
|
|
assert!(matches!(
|
|
r.decision,
|
|
ScreenDecision::Hit | ScreenDecision::AmbiguousNeedsReview
|
|
));
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn end_to_end_missing_returns_clear() {
|
|
let entities = synthetic_entities(1_000);
|
|
let idx = SanctionsIndex::build(entities);
|
|
let screener = Screener::new(idx, ScreenerConfig::default(), AuditLog::new());
|
|
|
|
let r = screener
|
|
.screen(&ScreenRequest {
|
|
name: "Definitively Not Anyone Sanctioned".to_string(),
|
|
dob: None,
|
|
address: None,
|
|
additional_ids: vec![],
|
|
})
|
|
.await
|
|
.expect("screen ok");
|
|
|
|
assert_eq!(r.decision, ScreenDecision::Clear);
|
|
assert!(r.hits.is_empty());
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn audit_log_records_every_call_and_verifies() {
|
|
let entities = synthetic_entities(50);
|
|
let idx = SanctionsIndex::build(entities);
|
|
let screener = Screener::new(idx, ScreenerConfig::default(), AuditLog::new());
|
|
|
|
for _ in 0..5 {
|
|
screener
|
|
.screen(&ScreenRequest {
|
|
name: "Some Random Name".to_string(),
|
|
dob: None,
|
|
address: None,
|
|
additional_ids: vec![],
|
|
})
|
|
.await
|
|
.expect("screen ok");
|
|
}
|
|
screener.with_audit_log(|log| {
|
|
assert_eq!(log.entries().len(), 5);
|
|
log.verify().expect("audit chain intact");
|
|
});
|
|
}
|
|
|
|
#[test]
|
|
fn parse_fixture_ofac() {
|
|
let xml = include_str!("fixtures/sdn_sample.xml");
|
|
let parsed = OfacUpdater::parse_sdn_xml(xml).expect("parse fixture");
|
|
assert!(!parsed.is_empty(), "fixture must parse to >=1 entity");
|
|
// At least one entry must carry a program.
|
|
assert!(parsed.iter().any(|p| !p.programs.is_empty()));
|
|
}
|