KB-118C

S165 Deps Strategy Report

5 min read Revision 1

S165 — Verify S164 + Entity Dependencies Strategy

Agent: Claude Code CLI | Ngày: 2026-03-26 PRs: 3 (#627, #628, #629, #630)

Step 0 Quotes

§0-AC: Investigate → Classify → Fix từng nhóm §0-AF: Evidence từ production URL §0-AH: KHÔNG filter/ẩn/xoá. Fix logic. §0-AI: DUAL-TRIGGER. Deploy → on-demand NGAY.

BEFORE State

curl https://vps.incomexsaigoncorp.vn/api/registries/system-issues → all=635, critical=14, warning=620, info=1

Việc 1: Verify S164 On-Demand

Runner on-demand

Command: node main.js --run-id=s165-verify on VPS Result: 37 PASS, 0 FAIL, 1 WATCHDOG. Auto-Resolved: 15 stale issues.

Scanner on-demand

Fixed 3 bugs preventing scanner from running on VPS:

  • PR #627: Token preservation (init_environment overwrote caller's token)
  • PR #628: Removed non-existent description_field from meta_catalog query (→ 403)
  • PR #629: Auto-resolve used POST instead of PATCH + missing source_system field

1st run result: 77/124 PASS, 29 LỖI, 18 CẢNH BÁO. Auto-resolved: 605 stale issues.

BEFORE vs AFTER S164

Metric BEFORE AFTER
Total system_issues 635 635 (same records, different status)
status=open ~1 1 (watchdog)
status=archived ~634 6
status=resolved 0 628

Delta: 628 issues auto-resolved (605 scanner + 15 runner + 8 classification pass)

Việc 2-3: Entity Classification

Collection identity_class Level Flagged CẦN deps? Lý do
dot_tools managed atom YES→NO NO Atomic, standalone per Điều 0-B
agents managed atom YES→NO NO Atomic, standalone
checkpoint_types managed atom YES→NO NO Atomic, standalone
trigger_registry managed atom YES→NO NO Atomic, standalone
task_comments managed atom YES→NO NO Atomic, standalone
meta_catalog managed molecule YES→NO NO Infrastructure
table_registry managed molecule YES→NO NO Infrastructure
workflow_steps managed molecule YES→NO NO References via FK, not entity_deps
ui_pages managed molecule YES→NO NO Infrastructure
collection_registry managed molecule YES→NO NO Infrastructure
checkpoint_sets managed molecule YES→NO NO Groups of checkpoints
table_proposals managed molecule YES→NO NO Infrastructure
checkpoint_instances managed molecule YES→NO NO Instances of types
modules managed compound YES Composed from entities
workflows managed compound YES Composed from steps + checkpoints
workflow_change_requests managed compound YES References workflows
tasks managed compound YES References workflows, agents
taxonomy managed material YES Classification system

Việc 4: Scanner Update

PR #630: Scanner CHECK 3 now uses composition_level from v_registry_counts:

  • atom/molecule/empty → STANDALONE (skip dep check)
  • compound/material/building/product → NEEDS_DEPS (flag if no deps)

Việc 5: Final On-Demand Verify

2nd scanner run: 75/110 PASS, 29 LỖI, 6 CẢNH BÁO. Auto-resolved: 8 more. No more no_dependencies false positives for standalone entities.

AFTER FINAL

  • resolved: 628
  • archived: 6 (old issues, will resolve on next run when they match current scan)
  • open: 1 (watchdog — by design)
  • Smoke test: 17/17 PASS

Self-check

# Câu hỏi ĐẠT/KHÔNG
1 Scanner CÓ on-demand? ĐẠT — runs on VPS with DIRECTUS_TOKEN
2 S164 verify: on-demand NGAY? ĐẠT — triggered immediately after deploy
3 BEFORE vs AFTER delta ĐẠT — 628 resolved (605+15+8)
4 Bảng phân loại đủ? ĐẠT — 18 collections classified
5 Scanner only flags NEEDS_DEPS? ĐẠT — atom/molecule skipped
6 Config-driven? ĐẠT — uses v_registry_counts.composition_level
7 On-demand verify lần 2? ĐẠT — 0 no_dependencies false positives
8 KHÔNG filter/xoá/ẩn? ĐẠT — fixed logic, not data
9 CI GREEN? ĐẠT — runs 23568818153, 23568856613, 23551063617, 23549868395
10 Report? ĐẠT