⚡ ferrox-py-aspyre
Enterprise Regulatory-Grade Financial Integration Engine for Aspyre.nl
Clean Architecture, Distributed Concurrency Control, Cryptographic Audit Trail, and Dutch Tax Compliance (SBR/BTW/RGS/XAF 3.2).
1. Overview
ferrox-py-aspyre is a production-hardened financial systems integration platform extending ferrox-py to meet the exacting regulatory, reliability, and concurrency requirements of Aspyre (aspyre.nl).
It provides mission-critical guarantees for 2,000 accounting offices managing up to 1,000,000 SME administrations:
- Zero-Race Token Lifecycle: Atomic single-flight coordination preventing single-use OAuth2 refresh token burns on Exact Online, with AES-256-GCM AEAD encryption at rest.
- Tamper-Proof Financial Audit Trail: Cryptographic SHA-256 backward hash-chaining satisfying Dutch Belastingdienst onveranderbaarheid requirements and XAF 3.2 (Auditfile Financieel) exportability.
- Resilient Stream Recovery: Checkpoint-based resumption for interrupted 30MB Twinfield SOAP XML responses, guaranteeing zero duplicate ledger entries on socket collapse.
- Exact Online Fair-Queuing: Strict
concurrency=1distributed Redis leases combined with Multi-Tenant Deficit Round Robin (DRR), preventing starvation across accounting firms. - Zero Ping-Pong Sync: Semantic content fingerprinting (
SHA256) eliminating echo webhook loops, coupled with automatic conflict routing to Vraagposten (Suspense Accounts / Account 9999) rather than destructive Last-Write-Wins overwrites.
2. Core Architecture Modules
🔹 1. security (Regulatory Token Protection)
- Zero-Race OAuth Coordinator: Distributed mutex + monotonic
generation_idrotation eliminating single-use refresh token burns. - Crypto Vault: Authenticated AES-256-GCM envelope encryption for secrets at rest (AWS KMS / HashiCorp Vault compatible).
🔹 2. audit (Belastingdienst & XAF 3.2 Compliance)
- Audit Hash-Chain: Immutable SHA-256 backward hash-chained ledger sealing every journal entry and sync state mutation.
- Verification Engine: Mathematical tampering detection across all historical blocks.
- XAF 3.2 Exporter: Generates official Belastingdienst-compliant XML audit files for tax inspections.
🔹 3. twinfield (Stateful Session & Checkpoint Recovery)
- Stateful Session Pooler: Redis-backed cluster session management (
c1.twinfield.com,c3.twinfield.com) with sliding TTL and keep-alive heartbeats. - Streaming Iterparse Parser: Off-thread streaming parser achieving > 36,000 transactions/sec with < 1ms event-loop lag.
- Checkpoint Recovery Streamer: Resumes interrupted streams from the last committed transaction without duplicates.
🔹 4. exact (Fair-Queuing & Rate Limiting)
- Strict Concurrency=1 Semaphore: Atomic Redis Lua script guaranteeing zero concurrent requests per division/token.
- Adaptive Rate Limiter: Parses Exact Online headers (
X-RateLimit-*) with proactive throttling before HTTP 429 occurs. - DRR Multi-Tenant Scheduler: 80/20 budget reservation protecting interactive UI actions from background batch syncs.
🔹 5. dutch_sbr (Tax Taxonomy & Validation)
- Pydantic V2 Domain Models: Strict double-entry balancing validation ($\sum \text{Debit} == \sum \text{Credit}$).
- Dutch Tax Matrix (Btw-aangifte): Tax rubrieken mapping (1a, 1b, 1e, 2a, 3b, 4b) and tolerance validation.
- Master Data Validators: 8-digit KvK checksum and SEPA Dutch IBAN (ISO 7064 MOD 97-10).
- Vraagposten Engine: Triage state machine for ambiguous items and conflict deltas.
🔹 6. sync (Transactional Sagas & Anti-Loop)
- Semantic Fingerprinting: Normalizes payloads (strips volatile timestamps and etags) to eliminate echo loops.
- Financial Sagas: Belastingdienst-compliant Storno (Tegenboeking) reversals on aborted transactions.
- Bidirectional Orchestrator: Optimistic concurrency control with triage escalation.
3. Quickstart & Evaluation
Prerequisites
- Python 3.11+
- Redis (optional: local tests run out-of-the-box using embedded
fakeredis[lua])
Installation
git clone https://github.com/ferrox-org/ferrox-py-aspyre.git
cd ferrox-py-aspyre
# Install in development mode
pip install -e .
Running the Production Benchmark
python examples/evaluation_demo.py
# or using the CLI:
aspyre-ferrox benchmark
Expected benchmark output:
================================================================================
📊 INTEGRATION SLA & REGULATORY PERFORMANCE REPORT
================================================================================
• Upstream 429 Errors: 0 (SLA Target: 0)
• Duplicate Ledger Entries: 0 (SLA Target: 0 - Zero Tolerance)
• Event-Loop p99 Jitter Lag: 0.00 ms (SLA Target: < 20.0 ms)
• Twinfield XML Parse Throughput: 36,512 tx/sec
• Single-Use Refresh Token Burns: 0 (SLA Target: 0 - 100% Locked)
• Audit Hash-Chain Tamper-Resistance: 100% Cryptographic Enforcement
================================================================================
✅ All Regulatory & Architectural Guarantees Verified for Aspyre.nl Production!
Running Full Test & Chaos Engineering Suite
pytest tests/ -v
4. Repository Structure
ferrox-py-aspyre/
├── .gitignore
├── pyproject.toml # Hatchling, Pydantic V2, Cryptography, Redis
├── README.md # Documentation & quickstart
├── ARCHITECTURE.md # Comprehensive Technical Architecture & Governance Blueprint
├── docker-compose.yml # Local Redis service definition
├── ferrox_py_aspyre/
│ ├── cli.py # CLI runner
│ ├── security/ # Zero-Race OAuth Coordinator & AES-256-GCM Vault
│ │ ├── crypto_vault.py
│ │ └── oauth_coordinator.py
│ ├── audit/ # Tamper-Proof Hash-Chain Ledger & XAF 3.2 Exporter
│ │ ├── ledger_chain.py
│ │ └── xaf_exporter.py
│ ├── twinfield/ # Stateful Session Pooler & Checkpoint Recovery Streamer
│ │ ├── session_pooler.py
│ │ ├── streaming_parser.py
│ │ ├── checkpoint_recovery.py
│ │ └── client.py
│ ├── exact/ # Concurrency=1 Semaphore & Fair DRR Scheduler
│ │ ├── concurrency_lock.py
│ │ ├── rate_limiter.py
│ │ ├── fair_queue.py
│ │ └── client.py
│ ├── dutch_sbr/ # Dutch SBR, RGS, VAT & Master Data Validation
│ │ ├── models.py
│ │ ├── vat_matrix.py
│ │ ├── validators.py
│ │ └── vraagposten.py
│ ├── sync/ # Anti-Ping-Pong & Reversible Financial Sagas
│ │ ├── fingerprint.py
│ │ ├── saga_steps.py
│ │ └── orchestrator.py
│ └── observability/ # SLA & KPI Trackers (Lag, 429s, MTTR)
│ └── metrics.py
├── examples/
│ ├── evaluation_demo.py # Production benchmark showcase
│ └── sample_twinfield.xml # Sample SOAP XML fixture
└── tests/
├── conftest.py
├── test_twinfield_session.py
├── test_twinfield_streaming.py
├── test_exact_fair_queue.py
├── test_dutch_sbr.py
├── test_anti_ping_pong.py
└── chaos/ # Chaos Engineering & Recovery Verification Suite
├── test_chaos_token_race.py
├── test_chaos_stream_recovery.py
├── test_chaos_audit_tampering.py
└── test_chaos_upstream_faults.py
5. Architectural Governance & Documentation
For the complete technical blueprint, mathematical hash proofs, and executive proposal for platform ownership, inspect ARCHITECTURE.md.
Metadata
Release files for ferrox-py-aspyre 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ferrox_py_aspyre-1.0.0.tar.gz | 71.6 kB | Without provenance | Details for ferrox_py_aspyre-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ferrox_py_aspyre-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for ferrox_py_aspyre-1.0.0-py3-none-any.whl |
Total release size: 117.4 kB
Release files / ferrox_py_aspyre-1.0.0.tar.gz
| Download URL | ferrox_py_aspyre-1.0.0.tar.gz |
|---|---|
| Size | 71.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2762790ac98b42079cae3833e9afbef2109ebab8a72faec7fa23b0a8ad701c7f
|
|
BLAKE2b-256 checksum How to use checksums |
c967a4e5ca86b9a2efe8ac6af73eb38b85fdc737866edefbee371734d71a9cd1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.2
|
Release files / ferrox_py_aspyre-1.0.0-py3-none-any.whl
| Download URL | ferrox_py_aspyre-1.0.0-py3-none-any.whl |
|---|---|
| Size | 45.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fcf66c4e06fe4daadc3588d854cca439f6306ade8f176f4581a3ab1a253d0946
|
|
BLAKE2b-256 checksum How to use checksums |
b33473ef62e7b43ec449afc15d3bba8599ac0e15deb02a5f2723d1c1dc30c2e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.2
|
Security for ferrox-py-aspyre 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.