RESEARCH · Eviulon · NOT OFFICIAL EVIULON DOCTRINE

From Reference Prototype to Sovereign Infrastructure: Target Architecture, Data Model, Security Invariants, and Staged Implementation Roadmap for Patefacere

Research section 3 of 4

Relying solely on unit tests is insufficient for a sovereign infrastructure, as tests only explore the interleavings explicitly conceived by the developer24. To mathematically prove that the state-machine transitions of the Passport lifecycle and concurrent recovery operations do not violate the defined invariants, peer-reviewed formal methods are highly recommended.
The Temporal Logic of Actions (TLA+) and its higher-level abstraction, PlusCal, are recommended for modeling the system25. In TLA+, the system is modeled by specifying the initial state and defining the next-state relation (Spec == Init /\ [][Next]_vars)26. By modeling the Optimistic Concurrency Control (OCC) logic, the TLC model checker can explore every possible concurrent interleaving of multiple WSGI processes attempting to supersede a passport simultaneously7. The model checker will mathematically prove whether a race condition exists that could lead to a "Lost Update" or a split-brain identity state9.
While Alloy is a powerful tool for relational modeling, it is deemed overkill for this specific stage of development; engineering effort should be heavily focused on TLA+ to verify concurrency safety24. Additionally, Property-Based Testing (e.g., utilizing Python's Hypothesis library) is highly recommended for verifying the idempotency of migrations and the determinism of JSON serialization formats.

Operations, Observability, Backup, and Supply Chain

Operational integrity requires strict adherence to security protocols. The project-provided requirement dictates that private keys, PII, and recovery shares must never be written to application logs. Observability pipelines must utilize structured error formats emitting deterministic codes rather than raw exception traces.
To secure the software supply chain against poisoning attacks, Patefacere must align with Supply-chain Levels for Software Artifacts (SLSA) Level 2 standards. A CycloneDX Software Bill of Materials (SBOM) must be produced for all Python dependencies. Furthermore, pip-tools must be utilized for rigorous dependency pinning and cryptographic hash checking during deployment.
Database backup strategies must prevent file-level corruption. For the initial SQLite implementation, backups should be conducted via Litestream or the native .backup API, ensuring that snapshots are transactionally consistent. Regular restoration drills are mandatory and must mathematically prove the continuity of the identity log post-restoration.

SQLite-to-Production-Storage Analysis

The architectural transition from SQLite to MySQL is driven by the need for robust concurrency handling, but the migration itself introduces immense risk to the identity log. This migration must utilize idempotent migration scripts, such as those generated by Alembic.
Idempotency guarantees that if a migration script fails midway and is re-run, it will not corrupt the database. This is achieved by strictly utilizing CREATE TABLE IF NOT EXISTS directives and checking the information schema for the existence of columns and indices prior to executing modifications. Before the application write-path is cut over to MySQL, a comprehensive shadow-read validation pass must be executed to ensure absolute parity between the legacy SQLite state and the new MySQL state.

Full Staged Migration Roadmap

The realization of the target architecture is managed through a meticulously phased 16-stage roadmap, designed to minimize disruption and isolate risk.

  1. Phase 9: Recovery and Rotation Hardening
    • Intent: Implement the temporal friction logic. Timelocks and multi-party approval requirements are integrated into the Python logic for all major civic changes.
  2. Phase 10: Trust-Policy Separation
    • Intent: Extract all hardcoded constitutional trust rules from Python if/else route blocks. These are migrated into declarative JSON policies that are evaluated deterministically by the pure-function engine.
  3. Phase 11: Receipt and Evidence Hardening
    • Intent: Activate the Evulgare integration contract. The fetcher module begins strictly verifying SHA-256 hashes before allowing external assurance payloads to influence the evaluation engine.
  4. Phase 12: Production Database Migration (If Justified)
    • Intent: Migrate the authoritative data store from SQLite to MySQL, triggered via secure environment variable configurations within Passenger1.
    • Data Changes: Execute a full ETL pipeline, strictly followed by a shadow-read verification phase to guarantee zero data loss.
  5. Phase 13: Partition and Continuity Work
    • Intent: Implement offline verification fallbacks. Stale status caching (CRLs) is deployed to ensure verifications survive transient database or network partitions.
  6. Phase 14: Independent Review
    • Intent: Subject the entire architecture, cryptographic ctypes bindings, and TLA+ models to a rigorous external audit.
    • Stop Condition: All critical OWASP vulnerabilities and architectural logic flaws must be remediated.
  7. Phase 15: Staged Production Acceptance (Go Live)
    • Intent: Execute the final cutover to the authoritative production state. Perform actual-host acceptance testing on the target cPanel/Passenger environment.
  1. Phase 8: Credential and Passport Migration
  1. Phase 7: Audited Public-Key Reference Implementation
  1. Phase 6: Cryptographic-Provider Abstraction
  1. Phase 5: Public/Private Record Separation (CQRS Implementation)
  1. Phase 4: State-Machine Hardening (Lifecycle Security)
  1. Phase 3: Schema Versioning (Database Idempotency)
  1. Phase 2: Domain Separation (Bounded Contexts)
  1. Phase 1: Truth-Boundary and Terminology Corrections (Policy Alignment)
  1. Phase 0: Repository-Enabled Verification (Baseline Evidence)

Rollback, Acceptance, and Independent Review

To manage deployment risk, rigid rollback conditions are established. Any failure in cryptographic signature verification, the detection of a split-brain state in the MySQL cluster, or an inability to resolve Evulgare hashes mandates an immediate and automatic rollback to the preceding deployment stage.
Production Acceptance is gated by a strict sign-off matrix. Deployment is authorized only upon the presentation of zero critical Common Vulnerabilities and Exposures (CVEs), the documented success of a full backup and restore drill, and a 100% pass rate in the property-based testing suite.
Furthermore, an independent review is a non-negotiable requirement. The system must not claim independent certification based solely on internal, self-executed test suites. A comprehensive, third-party cryptographic engineering review of the ctypes OpenSSL bindings and the FIDO2 CBOR decoding logic is absolutely mandatory prior to initiating Stage 15.

Decision Table

Decision Option Selected Justification
Database SQLite transitioning to MySQL Broad shared hosting support (cPanel); MySQL provides the row-level locking necessary to scale beyond SQLite's strict concurrency limits5.
Framework WSGI / Python Standard Library Radically minimizes supply chain poisoning risk; adheres to the project request for zero external UI/Node dependencies.
Consistency Strong (Authoritative Write-Model) Absolutely prevents the creation of duplicate identities or double-spend passport replacement attacks10.
Crypto Abstraction ctypes wrapping libcrypto.so Enables robust ECDSA and RSA verification natively without requiring external pip packages, fulfilling the standard library constraint15.

Conflict Register

Architectural conflicts inevitably arise during system design and must be explicitly resolved.
Conflict: The realities of Shared Hosting (cPanel) versus the security mandate for strict KMS/HSM secret custody. Resolution: This is resolved through the CryptoProvider abstraction layer. For Stage 0, secure environment variables (os.environ) populated by Passenger manage custody1. The architecture mandates that high-trust civic keys must eventually migrate to external signing hardware, severing them from the web server's memory space.
Conflict: Preserving citizen Unlinkability versus publishing a Public Civil-Registry.Resolution: This is resolved via the implementation of the CQRS pattern. Only explicitly public, non-correlatable civic hashes are projected into the registry_cache. The detailed transactional graphs and internal mappings remain strictly sequestered within the private, authoritative write-model.

Prioritized Engineering Backlog

To execute the immediate next steps following Phase 0, the engineering backlog must prioritize the highest-risk technical components:

  1. Extract the CryptoProvider interface and solidify the ctypes bindings for EVP_DigestVerifyInit and ECDSA_verify against libcrypto.so.
  2. Develop the native Python CBOR parser required to decode WebAuthn authData payloads accurately without third-party dependencies.
  3. Implement Alembic (or standard-library equivalent) idempotent schema migrations.
  4. Write comprehensive property-based tests for JSON serialization and projection sanitation.
  5. Develop and test the async CQRS public registry generator.

Residual Unknowns and Prohibited Claims

To manage expectations and enforce transparency, the following prohibited claims must be explicitly acknowledged:

Source: Eviulon/Eviulon Identity Architecture Research.md · SHA-256: ff30fad3e01343c8dc2b848c6ebe435f33d691a0a308b9ea5cde3f53814498a0