KB-9AF4

S146-M4c Pivot Tab + Species Row Report

3 min read Revision 1
s146pivotspeciesreport

S146-M4c — Pivot Tab + Species Row Report

Agent: Claude Code CLI (Claude Opus 4.6) Ngày: 2026-03-29 Trạng thái: DONE — 3 việc hoàn thành, verified production PR: #648 (MERGED)


Việc 1: Fix E2E — Qdrant

Root cause: Agent Data cached Qdrant connection error. Qdrant container healthy, reachable from agent-data. Fix: docker restart incomex-agent-data → Qdrant reconnected. Result: Agent Data status: "healthy", Qdrant: "ok".

Việc 2: Species Virtual Row — CAT-SPE

PG changes:

  • Extended chk_composition_level CHECK to include 'meta'
  • Inserted CAT-SPE: (name='Tổng loài', entity_type='species_total', composition_level='meta', identity_class='virtual')
  • Created fn_refresh_species_count() trigger on entity_species (AFTER INSERT/DELETE)

Dual-trigger:

Trigger Type Status
trg_refresh_species_count On-demand (PG trigger) ✅ ENABLED
Cron refresh_meta_catalog_from_pivot Scheduled (10 min) ✅ (covers managed rows, species via dedicated trigger)

Verify: CAT-SPE.record_count = 35 = COUNT(*) entity_species = 35 ✅ KHỚP

Việc 3: Tab "Pivot"

Navigation: Hardcode in TheHeader.vue line 109. Added pivotNavItem between registriesNavItem and lawsNavItem. Page: web/pages/knowledge/pivot/index.vue — 29 lines. readItems('meta_catalog') → UTable. No business logic (§0-BA). URL: https://vps.incomexsaigoncorp.vn/knowledge/pivot → 200 OK

V1-V5 Verify

# Check Result
V1 Agent Data healthy ✅ healthy
V2 CAT-SPE = COUNT(*) entity_species ✅ 35 = 35 KHỚP
V2 trg_refresh_species_count ENABLED ✅ O
V3 /knowledge/pivot loads ✅ 200 OK
V3 7 rows via API ✅ 7 rows
V4 All 7 rows KHỚP ✅ 7/7 KHỚP
V5 /knowledge/registries works ✅ 200 OK

V4 Detail — 7 Rows

Row Code record_count Expected Status
Atom CAT-ALL 33,683 33,683 ✅ KHỚP
Molecule CAT-MOL 646 646 ✅ KHỚP
Compound CAT-CMP 326 326 ✅ KHỚP
Material CAT-MAT 0 0 ✅ KHỚP
Product CAT-PRD 0 0 ✅ KHỚP
Building CAT-BLD 0 0 ✅ KHỚP
Species CAT-SPE 35 35 ✅ KHỚP

Files Changed

  • sql/s146_m4c_species_virtual_row.sql — PG migration
  • web/components/navigation/TheHeader.vue — Pivot nav item
  • web/pages/knowledge/pivot/index.vue — Pivot page (29 lines)