KB-21C4
22-P3-P1 — IU Gateway Policy Keys + Canonical Marker Patch — Report (PASS)
4 min read Revision 1
pack-22p3p1gatewaypolicycanonical-markerreportpass
22-P3-P1 — IU Gateway Policy Keys + Canonical Marker Patch — Report
Date: 2026-05-06 | Prompt: rev6 | Status: PASS — p3p2_readiness=READY Executor: Opus (Claude Code) on VPS 38.242.240.89, container
postgres, dbdirectusPilot canonical_address:pilot.p3.p1.20260506-070623.cbb29036
1. Final Verdict (machine-readable)
patch_state=UNPATCHED
function_replace=EXECUTED
sql_exit=0
post_exit=0
post_commit_status=PASS
leak_status=PASS
gateway_keys=9
pilot=pilot.p3.p1.20260506-070623.cbb29036
phase_status=PASS
p3p2_readiness=READY
2. Scope executed
- Policy keys seeded into
public.dot_config(9 keys, idempotent UPSERT, all underiu_create.gateway.%). fn_iu_createpatched to set transaction-local GUCapp.canonical_writer = 'fn_iu_create'viaset_config(..., true). Marker emitted only on the canonical create path (after preflight + classify, before INSERT).- No trigger guard created (P3-P2 scope).
- No GRANT/REVOKE, no role separation, no Directus changes, no cleanup, no DDL on data tables.
3. Preflight
| Check | Result |
|---|---|
dot_config.key unique guard |
constraint=1, index=1 (total=2) ✅ |
Pre-existing iu_create.gateway.% duplicates |
0 ✅ |
fn_iu_create source_hash_before |
5db9f7542c2e62e0cfefa01df43eb294 |
prosecdef / provolatile |
t / v ✅ |
PATCH_STATE |
UNPATCHED (clean install of marker) |
4. Transaction trace (single all-or-nothing BEGIN..COMMIT)
CREATE TEMP TABLE _p3p1_trg_baseline ON COMMIT DROP— capturediu_triggers=4,uv_triggers=0.INSERT ... ON CONFLICT DO UPDATE9 gateway policy keys.CREATE OR REPLACE FUNCTION public.fn_iu_create(...)— marker patch applied.- Post-patch audit:
- source_hash_after:
3017892a5ac605a6daeaa5348e2a6cdf prosecdef=t,provolatile=v,config=search_path=pg_catalog, publicmarker_check=MARKER_PRESENT✅- PUBLIC EXECUTE on
fn_iu_create/fn_iu_create_plan: 0 ✅ directushas EXECUTE on both: ✅
- source_hash_after:
- Pilot create + verify_invariants + idempotent re-call:
status=created,invariants_verified=trueinformation_unit= 1 row,unit_version= 1 row,birth_registry(collection=information_unit) = 1 row- Re-call returned
status=exists_complete; row count remained 1 ✅ - L1 birth-gate PILOT-ONLY warnings noted for
P-pub1/P-pub2(informational, expected pre-production).
- Trigger drift guard: post = pre (IU=4, UV=0) ✅
COMMIT.
5. Post-commit verification
| Check | Result |
|---|---|
current_setting('app.canonical_writer', true) outside writer xact |
(not set) → LEAK_STATUS=PASS ✅ |
fn_iu_verify_invariants(pilot) post-commit |
all_pass=true → POST_STATUS=PASS ✅ |
Required gateway keys present in dot_config |
9 / 9 ✅ |
6. Final table counts after commit
| Table | Count |
|---|---|
information_unit |
3 |
unit_version |
3 |
birth_registry (information_unit) |
3 |
(Pre-existing rows + 1 new pilot from this run.)
7. Boundaries honored
- ❌ No trigger guard (P3-P2)
- ❌ No GRANT/REVOKE
- ❌ No role separation
- ❌ No Directus changes
- ❌ No cleanup of pilot row
- ❌ No DDL beyond function replace
8. Readiness for P3-P2
p3p2_readiness=READY. Gateway is in prepared mode: marker is set on the canonical path; direct INSERT remains permitted (policy block_after_guard). P3-P2 may now design and deploy the trigger guard that asserts current_setting('app.canonical_writer', true) = 'fn_iu_create' on information_unit / unit_version writes.
9. Artifacts
- VPS log:
/tmp/22-p3-p1.20260506-070623.log(+.sqlcompanion). - Pilot row retained at
canonical_address = pilot.p3.p1.20260506-070623.cbb29036(cleanup out of scope).
22-P3-P1 rev6 executed 2026-05-06 07:06:23 UTC. PASS. Ready for P3-P2 design.