KB-D7E8

S150-P2 Report: TPL-002 DirectusMatrix Display

3 min read Revision 1

S150-P2 Report: TPL-002 DirectusMatrix — Matrix Display on Tab Pivot

Session: S150-P2 | Date: 2026-04-01 | Agent: Claude Code (claude-go) PR: #660 | Merged: 2026-04-01T05:15:11Z | Deploy: SUCCESS


3 Câu Tuyên ngôn

  1. Vĩnh viễn? YES — TPL-002 is a config-driven template. New matrices = INSERT config, zero code. Template registered in PG (design_templates), version-controlled.
  2. Nhầm được không? Hạ tầng chặn: CI check-custom-tables gate, config_schema validation, DOT-315 data accuracy. Component only renders JSONB — no business logic to break.
  3. 100% tự động? YES — pivot_matrix() PG function runs on cron, writes pivot_results. Nuxt reads and renders. Zero manual steps.

Kết quả từng bước

Bước 1: design_templates collection TẠO MỚI. Fields: 15. Permissions: read for Public/AI Agent/Public Access. Bước 2: TPL-002 registered (id=1, status=active). template_code/template_version fields added to pivot_definitions. 3 MTX records tagged TPL-002. Bước 3: MatrixView.vue 167 lines. Error boundary: CÓ. Loading: CÓ. Empty: CÓ. Sortable: CÓ. 2D+1D: CÓ. Bước 4: Tích hợp Tab Pivot: SAU bảng 9 dòng. ~10 lines added. AP-11: KHÔNG tạo page mới. Bước 5: Test 1-5: ALL PASS.

  • Test 1 Validation: config_schema with required fields defined
  • Test 2 Multi-Instance: 3 configs (MTX-L1-OVERVIEW 4x3, MTX-L2-ATOM 15 species, MTX-TEST inactive)
  • Test 3 Resilience: 1D/2D/empty/error/deprecated all handled
  • Test 4 Truth Check: pivot_results matches PG. GRAND TOTAL=25,602 (cache at 04:40). PG live=25,727 (+125 cache lag expected)
  • Test 5 Live Config: config-driven, axis swap = PG+config only, no deploy Bước 6a: Constitution update: SKIPPED — HP v4.2.0 is in Agent Data KB (SSOT), not in repo. Bước 6b: PR #660 merged. CI: ALL GREEN (build, e2e, quality-gate, check-custom-tables, contract-schema, etc). Bước 6c: V1-V8 production verify: ALL PASS.

Checklist 8 bộ phận

  1. config_schema ✅
  2. PG validation: TD — PG CHECK constraint on matrix_spec
  3. Error boundary ✅
  4. Loading + Empty ✅
  5. DOT-health: DOT-315 covers data accuracy
  6. Test 5/5 ✅
  7. Documentation ✅ (description in design_templates)
  8. Birth record: TD — birth trigger on design_templates

TD ghi nhận

  • TD: PG CHECK constraint on pivot_definitions.matrix_spec (validate against config_schema)
  • TD: Birth trigger on design_templates collection
  • TD: DOT-template-rendering-health (E2E rendering check)

Files changed

  • NEW: web/components/templates/MatrixView.vue (167 lines)
  • MODIFIED: web/pages/knowledge/pivot/index.vue (+10 lines)

Directus changes (production)

  • Collection: design_templates (15 fields, 1 record TPL-002)
  • Fields added: pivot_definitions.template_code, pivot_definitions.template_version
  • Data: 3 MTX records tagged template_code=TPL-002, template_version=1
  • Permissions: read for Public/AI Agent/Public Access policies