KB-42D6

TD — P3D Phase 1 Notification Display Remaining Work Before Nuxt Law Pause

12 min read Revision 1
tdp3dphase1notificationnuxt-lawtable-modulecheckpointpause

TD — P3D Phase 1 Remaining Work: Show Notification Before Nuxt Law Pause

Date: 2026-05-08
Owner: GPT / Incomex Hội đồng AI
Purpose: External-memory checkpoint before pausing notification display work to redesign Nuxt/UI/template law.
Status: PAUSE NOTIFICATION IMPLEMENTATION HERE. Finish Nuxt law/template governance first.


0. User directive

Nuxt hiện đang lộn xộn và có rác lịch sử. Không được tiếp tục bằng cách thêm một dòng hardcode cho từng nhánh/bảng.

Trước khi đấu nối phần notification display, cần dừng lại để:

  1. Quy hoạch lại toàn bộ phần hiển thị Nuxt.
  2. Gom các quy định rải rác về UI/template/khuôn mẫu về một mối.
  3. Xem nên đưa vào luật hiện có hay tạo luật mới, có thể là Điều 45 — Luật Nuxt / Hiển thị / Khuôn mẫu.
  4. Hoàn thiện các công cụ/khuôn dùng chung trước.
  5. Sau đó mới quay lại đấu nối notification display.

Nguyên tắc điều hành:

Những gì máy móc làm được thì không dùng con người.
Không tạo UI riêng.
Không hardcode từng nhánh nếu có thể registry/config-driven.
Không làm double chức năng đã thuộc luật/chức năng chuyên môn khác.
Nếu module cũ thiếu → dừng sửa module chung, không workaround cục bộ.

1. Mục tiêu cuối Giai đoạn 1

Mục tiêu cuối Giai đoạn 1 là:

User xem được notification / event board qua web bằng hạ tầng mẫu dùng chung.

Không phải mục tiêu:

  • không tạo notification UI riêng;
  • không tạo route/component riêng cho notification;
  • không bypass Table Module;
  • không click-config Directus;
  • không để manual smoke là trạng thái cuối.

2. Trạng thái đã hoàn thành

2.1 Universal event core đã live

P3D4C1U PASS. Universal event core đã hoạt động trên PG production cho system_issues.

Live objects:

  • event_type_registry
  • event_outbox
  • event_read
  • event_subscription
  • event_pending — seam delayed, hiện không dùng worker
  • registry validation trigger trên event_outbox
  • capture trigger trên system_issues
  • fn_event_unread
  • fn_event_mark_read

Không có:

  • worker;
  • pg_cron;
  • polling;
  • fn_event_board;
  • Nuxt code;
  • IU runtime mutation.

Architecture accepted:

Immediate single events → trigger writes durable event_outbox directly.
Delayed/batch/noisy events → event_pending + worker only when genuinely needed later.

2.2 P3D4C2U view path blocked and rolled back

Attempted path:

PG view v_event_outbox_table → Directus collection → table_registry

Blocked because Directus/knex-schema-inspector did not recognize id uuid projected through a PG view as primary key.

Result:

  • blocked correctly;
  • rollback clean;
  • no residual view/collection/permission/registry row;
  • event core and IU untouched.

Lesson:

Do not force Directus PG view PK when convention has already failed.
Use real table with real PK or shared module convention.

2.3 Option D implemented in scope

Option D selected and executed:

event_outbox base table
+ Directus field-level read allowlist
+ table_registry field config allowlist

Execution result:

  • Directus permission id=1483 created for Public Access policy.
  • Permission allows 14 metadata fields only.
  • Unsafe fields rejected with HTTP 403:
    • safe_payload
    • correlation_id
    • causation_id
  • table_registry row id=21 created:
    • table_id=tbl_event_outbox
    • collection=event_outbox
    • status=draft
    • page_url=/knowledge/registries/event_outbox
    • _dot_origin=P3D4C2U_D|2026-05-08
  • DirectusTable fetch path proved safe:
    • web/components/shared/DirectusTable.vue
    • web/composables/useDirectusTable.ts
    • reads table_registry.fields
    • passes fields= into Directus readItems
    • runtime auth is Public role on SSR / user session on client, not admin token
  • IU/event core unchanged.
  • No view, no worker, no cron, no Nuxt code.

2.4 Current status

phase_status=PASS_IN_SCOPE
published=NO
registry_status=draft
table_registry_id=21
permission_id=1483
blocker=TABLEIDMAP_MISSING_EVENT_OUTBOX

3. Current blocker

Route:

/knowledge/registries/event_outbox

returns HTTP 200, but SharedDirectusTable does not mount because:

web/pages/knowledge/registries/[entityType]/index.vue
hardcoded tableIdMap does not contain:
event_outbox: 'tbl_event_outbox'

This is not a notification-specific bug. It is a Table Module / Nuxt template architecture gap.

Current bad pattern:

Each new registry-backed table may require Nuxt hardcoded map entry.

Desired pattern:

Generic registry route dynamically resolves entityType/tableId from table_registry or shared config.

4. Why not add the one-line hardcode now

Fast tactical fix would be:

event_outbox: 'tbl_event_outbox'

inside tableIdMap.

But User explicitly paused this because Nuxt is currently unplanned and messy. Adding one line may solve this instance while reinforcing the wrong pattern:

new table → edit Nuxt hardcoded map → smoke → publish

That violates the emerging governance principle:

UI is generated from schema/config/template.
No bespoke or per-branch Nuxt work unless shared template law allows it.

Therefore: do not proceed with one-line hardcode until Nuxt/UI/template law is clarified.


5. What must be done before resuming notification display

5.1 Nuxt/UI law consolidation

Create or amend a law for Nuxt/UI/display/template governance.

Candidate options:

  • fold into existing Display/Template law;
  • fold into Table Module SSOT + Assembly Module SSOT;
  • or create Điều 45 — Luật Nuxt / Hiển thị / Khuôn mẫu.

This law should collect and normalize all scattered rules from:

  • Assembly Module SSOT;
  • Table Module SSOT;
  • Điều 7 Assembly First;
  • Điều 28 Standard Template / Khuôn mẫu chuẩn;
  • P3D UI Boundary notes;
  • Nuxt/Agency OS conventions;
  • existing table_registry implementations;
  • existing DirectusTable route/component behavior;
  • old registry pages and legacy Nuxt hardcodes.

5.2 Law should define these concepts

At minimum:

  1. No bespoke UI by default
    • UI must be generated from schema/config/template.
  2. Template/khuôn registry
    • list all templates/khuôn hiện có.
  3. Product-from-template registry
    • list all UI products currently cast from each template.
  4. Template creation process
    • when to create/extend a template.
  5. Template extension process
    • how to add generic capability without forking UI.
  6. DirectusTable/Table Module rules
    • registry entry required;
    • field config required;
    • permission allowlist interaction;
    • route resolution rule.
  7. Nuxt cleanup policy
    • classify legacy code: keep, migrate, delete, quarantine.
  8. Automated smoke requirement
    • route smoke must be machine-verifiable where possible.
  9. DOT/API 100% requirement
    • no click UI.
  10. Manual step policy
  • manual step = gap to repair, not final architecture.

5.3 Specific Table Module issue to resolve

Decide desired replacement for hardcoded tableIdMap:

Current:

entityType → tableId hardcoded in Nuxt page

Preferred candidates:

A. Dynamic lookup by page_url:

/knowledge/registries/event_outbox
→ query table_registry where page_url = current path
→ table_id = tbl_event_outbox

B. Dynamic lookup by entityType convention:

entityType=event_outbox
→ query table_registry where collection='event_outbox' or table_id='tbl_event_outbox'

C. Generated static map from registry during build/deploy:

table_registry → generated tableIdMap artifact

Decision should follow the new Nuxt/UI law, not be solved locally inside notification pack.


6. Remaining tasks to reach Giai đoạn 1 final goal

After Nuxt/UI law and Table Module routing policy are fixed, resume P3D notification display with these tasks:

Task R1 — Apply shared Table Module routing fix

Depending on law decision:

  • replace hardcoded tableIdMap with dynamic registry lookup; or
  • introduce generated registry map; or
  • if law permits short-term map entry, add via controlled template-module pack.

Must be generic, not notification-specific.

Task R2 — Re-run route smoke automatically

Machine smoke must verify:

/knowledge/registries/system_issue renders DirectusTable
/knowledge/registries/event_outbox renders DirectusTable

Evidence should include:

  • route HTTP status;
  • proof SharedDirectusTable mounted;
  • proof it requested table_registry.fields;
  • proof response keys exclude unsafe fields.

Task R3 — Publish tbl_event_outbox

Only after route smoke passes:

table_registry id=21 status: draft → published

Must be done via DOT/API/convention channel, not click UI.

Task R4 — User view smoke

Verify user can access:

/knowledge/registries/event_outbox

Expected current content may be empty because event_outbox row count was 0 at report time.

If empty, test should still prove:

  • table renders;
  • columns visible;
  • empty state displayed;
  • no unsafe fields visible.

Optional: generate a safe test event through approved event path only if needed and allowed.

Task R5 — Decide mark-read UX later

Do not mix into Giai đoạn 1 display finalization unless explicitly approved.

Existing function:

fn_event_mark_read

But human UI mark-read is deferred.

Future decision:

  • expose mark-read action through generic action template?
  • use Directus operation?
  • keep read-only for Phase 1?

Task R6 — IU notification convergence later

IU runtime remains separate and untouched:

  • iu_notification_event
  • iu_notification_read
  • fn_iu_*

Do not migrate IU into universal event core until a later convergence pack.


7. Data/artifact IDs to remember

Current important IDs:

Directus permission id = 1483
table_registry id = 21
table_id = tbl_event_outbox
collection = event_outbox
page_url = /knowledge/registries/event_outbox
status = draft
_dot_origin = P3D4C2U_D|2026-05-08

Current safe fields:

id
occurred_at
created_at
event_domain
event_type
event_stream
delivery_lane
event_severity
event_subject_table
event_subject_ref
canonical_address
actor_ref
source_system
payload_classification

Registry fields exclude id because DirectusTable auto-includes it.

Unsafe fields must stay hidden:

safe_payload
correlation_id
causation_id
payload
body
raw_payload
vector
embedding
secret
token
password
ssn
personal_data

8. Documents to read when resuming

Read these before resuming notification display:

  1. knowledge/dev/laws/dieu44-trien-khai/reports/23-p3d4c2u-option-d-base-table-field-allowlist-implementation-report.md
  2. knowledge/dev/laws/dieu44-trien-khai/reviews/opus-review-23-p3d4c2u-option-d-draft-pending-2026-05-08.md
  3. knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-analysis-23-p3d4c2u-option-d-draft-pending-smoke-2026-05-08.md
  4. registries/table_registry/tbl_event_outbox
  5. Nuxt/UI law or Điều 45 once created.
  6. Table Module SSOT after it is updated.

9. Pause instruction

Stop notification display work here.

Do not:

  • add event_outbox: 'tbl_event_outbox' as local one-line hotfix;
  • publish tbl_event_outbox;
  • build notification UI;
  • add Nuxt page/component;
  • expose mark-read UI.

Proceed first with:

Nuxt/UI/template law consolidation
Table Module routing design cleanup
Legacy Nuxt registry cleanup plan
Automated route-smoke mechanism

After that, return to tasks R1–R4 to complete Giai đoạn 1 display.


10. One-line checkpoint

Giai đoạn 1 notification display is 90% wired: Directus permission + table_registry draft are done and safe; remaining blocker is Nuxt/Table Module hardcoded tableIdMap. Pause here, write Nuxt/UI/template law, fix shared routing/template mechanism, then publish tbl_event_outbox after automated route smoke passes.
Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/todos/td-p3d-phase1-notification-display-remaining-before-nuxt-law-pause-2026-05-08.md