KB-6915

10000x · 07 — Piece Event Runtime foundation package (6 piece.* events live, inert)

3 min read Revision 1
iu-corev0.610000xpiece-eventsevent-runtimefoundationauthor-modeops-package

10000x · 07 — Piece Event Runtime foundation package

Package location

ops/piece-event-runtime-package-10000x/

README.md                                   — package overview + apply checklist
01-piece-event-type-seed.sql                — APPLIED LIVE (idempotent INSERT 6 rows)
02-piece-event-outbox-substrate-design.md   — design-only (NOT a migration)
03-rollback.sql                             — DELETE the 6 seed rows
04-author-mode-verification.sql             — READ-ONLY 5 checks (V1..V5)

What was applied live

01-piece-event-type-seed.sql — 6 rows inserted into public.event_type_registry:

event_domain.event_type event_stream delivery_lane
piece.created birth immediate
piece.updated update immediate
piece.split update immediate
piece.merged update immediate
piece.retired update immediate
piece.superseded update immediate

All active=true, default_severity='info'. Idempotent via ON CONFLICT (event_domain, event_type) DO NOTHING.

Live verification (V1..V5 all pass)

V1_row_count       |    6 | t   -- exactly 6 piece-domain rows
V2_all_active      |    6 | t   -- every row active=true
V3_stream_allowed  |        t   -- every event_stream in CHECK allowlist
V4_immediate       |        t   -- every delivery_lane='immediate'
V5_name_set        |        t   -- exact name set match

Why the seed is inert today

No function emits these events yet. iu_piece_event_outbox (the ledger where emissions would land) does not exist — specified in 02- for a future macro.

Until that table exists and the lifecycle primitives are rewritten to INSERT into it, the 6 registered event types are pure metadata. The existing event_outbox / fn_iu_emit_event machinery will not pick them up because (a) no INSERT writes them, and (b) the IU Core routes master gate stays false.

What 02- specifies for the next macro

  • public.iu_piece_event_outbox with FK to event_type_registry, partial index on delivered_at IS NULL, correlation_id column for split/merge bundling.
  • Per-fn emit hooks added inside fn_iu_create, fn_iu_supersede, fn_iu_retire, fn_iu_piece_split, fn_iu_piece_merge after post-write read-back.
  • cutter_agent/iu_core/piece_event_handler.py — route_worker subclass.
  • 8th healthcheck surface piece_events_backlog.
  • DOT commands dot_iu_piece_event_dead_letter + dot_iu_piece_event_replay.
  • New gate iu_core.piece_events_enabled (default false).

DOT scan registration

The 6 new event types are now in the SSOT of sql/iu-core/runtime/110_iu_core_dot_conformance_scan.sql. D9 event_type expected count bumped 15 -> 21. Live D9 reports event_type | 21 | 21 | t.

Rollback path

03-rollback.sql deletes the 6 seed rows. Safe at any point in this macro's scope because no iu_piece_event_outbox row references them yet (the table doesn't exist).

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-iu-core-10000x-piece-platform-dot-lifecycle-open-goal/07-event-runtime-package.md