KB-3E6A

P10D — Nuxt Laws Page Design Brief v0.2

5 min read Revision 1
p10ddesign-briefnuxtlaws-pagetac

P10D — Nuxt Laws Page Design Brief v0.2

Phase: TAC MVP / P10D Phiên: S189 | Ngày: 2026-04-30 Agent soạn: Opus 4.6 (Desktop) Inputs: P10A tree report (D35 36u), P10B tree reports (D32 23u, D28 27u), G6 DDL package, GPT P10D direction §6, P10D requirements carry-forward S187–S188, GPT review v0.1 (7 patches) Trạng thái: v0.2 — patched theo GPT review. Chờ GPT final approve.


1. Mục tiêu

Hiển thị tài liệu luật từ TAC pipeline (tac_* tables) trên route /knowledge/laws của Nuxt app, dạng read-only. Người dùng đọc luật như đọc văn bản bình thường. Admin/reviewer có thêm chế độ xem ranh giới information-unit.


2. Data Foundation

2.1 Schema (production)

4 bảng chính: tac_publication (cuốn sách), tac_logical_unit (đoạn, cây cha-con), tac_unit_version (nội dung: title+body+description), tac_publication_member (mục lục: ghép pub↔uv, render_order).

2.2 Data thực tế (86 units)

Document Units Max depth Đặc điểm
Đ35 v5.2 36 3 Lớn, 12 section_types, nesting sâu
Đ32 v1.1 23 3 Nhỏ hơn
Đ28 v2.0 27 3 SQL code blocks, Roman numerals

2.3 Render query (generic CTE)

Dùng pm.unit_version_id — lấy đúng version thuộc publication, KHÔNG "latest UV by LU". Chỉ cần $1 (pub_id) parameter.


3. Architecture

Server route: recursive CTE, lifecycle filter, auth, metadata exposure. Client: tree build, markdown render, scroll sync, mode toggle. Phân tách rõ — client không query PG, server không render HTML.

3.1 Data source

Trang Source
/knowledge/laws listing governance_docs (giữ nguyên) + TAC Publications section (tac_publication qua server adapter)
/knowledge/laws/:pubId reader tac_* tables qua server route

Không thêm pub_id vào governance_docs (schema change cần gate riêng).

3.2 API (authenticated)

  • GET /api/laws/publications — list, lifecycle filtered
  • GET /api/laws/publications/:pubId/tree — flat ordered array, role-based metadata

4. UI Layout

Tree view (trái) + Document reader (phải). Collapsible tree, scroll sync bidirectional.


5. Numbering

Title có sẵn (§4.1, I.2...) = human-facing label. Auto-numbering DEFERRED. UUID = stable ID. Canonical address = structural reference.


6. Rendering Modes

  • Reader (default): văn bản sạch, no boundaries
  • Review (admin toggle): dashed border, hover metadata tooltip, server-controlled exposure
  • Debug: DEFERRED

7. Generic Renderer Rules

  • section_type → CSS class mapping (no JS branching per doc)
  • Markdown renderer: chọn sau repo inspection, bắt buộc sanitize
  • Depth → heading level: h${depth+1}
  • Forbidden: doc_code === 'DIEU-28', canonical_address literals, custom title per doc
  • "Metadata-only title" nếu cần → model qua data/render profile, not UI hardcode

8. Scope

In: listing enhancement, 2 API endpoints, reader page, tree, reader/review modes, scroll sync, responsive. Out: edit, auto-numbering, debug mode, diff, search, print, lifecycle UI, KG sync, bridge field, public API, D28-specific rules.


9. PASS Criteria (19 items)

Includes: listing works, 3 docs render correctly, scroll sync, review mode boundaries, admin-only toggle, no-hardcode audit (grep DIEU-28/32/35 doc_code D38-DIEU in renderer = 0), API authenticated, generic endpoint, responsive, markdown sanitized.


10. Resolved Decisions

# Decision
Bridge Read-only server adapter, no field addition
Markdown Choose after repo inspection, must sanitize
API auth Internal authenticated first
Timing S189 design. Implementation separate step.

11. Patch Log

  • v0.1: Initial (4 OD pending)
  • v0.2: 7 GPT patches (no bridge field, auth first, sanitize mandatory, no D28 rule, server/client separation, explicit pm.unit_version_id, no-hardcode audit PASS criteria)

P10D Design Brief v0.2 | S189 | 2026-04-30 | Opus 4.6