Date: 2026-07-23
Branch: codex/data-rule-execution-m3a-m5
Lifecycle boundary: Task 6 consumes only plans already marked published.
It does not add, relax, or emulate the Task 7 publication gate.
Task 6 now provides a production-wired path from a signed Runner task to one
server-attested rule_runs record, optional durable violation evidence, and a
closed artifact-only handoff to the next node.
The implementation includes:
PostgresRuleEvidenceWriter with canonical deployment, component, rule
version, plan hash, DataFlow, workflow version, node, and correlation
attestation;running to success, failed, unknown, or cancelled
finalization with row counts, timings, commit outcome, and bounded public
result;unknown and is never blindly re-executed;pending to verified MinIO upload to ready sample state machine with
digest, schema hash, reference, expiry, and bounded TTL cleanup;dataops-staging://<uuid> SQL receipt for same-source pushdown
handoff, bound to producer run, deployment, correlation, dataset binding,
binding hash, relation digest, commit state, and expiry;input_artifact expressions;
governed rule fan-in is rejected until an explicit merge component exists;output_artifact field matching the Kestra expression
contract while retaining the full bounded result object.Migrations 20260723_160 and 20260723_170 extend the existing evidence
tables without changing historical migrations 110, 140, or 150.
rule_runs gains:
evidence_key with a unique constraint;commit_outcome;public_result;failure_code and updated_at.rule_violation_samples gains:
legacy, pending, ready, and failed handoff states;Downgrade is deliberately rejected because deleting execution evidence would break audit and replay guarantees.
Migration 160 explicitly preflights duplicate legacy rule_run_id samples and
legacy samples over 100 rows before adding constraints. Migration 170 adds
leases, exact task deployment identity, bounded replay fields, evidence
digests, and SQL staging receipts.
The local Docker PostgreSQL was upgraded through the formal
20260723_150 -> head Alembic path. Two isolated real PostgreSQL tests prove
that duplicate and oversized legacy samples abort with a clear diagnostic and
leave Alembic at revision 150.
The initial fail-first slice produced five expected failures:
RulePlanExecutor did not accept
an evidence writer;A second fail-first assertion proved that the Polars adapter did not expose a bounded violation sample before the worker implementation was added.
Final review verification:
129 passed;1 passed;4 passed;150 -> head migration acceptance: 2 passed;594 passed, 28 skipped, 59 subtests passed;All checks passed!;git diff --check: passed;The production-path integration uses:
PostgresRulePlanRepository;PostgresArtifactResolver;PostgresRuleEvidenceWriter;RulePlanExecutor;It proves:
output_artifact reference and publishes a distinct output;unknown instead of being reclaimed;failed/not_committed;unknown/unknown;Task 6 deliberately does not decide whether a compiled plan may become published. Task 7 must require trusted generation, test, and preflight evidence before changing plan lifecycle state. The evidence added here is the immutable input to that gate, not a bypass around it.