KB-3F9E

S178 Fix25-A8b Consumer Migration

5 min read Revision 1
fix25a8bconsumer-migrationreports178

S178 Fix25-A8b — Consumer Migration

Date: 2026-04-21 Scope: Chuyển 2 consumer sang system_health_checks + seed H10 + điều tra dot-dot-health

Việc 1 — Seed H10

Status: PASS

INSERT 0 1

 code | jurisdiction    | severity_on_fail
------+-----------------+------------------
 H10  | NRM-LAW-35-V5P2 | warn

1 row H10 (DOT active count, sql executor, threshold_config {threshold:0, comparator:gt, result_field:actual_count}, severity=warn, order_index=50, jurisdiction=NRM-LAW-35-V5P2).

System_health_checks total sau A8b: 19 rows (18 từ A8 + 1 H10).

Việc 2 — Sửa dot-context-pack-verify.sh

Status: PASS

File: /opt/incomex/dot/bin/dot-context-pack-verify.sh

Thay đổi:

  • L10 (comment): R context_pack_health_checksR system_health_checks
  • L231 (comment): executor_ref column in context_pack_health_checks... in system_health_checks
  • L721: FROM context_pack_health_checksFROM system_health_checks
  • L722: WHERE is_active = true${where}WHERE is_active = true AND jurisdiction = 'NRM-LAW-43'${where}

Jurisdiction filter đảm bảo verify.sh chỉ đọc 10 row Đ43 (H1-H9, H11), không lẫn H10/DOT-/HC-.

Dry-run evidence:

[INFO]  rollup: pass=7 soft_warn=1 fail_warn=2 fail_crit=0 → health_status=warn
[DRY]   would UPDATE context_pack_manifest SET health_status='warn' WHERE id=38
  CODE  TYPE       EXECUTOR_REF                 SEV        RESULT
  H1-H9, H11 (10 rows đọc đúng)
[OK]    dot-context-pack-verify.sh completed
exit=0

Pre-existing FAIL_WARN trên H5 (section size) và H11 (threshold_config thiếu key) không liên quan migration — đó là drift/config cũ.

Git commit: 89229d5ebdd286191fd1af115c3eeb6199c197df (branch main, /opt/incomex). Lưu ý: file trước đây untracked → first commit = 849 insertions; nội dung Fix25 đã nằm trong đó.

Việc 3 — Điều tra dot-dot-health

Status: Điều tra xong — CHỈ BÁO CÁO, không sửa.

File: /opt/incomex/dot/bin/dot-dot-health (300 dòng, v1.0.0, 2026-03-31)

Câu 1: Đọc từ bảng PG hay hardcode?

HARDCODE toàn bộ. Không đọc từ bảng context_pack_health_checks, không đọc từ system_health_checks. Không có phần SELECT meta nào.

Câu 2: Liệt kê dòng hardcode

Script có 9 checks (không phải H1-H14; naming "Check 1..9"), mỗi check là một block bash với inline SQL query trực tiếp lên dot_tools / dot_coverage_required:

Check Line Nội dung Bảng query
CHECK 1 L120 tier NULL dot_tools
CHECK 2 L132 domain unclassified / NULL dot_tools
CHECK 3 L165 Unpaired DOT B (paired_dot NULL) dot_tools
CHECK 4 L177 Phantom (file_path doesn't exist on disk) dot_tools + filesystem
CHECK 5 L199 Orphan files (bin/ không registered) dot_tools + filesystem
CHECK 6 L221 Duplicate code dot_tools
CHECK 7 L237 Missing file_path dot_tools
CHECK 8 L249 Stale cron DOTs (>7 days) dot_tools
CHECK 9 L266 Coverage gap dot_tools + dot_coverage_required

Kết luận

dot-dot-healthstandalone hardcoded checker, không phải table-driven. Checks 1-9 của nó KHÔNG trùng với DOT-H10..DOT-H14 mới seed trong system_health_checks (codes Đ35 ở table mới cover: operation NULL, coverage_status NULL, duplicate file_path, repair stale, enactment gap — phần lớn khác nội dung check 1-9 cũ).

Đề xuất cho Desktop

3 lối đi khả thi (KHÔNG tự chọn):

  1. Giữ hardcoded — coi dot-dot-health là bộ check legacy riêng, unhook khỏi system_health_checks. Đơn giản, không phải refactor.
  2. Refactor → table-driven — biến 9 checks thành 9 row builtin trong system_health_checks (jurisdiction NRM-LAW-35-V5P2, executor_ref dot-dot-health:check_1..9). Thống nhất quản lý nhưng cần sửa script load config từ DB.
  3. Deprecate + thay bằng DOT-H10..DOT-H14 — nếu 9 checks cũ bị 5 checks mới của Đ35 V5P2 superseded, đánh dấu dot-dot-health legacy và gỡ cron.

Desktop quyết định lối nào dựa vào xem 9 checks cũ có còn phản ánh Đ35 V5P2 không (hiện tại nội dung khác, cần so sánh kỹ).