KB-C49C rev 2

23-P3D4B — Directus DOT Notification Read-Only Exposure — Package Review Prompt (rev2)

9 min read Revision 2
p3d4bpromptdirectusdotnotificationreadonlyexposuredieu43rev2

23-P3D4B — Directus DOT Notification Read-Only Exposure — Package Review Prompt (rev2)

Date: 2026-05-08 Status: PROMPT rev2 — chờ GPT/User final review. CHƯA dispatch. Report: knowledge/dev/laws/dieu44-trien-khai/reports/23-p3d4b-directus-dot-notification-readonly-exposure-report.md Scope: DOT package design/review only. NO implementation. NO production mutation. NO executable artifacts. Rev1→Rev2: Non-executable sketches, role reuse, view scope, payload strategy, Điều 43 tool check, go/no-go gate.


Hard Boundaries

  • ❌ KHÔNG implement PG view — chỉ design candidate (non-executable sketch)
  • ❌ KHÔNG mutate PG (no CREATE/ALTER/DROP/INSERT/UPDATE/DELETE)
  • ❌ KHÔNG mutate Directus config
  • ❌ KHÔNG grant/change Directus item-level permissions — chỉ mô tả future grant
  • ❌ KHÔNG click Directus UI để configure
  • ❌ KHÔNG tạo DOT package executable trong production — candidate outline only
  • ❌ KHÔNG provide runnable CREATE VIEW script — non-executable sketch only, clearly fenced
  • ❌ KHÔNG code Nuxt
  • ❌ KHÔNG start Hermes
  • ❌ KHÔNG dispatch Codex (cần user approval)
  • ❌ KHÔNG expose IU body content (metadata-only)
  • ❌ KHÔNG invent DOT convention mới nếu existing DOT đã có
  • ❌ KHÔNG duplicate Điều 43 relationship/counting work
  • ❌ KHÔNG sửa Điều 43 schema blockers — chỉ document và assess conflict
  • ❌ KHÔNG tạo/tiết lộ secret/token
  • ✅ KB document create only (package review note)
  • ✅ KB/Directus API read-only (inventory)

Step 0: Mandatory Pre-Read

Agent PHẢI đọc theo thứ tự. Thiếu file bắt buộc → STOP.

Laws:

  1. knowledge/dev/laws/constitution.md
  2. knowledge/dev/laws/law-07-assembly-first.md
  3. knowledge/dev/ssot/data-connection-law.md
  4. Điều 28 / display law nếu available
  5. knowledge/dev/laws/dieu44-trien-khai/design/23-p3d-ui-boundary-directus-nuxt-assembly-note.md

P3D context: 6. knowledge/dev/laws/dieu44-trien-khai/reports/23-p3d4-directus-exposure-design-review-report.md 7. knowledge/dev/laws/dieu44-trien-khai/design/23-p3d4-directus-notification-exposure-review.md 8. knowledge/dev/laws/dieu44-trien-khai/design/23-p3d3-user-notification-board-directus-exposure-design.md


Step 1: Điều 43 / DOT Overlap Inventory — REQUIRED (bounded)

Search scope (bounded — không mở điều tra lớn):

KB search:

  • Documents under knowledge/dev/laws/dieu43*
  • Tags/paths: dot, directus, d35, d43, relationship, count, counter, metrics, dot_apply, rollup, schema blocker
  • Any existing DOT package templates/conventions

Tool/MCP check (bounded):

  • Check if any DOT-related tools available (Directus MCP, DOT registry)
  • Report whether inventory was KB_ONLY or KB_AND_TOOLING
  • Không deep tool discovery mission

Questions to answer:

  1. Điều 43 có DOT format/template chuẩn không? → P3D4B PHẢI dùng nếu có.
  2. Có counting/relationship mechanisms áp dụng cho notification? → không duplicate.
  3. Điều 43 đang blocked ở đâu? Phần nào reusable, phần nào blocked?
  4. Có DOT package nào đã tạo cho Directus collection/view exposure chưa? → template.

Hard rule: Do not fix Điều 43 schema blockers in P3D4B. Only document blockers and assess whether notification exposure can proceed without conflict.

Fallback: Không tìm thấy hoặc incomplete → dieu43_dot_inventory=LIMITED + lý do, tiếp tục.


Step 2: Design Candidate Package (NON-EXECUTABLE)

2A. PG View Design (non-executable sketch)

Do NOT provide a runnable CREATE VIEW script. Provide a clearly fenced NON-EXECUTABLE SKETCH with columns and join logic described.

View scope decision — agent must choose 1:

Option Mô tả
HISTORY Tổng quan toàn bộ events + read-state (giám sát)
ACTIONABLE Chỉ events chưa resolved (active drafts, recent comments)
PAIR 2 views: current + history

GPT leaning: Phase 1 human monitoring nên ưu tiên HISTORY/overview. Nếu actionable filter thì document exact rule (applied/stale drafts).

Candidate columns (metadata-only):

  • event_id, event_type, event_stream
  • canonical_address, unit_id, ref_id
  • actor_ref, source, created_at
  • read_count: COUNT DISTINCT actor_ref from iu_notification_read per event_id. No separate counter table. No stored denormalized count.
  • latest_readers: JSON array, top 5 by read_at DESC, actor_ref ASC tie-breaker. No separate aggregate table.
  • NO body content, NO join to information_unit.body / unit_version.body

Payload strategy — agent must choose 1:

Option Mô tả
OMIT_RAW_PAYLOAD Không include payload trong view Phase 1
SANITIZED_REFS Chỉ include: draft_id, comment_id, version_id, actor_ref từ payload

GPT preference: OMIT_RAW_PAYLOAD hoặc SANITIZED_REFS. Không raw jsonb.

Owner/permissions sketch:

  • Owner: directus
  • GRANT SELECT TO directus only, no PUBLIC
  • Rollback: DROP VIEW IF EXISTS

2B. Directus DOT Package Outline (non-executable)

Do NOT create an actual DOT package file intended for execution. Candidate outline only.

  • Collection exposure plan (auto-discover view vs manual register)
  • Read-only permission grant description (NO actual grant)
  • No create/update/delete permissions
  • Metadata labels/descriptions

Role strategy — agent must choose 1:

Option Mô tả
REUSE_EXISTING Dùng role hiện có từ inventory
NEW_ROLE_RECOMMENDED Cần role mới, justify và defer to implementation review
UNKNOWN Chưa đủ thông tin

Prefer REUSE_EXISTING. Nếu new role → justify.

2C. Điều 43 Reuse Assessment

  • Existing DOT conventions áp dụng
  • read_count/latest_readers có conflict với existing count infrastructure không
  • Blockers summary
  • Reusable parts vs blocked parts

2D. Phase Boundaries

  • Phase 1 (this package): read-only board view only
  • Mark-read: DEFERRED
  • Directus user→actor_ref mapping: DEFERRED
  • Nuxt display assembly: DEFERRED
  • Hermes: DEFERRED

Step 3: Output — Package Review Note

Path: knowledge/dev/laws/dieu44-trien-khai/design/23-p3d4b-directus-dot-notification-readonly-exposure-package-review.md

A. Điều 43/DOT inventory results

B. Candidate PG view sketch (non-executable, fenced)

C. Candidate Directus DOT outline (non-executable)

D. Reuse assessment

E. Phase boundaries

F. Go/No-Go Gate for P3D4C

GO conditions (all must be met):

  • overlap_risk = LOW, or accepted MEDIUM with documented mitigations
  • DOT convention/template identified, or fallback approved
  • view_scope decided (HISTORY/ACTIONABLE/PAIR)
  • payload_strategy decided (OMIT/SANITIZED)

NO-GO if:

  • Điều 43 overlap cannot be assessed
  • Any hard boundary would be violated in implementation

G. Recommendation — chọn 1:

Option Mô tả
READY_FOR_IMPLEMENTATION_PROMPT GO conditions met, soạn P3D4C implementation prompt
NEEDS_DIEU43_ALIGNMENT Overlap/conflict, align trước
DEFERRED Risk quá cao hoặc thiếu thông tin

H. Compliance Checklist

PG source of truth: PASS/FAIL
Directus DOT-only: PASS/FAIL
Directus UI view-only: PASS/FAIL
Metadata-only (no body): PASS/FAIL
No Điều 43 DOT overlap: PASS/FAIL
No duplicate counting: PASS/FAIL
No law jurisdiction overlap: PASS/FAIL
Assembly First respected: PASS/FAIL
No Nuxt code: PASS/FAIL
Non-executable artifacts only: PASS/FAIL

Verification

phase_status=PASS|FAIL
dieu43_dot_inventory=PASS|LIMITED|FAIL
dieu43_inventory_depth=KB_ONLY|KB_AND_TOOLING|LIMITED
existing_dot_conventions_checked=PASS|FAIL
reusable_dot_template=FOUND|NOT_FOUND|UNCLEAR
reusable_counting_pattern=FOUND|NOT_FOUND|UNCLEAR
dieu43_blockers_summary=<short text>
overlap_risk=LOW|MEDIUM|HIGH
recommendation=READY_FOR_IMPLEMENTATION_PROMPT|NEEDS_DIEU43_ALIGNMENT|DEFERRED
candidate_view_defined=PASS|FAIL
view_scope=HISTORY|ACTIONABLE|PAIR|UNDECIDED
candidate_dot_outline_defined=PASS|FAIL
role_strategy=REUSE_EXISTING|NEW_ROLE_RECOMMENDED|UNKNOWN
payload_strategy=OMIT_RAW_PAYLOAD|SANITIZED_REFS|UNDECIDED
metadata_only=true
no_body_content=true
no_pg_mutation=true
no_directus_mutation=true
no_directus_permission_change=true
no_executable_sql=true
no_executable_dot=true
no_nuxt_code=true
no_codex_dispatch=true
no_secret_creation=true
no_dieu43_overlap=true
no_dieu43_schema_repair=true
assembly_first_compliant=true
go_nogo_gate=GO|NOGO
next_required_pack=P3D4C_PG_VIEW_AND_DIRECTUS_DOT_IMPLEMENTATION_PROMPT_REVIEW (nếu READY) | P3D4B_DIEU43_ALIGNMENT_REVIEW (nếu NEEDS) | DEFERRED

Key Principles

  1. Non-executable only. Sketch, không copy-paste-ready.
  2. Không invent nếu đã có. Điều 43/DOT convention có sẵn → dùng.
  3. Metadata-only. Không body content. Payload omit hoặc sanitized refs.
  4. Prefer existing roles. Không invent role mới mặc định.
  5. Mỗi luật giữ chuyên môn. Không bypass, không double.
  6. Candidate chờ duyệt. Design review note chỉ là bản vẽ.

P3D4B rev2 | DOT package review only | Non-executable | CHƯA dispatch | Chờ GPT/User final review

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/prompts/23-p3d4b-directus-dot-notification-readonly-exposure-prompt.md