RIL to Database Governed Writes
This page defines the source-only evidence contract for B804 stage D1. It is
not production, release, hosted-service, or customer-installation proof. The
governed write capability remains owner-evidence-pending until the owner
repositories provide executable proof and the public claim ledger is promoted.
Ownership Boundary
retvest-rilowns the governed-write semantics, provenance receipt shape, receipt digest reuse, deterministic chain verification, and adversarial scenario.retvest-platformowns production Postgres deployment, tenant and authorization enforcement at API boundaries, migrations, backup and restore, retention, observability, and customer deployment evidence.retvest-siteowns this evidence-intake contract and the guard against premature public claims. The site does not implement or attest database behavior.
Stage D1 uses existing internal interfaces in this round. This page does not claim a new public endpoint, SDK method, or shared OpenAPI surface.
D1 Invariants
An owner proof is acceptable only when all of these invariants hold against a real local Postgres process:
- Every accepted history row binds the tenant, record, version, payload,
agent_id,authority_id, evidence identifiers, write time,previous_hash, androw_hash. - Authority is lease-bounded. The agent, authority, namespace, token, and write time must match one active lease. The authorization check and write commit form one consistency boundary; uncertainty fails closed.
- Evidence is mandatory. D1 reuses RIL receipt and digest semantics rather than creating a second mutable evidence authority in Postgres.
- History is append-only. Concurrent appends preserve a unique monotonic
version order, and each
previous_hashpoints to the precedingrow_hash. - Verification independently re-derives every row hash and the chain head. Updating, deleting, reordering, or splicing history must be detectable.
- Lease tokens and private evidence bodies are never emitted by the public evidence packet or history rendering.
Postgres is the consistency-first source of truth for this path. A database error, missing authority, expired or not-yet-active lease, wrong agent, wrong namespace, invalid token, or missing evidence rejects the write without creating a current record or history row.
Required Adversarial Proof
The owner proof requires the test file
ril/tests/test_governed_postgres.py against a real local Postgres process. A
skip, monkeypatch, application dependency override, in-memory substitute, or
static source scan is not database behavior proof.
The proof must include all of the following:
- an accepted write that stamps agent, authority, and evidence provenance;
- a second write whose
previous_hashequals the firstrow_hash; - an out-of-lease matrix covering early, expired, wrong-agent, invalid-token, and unknown-authority writes, each denied with zero persisted rows;
- missing-evidence denial with zero persisted rows;
- concurrent appends that preserve every version and verify the chain;
- update and delete attempts rejected by append-only database enforcement; and
- deliberate history-payload tampering detected as
receipt_column_mismatchbefore a forged row can verify.
The command output is local owner proof only. It must not include lease-token values, customer payloads, raw evidence bodies, private evidence references, database credentials, or customer identifiers.
Promotion Boundary
D1 remains source-only and ready: false. Public copy must not say that
governed Postgres writes are shipped, production-ready, generally available,
customer-installed, or covered by an SLA until RIL proof, platform migration
and deployment proof, sanitized customer evidence, and launch-readiness review
all exist.