KB-7111

S178 Fix30 Description Coverage Investigation

12 min read Revision 1
reports178fix30description-coverageh11ah11binvestigation

S178 Fix30 — Description Coverage + Chuông H11a/H11b

Date: 2026-04-23 Agent: Codex Scope: VPS production contabo, DB directus, user directus. Mode: Investigation only. No DB/KB schema/data mutation was performed for this report.

Luật / context đã đọc

  • .claude/skills/incomex-rules.md: quy trình 36 mục / 8 bước, cấm background agent, verify cần output thật.
  • search_knowledge("operating rules SSOT"): trả context-pack chứa knowledge/dev/ssot/operating-rules.md.
  • search_knowledge("hiến pháp v4.0 constitution"): trả context luật nền tảng / Điều 14 / Điều 15-16.
  • search_knowledge("H11a H11b description coverage PROV-DOT PROV-AI v_entity_full_classification system_health_checks"): trả đúng query KB:
    • knowledge/current-state/queries/h11a-description-basic-missing.sql
    • knowledge/current-state/queries/h11b-description-detail-missing.sql

A. Tổng quan description coverage

A1. Tổng entity governed có/không description

SELECT 
  CASE 
    WHEN description IS NULL OR btrim(description) = '' THEN 'THIẾU'
    ELSE 'CÓ'
  END AS desc_status,
  count(*) 
FROM v_entity_full_classification 
WHERE governance_role = 'governed'
GROUP BY desc_status;

Output nguyên văn:

desc_status | count 
-------------+-------
 CÓ          |  3106
(1 row)

A2. Phân bổ provenance

SELECT 
  description_provenance, 
  count(*) 
FROM v_entity_full_classification 
WHERE governance_role = 'governed' 
  AND description IS NOT NULL 
  AND btrim(description) != ''
GROUP BY description_provenance 
ORDER BY count DESC;

Output nguyên văn:

 description_provenance | count 
------------------------+-------
 PROV-HUMAN             |  1713
 PROV-DOT               |  1393
(2 rows)

A3. Top 10 bảng governed nhiều entity nhất

SELECT 
  source_table,
  count(*) AS total,
  count(*) FILTER (WHERE description IS NOT NULL AND btrim(description) != '') AS has_desc,
  round(100.0 * count(*) FILTER (WHERE description IS NOT NULL AND btrim(description) != '') / count(*), 1) AS pct
FROM v_entity_full_classification
WHERE governance_role = 'governed'
GROUP BY source_table
ORDER BY total DESC
LIMIT 10;

Output nguyên văn:

    source_table     | total | has_desc |  pct  
---------------------+-------+----------+-------
 system_issues       |  2064 |     2064 | 100.0
 dot_tools           |   288 |      288 | 100.0
 meta_catalog        |   169 |      169 | 100.0
 collection_registry |   164 |      164 | 100.0
 workflow_steps      |    70 |       70 | 100.0
 dot_domain_rules    |    67 |       67 | 100.0
 taxonomy            |    58 |       58 | 100.0
 law_jurisdiction    |    43 |       43 | 100.0
 entity_species      |    40 |       40 | 100.0
 ui_pages            |    37 |       37 | 100.0
(10 rows)

A4. Mẫu 5 description auto-gen — query nguyên bản

SELECT code, source_table, left(description, 120) AS desc_preview
FROM v_entity_full_classification
WHERE governance_role = 'governed' 
  AND description_provenance = 'PROV-DOT'
LIMIT 5;

Output nguyên văn:

ERROR:  column "code" does not exist
LINE 1: SELECT code, source_table, left(description, 120) AS desc_pr...
               ^

Schema thực tế của view:

 ordinal_position |      column_name       | data_type 
------------------+------------------------+-----------
                1 | entity_code            | text
                2 | source_table           | text
                3 | entity_type            | text
                4 | name                   | text
                5 | description            | text
                6 | description_length     | integer
                7 | status                 | text
                8 | domain                 | text
                9 | tier                   | text
               10 | paired_dot             | text
               11 | governance_role        | text
               12 | species_code           | text
               13 | composition_level      | text
               14 | description_provenance | text
(14 rows)

A4-alt dùng entity_code thay code:

SELECT entity_code, source_table, left(description, 120) AS desc_preview
FROM v_entity_full_classification
WHERE governance_role = 'governed' 
  AND description_provenance = 'PROV-DOT'
LIMIT 5;

Output nguyên văn:

           entity_code            | source_table |                                            desc_preview                                            
----------------------------------+--------------+----------------------------------------------------------------------------------------------------
 DOT-FIX-REPAIR-DETECT            | dot_tools    | [A] [governance.audit] cron trigger. Operation: audit. Paired: (chưa có).
 DOT-FIX-REPAIR-PROPOSE           | dot_tools    | [B] [governance.approval] event trigger. Operation: register. Paired: DOT-FIX-REPAIR-DETECT.
 DOT-FIX-REPAIR-DETECT-TEST       | dot_tools    | [A] [governance.audit] on-demand trigger. Operation: verify. Paired: DOT-FIX-REPAIR-DETECT.
 dot-ops-silent-fail-scan-test    | dot_tools    | [A] [governance.audit] on-demand trigger. Operation: test. Paired: dot-ops-silent-fail-scan.
 dot-ops-silent-fail-propose-test | dot_tools    | [A] [governance.approval] on-demand trigger. Operation: test. Paired: dot-ops-silent-fail-propose.
(5 rows)

A5. Mẫu 5 entity governed thiếu description — query nguyên bản

SELECT code, source_table, description
FROM v_entity_full_classification
WHERE governance_role = 'governed' 
  AND (description IS NULL OR btrim(description) = '')
LIMIT 5;

Output nguyên văn:

ERROR:  column "code" does not exist
LINE 1: SELECT code, source_table, description FROM v_entity_full_cl...
               ^

A5-alt dùng entity_code thay code:

SELECT entity_code, source_table, description
FROM v_entity_full_classification
WHERE governance_role = 'governed' 
  AND (description IS NULL OR btrim(description) = '')
LIMIT 5;

Output nguyên văn:

 entity_code | source_table | description 
-------------+--------------+-------------
(0 rows)

B. Chuông H11a/H11b — có đang rung không?

B1. H11a findings hiện tại

SELECT count(*) AS h11a_total 
FROM v_entity_full_classification v 
WHERE v.governance_role = 'governed' 
  AND (v.description IS NULL OR btrim(v.description) = '');

Output nguyên văn:

 h11a_total 
------------
          0
(1 row)

B2. H11b findings hiện tại

SELECT count(*) AS h11b_total 
FROM v_entity_full_classification v 
WHERE v.governance_role = 'governed' 
  AND v.description IS NOT NULL 
  AND btrim(v.description) <> '' 
  AND (v.description_provenance = 'PROV-DOT' OR v.description_provenance IS NULL);

Output nguyên văn:

 h11b_total 
------------
       1393
(1 row)

B3. system_health_checks rows H11a + H11b

SELECT code, name, is_active, check_kind, severity_on_fail, auto_fix_action
FROM system_health_checks
WHERE code IN ('H11a', 'H11b', 'H11');

Output nguyên văn:

 code |            name            | is_active |   check_kind   | severity_on_fail |    auto_fix_action     
------+----------------------------+-----------+----------------+------------------+------------------------
 H11  | Description Coverage       | f         | detect_only    | warn             | 
 H11b | Description Detail Missing | t         | detect_only    | warn             | 
 H11a | Description Basic Missing  | t         | detect_and_fix | critical         | heal_description_basic
(3 rows)

B4. system_issues cho H11a/H11b

SELECT source, status, count(*)
FROM system_issues
WHERE source IN ('H11a', 'H11b')
GROUP BY source, status
ORDER BY source, status;

Output nguyên văn:

 source |  status  | count 
--------+----------+-------
 H11a   | open     |     6
 H11b   | archived |     1
 H11b   | open     |     5
(3 rows)

B5. Executor heartbeat

SELECT key, value 
FROM dot_config 
WHERE key LIKE '%heartbeat%' OR key LIKE '%last_run%' OR key LIKE '%executor%';

Output nguyên văn:

               key               | value 
---------------------------------+-------
 hc_executor_max_runtime_seconds | 600
(1 row)

B6. Severity case inconsistency

SELECT severity, count(*) 
FROM system_issues 
GROUP BY severity 
ORDER BY count DESC;

Output nguyên văn:

 severity | count 
----------+-------
 warning  |   764
 WARNING  |   759
 critical |   285
 warn     |   224
 CRITICAL |    27
 info     |     2
 normal   |     2
 INFO     |     1
(8 rows)

C. Context pack reflection

C1. Đ43 build gần nhất

SELECT key, value FROM dot_config WHERE key LIKE '%context_pack%' ORDER BY key LIMIT 10;

Output nguyên văn:

                   key                    |                                                     value                                                     
------------------------------------------+---------------------------------------------------------------------------------------------------------------
 context_pack_dot_register_watch_tiers    | ["A","B","C"]
 context_pack_grace_period_days           | 7
 context_pack_mode                        | warn
 context_pack_output_root                 | /opt/incomex/context-pack
 context_pack_python_deps                 | ["chevron","jinja2"]
 context_pack_render_config_whitelist     | ["placeholder_style","date_format","group_by","whitelist_key","source_patterns_key","diagram_type","filters"]
 context_pack_retry_policy                | {"max_retries":3,"backoff_seconds":[60,300,1800]}
 context_pack_scan_db_whitelist           | []
 context_pack_scan_paths                  | ["/opt/incomex/dot/bin","/opt/incomex/web/app","/opt/incomex/deploy","/opt/incomex/scripts"]
 context_pack_section_headroom_multiplier | 1.5
(10 rows)

Nhận xét ngắn

  1. Khai sinh cơ bản đang cover hết theo view hiện tại: governed có description = 3106, thiếu = 0. H11a detect query cũng trả 0.
  2. Nội dung auto-gen đang khai được metadata kỹ thuật cơ bản, ví dụ DOT tier/domain/trigger/operation/paired. Đây là mô tả skeleton vận hành, chưa phải enrichment nghiệp vụ.
  3. Enrichment chưa xong: 1393/3106 description còn PROV-DOT, trong khi PROV-HUMAN là 1713. Không thấy PROV-AI trong kết quả A2.
  4. H11a/H11b check definitions còn sống đúng hướng: H11 inactive, H11a/H11b active. H11a là detect_and_fix, critical, có heal_description_basic; H11b là detect_only, warn.
  5. Chuông đang có dấu hiệu dây auto-close/heartbeat chưa đủ: H11a findings hiện tại = 0 nhưng vẫn còn 6 issue H11a open; dot_config không có heartbeat/last_run, chỉ có hc_executor_max_runtime_seconds=600, nên chưa chứng minh executor đang chạy và auto-close sau reclassify.
  6. Severity bị lệch chuẩn case/value: đang có warning, WARNING, warn, critical, CRITICAL, info, INFO, normal. Đây có thể làm query/guard theo exact value bị mù một phần nếu không normalize.
  7. Query A4/A5 trong prompt dùng cột code, nhưng production view v_entity_full_classification dùng entity_code. Đây là mismatch nhỏ giữa contract truy vấn và schema view.