S108-CLEANUP Report 2026-03-10
S108-CLEANUP Report — 2026-03-10
Assembly Gate
- Nuxt UI component? → Không cần UI mới
- Agency OS / Directus có sẵn? → dot-* scripts có sẵn
- Codebase tương tự? → dot-registry-count-refresh, dot-registry-integrity-check, dot-selftest-registries
- Có sẵn → dùng.
- Code mới → TD-111 rule thêm vào incomex-rules.md (đăng ký PR #470)
A1: Collections actual 114→106 — SOURCE CODE ANALYSIS
Source code: dot/bin/dot-registry-count-refresh v2.0.0
record_count (line 127-137):
def count_collection(collection):
api('GET', f'/items/{collection}?aggregate[countDistinct]=id')
→ Đếm số items trong bảng collection_registry qua Directus aggregate API.
actual_count (line 139-145 + line 158-159):
def count_system_collections():
api('GET', '/collections?limit=-1')
return sum(1 for c in data if not c.get('collection', '').startswith('directus_'))
SYSTEM_ACTUAL = {'collection_registry': count_system_collections}
→ Đếm non-system collections qua Directus /collections system API (filter bỏ directus_*).
KẾT LUẬN: HAI NGUỒN ĐỘC LẬP ✅
record_count= số collections ĐÃ ĐĂNG KÝ trongcollection_registryactual_count= số collections THỰC SỰ TỒN TẠI trong Directus system
Giải thích 114→106:
Orchestrator nói "hôm nay actual=106 orphan=0" là do ĐỌC SỐ CŨ từ last_scan trước khi collections mới được tạo. Sau khi chạy count-refresh: actual=114, record=106, orphan=8. 8 collections tồn tại trong Directus nhưng chưa đăng ký trong collection_registry. KHÔNG CÓ BUG.
A2: WARNs Chi Tiết (14 total → 3 integrity + 12 selftest = 15 thực tế)
Integrity Check WARNs (3):
| # | WARN | Phân loại | Lý do |
|---|---|---|---|
| 1 | CAT-014 Table Proposals: record_count=0 | ACCEPTABLE | Collection trống, chưa có proposal |
| 2 | ALL 3 Model B entries have record=actual | ACCEPTABLE | DOT tools vừa fix orphans nên khớp. Pages luôn khớp. Agents dùng directus fallback |
| 3 | Total orphans: 8 | ACCEPTABLE | 8 Collections orphans = chưa đăng ký vào collection_registry (riêng biệt) |
Selftest WARNs (12):
| # | WARN | Phân loại | Lý do |
|---|---|---|---|
| 1-5 | Layer 2 no data markers: workflow_step, wcr, task, table_proposal, checkpoint_instance | ACCEPTABLE | SSR HTML không chứa code prefix trực tiếp — data render client-side |
| 6-11 | Layer 3 config only 1 section: workflow, workflow_step, dot_tool, collection, checkpoint_type, checkpoint_set | ACCEPTABLE | detail-sections.ts config cho discovery mode fallback chỉ có info section |
| 12 | API table_proposals: 0 records | ACCEPTABLE | Same as integrity #1 |
A3: 9 DOT Orphans
| # | File | Mô tả |
|---|---|---|
| 1 | dot-dependency-scan | Scan Directus relations → entity_dependencies |
| 2 | dot-fill-tool-descriptions | Fill missing descriptions for DOT tools |
| 3 | dot-flow-setup-count-refresh | Create Directus Flow for scheduled count refresh |
| 4 | dot-layer3-audit | Audit Layer 3 detail pages |
| 5 | dot-registries-verify | Verify ALL registries pages via HTTP |
| 6 | dot-registry-count-refresh | Refresh meta_catalog record counts |
| 7 | dot-registry-integrity-check | Agent self-check for registry integrity |
| 8 | dot-schema-entity-dependencies-ensure | Ensure entity_dependencies collection schema |
| 9 | dot-selftest-registries | Comprehensive Registry System Self-Test |
A4: Deploy Hook
VERIFIED ✅ — Both deploy-direct (line 183) and deploy-artifact (line 357) call /api/registry/refresh-counts API endpoint post-deploy.
B1: Collections Counting
NO FIX NEEDED — actual và record ĐÃ ĐỘC LẬP. rec=106 (collection_registry items), act=114 (system API). Orphan=8 = 8 collections chưa đăng ký.
B2: 9 DOT Orphans → Đã Đăng Ký
- Tạm disable [AUTO-ID] DOT Tools flow (filter trigger gây 500 error do exec operation)
- Tạo 9 records: DOT-098 → DOT-106
- Re-enable flow
- Kết quả: CAT-006 orphan 9→0 ✅
B3: WARNs
Tất cả 15 WARNs phân loại ACCEPTABLE — không cần fix.
B4: Deploy Hook
Đã có sẵn — không cần thêm.
B5: TD-111
Thêm section "TD-111: CODE = UNIQUE ID TOÀN HỆ THỐNG" vào .claude/skills/incomex-rules.md. PR #470.
C1: Verify Numbers Cuối Cùng
Count Refresh:
CAT-006 DOT Tools [B:filesystem]: rec=106, act=106, orp=0 ✅ (was 97/106/9)
CAT-008 Collections [A:system-api]: rec=106, act=114, orp=8 (independent, correct)
Integrity Check:
Integrity Check: 4/7 PASS, 0/7 FAIL, 3/7 WARN
System: 704 atoms, 16 categories, 8 orphans
INTEGRITY: PASS WITH WARNINGS
Ghi chú về AUTO-ID flow:
Flow [AUTO-ID] DOT Tools dùng exec operation type (isolated-vm) gây 500 error khi create. Cần điều tra riêng — có thể chuyển sang log pattern hoặc fix exec. Ghi nhận cho tech debt.
Checklist Hoàn Thành
- A1 GIẢI THÍCH Collections actual 114→106 (source code evidence)
- 15 WARNs đã điều tra + phân loại (tất cả ACCEPTABLE)
- 9 DOT orphans → orphan=0
- Deploy hook verified (đã có)
- TD-111 rule trong skills file (PR #470)
- Báo cáo uploaded