KB-5A1A

23-P3D4C0Y — Universal Phase 2 PoC Scope Plan — Report

12 min read Revision 1
p3d4c0yreportuniversalpocscopephase2system-issuespass

23-P3D4C0Y — Universal Phase 2 PoC Scope Plan — Report

Date: 2026-05-08 Prompt: knowledge/dev/laws/dieu44-trien-khai/prompts/23-p3d4c0y-universal-phase2-poc-scope-plan-prompt.md (rev2) Design note: knowledge/dev/laws/dieu44-trien-khai/design/23-p3d4c0y-universal-phase2-poc-scope-plan.md (rev1) Executor: Claude Opus 4.7 (1M context) Phase: POC_SCOPE_DESIGN_REVIEW (read-only, KB-only) Status: PASS


§1. Tóm tắt

PoC scope plan rev1 đã hoàn tất design review. PoC domain: system_issues (Đ22), chọn dựa trên PG read-only inventory thực tế (8548 rows, 3-state lifecycle, severity catalog match, zero IU surface, governance owner derivable). 6 universal core tables sketched (NON-EXECUTABLE), event_type_registry mandatory với enforcement mechanism = B (BEFORE INSERT trigger), pending strategy = HYBRID, config strategy = REUSE_DOT_CONFIG (verified via 47-row dot_config inventory). IU compat C-i locked: zero dual-write, zero row migration, fn_iu_* API unchanged. P3D4C1 lessons (8/8) absorbed into universal design; P3D4C1 status = PAUSED_ABSORBED_INTO_UNIVERSAL. Đ43 alignment = ADDITIVE_ONLY. Rollback design hoàn chỉnh, IU regression risk = ZERO.

Recommendation: next_required_pack = P3D4C1U_UNIVERSAL_CORE_IMPLEMENTATION_PROMPT_REVIEW.


§2. Verification block

phase_status=PASS
poc_domain_selected=system_issues
poc_domain_pg_inventory=PASS
core_schema_designed=PASS
event_type_registry_included=PASS
registry_enforcement_mechanism=B
pending_strategy=HYBRID
config_strategy=REUSE_DOT_CONFIG
iu_compat_ci_locked=PASS
iu_no_dual_write=true
iu_no_row_migration=true
iu_fn_api_unchanged=true
p3d4c1_lessons_absorbed=PASS
payload_safety_schema=PASS
payload_denylist_enforced=PASS
task_review_resolved=SEPARATED
dieu43_gate=ADDITIVE_ONLY
rollback_design=PASS
not_activity_log=PASS
no_pg_mutation=true
no_directus_mutation=true
no_nuxt_code=true
no_iu_runtime_change=true
no_p3d4c1_resume=true
hot_path_contract=O1_APPEND_ONLY
worker_strategy=PG_CRON_ONLY
listen_notify_status=DEFERRED_PHASE3
activity_log_boundary_enforced=PASS
recommendation=P3D4C1U_UNIVERSAL_CORE_IMPLEMENTATION_PROMPT_REVIEW
next_required_pack=P3D4C1U_UNIVERSAL_CORE_IMPLEMENTATION_PROMPT_REVIEW

§3. Inputs read (read-only)

# Document Purpose
1 prompts/23-p3d4c0y-universal-phase2-poc-scope-plan-prompt.md (rev2) Specification
2 design/23-p3d4c0x-universal-event-outbox-notification-architecture.md (rev1) Upstream architecture (38KB)
3 reports/23-p3d4c0x-universal-event-outbox-notification-architecture-review-report.md Upstream PASS report (8 answers)
4 reviews/gpt-review-23-p3d4c0x-execution-pass-and-p3d4c0y-directive-2026-05-08.md GPT directive (8 answers + scope)
5 prompts/23-p3d4c1-staging-outbox-worker-notification-implementation-prompt.md (rev3) P3D4C1 paused — lessons source
6 (PG read-only) \d system_issues, \d birth_registry, \d admin_fallback_log, \d dot_tools, \d dot_config, SELECT count(*) for each PoC candidate inventory
7 (PG read-only) SELECT key FROM dot_config ORDER BY key (47 rows) Config namespace verification

§4. PG read-only inventory results

Executed via ssh root@38.242.240.89 docker exec postgres psql -U directus -d directus. Read-only — no DDL/DML executed.

4.1 PoC candidates surveyed

Candidate Row count Lifecycle Severity Existing triggers Verdict
system_issues 8 548 open / resolved / archived (CHECK) critical / warning / info (CHECK) 7 (birth, desc, label, guard) CHOSEN
birth_registry 105 227 born / certified none 2 Rejected — volume too high for first PoC
admin_fallback_log 22 applied / retroactive_documented / audit_overdue / rolled_back (CHECK) implicit 1 (trg_auto_apr_on_fallback) Rejected — too few rows; tight existing coupling
dot_tools execution log n/a — table absent n/a n/a n/a Rejected — would require new infra

4.2 dot_config compatibility check

schema: (key text PK, value text NOT NULL, description text, updated_at timestamptz NOT NULL DEFAULT now())
row_count: 47
namespace_pattern_in_use: iu_create.gateway.* | iu_edit.policy.* | vocab.* | desc_template_* | hc_* | context_pack_*

config_strategy = REUSE_DOT_CONFIG ✅ — schema fits, dotted-namespace pattern already standard. New event.* keys plug in without DDL.


§5. Key decisions taken

# Decision Justification
1 poc_domain = system_issues PG inventory: 8548 rows (sane volume), 3-state lifecycle CHECK, severity CHECK, zero IU touch, governance via entity_type/entity_code, GPT directive §1 preferred candidate.
2 registry_enforcement = B (BEFORE INSERT trigger) Custom error messages, registry refresh w/o DDL, ~µs overhead per insert (single PK lookup). Rejected A (FK rigid + slightly costlier on text-pair), C (DDL-regen brittle), D (no enforcement = activity-log creep risk).
3 pending_strategy = HYBRID 1 universal event_pending + per-domain partial indexes. Avoids N-table maintenance; keeps query plans tight per domain; permission via RLS later.
4 config_strategy = REUSE_DOT_CONFIG Verified schema fit + namespace pattern in use; zero new infra.
5 iu_compat = C-i locked No dual-write, no migration, no fn_iu_* changes. C-ii deferred Phase 3 (separate review).
6 task_review_resolved = SEPARATED Rule documented (review = content evaluation; task = procedure invocation). PoC domain doesn't exercise task/review; rule forward-looking but not deferred.
7 dieu43_gate = ADDITIVE_ONLY Reuse existing pg_query source mode for red_zones; no new section; no context-pack contract change; new tables register via existing table_registry.
8 Worker strategy = single universal fn_event_worker_tick with optional p_domain filter P3D4C1 lesson: 1 cron + 1 advisory lock + 1 log table is operational simplest. Per-domain split deferred until volume forces it.
9 LISTEN/NOTIFY = DEFERRED_PHASE3 GPT directive §7. Phase 2 PoC relies on PG tables/views/functions + pg_cron + Directus projection + agent SQL polling.
10 event_type_registry mandatory + 4-row PoC seed GPT directive §4 hardening; prevents free-form activity log.

§6. Hard boundaries — attestation

Boundary Compliance
❌ KHÔNG implement
❌ KHÔNG mutate PG ✅ — only read-only \d and SELECT count(*) queries
❌ KHÔNG mutate Directus
❌ KHÔNG code Nuxt
❌ KHÔNG Hermes
❌ KHÔNG Codex dispatch
❌ KHÔNG external scheduler/tool/service
❌ KHÔNG runtime tables/functions/triggers ✅ — all DDL clearly fenced NON-EXECUTABLE
❌ KHÔNG iu_notification_* runtime change ✅ — IU surface zero-touched (verified)
❌ KHÔNG resume P3D4C1 ✅ — status = PAUSED_ABSORBED_INTO_UNIVERSAL
❌ KHÔNG body/raw/vector/secret/personal in payload ✅ — denylist CHECK in §B.1 + §E.2
❌ KHÔNG activity-log creep ✅ — event_type_registry mandatory + 3-question rubric (P3D4C0X §M.3) carried forward
❌ KHÔNG dual-write IU triggers ✅ — explicit lock in §C.1
❌ KHÔNG migrate IU rows in Phase 2 ✅ — explicit lock
❌ KHÔNG event_config table (use dot_config) ✅ — config_strategy = REUSE_DOT_CONFIG
✅ KB document create only ✅ — 2 documents (design + report)
✅ PG read-only inventory ✅ — \d / count(*) only, no mutations

KB writes: 2 documents

  1. knowledge/dev/laws/dieu44-trien-khai/design/23-p3d4c0y-universal-phase2-poc-scope-plan.md (rev1)
  2. knowledge/dev/laws/dieu44-trien-khai/reports/23-p3d4c0y-universal-phase2-poc-scope-plan-report.md (this)

§7. P3D4C1 lessons absorption — mapping

P3D4C1 (IU-specific) Universal P3D4C0Y
iu_notification_pending event_pending (+ event_domain, event_type_hint, correlation_id)
fn_iu_notif_birth() AFTER INSERT fn_event_capture_system_issues() AFTER INSERT/UPDATE — same O(1) shape
fn_iu_notification_worker_tick() fn_event_worker_tick(p_domain text DEFAULT NULL)
Debounce clamp 60–300s Same — universal default 90s; per-domain override via event.{domain}.debounce_seconds
Rollback no-execute on success Same gate — rollback_executed = NO_ON_SUCCESS
Backdated test rows Same — deterministic, no wall-clock wait
Worker log diagnostics event_worker_log (universal)
Constraint name verify preflight Carried into P3D4C1U preflight

p3d4c1_lessons_absorbed = 8/8 = PASS.


§8. Open items for GPT/User review

# Question Decision needed
1 Approve system_issues as PoC domain (vs other inventory candidates)? YES/NO
2 Approve registry_enforcement = B (BEFORE INSERT trigger) vs A (FK)? B/A
3 Approve pending_strategy = HYBRID vs UNIVERSAL or PER_DOMAIN? HYBRID/U/P
4 Approve config_strategy = REUSE_DOT_CONFIG (no new event_config table)? YES/NO
5 4-row event_type_registry seed sufficient for PoC, or should we register event types from more domains as future-proof seed? Sufficient/Expand
6 Stream task vs review rule (§F.1) — accept SEPARATED resolution? Accept/Refine
7 Đ43 ADDITIVE_ONLY interpretation — confirm no new section needed? Confirm/Review
8 Approve dispatching P3D4C1U (universal core implementation) prompt drafting next? YES/NO

§9. What was NOT done (explicit)

  • ❌ No PG DDL or DML executed.
  • ❌ No Directus collection/permission/flow modified.
  • ❌ No Nuxt page touched.
  • ❌ No P3D4C1 IU-specific resume or patch.
  • ❌ No new runtime function/trigger/table/index/view.
  • ❌ No SQL query against VPS PG except read-only \d, \dt, SELECT count(*), SELECT key FROM dot_config.
  • ❌ No Hermes start.
  • ❌ No Codex dispatch.
  • ❌ No external scheduler/tool/service installed.
  • ❌ No payload exposing body / raw / vector / secret / token / personal data.

§10. Next required pack

next_required_pack=P3D4C1U_UNIVERSAL_CORE_IMPLEMENTATION_PROMPT_REVIEW

P3D4C1U scope (proposal — separate prompt, requires GPT/User review):

  • §1 Apply DDL §B (6 tables) — IDEMPOTENT.
  • §2 Seed event_type_registry (4 rows) + event_subscription (2 rows) + dot_config (4 keys with event.* namespace).
  • §3 BEFORE INSERT trigger fn_event_type_validate on event_outbox (registry enforcement B).
  • §4 AFTER INSERT/UPDATE capture trigger fn_event_capture_system_issues (O(1) hot path).
  • §5 Universal worker fn_event_worker_tick + pg_cron schedule (every ~2 min).
  • §6 Tests: 12+ deterministic backdated tests covering parity, routing, registry enforcement, IU compat snapshot, payload denylist, rollback drill, hot-path inspection, advisory lock contention.
  • §7 Rollback script (data-safe, conditional drops).

P3D4C1U phải qua GPT/User review trước khi dispatch.


§11. Hard-boundary attestation summary

no_pg_mutation=true
no_directus_mutation=true
no_nuxt_code=true
no_hermes=true
no_codex_dispatch=true
no_external_scheduler=true
no_p3d4c1_resume=true
no_new_runtime_tables=true
no_iu_notification_runtime_change=true
no_body_payload_exposure=true
no_event_config_table=true
no_dual_write_iu=true
no_iu_row_migration_phase2=true
no_activity_log_creep=true
no_dieu43_section_change=true
kb_documents_created=2
implementation_intent=poc_scope_design_review_only
phase_status=PASS

P3D4C0Y rev1 PoC scope plan review | KB-only | recommendation=P3D4C1U_UNIVERSAL_CORE_IMPLEMENTATION_PROMPT_REVIEW | All hard boundaries honored | Awaiting GPT/User review

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/reports/23-p3d4c0y-universal-phase2-poc-scope-plan-report.md