Handoff S178 Fix 26 → Fix 27
Phiên: S178 Fix 26 | Ngày: 2026-04-22
HP: v4.6.3 (14 NT) | Đ22: v1.2 | Đ35: v5.2 | Đ43: v1.2 FINAL rev 6
§0. TÓM TẮT 1 CÂU
Vòng lặp Đ22 §1 từ gãy bước ② → sống hoàn chỉnh 5/5 bước. Camera có, dây nối, chuông kêu, vòi phun, máy ký giấy tự động, đồng hồ hẹn giờ, cảnh báo kẹt. Nhóm A+ DONE 100%. A11 (DROP bảng cũ) chờ 48h gate ngày 23/4.
§1. QUYẾT ĐỊNH KỸ THUẬT CỤ THỂ
| # |
Quyết định |
Lý do |
| 1 |
fn_log_issue: SECURITY DEFINER, OWNER directus, 10 params |
Tương lai executor chạy role khác vẫn INSERT được. Signature generic (p_source, p_severity, p_title, p_description, p_entity_type, p_entity_code, p_issue_type, p_evidence jsonb, p_run_id, p_status) |
| 2 |
dot-hc-executor v1.2.0: 750+ dòng, query ALL WHERE is_active=true, không filter jurisdiction |
NT13 PG Driven — thêm check = INSERT row, executor tự thấy |
| 3 |
Auto-fix dispatcher: dispatch theo auto_fix_action value từ PG. Config gate convention hc_{action}_autofix_enabled |
NT13 — thêm action mới = INSERT dot_config key theo convention |
| 4 |
Config key renamed: hc_trigger_autofix_enabled → hc_auto_attach_trigger_autofix_enabled |
Khớp convention derive từ auto_fix_action value |
| 5 |
PG trigger trg_auto_apr_on_fallback trên admin_fallback_log |
Động cơ phụ Đ22 §5 — INSERT fallback → tự tạo APR. Không bao giờ quên |
| 6 |
HC-TRIGGER detect query dùng pg_trigger+pg_class thay information_schema.triggers |
RO role nhìn nhất quán với admin |
| 7 |
Re-check max 1 lần, không loop |
Detect → Fix → Re-check 1 → DỪNG. Fail → log warning |
| 8 |
Stuck alert: lockfile age > dot_config.hc_executor_max_runtime_seconds (600s) → fn_log_issue critical. Không auto-kill PID |
NT9 an toàn — cảnh báo, không can thiệp |
| 9 |
Cron: executor 0 */3 * * *, verify 30 */3 * * *. Log date-based /var/log/incomex/ |
|
| 10 |
11 triggers auto-attached production (apr_request_types, apr_action_types, agents, tasks, workflow_change_requests, workflow_steps, workflows, ui_pages, checkpoint_sets, checkpoint_types, system_issues). APR 238-248 retroactive |
|
§2. SAI LẦM + BÀI HỌC
| # |
Sai lầm |
Bài học |
| 1 |
Prompt A+3 v1 thiếu NT7 (dual-trigger), NT2 (non-interactive), NT9 (error isolation), NT4 (scale overlap) |
Rà 14 NT từng cái trước khi gửi prompt. Checklist, không tin trí nhớ |
| 2 |
RO re-check blind spot: information_schema filter theo role |
Luôn test query dưới role thực tế sẽ chạy, không chỉ admin |
| 3 |
APR quên tạo sau auto-fix |
Giải pháp gốc = PG trigger (động cơ phụ), không dựa vào người nhớ |
| 4 |
Handoff Fix 25 ghi "Đ35 §4.1B spec fn_log_issue" nhưng thực tế không tồn tại trong luật |
Verify cross-reference trước khi tin handoff. Ghi TD-S178-31 |
§3. DỮ LIỆU CÓ SỐ
- system_health_checks: 28 active checks (tăng từ 19 ban đầu → 28 sau HC-TRIGGER auto-attach)
- system_issues: ~5200+ rows (findings tích lũy)
- End-to-end run: 28 checks, 22 PASS, 4 WARN, 2 CRIT, duration 17s
- max_runtime: 600s (headroom 35×)
- admin_fallback_log: ids 9-19 retroactive documented, APR 238-248
- dot-hc-executor v1.2.0 (~750+ dòng), dot-hc-executor-verify v1.0.0 (226 dòng)
- Commits: /opt/incomex f8eb347→44c7800→76c93c5→latest, /opt/incomex/dot 38c6196→e966f8f→c06ad9c→latest
§4. PROMPT TARGETS (Fix 27)
A11 — DROP bảng cũ (PROMPT ĐÃ SOẠN — artifact prompt-a11)
- Deadline: 2026-04-23T08:17:39Z (48h gate)
- Scope: DROP context_pack_health_checks, verify auto-APR trigger hoạt động production
- Prompt sẵn sàng, chờ gửi CLI sau deadline
Nhóm B — Phase C backfill (ƯU TIÊN Fix 27)
| # |
Việc |
Status |
| B1 |
Nới max_size 2 section (project_map, ops_code_inventory) |
⏳ |
| B2 |
Backfill description 1,314 entity → MỤC TIÊU 2 |
⏳ |
| B3 |
Project Identity trang bìa |
⏳ |
| B4 |
Architecture Annotation 4 lớp |
⏳ |
Nợ kỹ thuật cần trả trước A+7 verify
| TD |
Mô tả |
Priority |
| TD-S178-31 |
Amend Đ35 bổ sung fn_log_issue spec §4.1B |
🟡 |
| TD-S178-32 |
dot-hc-executor hardcode delegation map builtin → move sang dot_config |
🟡 |
Nợ kỹ thuật backlog
| TD |
Mô tả |
Priority |
| TD-S178-25 |
Dedupe system_issues (Đ31 vs Đ22) |
🟡 |
| TD-S178-26 |
system_health_checks lên Tab Pivot Đ26 |
🟢 |
§5. VIỆC TIẾP THEO ĐỦ LÀM NGAY
- Gửi prompt A11 cho CLI sau 2026-04-23T08:17:39Z (artifact
prompt-a11 đã soạn)
- Đọc Đ43 v1.2 rev 6 kỹ — Nhóm B là backfill nội dung Đ43, cần hiểu sâu schema (section types, max_size, description field requirements)
- Soạn prompt B1 (nới max_size) — kiểm tra Đ43 §5.3 check constraint, council nếu cần amend
- B2 (1,314 entity description) — việc nặng nhất nhóm B, cần strategy batch
§6. TÀI LIỆU PATH + REV
| Tài liệu |
Path |
Rev/Version |
| HP |
knowledge/dev/laws/constitution.md |
v4.6.3 (14 NT) |
| Đ22 |
knowledge/dev/laws/law-22-self-healing.md |
v1.2 |
| Đ35 |
knowledge/dev/laws/dieu35-dot-governance-law.md |
v5.2 FINAL |
| Đ43 |
knowledge/dev/laws/dieu43-system-context-law.md |
v1.2 FINAL rev 6 |
| Đ32 |
knowledge/dev/laws/dieu32-approval-law.md |
v1.1 |
| Phụ lục HC |
knowledge/current-state/reports/phu-luc-trien-khai-du-thao-ssot-hc-fix24.md |
Fix 24 |
| Tech Debt |
knowledge/dev/ssot/tech-debt.md |
rev 400 |
| HC-TRIGGER query |
knowledge/current-state/queries/hc-trigger-enforcement-gap.sql |
rev 4 |