KB-CE39

11000x · 00 — PASS summary (Piece Event Runtime substrate + 8th healthcheck surface)

5 min read Revision 1
iu-corev0.611000xpiece-event-runtimemigration-029migration-030healthcheck-8th-surfacepass-summary

IU Core 11000x — Piece Event Runtime + Product Factory Foundation (PASS)

Macro tag: IU_CORE_11000X_PIECE_EVENT_RUNTIME_AND_PRODUCT_FACTORY_PASS Date: 2026-05-25 Repo: Huyen1974/iu-cutter — main Parent commit: d88d08b (10000x) This commit: pending — local working tree green at this report time

Outcome

Phase Status Notes
A. Baseline (repo / DB / gates / Qdrant / healthcheck / backup) PASS HEAD=d88d08b, 1305 tests, pg_dump 79.4MB sha c62ed38a…
B. Event runtime substrate (migration 029) PASS LIVE +1 view, +3 fns, +1 trigger, +2 config keys; all gated off
C. Emit hooks via lifecycle log trigger PASS LIVE TRIGGER on iu_lifecycle_log AFTER INSERT, gated by piece_event_runtime.emit_enabled (default false)
D. Worker / 8th healthcheck surface PASS LIVE piece_event_runtime surface returns ok=true
E. Product Factory foundation PARTIAL_AS_DESIGNED Live discovery: most primitives already exist (fn_iu_compose, full collection suite, text_as_code roundtrip, dot_iu_create_workflow_from_steps / dot_iu_create_file_from_pieces). 4 deferred items packaged as roadmap.
F. Bounded BEGIN/ROLLBACK proof PASS 4 phases all PASS; 0 rows persist
G. Regression PASS Qdrant 152/149/3 unchanged, lifecycle_log 146 unchanged, gates closed
H. Tests + DOT scan + reports PASS 1305 → 1324 (+19), D9 156 → 163 (+7), all 10 KB reports uploaded

Live discoveries that overrode the input pack

  1. 10000x defect: event_outbox.event_domain CHECK never included 'piece'. 10000x seeded piece.* into registry but the column constraint would have rejected any actual emission. Surfaced live by Phase B of the bounded proof. Fixed by migration 030.
  2. Product Factory is more built than input pack stated: live catalog already contained dot_iu_create_workflow_from_steps and dot_iu_create_file_from_pieces (both → fn_iu_compose); fn_iu_compose and the full fn_iu_collection_* suite are live; cutter_agent/iu_core/text_as_code.py already implements roundtrip_collection_manifest. Macro pivoted Product Factory from "build foundation" to "document live foundation + author-mode roadmap for the 4 remaining items".
  3. Trigger pattern chosen over fn-rewrite: emit hooks live in a NEW trigger on iu_lifecycle_log rather than CREATE OR REPLACE edits to the 100+ line fn_iu_supersede / fn_iu_piece_split / fn_iu_piece_merge functions. Much smaller blast radius; fail-closed by default.

Substrate at a glance

iu_lifecycle_log AFTER INSERT
  → trg_iu_lifecycle_log_emit_piece_event
     → fn_iu_lifecycle_log_emit_piece_event_trg
        (transition_type IN supersede/split/merge → maps to piece.* event_type)
        → fn_iu_piece_emit_event
           Gates (BOTH must be open):
             1. fn_iu_core_routes_enabled()        [master, currently true]
             2. piece_event_runtime.emit_enabled   [runtime, currently FALSE]
           Discriminator:
             piece_event_runtime.dry_run_only      [currently true]
           → INSERT event_outbox event_domain='piece'
              → v_piece_event_outbox

D9 surface (11000x)

Class 10000x 11000x Delta
table 25 25 0
view 23 24 +1
function 56 59 +3
trigger 5 6 +1
config 10 12 +2
event_type 21 21 0
route 16 16 0
total 156 163 +7

Live D9 conformance: every row reports ok=true.

Backup

/root/backups/directus-pre-iucore-11000x-20260525T000257Z.dump — sha c62ed38a342eec3b3e8d11b1d46d7597ac065c8769782a8439b4ec2178089fed.

Lessons (written to memory)

  • [[feedback-event-outbox-check-vs-registry-drift]]: registering an event_domain in event_type_registry is NOT enough; check the CHECK constraint on event_outbox.event_domain matches. 10000x missed this.
  • [[feedback-trigger-emit-over-fn-rewrite]]: emit hooks belong in a trigger on the audit log table, not as CREATE OR REPLACE edits to big lifecycle functions. Smaller blast radius, easier rollback.
  • [[feedback-pinning-tests-bump-per-macro]] (re-confirmed): 13 test files pin DOT counts and required bumps in this commit. The one-stop trip wire test_iu_core_ddl.py::EXPECTED_COUNTS was hit first and pointed to the rest.

What did NOT happen

  • production_documents collection: untouched
  • PR #669: not merged (still OPEN/MERGEABLE per last check)
  • retention: not enabled (iu_core.retention_enabled='false')
  • Nuxt deploy: not triggered
  • Qdrant: 152 sync rows / 149 indexed / 3 dryrun — byte-identical
  • Three-axis auto-refresh: still gated off
  • Piece event emission: gate is false, dry_run_only is true; even if an operator flipped emit_enabled, the first emit batch would be dry-run.
Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-iu-core-11000x-piece-event-runtime-product-factory-open-goal/00-pass-summary.md