KB-9B5C

S162C Orphan Dependencies Report

3 min read Revision 1

S162C — Orphan Dependencies Report

Agent: Claude Code CLI | Ngày: 2026-03-25 PRs: 1 (#624)

Step 0 Quotes

§0-AB: CẤM --admin merge §0-AF: EVIDENCE từ production URL §0-AG: DB migration deadlock protocol

Investigation Findings

Zero actual orphans in entity_dependencies. All 141 deps have valid source_code and target_code:

  • 70 target workflow (WF-001, WF-002 both exist)
  • 65 target workflow_step (all 64 unique codes exist in workflow_steps)
  • 6 target checkpoint_set (CPS-001, CPS-002 both exist)
  • All source_codes (6 checkpoint_type + 135 workflow_step) verified valid

119 system_issues (110 target + 9 source) were ALL status=archived — stale false positives from a previous scan.

Process Fix (Việc 2)

Root cause: Not broken FKs, but stale system_issues not cleaned up after resolution. Fix: All 4 system-issues API endpoints now filter status != archived. This prevents archived (resolved) issues from appearing in counts.

Cleanup (Việc 3)

SQL migration s162c_cleanup_archived_orphan_issues.sql deletes 119 archived orphan issues.

§0-AF Production Evidence

orphan_dep_target

curl https://vps.incomexsaigoncorp.vn/api/registries/system-issues/detail?sub_class=orphan_dep_target&page=1&limit=1 → {total: 0, issues: []}

orphan_dep_source

curl https://vps.incomexsaigoncorp.vn/api/registries/system-issues/detail?sub_class=orphan_dep_source&page=1&limit=1 → {total: 0, issues: []}

Summary

curl https://vps.incomexsaigoncorp.vn/api/registries/system-issues → {all: 1, critical: 1, warning: 0, info: 0} (was all=754, critical=133)

Self-check

# Mục ĐẠT Evidence
1 Step 0 quotes ĐẠT §0-AB, §0-AF, §0-AG quoted
2 Investigate: orphan count ĐẠT 0 actual orphans; 119 stale archived issues
3 Process fix: API filters archived ĐẠT 4 endpoints updated
4 Cleanup: orphan count=0 ĐẠT SQL migration applied
5 Production orphan_dep_target=0 ĐẠT curl production → total=0
6 Production orphan_dep_source=0 ĐẠT curl production → total=0
7 CRITICAL giảm ĐẠT 133→1
8 CI GREEN ĐẠT Nuxt 3 CI run 23537737888
9 0 manual deploy ĐẠT Auto-deploy triggered by CI success
10 Report ĐẠT This report

10/10 ĐẠT = PASS