Spaces:
Runtime error
Runtime error
File size: 8,992 Bytes
73ba4f5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | # Platform Developer Tools, Benchmarks & Operational Automation (`scripts/`)
This directory houses the unified operational CLI, benchmarking harnesses, security and regulatory compliance exporters, code integrity scanners, and deployment verification tools for the **Collaborative Fraud Intelligence Platform (CF-Intelligence)**.
---
## 1. Scripts Taxonomy & Directory Index
The 37 operational, benchmarking, and verification scripts are organized into five primary engineering domains:
```text
scripts/
βββ [1. Master Runners & Orchestration]
β βββ run_all_tests.py # Master unified test runner across all test suites (Frontend, Backend, Contracts)
β βββ run_all_verifications.py # Master runner for all 21 scientific verification audit modules
β βββ cfi_cli.py # Self-service bank onboarding & consortium integration CLI
β
βββ [2. Benchmarking & Simulation Engines]
β βββ run_benchmark.py # 9-Configuration architectural evaluation runner (C1βC9 matrix)
β βββ benchmark_prepare_datasets.py # Synthetic dataset generator & real-world dataset preprocessor
β βββ generate_amlnet_dataset.py # AMLNet synthetic benchmark dataset generator (AUSTRAC specification)
β βββ generate_synthaml_dataset.py # SynthAML synthetic benchmark dataset generator (Nature Scientific Data)
β βββ run_enterprise_stress_test.py # High-throughput ISO 20022 payment stream stress test (>38k tx/s)
β βββ realtime_benchmark.py # Sub-100ms in-process ASGI scoring latency benchmark
β βββ run_elliptic_benchmark.py # Real Elliptic Bitcoin AML transaction graph benchmark runner
β βββ run_fl_synthetic_benchmark.py # Multi-bank federated learning convergence benchmark
β βββ run_abac_benchmark.py # Attribute-Based Access Control authorization engine benchmark
β βββ transaction_stream.py # Live real-time transaction streaming simulation service
β βββ locustfile.py # Distributed Locust user load testing suite
β βββ run_load_test.py # Asynchronous HTTP & WebSocket load tester with SLA reports
β βββ download_real_benchmarks.py # Automated downloader for IEEE-CIS, PaySim, and Elliptic datasets
β βββ etl_dataset_pipeline.py # Pandera data contract ETL pipeline with distribution bounds
β βββ generate_plots.py # Generates publication-ready PR-AUC, ROC-AUC & convergence charts
β βββ generate_charts.py # Generates operational benchmark comparative figures and matrices
β
βββ [3. Quality, Integrity & Security Scanners]
β βββ codebase_integrity_scanner.py # Autonomous 22-vector zero-mock and dead-code scanner
β βββ audit_api_contracts.py # Deep bidirectional contract auditor (FastAPI OpenAPI <-> TypeScript)
β βββ capture_openapi_snapshot.py # Captures reference OpenAPI v3.1 schema snapshot
β βββ run_coverage_audit.py # 4-Tier branch coverage auditor (Statements, Branches, Functions, Lines)
β βββ run_mutation_tests.py # Mutation testing suite driver for frontend and backend
β βββ ast_mutation_engine.py # AST mutation engine injecting arithmetic, boundary & logic mutations
β βββ chaos_harness.py # Chaos engineering harness (network delay, packet drop, node crash)
β
βββ [4. Security, Governance & Regulatory Compliance]
β βββ generate_secrets.py # Cryptographically secure 256-bit secret generator for .env
β βββ generate_sbom.py # Automated CycloneDX 1.5 & SPDX JSON SBOM generator with pip-audit
β βββ export_compliance_report.py # EU AI Act & Article 13/14 compliance report generator
β βββ init_vault_pki.py # HashiCorp Vault mTLS intermediate CA & certificate provisioning
β βββ setup_cloudflare_waf.py # Cloudflare WAF perimeter rules, rate limits & TLS 1.3 setup
β
βββ [5. Deployment, Scientific Provenance & Verification]
βββ verify_benchmark_evidence.py # Master scientific evidence provenance & mathematical reconciliation CLI
βββ verify_b1_reconstruction.py # Independent Class B1 HTTP latency percentile & sample math verifier
βββ verify_reproducibility.py # 38-Item platform reproducibility & empirical parity sweep
βββ verify_docker_deployment.py # Automated Docker Compose pre-flight & runtime verification
βββ validate_k8s_manifests.py # Rendered Helm manifest dry-run validator (kubectl apply --dry-run=client)
βββ production_smoke_test.py # Post-deployment end-to-end smoke test validating all live endpoints
```
---
## 2. Key Developer Workflows
### 2.1 Running the Full Test Suite (`run_all_tests.py`)
```bash
# Run all core test suites (Frontend + Backend + Scientific Verification)
python scripts/run_all_tests.py
# Run specific individual suites
python scripts/run_all_tests.py --frontend # Vitest unit & E2E tests
python scripts/run_all_tests.py --backend # Pytest unit, integration & chaos tests
python scripts/run_all_tests.py --verification # 18-module scientific verification suite
python scripts/run_all_tests.py --contracts # Hardhat EVM smart contract suite
python scripts/run_all_tests.py --coverage # 4-tier branch coverage audit with 75% gate
python scripts/run_all_tests.py --all # Everything including Playwright visual & mutation tests
```
### 2.2 Benchmarking & Stress Testing
```bash
# 9-Configuration matrix evaluation (ROC-AUC, PR-AUC, F1, DP budget consumption)
python scripts/run_benchmark.py --samples 5000 --rounds 10
# High-throughput ISO 20022 payment stream stress test (pacs.008 messages)
python scripts/run_enterprise_stress_test.py --banks 5 --target-tps 10000 --duration 10
# Real-time sub-100ms inference latency benchmark
python scripts/realtime_benchmark.py --concurrency 50 --requests 1000
# Elliptic Bitcoin AML dataset benchmark
python scripts/run_elliptic_benchmark.py
```
### 2.3 Codebase Quality, Anti-Mock & Contract Audits
```bash
# Autonomous 22-vector anti-mock & integrity scanner
python scripts/codebase_integrity_scanner.py --all --strict
# Bidirectional API contract audit (OpenAPI schemas vs TypeScript types)
python scripts/audit_api_contracts.py
# AST mutation testing suite (Backend Python & Frontend TypeScript mutants)
python scripts/run_mutation_tests.py
```
### 2.4 Production Deployment Verification
```bash
# Validate Docker Compose configuration, multi-stage builds & health probes
python scripts/verify_docker_deployment.py
# Validate all Kubernetes Helm manifests via kubectl client dry-run (39 resources)
python scripts/validate_k8s_manifests.py --all
# Post-deployment live cluster smoke test
python scripts/production_smoke_test.py --base-url http://localhost:8000
```
### 2.5 Bank Onboarding CLI (`cfi_cli.py`)
```bash
# Initialize bank configuration scaffold
python scripts/cfi_cli.py init --bank-id bank_alpha --coordinator coordinator.cfi.internal:50051
# Generate mTLS Certificate Signing Request (CSR)
python scripts/cfi_cli.py cert generate-csr --bank-id bank_alpha --output-dir ./certs
# Verify coordinator connectivity and mTLS handshake
python scripts/cfi_cli.py test-connection --host coordinator.cfi.internal --port 50051
# Run local self-service integration sandbox
python scripts/cfi_cli.py sandbox run --transactions 5000
```
### 2.6 Platform Reproducibility & Empirical Parity Sweep (`verify_reproducibility.py`)
```bash
# Execute comprehensive 38-item empirical reproducibility verification
python scripts/verify_reproducibility.py --all
# Generate structured JSON attestation report
python scripts/verify_reproducibility.py --json
```
### 2.7 Synthetic AML Benchmark Dataset Generation
```bash
# Generate AUSTRAC-compliant AMLNet synthetic benchmark dataset
python scripts/generate_amlnet_dataset.py
# Generate Nature Scientific Data calibrated SynthAML dataset
python scripts/generate_synthaml_dataset.py
```
### 2.8 Scientific Evidence Provenance & Benchmark Verification
```bash
# Verify end-to-end scientific evidence chain, SHA-256 hashes & mathematical reconciliation
python scripts/verify_benchmark_evidence.py
# Verify Class B1 HTTP service latency sample percentile math
python scripts/verify_b1_reconstruction.py
```
---
## 3. Maintenance & Standards
- All scripts adhere to strict PEP 8 formatting validated by `ruff check scripts/`.
- No mock or dummy fallbacks: all benchmarks and utilities execute authentic computational pipelines.
- Zero hardcoded production secrets: all cryptographic keys and credentials are dynamically sourced from environment variables.
|