QODIQA Reference Implementation
Specification

Minimal Deterministic Enforcement Stack for Runtime Consent Validation

April 2026

QODIQA Reference Specification  ·  Version 1.0

A minimal, deterministic runtime enforcement stack demonstrating consent validation at the inference boundary, fail-closed decisioning, and verifiable audit logging.

Scroll
Contents
Abstract

This document specifies a minimal, deterministic reference implementation of the QODIQA runtime consent enforcement stack. It defines the components, interfaces, data structures, and execution flow required to demonstrate consent validation at the AI inference boundary, deterministic allow/deny decisioning, fail-closed behavior, and verifiable audit logging. The implementation is explicitly minimal in scope: it is not a production system, not a scalable architecture, and not a complete security solution. Its purpose is to instantiate the core behavioral guarantees of the QODIQA Core Standard and the 68-Point Enforcement Framework in a concrete, executable form that can be inspected, validated, and used as a reference for production implementations. The stack is fully deterministic: given identical inputs and policy state, the system will always produce identical outputs. All undefined or missing inputs result in denial. No silent fallback, inference, or probabilistic behavior is permitted at any stage of the enforcement pipeline.

#Executive Overview

The QODIQA Reference Implementation Specification defines a minimal, self-contained enforcement stack that demonstrates the behavioral properties required by the QODIQA Core Standard. It is not a production deployment blueprint. It is a structured reference: a concrete instantiation of the enforcement model in its simplest correct form, against which production implementations can be calibrated.

The reference stack addresses a specific validation gap. Specifications describe what a system must do; reference implementations demonstrate how those requirements are satisfied in practice. Without a concrete reference, specification conformance is assessed against documentation alone, which is insufficient for systems whose correctness properties must be mechanically verifiable.

This document covers the complete enforcement pipeline from request ingestion to decision artifact generation. Each component is defined with explicit inputs, outputs, responsibilities, and failure behaviors. The enforcement flow is defined step by step with no ambiguous transitions. All failure modes resolve to denial. No component is permitted to infer, assume, or fall back silently.

The scope of this specification is deliberately bounded. It covers runtime consent validation, deterministic policy evaluation, fail-closed enforcement at the inference boundary, and append-only audit logging. It does not cover distributed deployment, high-availability configurations, advanced identity systems, cryptographic proof generation, or full production security controls. These are addressed in companion specifications within the QODIQA corpus.

The reference implementation serves three functions. First, it validates that the QODIQA enforcement model is implementable in a minimal configuration. Second, it provides a concrete behavioral reference for teams building production systems. Third, it enables conformance testing by defining validation scenarios against which any implementation can be assessed.

#System Scope and Constraints

The boundary of this reference implementation is explicitly defined. Conformant behavior is only required within the stated scope. Behaviors outside this scope are not evaluated by this specification and must be addressed by production-specific architecture decisions and companion QODIQA documents.

2.1 Included

The following capabilities are within scope and must be implemented by any system claiming conformance with this reference specification:

  • Runtime consent validation prior to AI inference execution
  • Deterministic allow/deny decisioning based on explicit consent state and policy
  • Fail-closed behavior: all undefined or error states resolve to DENY
  • Append-only audit logging of all enforcement decisions
  • Minimal evidence artifact generation for each decision
  • Request validation including identity extraction and context parsing
  • Consent registry with mock or in-memory state adequate for single-node operation
  • Policy engine operating on immutable, versioned policy snapshots

2.2 Excluded

The following are explicitly outside scope and must not be assumed by any conformant implementation of this reference specification:

  • Distributed consensus, replication, or multi-node coordination
  • High-availability or fault-tolerant deployment configurations
  • Advanced identity and authentication systems (PKI, hardware tokens, federated identity)
  • Cryptographic proof generation or zero-knowledge constructs
  • Full production security hardening, threat modeling, or penetration-tested configurations
  • Scalability or throughput optimization
  • AI model governance beyond the enforcement boundary
  • User-facing consent capture, consent management interfaces, or consent workflow orchestration
  • Legal or regulatory compliance verification
This scope boundary is a design constraint, not a limitation of the QODIQA framework. The minimal reference implementation is intentionally restricted to isolate and demonstrate core enforcement behavior without conflation with operational concerns. Production systems must extend this reference according to their deployment requirements and applicable QODIQA companion specifications.

#Architectural Overview

3.1 System Topology

The reference implementation operates as a single-node enforcement layer interposed between the request source and the AI inference execution environment. All inbound requests to the inference boundary must pass through the enforcement stack. No request may reach the inference layer without a positive ALLOW decision issued by the Decision Engine.

Request Source Enforcement Stack Enforcement Gateway Request Validator Decision Engine Audit Log AI Inference (ALLOW only) Consent Registry (mock / in-memory) Policy Engine (immutable snapshots) Artifact Generator All paths through enforcement stack. No bypass permitted.
Figure 1. Reference implementation topology. All requests traverse the enforcement stack. AI inference executes only upon receipt of a positive ALLOW decision. Consent Registry and Policy Engine are read-only inputs to the Decision Engine.

3.2 Trust Boundaries

The reference implementation defines two trust domains. The external domain encompasses all request sources, including clients, agents, orchestration layers, and upstream services. No entity in the external domain is trusted by default. All claims made by external entities, including identity assertions, scope declarations, and purpose statements, must be validated within the enforcement stack before any decision is issued.

The internal domain encompasses the enforcement stack components themselves: the Enforcement Gateway, Request Validator, Policy Engine, Consent Registry, Decision Engine, Audit Log, and Artifact Generator. These components are assumed to be co-located in a trusted runtime environment in the minimal reference configuration. In production deployments, inter-component trust must be explicitly secured; this is outside the scope of this specification.

The AI inference environment is treated as a downstream consumer of enforcement decisions. It is not part of the enforcement stack and must not be trusted to self-authorize execution. It receives only a signed decision artifact and must refuse to execute if no valid ALLOW artifact is present.

3.3 Enforcement Boundary

The enforcement boundary is the precise point at which the Decision Engine's output is applied. In this reference implementation, the boundary is defined as the interface between the Enforcement Gateway and the AI inference execution environment. No inference computation, model invocation, data retrieval, or output generation may occur prior to the receipt and validation of a positive decision artifact at this boundary.

Critical Invariant

The enforcement boundary is absolute. Any architecture in which AI inference can be initiated without a valid ALLOW decision from this enforcement stack is non-conformant, regardless of any other controls present in the system.

#Core Components

Each component in the enforcement stack is defined below with its precise responsibility, input contract, output contract, and failure behavior. Components must not exceed their defined responsibilities. Cross-component calls must follow the defined flow sequence specified in Section 5.

4.1 Enforcement Gateway

Responsibility: The Enforcement Gateway is the single ingress point for all requests targeting the AI inference boundary. It receives raw inbound requests, performs initial structural validation, and routes conformant requests into the enforcement pipeline. It is responsible for rejecting malformed requests before they enter the pipeline and for enforcing the fail-closed contract at the system perimeter.

Inputs: Raw inbound request payload; caller network context.

Outputs: Structured request object passed to Request Validator; or a DENY response to caller with reason code MALFORMED_REQUEST.

Failure Behavior

If the inbound request cannot be parsed, is missing required structural fields, or exceeds defined payload constraints, the Gateway must immediately return DENY with reason code MALFORMED_REQUEST. No partial parsing or recovery is permitted. The failure event must be logged to the Audit Log before the response is returned.

4.2 Policy Engine (Deterministic)

Responsibility: The Policy Engine evaluates a resolved request context against an immutable policy snapshot to produce a binary policy result: PERMITTED or NOT_PERMITTED. It does not resolve consent state. It does not perform probabilistic or heuristic evaluation. Given identical inputs, it must produce identical outputs without exception.

Inputs: Validated request context object; immutable policy snapshot identified by policy version identifier.

Outputs: Policy result: PERMITTED or NOT_PERMITTED; policy version identifier used in evaluation; evaluation timestamp.

Failure Behavior

If the policy snapshot cannot be located, loaded, or parsed, the engine must return NOT_PERMITTED with reason code POLICY_UNAVAILABLE. If any policy rule evaluation produces an undefined result due to missing fields, the rule must be treated as NOT_PERMITTED. No default-allow, probabilistic, or inferred results are permitted.

4.3 Consent Registry (Mock / Minimal)

Responsibility: The Consent Registry provides a queryable store of consent records. In the minimal reference implementation, this may be an in-memory structure, a static file, or a simple key-value store. It does not capture consent; it reads consent state. Consent records must be pre-populated prior to system operation. The registry is read-only during enforcement execution.

Inputs: Consent lookup key comprising subject identifier, scope identifier, and purpose identifier.

Outputs: Consent object (see Section 8.1) if a valid, non-expired record exists; or a structured absence response: CONSENT_NOT_FOUND or CONSENT_EXPIRED.

Failure Behavior

If the registry is unavailable, if the lookup produces an error, or if the returned record fails structural validation, the registry must return CONSENT_UNAVAILABLE. The Decision Engine must treat all non-positive consent responses as denial conditions. There is no fallback consent state.

4.4 Request Validator

Responsibility: The Request Validator performs semantic validation of the structured request object produced by the Enforcement Gateway. It extracts and validates identity context, declared purpose, requested scope, and any timing or contextual constraints. It produces a validated request context object for consumption by the Decision Engine.

Inputs: Structured request object from the Enforcement Gateway.

Outputs: Validated request context object; or a structured validation failure with reason code.

Failure Behavior

If any required field is absent, malformed, or semantically invalid, the validator must return a validation failure with the appropriate reason code. Partial validation results are not permitted. The validation failure is forwarded to the Decision Engine, which must resolve it as DENY.

4.5 Decision Engine (Allow / Deny Only)

Responsibility: The Decision Engine is the central enforcement component. It receives a validated request context, queries the Consent Registry and Policy Engine, and produces a final binary enforcement decision: ALLOW or DENY. It does not perform probabilistic assessment, risk scoring, or conditional outcomes. It applies consent state and policy result to produce a deterministic decision artifact.

Inputs: Validated request context; Consent Registry response; Policy Engine result.

Outputs: Decision record (see Section 8.4): ALLOW or DENY; decision reason code; evaluation trace.

Failure Behavior
  • Any consent response other than a valid, non-expired, scope-matched consent object → DENY
  • Any policy result other than PERMITTED → DENY
  • Any validation failure from Request Validator → DENY
  • Any internal error, timeout, or exception during evaluation → DENY with reason code EVALUATION_ERROR
  • Absence of any required input → DENY with reason code MISSING_INPUT

4.6 Audit Log (Append-Only)

Responsibility: The Audit Log records all enforcement decisions and system events in an append-only, tamper-evident log. Every decision produced by the Decision Engine must be written to the Audit Log before the decision is returned to the Enforcement Gateway. The log is a system-of-record for enforcement behavior.

Inputs: Decision record from Decision Engine; system event records from all components.

Outputs: None (write-only during enforcement). Log entries are available for read-only audit access through a separate interface not part of the enforcement pipeline.

Failure Behavior

If the Audit Log cannot accept a write, the Enforcement Gateway must return DENY to the caller and must not proceed with execution. A system that cannot audit its decisions must not make them. Log write failure is a hard enforcement failure condition, not a degraded mode.

4.7 Artifact Generator

Responsibility: The Artifact Generator produces a structured evidence artifact for each ALLOW decision. The artifact encodes the decision record, the consent record identifier, the policy version identifier, and the evaluation timestamp. It is attached to the execution context and forwarded to the AI inference environment as the sole authorization credential for the requested inference operation.

Inputs: Decision record (ALLOW decisions only); consent record identifier; policy version identifier.

Outputs: Decision artifact object; artifact identifier.

Failure Behavior

If artifact generation fails for any reason, the Enforcement Gateway must return DENY. No inference execution is permitted without a successfully generated and validated artifact. DENY decisions do not generate artifacts; they generate denial records in the Audit Log only.

#Deterministic Enforcement Flow

The enforcement flow is a linear, sequential pipeline. No step may be skipped, reordered, or parallelized in a manner that allows execution to proceed without a completed prior step. Each step is defined with its preconditions and the failure behavior that applies if the step cannot be completed successfully.

Enforcement Pipeline — Step Sequence
Step Action Component Failure Outcome
1 Request ingestion and structural validation Enforcement Gateway DENY / MALFORMED_REQUEST
2 Identity and context extraction Request Validator DENY / INVALID_CONTEXT
3 Consent lookup by subject, scope, purpose Consent Registry DENY / CONSENT_NOT_FOUND or CONSENT_EXPIRED
4 Policy evaluation against versioned snapshot Policy Engine DENY / NOT_PERMITTED or POLICY_UNAVAILABLE
5 Decision synthesis (ALLOW / DENY) Decision Engine DENY / EVALUATION_ERROR
6 Enforcement at inference boundary Enforcement Gateway DENY / ARTIFACT_MISSING
7 Audit log write and artifact generation Audit Log + Artifact Generator DENY / LOG_WRITE_FAILURE

Step 1 — Request Ingestion

The Enforcement Gateway receives the raw inbound request. It validates the structural envelope: required fields present, payload within size bounds, content type declared. Requests that fail structural validation are rejected immediately with DENY and reason code MALFORMED_REQUEST. Conformant requests are passed as structured objects to the Request Validator.

Step 2 — Identity and Context Extraction

The Request Validator extracts and validates the following fields from the structured request: subject identifier (who is acting), declared purpose (why the action is performed), requested scope (what data or capability is targeted), and request timestamp. All fields are mandatory. Any absent or malformed field causes the validator to return a validation failure with the corresponding reason code.

Step 3 — Consent Lookup

The Decision Engine queries the Consent Registry using the composite key: subject identifier, scope identifier, purpose identifier. The registry returns the consent object if a valid, non-expired, scope-matched record exists. Any other response, including absence, expiry, scope mismatch, or registry error, is treated as a denial condition. The Decision Engine does not proceed to policy evaluation if consent is not positively confirmed.

Step 4 — Policy Evaluation

The Policy Engine is invoked with the validated request context and the current policy version identifier. It evaluates all applicable policy rules from the immutable policy snapshot. The result is PERMITTED only if all applicable rules are satisfied. If any rule is not satisfied, if any rule produces an undefined result, or if the policy snapshot cannot be loaded, the result is NOT_PERMITTED.

Step 5 — Decision Synthesis

The Decision Engine synthesizes the final enforcement decision. ALLOW requires: a valid consent object returned from the Consent Registry, and a PERMITTED result from the Policy Engine, and no validation failures from the Request Validator. If any of these conditions is not met, the decision is DENY. The decision record is produced with a complete evaluation trace including all inputs, their resolution, and the final outcome.

Step 6 — Enforcement at Inference Boundary

The Enforcement Gateway applies the decision at the inference boundary. If the decision is ALLOW, the decision artifact is attached to the execution context and inference execution is permitted. If the decision is DENY, inference execution is blocked and the denial reason is returned to the caller. The inference environment must verify the artifact before accepting any execution request.

Step 7 — Logging and Artifact Generation

All enforcement decisions, including denials, are written to the Audit Log before the response is returned to the caller. ALLOW decisions additionally trigger artifact generation. The artifact contains the decision record, consent record identifier, policy version, and evaluation timestamp. If the Audit Log write fails, the Enforcement Gateway returns DENY regardless of the decision outcome.

#Fail-Closed Guarantees

Fail-closed behavior is a core invariant of the QODIQA enforcement model. It is not a configuration option or a default setting. It is a structural property that must hold unconditionally across all operating conditions.

Fail-Closed Definition

Any condition that cannot be positively resolved to an ALLOW decision must result in DENY. This includes errors, timeouts, missing inputs, undefined states, partial results, and system failures. There is no degraded mode. There is no default-allow fallback. There is no ambiguity state that permits execution.

Explicit Denial Conditions

The following conditions must each individually produce DENY with the corresponding reason code:

Denial Condition Registry
Condition Reason Code
Request structurally malformed MALFORMED_REQUEST
Subject identifier absent or invalid INVALID_SUBJECT
Purpose not declared PURPOSE_MISSING
Scope not declared or invalid SCOPE_INVALID
No consent record found CONSENT_NOT_FOUND
Consent record expired CONSENT_EXPIRED
Consent scope does not match request scope CONSENT_SCOPE_MISMATCH
Consent purpose does not match declared purpose CONSENT_PURPOSE_MISMATCH
Policy not found or unavailable POLICY_UNAVAILABLE
Policy evaluation result NOT_PERMITTED POLICY_DENIED
Decision Engine internal error EVALUATION_ERROR
Audit Log write failure LOG_WRITE_FAILURE
Artifact generation failure ARTIFACT_GENERATION_FAILURE
Any unclassified system error SYSTEM_ERROR

System Failure Handling

System failures, including process crashes, memory exhaustion, network timeouts between components, and unhandled exceptions, must all resolve to DENY. No component is permitted to swallow exceptions and proceed. No component is permitted to produce an ambiguous or partial result that allows downstream components to interpret the outcome as ALLOW. Every error boundary must terminate the request with DENY.

No Silent Fallback

Silent fallback, defined as any behavior that permits execution to proceed without a positive enforcement decision, is categorically prohibited. This includes: treating an absent consent record as implied consent; applying a default policy when a named policy is unavailable; proceeding with inference when the Audit Log is unavailable; or returning ALLOW when evaluation is incomplete. Any such behavior constitutes a conformance failure.

#Audit and Evidence Model

What Is Logged

Every enforcement event must be logged. The following event types must each produce a log entry:

  • Request received by Enforcement Gateway (structural outcome: accepted / rejected)
  • Validation result from Request Validator (outcome and reason code)
  • Consent lookup result (outcome, consent record identifier if found, reason code if not)
  • Policy evaluation result (outcome, policy version, applicable rule identifiers)
  • Final decision from Decision Engine (ALLOW or DENY, complete reason chain)
  • Audit Log write confirmation or failure
  • Artifact generation outcome (for ALLOW decisions)

Log Entry Format

Each log entry must include at minimum: event type identifier; timestamp (ISO 8601, UTC); request identifier; subject identifier; decision outcome; reason code; policy version identifier; consent record identifier (if applicable). Log entries must be structured and machine-parseable. Free-form text fields are prohibited in mandatory fields.

Log Entry Schema (Minimal)
{
  "event_type":        string,      // GATEWAY_RECEIVED | VALIDATION_RESULT | CONSENT_LOOKUP
                                    // POLICY_EVAL | DECISION | ARTIFACT_GENERATED
  "timestamp":         ISO8601/UTC,
  "request_id":        uuid,
  "subject_id":        string,
  "decision":          "ALLOW" | "DENY",
  "reason_code":       string,      // from Denial Condition Registry
  "policy_version":    string,
  "consent_record_id": string | null,
  "artifact_id":       string | null  // present on ALLOW decisions only
}

Immutability Assumptions

In the minimal reference implementation, append-only immutability is implemented by prohibiting any delete, update, or overwrite operation on the log store. Log entries are written sequentially with a monotonically increasing sequence number. In production systems, cryptographic immutability guarantees must be applied; this is specified in the QODIQA Security and Cryptographic Profile.

Evidence Generation Triggers

Decision artifacts are generated only for ALLOW decisions. Artifacts are not generated for DENY decisions; the Audit Log entry for a DENY decision constitutes the full evidence record. Artifact generation is triggered immediately after the Decision Engine issues an ALLOW decision and before the decision is returned to the Enforcement Gateway.

#Minimal Data Model

8.1 Consent Object

Consent Object Schema
{
  "consent_id":       uuid,          // unique record identifier
  "subject_id":       string,        // data subject or acting entity identifier
  "scope":            string[],      // list of authorized scope identifiers
  "purpose":          string[],      // list of authorized purpose identifiers
  "granted_at":       ISO8601/UTC,   // timestamp of consent grant
  "expires_at":       ISO8601/UTC,   // hard expiry; null not permitted
  "revoked":          boolean,       // true if consent has been revoked
  "revoked_at":       ISO8601/UTC | null,
  "grantor_id":       string         // identity of consent-granting entity
}

A consent object is valid if and only if: revoked is false, the current timestamp is before expires_at, the requested scope is contained within the scope array, and the declared purpose is contained within the purpose array. Any condition not met renders the consent object invalid for the given request.

8.2 Request Context

Request Context Schema
{
  "request_id":     uuid,          // unique request identifier, caller-supplied
  "subject_id":     string,        // identity of the acting entity
  "declared_purpose": string,      // single purpose identifier for this request
  "requested_scope":  string,      // single scope identifier for this request
  "timestamp":      ISO8601/UTC,   // request creation timestamp
  "caller_context": {
    "source_ip":    string | null,
    "agent_id":     string | null   // optional upstream agent identifier
  }
}

8.3 Policy Structure

Policy Snapshot Schema
{
  "policy_id":      string,        // unique policy identifier
  "version":        string,        // semver or monotonic version string
  "effective_at":   ISO8601/UTC,
  "rules": [
    {
      "rule_id":    string,
      "scope":      string,        // scope this rule applies to
      "purpose":    string,        // purpose this rule applies to
      "condition":  object,        // structured condition expression (no free text)
      "effect":     "PERMIT" | "DENY"
    }
  ]
}

Policy snapshots are immutable once published. The Policy Engine must load the snapshot identified by the current policy version and evaluate all applicable rules. Modifications to published snapshots are prohibited. New versions must be published as distinct snapshots with new version identifiers.

8.4 Decision Record

Decision Record Schema
{
  "decision_id":        uuid,
  "request_id":         uuid,
  "subject_id":         string,
  "decision":           "ALLOW" | "DENY",
  "reason_code":        string,
  "consent_record_id":  uuid | null,
  "policy_version":     string,
  "evaluation_trace": {
    "validation_result":  "VALID" | "INVALID",
    "consent_result":     "FOUND" | string,    // reason code if not FOUND
    "policy_result":      "PERMITTED" | string // reason code if not PERMITTED
  },
  "decided_at":         ISO8601/UTC,
  "artifact_id":        uuid | null            // populated for ALLOW decisions only
}

#Deployment Model

The reference implementation is designed for single-node deployment. All components run within a single process or within a single trusted host environment. No distributed coordination, consensus protocol, or network-separated component topology is required or assumed.

Single-Node Acceptability

A single-node deployment is fully conformant with this specification. The reference implementation does not require replication, load balancing, or distributed storage. These are production concerns addressed in companion specifications.

The Consent Registry may be implemented as an in-memory key-value store seeded from a static file at startup. The Audit Log may be implemented as a local append-only file with sequential write semantics. The Policy Engine loads policy snapshots from a local filesystem path at initialization. No external service dependencies are required for baseline operation.

The runtime boundary is defined as: the enforcement stack process, the consent registry data source, the policy snapshot store, and the audit log destination. All must be present and operational before the Enforcement Gateway accepts any inbound requests. A startup check must verify all component availability and must refuse to accept requests if any component is unavailable.

Network exposure of the enforcement stack is outside the scope of this specification. In production deployments, the enforcement stack must be protected from unauthorized access; this is addressed in the QODIQA Security and Cryptographic Profile.

#Non-Goals

The following are explicitly outside the scope of this specification. An implementation that addresses these areas is not prohibited, but conformance with this specification does not require them and does not assess them.

Scalability

This specification makes no performance or throughput requirements. Horizontal scaling, load distribution, caching, and latency optimization are not addressed and must not be assumed from this reference.

Full Production Security

This specification does not define a production security posture. Authentication of callers, transport security, component isolation, secret management, and hardening against adversarial inputs are outside scope and are addressed in the QODIQA Security and Cryptographic Profile.

Distributed Systems

No distributed consensus, eventual consistency, partition tolerance, or multi-node coordination is defined or required. These concerns are addressed in the QODIQA Reference Architecture for Deterministic Runtime Consent Enforcement.

Advanced Identity Systems

This specification uses opaque string identifiers for subjects and grantors. PKI, federated identity, hardware attestation, and verifiable credentials are not addressed and must not be assumed from the minimal data model defined herein.

Consent Capture and Lifecycle Management

This specification addresses consent enforcement only. Consent capture, revocation workflows, consent versioning, and user-facing consent management interfaces are outside scope.

#Conformance Alignment

This reference implementation is designed to demonstrate compliance with the QODIQA Core Standard and the 68-Point Enforcement Framework. The following table maps key implementation behaviors to their governing framework principles.

Conformance Mapping — Implementation to QODIQA Framework
Implementation Behavior QODIQA Core Invariant 68-Point Framework
All requests pass through Enforcement Gateway before inference Enforcement boundary is absolute Points 1–4: Boundary enforcement
Consent explicitly resolved before policy evaluation Consent separation from policy Points 12–18: Consent resolution
Deterministic decision: ALLOW or DENY only Binary decisioning, no ambiguity Points 19–26: Decision determinism
All undefined states resolve to DENY Fail-closed semantics Points 27–34: Fail-closed guarantees
Every decision written to append-only log before response Auditability is unconditional Points 40–48: Audit requirements
Policy evaluated against immutable versioned snapshot Policy immutability Points 49–55: Policy integrity
ALLOW decisions produce signed decision artifacts Verifiable authorization Points 56–62: Evidence model

#Validation Scenarios

The following scenarios constitute the minimal conformance test suite for this reference implementation. Any conformant implementation must produce the specified outcome for each scenario. These scenarios may be executed as automated tests against a running implementation.

Scenario 1 — Valid Consent, Permitted Policy: ALLOW

Preconditions
  • Consent record exists for subject, scope, and purpose
  • Consent record is not expired and not revoked
  • Policy snapshot is loaded and applicable rule effect is PERMIT

Expected outcome: Decision Engine issues ALLOW. Decision artifact is generated. Audit Log entry written with decision ALLOW. Inference execution is permitted.

Scenario 2 — Missing Consent: DENY

Preconditions
  • No consent record exists for the given subject, scope, and purpose combination
  • Policy snapshot is otherwise valid

Expected outcome: Consent Registry returns CONSENT_NOT_FOUND. Decision Engine issues DENY with reason code CONSENT_NOT_FOUND. No artifact is generated. Audit Log entry written with decision DENY. Inference execution is blocked.

Scenario 3 — Invalid Scope: DENY

Preconditions
  • Consent record exists but does not include the requested scope identifier
  • All other inputs are valid

Expected outcome: Decision Engine issues DENY with reason code CONSENT_SCOPE_MISMATCH. No artifact is generated. Audit Log entry written with decision DENY. Inference execution is blocked.

Scenario 4 — System Failure: DENY

Preconditions
  • Consent Registry is unavailable (simulated by shutting down registry component)
  • Request is otherwise well-formed and valid

Expected outcome: Decision Engine issues DENY with reason code CONSENT_UNAVAILABLE. No artifact is generated. System does not fall back to implicit consent or default-allow. Audit Log entry written if log is available; if Audit Log is also unavailable, DENY is still returned and system records the failure in its internal error state.

Scenario 5 — Expired Consent: DENY

Preconditions
  • Consent record exists but expires_at is in the past
  • All other inputs are valid

Expected outcome: Consent Registry returns CONSENT_EXPIRED. Decision Engine issues DENY with reason code CONSENT_EXPIRED. Inference execution is blocked.

#Conclusion

This specification defines a minimal, self-contained reference implementation of the QODIQA enforcement model. It is not a production system. It is the smallest correct instantiation of the enforcement properties required by the QODIQA Core Standard, expressed in concrete component definitions, data structures, flow sequences, and validation scenarios.

The reference implementation demonstrates that deterministic runtime consent enforcement is achievable in a minimal configuration. Seven components are sufficient to implement the complete enforcement pipeline: a gateway, a validator, a consent registry, a policy engine, a decision engine, an audit log, and an artifact generator. Each has a precisely bounded responsibility. The interaction between them is fully specified. All failure modes resolve to denial. No ambiguity is permitted at any stage.

This specification serves as the bridge between the QODIQA Core Standard's normative requirements and the operational realities of production deployment. Teams building production enforcement systems should use this reference as their behavioral baseline, validating each component against the scenarios defined in Section 12 before extending the stack with production-grade capabilities: distributed deployment, cryptographic proof generation, high-availability configurations, and advanced identity integration.

The enforcement model defined here is intentionally minimal, but it is not simplified. Every component and every constraint is present because removing it would compromise the correctness of the enforcement guarantee. Fail-closed behavior, audit unconditionally, consent-before-policy, and binary decisioning are not optional features; they are the properties that make the enforcement model trustworthy. Production implementations may add capabilities above this baseline, but they must not remove any of its behavioral guarantees.

Runtime consent enforcement represents a structural shift in how AI systems are governed: from documentation and retrospective accountability toward execution-layer control and verifiable authorization. This reference implementation is a concrete demonstration that the shift is achievable and that its core properties can be implemented, tested, and validated with precision.

#Document Status and Corpus Alignment

This document is the Reference Implementation Specification of the QODIQA standard corpus. It defines a minimal, deterministic enforcement stack demonstrating runtime consent validation, fail-closed decisioning, and verifiable audit logging at the AI inference boundary.

This specification is normative within its defined scope. It provides the concrete behavioral reference against which production implementations of the QODIQA enforcement model are validated. It should be read in conjunction with the following documents:

  • QODIQA — Consent as Infrastructure for Artificial Intelligence Technical Whitepaper
  • QODIQA — Core Standard for Deterministic Runtime Consent Enforcement
  • QODIQA — 68-Point Enforcement Framework for Deterministic Runtime Consent Enforcement
  • QODIQA — Reference Architecture for Deterministic Runtime Consent Enforcement
  • QODIQA — Security and Cryptographic Profile for Runtime Consent Enforcement
  • QODIQA — Terminology and Normative Definitions
  • QODIQA — Threat Model and Abuse Case Specification
  • QODIQA — Certification Framework for Deterministic Runtime Consent Enforcement
  • QODIQA — Governance Charter for the QODIQA Standard Corpus

Version 1.0 represents the initial formal release of this document as part of the QODIQA standard corpus.


For strategic inquiries, architectural discussions, or partnership exploration:

Bogdan Duțescu

bddutescu@gmail.com

0040.724.218.572

Document Identifier QODIQA-RIS-2026-001
Title Reference Implementation Specification (Minimal Deterministic Enforcement Stack)
Subtitle Minimal Deterministic Enforcement Stack for Runtime Consent Validation
Publication Date April 2026
Version 1.0
Document Type Reference Implementation Specification
Document Status Normative
Governing Authority QODIQA Governance Charter
Integrity Notice Document integrity may be verified using the official SHA-256 checksum distributed with the QODIQA specification corpus.