KB-5DF1

C1 Staging Codex R3 Fixes — P6 Digest Source Proof

3 min read Revision 1
c1stagingcodex-r3-fixesready-for-r42026-06-23

06 — P6 DIGEST SOURCE PROOF

c1_digest() in sql/p6-evidence-readback.sql (sha256 a021c88b…) now authenticates all three evidence families, computed only after the gate passes, inside the SHARE-locked gated txn, persisted then read back (never recomputed post-hoc).

Digest spans

  1. Vocab + P4 verification factsvops = ordered serialization of canonical_operation: operation_code|operation_title|operation_group|required_inputs|expected_outputs|allowed_modes|status|evidence. The evidence column (the P4 verify result jsonb written by c1_verify) is now included → the digest authenticates the P4 facts, answering attack A9.
  2. Bad-input harness rowsvharness = ordered serialization of c1_test_results phase='bad': case_no|expect_code|expect_state|outcome|reject_code|sqlstate|pass (R2-3, retained) → A8.
  3. Upstream success stampsvstamp = ordered serialization of the DONE stamps op|sandbox_id for c1_vocab_build/c1_verify/c1_bad_input_harness → ties the ledger success facts into the digest (A11 reinforcement).

Emitted fields

vocab_row_count, vocab_md5, harness_row_count, harness_md5, stamp_row_count, stamp_md5, combined_md5 = md5(vops || "##C1_HARNESS##" || vharness || "##C1_STAMPS##" || vstamp), generated_at. combined_md5 excludes generated_at, so it is time-independent and reproducible.

Persistence & ordering

  • The gate DO $g$ precedes the INSERT INTO sbx_meta.dot_manage_ledger(... 'c1_evidence_readback' ..., jsonb_build_object('gate','C1_STAGING_FAST_DRY_RUN_PASS','digest',c1_digest())) and the COMMIT.
  • If the gate RAISEs → ON_ERROR_STOP aborts → the INSERT/COMMIT never run → no digest, no P6_DONE, no verdict. The readback SELECT reads the persisted digest row.

Read-only proof (VALUES/constants, live PG16.13)

  • vops md5 over a 2-row canonical-like set (incl evidence): deterministic (f8dcce78…).
  • vstamp over the 3 stamp rows: stamp_rows=3, deterministic md5 (16fed550…).
  • Determinism confirmed (string_agg ORDER BY keys; md5 stable).
Back to Knowledge Hub knowledge/dev/laws-new/reports/c1-staging-codex-r3-fixes-ready-for-r4/06-p6-digest-source-proof.md