Files
solution-erp/.claude/workflows/runs/2026-07-16-S129-adap-errata-16-07/sub-investigator-codebase-2.md
2026-07-16 22:51:50 +07:00

15 KiB
Raw Blame History

sub-investigator-codebase-2 — T2 compendium 7-lớp + 6-dấu-hiệu tự-soi SE (S129)

Engine: fable-real single deep-pass · read-only INTERNAL audit · PROPOSE-only (chỉ ghi file này). Nguồn: broadcasts/inbox/2026-07-16-Governance-tong-hop-loi-da-bat-va-sua-bay-lop-sau-phep-thu.md (sha 0db707e4…, đọc TRỌN §1-§6). Mọi số ĐO lúc chạy 2026-07-16, không chép spec. RE-VERIFY từ đĩa (không tin gợi-ý suông).


A. BẢNG 7 LỚP — trạng-thái SE + phép-thử-nhanh

# Lớp lỗi Trạng-thái SE Evidence (file:line, RE-VERIFIED) Phép-thử lớp
1 Nhãn "đã-đo" thiếu phép-thử làm-TRƯỢT ADOPTED (relabel) + "add-FAIL-test" reading = N/A by-design scripts/crystallized-backfill.ps1:25 = "(4) HEURISTIC RANGE (convention, NOT measured): [bytes/4 .. bytes/3.0]" + :117 "convention char/4 + VN ~3.0-3.5 — CHUA do tokenizer that tai SE (dinh-chinh 58f5afd8)". budget.json:90 _owner_override_note: parallel field measured_token_estimate RETIRED S129, "a stored 'measured/estimate' number invites the mislabel class (san-su-that 190c11ba; SE dinh-chinh 58f5afd8)", "0 script consumers … grep-verified S127 + S129". budget.json:65 token_estimate = "convention … report a RANGE". map-only (xem lý-do §D)
2 Quét theo TÊN-ĐUÔI thay vì LỚP ADOPTED Lesson: feedback_root_cause_over_symptom.md (S122: "được-chỉ-1-chỗ ⇒ PHẢI grep cùng-lớp") + feedback_citation_trap_selfreference.md ("vá 1 CLASS ⇒ grep MỌI matcher cùng-lớp"). Code-embodiment: scripts/governance-detectors.ps1:593-598 Test-Quoted = "SHARED by H24-1 và H24-3 … Deliberately a FUNCTION, not two inline copies: the citation trap is a CLASS … One greppable definition is how the next detector inherits the fix". Mark: ACTIVE-MARKS.md:25 §(3) "bẫy tự-quy-chiếu = CLASS, không phải ca lẻ … helper DUY-NHẤT Test-Quoted, mọi matcher prose PHẢI gọi". Anti-pattern-INSTANCE (SE tự-dính): S125 vá 2 command-file KHÔNG grep sibling → S126 B1 all-inherit sweep (MEMORY S126). map-only
3 Công-cụ-kiểm báo an-toàn GIẢ ADOPTED (2 vế) Vế "ăn sản-phẩm-hỏng-thật": scripts/agent-frontmatter-eol-check.ps1:213-241 synthetic control (RAN §B-b: (+)CRLF FmCr=4>0 PASS · (-)LF FmCr=0 PASS) + :41-52 "a detector that is merely broken is also green … If either control fails, HIGH self-broken FLAG". Vế "cấm đồ-gá chứa sẵn dấu-hiệu": :60-63 "No self-reference hazard: test is STRUCTURAL … path-disjoint from its own scan set". Vế "chế-độ đọc nuốt byte lỗi": :55-58 "Get-Content (default AND -Raw) drops/normalises CR … vacuous BY CONSTRUCTION. [System.IO.File]::ReadAllBytes is used instead". Fault-inject teeth: -RepoRoot param (:85-86, :77) + ACTIVE-MARKS.md:25 "fault-inject 4 bộ, 24/24" (backtick-guard 5/5 · H24-3 6/6 · DUAL-ACCEPT 7/7 · reviewer-retry 6/6). Lesson feedback_faultinjection_proves_teeth.md (S95). RAN (§B-b PASS)
4 Đọc trạng-thái CŨ/ĐỔI-ĐƯỢC như chân-lý ADOPTED + live near-miss CAUGHT Lesson feedback_resume_premise_reverify.md (S121 "bảng-kế-hoạch ≠ đĩa; khẳng-định trạng-thái-đĩa = phải chạm đĩa 1 lệnh"). Live SE case = compendium layer-4 "suýt ghi-thêm TRÙNG một khối": .claude/WAL.md:13 carry "mark-S123 ACTIVE-MARKS.md:33 (⚠️ dấu-hiệu ĐÃ-chốt-rồi — mark RC-…17-23-10 tồn-tại dòng 25+28 — anh confirm 1 chữ là gỡ carry)". Re-grep đĩa: mark RC-pqhuy1987-15-07-2026-17-23-10 ĐÃ tồn-tại + đã stamp ACTIVE-MARKS.md:25 ("anh-confirm S123 · P4 report-before-stamp") ⇒ carry-line STALE, nếu tin sẽ tạo mark TRÙNG. Bắt bằng grep-live thay tin WAL. map-only (grep-đĩa đã chạy)
5 Đóng-dấu/băm HAI-NHỊP lệch nhau ADOPTED (đường-CHUNG + selftest) check-email.md:17 hash-verify 3-đường: (a) whole-file Get-FileHash == nguồn · (b) body-recompute SHA256(body) canonical Y HỆT AI_INFRA\scripts\stamp_verify.py · (python fallback đối-chứng). send-email.md:28 content_sha256 canonical = strip ALL \r + strip 1 leading-newline "Y HỆT receive + khớp stamp_verify.py hub". send-email.md:32 6c Selftest-stamp: NGAY sau Write recompute → so frontmatter, "Lệch → ABORT gửi". Live S125: dinh-chinh 58f5afd8 stamp-then-edit → RE-STAMP + selftest exit-0 ×2 (reviewer/MEMORY.md:76, runs/2026-07-16-S125-…/run.md:18); near-miss "băm lệch → NGHI VERIFIER TRƯỚC" (check-email.md:17 sibling-test 2-chiều). map-only
6 Phao-đo ĐÔNG-CỨNG trong vòng lặp ADOPTED (live re-measure, không đông-cứng) scripts/memory-archive-gate.ps1:114 $bytes = (Get-Item $mem).Length = đo LIVE mỗi run; DRY-RUN default (:86,:227-230 no writes without -Apply); defense chống "dọn-sạch-1-lượt": hysteresis low_watermark_ratio 0.85 (budget.json) + keep_floor_entries 5 + strike_threshold 2 consecutive + value_protect hard-skip (:137-214) + human-curate. Snapshot-stale-by-design: budget.json:90 retired-field measured_token_estimate "0 script consumers" ⇒ không có loop đọc nó. RAN (§B-a): 2× byte-identical, no-strike-persisted
7 Tìm-chuỗi/acceptance = PROXY tồi cho MỆNH-ĐỀ ADOPTED Enclosure use⟂mention: governance-detectors.ps1:598-601 Test-Quoted (backtick-parity), live uses :613/:745/:755; :741-746 "LABEL: first UNQUOTED hit wins … a line that quotes an example label before carrying a real one still yields the real one". grep-c mega-line trap: STATUS.md dòng-6 ~64K chars/1 dòng ⇒ grep -c=1 (dòng) vs -o|wc -l (occurrence) — gotcha-pack #2. acceptance-literal-tự-lão-hoá: ACTIVE-MARKS.md:36 "class acceptance literal tự-lão-hoá, S121 … lập-luận giữ, literal gỡ". Goodhart classify-before-count: feedback_goodhart_leave_measurement_set.md + eol-check :64-66 "never print a verdict label next to a number that says otherwise" + :323-328 GREEN-BUT-VACUOUS self-label. RAN (§B-c): Test-Quoted located + use⟂mention example

Tally A: 7/7 ADOPTED · 0 N-A toàn-lớp · 1 nuance (lớp-1 "add-FAIL-test" reading = N/A by-design, relabel là fix đúng).


B. 3 QUICK-TEST BẮT BUỘC — output THẬT (chạy 2026-07-16)

(a) Lớp-6 scripts/memory-archive-gate.ps1 × 2 liên-tiếp → phao SỐNG hay ĐÔNG-CỨNG?

RUN 1 ≡ RUN 2 byte-identical. Cả 9 sub over?=no (investigator-codebase 18642B < cap 25600). PASS 2 A7 GATE PASS total pointers 251 resolved 251 failed 0. [A6] DRY-RUN: strike counters NOT persisted. git status --porcelain .claude/agent-memory/.archive-strikes.json = rỗng (0 side-effect). Exit 0. VERDICT: PASS — gauge đọc bytes LIVE mỗi run (re-measure, không snapshot-đông-cứng); DRY-RUN idempotent ⇒ lần-2 cùng-verdict/không-đề-xuất-mới. (Nghịch với anti-pattern: 1 loop lấy phao đo-1-lần → dọn-sạch-1-lượt; SE không có loop tự-apply, DRY + human-curate.)

(b) Lớp-3 scripts/agent-frontmatter-eol-check.ps1 → synthetic control ± PASS?

===== Synthetic control (DECLARED SYNTHETIC) - does the byte-reader have teeth? =====
  (+) CRLF synthetic : fm=True FmCr=4 BodyCr=1  expect fm=True,FmCr>0  -> PASS
  (-) LF   synthetic : fm=True FmCr=0 BodyCr=0  expect fm=True,FmCr=0  -> PASS
  [OK] reader detects CRLF and stays silent on LF - a green scan below is at least meaningful
  (reminder: the control proves the READER works. It does NOT prove CRLF harms anything - S121 W0.6 measured that it does not.)

Scan: agents=15 · commands=18 · skills=6 = 39 file, CR-bytes=0. TOTAL FLAGS: 0, RESULT: GREEN-BUT-VACUOUS (self-label trung-thực "Do NOT bank this as an achievement"). Exit 0. VERDICT: PASS — control 2 chiều ĐẠT (reader có răng: bắt CRLF, im trên LF). Scan green = vacuous-honest, không khoe.

(c) Lớp-7 Test-Quoted trong scripts/governance-detectors.ps1 — file:line + ví-dụ use⟂mention SỐNG

  • Định-nghĩa: governance-detectors.ps1:598-601
    function Test-Quoted { param([string]$Line,[int]$Index)
      return ((([regex]::Matches($Line.Substring(0,$Index),'`')).Count % 2) -eq 1) }
    
    (đếm backtick TRƯỚC vị-trí match; lẻ ⇒ đang trong `…`mention ⇒ skip).
  • Ví-dụ enclosure use⟂mention SỐNG: :741-746 (session-label detector) — comment :741 "LABEL: first UNQUOTED hit wins. Matches(all) + Test-Quoted, so a line that quotes an example label before carrying a real one still yields the real one"; :745 if (Test-Quoted $ls[$i] $lm.Index) { continue }. Cùng cơ-chế :613 (H24-1 anchor-date) + :755 (H24-3 max-heading). Header :593-597 ghi lý-do: S123 review bắt H24-3 ship THIẾU guard trong chính diff chứng-minh class tồn-tại. VERDICT: PASS — Test-Quoted = discriminator use⟂mention, dùng SỐNG 3 site, đúng "file NÓI VỀ pattern ≠ file DÙNG pattern".

Tất cả 3 quick-test BẮT BUỘC = CHẠY THẬT (không map-only).


C. BẢNG 6 DẤU-HIỆU XUYÊN-DỰ-ÁN — SE dính cái nào

# Dấu-hiệu SE dính? Evidence
1 EOL/CRLF lật ngầm khi tái-dựng worktree DÍNH (đã có sàn) .gitattributes S120 * text=auto eol=lf + binary tường-minh; scripts/agent-frontmatter-eol-check.ps1 byte-level; 188 file i/lf w/crlf INFORM-only by-design (131 EF Migrations); W0.6 spawn-probe REFUTED CRLF-fatal (scope agents/, runs/2026-07-15-S119…/W0-evidence). gotcha-pack #6/#7/#8.
2 "Vắng-mặt"→"sạch" + quên-kiểm-tại-điểm-phóng (kỷ-luật-người THUA cổng-máy) DÍNH (đã có cổng-máy) feedback_monitor_residual_write_containment.md (git-diff commit-gate = backstop THẬT, không dựa kỷ-luật); eol-check :323-328 "0 CR = GREEN-BUT-VACUOUS, KHÔNG phải achievement"; backfill=0-rows = cờ đỏ (gotcha #79 Mig 60→61); archive-gate/eol-check/governance-detectors = 3 cổng-máy. send-email.md:32 selftest = cổng tại-điểm-phóng (NGAY sau Write).
3 Nhãn-đo thay cho phép-đo DÍNH (đã sửa) SE tự rút nhãn "measured": crystallized-backfill.ps1:25 "convention, NOT measured"; budget.json:90 measured_token_estimate RETIRED; email hub dinh-chinh 58f5afd8. Self-bias "cùng một chiều": feedback_meta_count_selfcoverage_blindspot.md (S119 lead ĐẾM-VỀ-MÌNH sai ~13%).
4 Công-cụ-đo tự nói dối trên đúng lớp nó đo DÍNH — instance được cite PS5.1 Get-Content -Raw mojibake S125: check-email.md:17 "🔴 CẤM Get-Content -Raw cho hash — PS 5.1 đọc UTF-8-no-BOM bằng ANSI → mojibake → false-tamper (S125)"; send-email.md:28 cùng cấm. Đối-chứng đường-2: sibling-test + stamp_verify.py (check-email.md:17). Bản-thân lớp EOL: eol-check.ps1:55-58 "Get-Content nuốt CR → vacuous BY CONSTRUCTION → dùng ReadAllBytes"; tab-column trap: gotcha-pack #4 ([IO.File]::ReadAllBytes vì Get-Content drop CR).
5 Biến-thể con-dấu = đất cho verifier dễ-gãy DÍNH (đã có đường-CHUNG) + 1 open send-email.md:28/check-email.md:17 = 1 đường canonical PHÂN-PHỐI CHUNG (khớp stamp_verify.py hub) thay mỗi nơi tự chế. stamp_verify.py 3-OK/2-NO-DECLARED-SHA (MEMORY S125). Open declared: recipe body-sha strip-1 vs strip-ALL = ứng-viên adap-request (WAL.md:14 + sub-reviewer-1.md §tooling-note) — CHỜ hub.
6 Số-liệu trong thư đi rất nhanh DÍNH (đã có kỷ-luật mốc-đo) B1 derived-trỏ-canonical: số bảng/mig/menu KHÔNG chép, trỏ docs/STATUS.md (permission-matrix skill header + budget.json mfe B1). Memory entries kèm [sNNN, YYYY-MM-DD] mốc; feedback_root_cause S122 "SHA-bịa tái-phạm sau 1 ngày" = hậu-quả số-không-mốc.

Tally C: 6/6 DÍNH — 5/6 đã-có-sàn/đã-sửa · 1/6 (dấu-hiệu-5) còn 1 open declared (strip-1-vs-ALL, hub-gated).


D. GAP LIST THẬT

0 GAP ẩn. Lý-do phủ per-lớp:

  • Lớp 1: phép-thử "đổi hằng-số ±half → chạy bộ-kiểm" = map-only + N/A by-design. Hằng-số SE (/3.0, /4.0) KHÔNG có test-suite pin (không phải "measured constant" mà là RANGE-convention). Chạy ±half sẽ "all-green" NHƯNG đó là ĐÚNG: pin nó = false-precision = chính anti-pattern. Fix đúng của SE = relabel "convention, NOT measured" + provenance (đã làm crystallized-backfill.ps1:25/117 + budget.json:65/90), KHÔNG phải thêm numeric-assert. Compendium §5 xác-nhận "dải cận-trên tạm-thời … ra ngoài dải là BÌNH-THƯỜNG". ⇒ không gap.
  • Lớp 2/3/6/7: có guard code SỐNG + fault-inject teeth (24/24 mark, synthetic-control ran, Test-Quoted ran, archive-gate ran). ⇒ không gap.
  • Lớp 4: live near-miss (mark-S123 stale-carry) đã BẮT (grep-đĩa), đang CHỜ-ANH 1 chữ gỡ carry (WAL.md:13) — caught-and-owner-gated, KHÔNG phải silent-gap.
  • Lớp 5: đường-CHUNG đã có; 1 KNOWN-OPEN declared (không ẩn): recipe body-sha strip-1 vs strip-ALL = ứng-viên adap-request CHỜ-hub-land (WAL.md:14). Nấc = "tìm-thấy-đang-CHỜ-hub", không phải chưa-biết.

2 KNOWN-OPEN (đã khai, owner/hub-gated — KHÔNG silent):

  1. [lớp-4] Gỡ carry-line WAL.md:13 "mark-S123" (mark đã tồn-tại+stamped :25/:28) — chờ anh confirm 1 chữ.
  2. [lớp-5/dấu-hiệu-5] Recipe body-sha strip-1 vs strip-ALL — ứng-viên adap-request, chờ hub-broadcast land + verify-hash trước áp.

Đề-xuất hành-động: cả 2 = owner/hub-gated ⇒ KHÔNG tự-áp (đúng PROPOSE-only). Chỉ cần giữ MỞ trong WAL (đã có). Không đề-xuất diff code mới cho T2 (7/7 lớp đã có sàn; T0/T1 xử phần EOL-metric riêng).


E. Tests-đã-chạy vs map-only (khai thẳng)

  • CHẠY THẬT: (a) archive-gate ×2 · (b) eol-check synthetic-control · (c) Test-Quoted locate+example · (d) grep-live đĩa cho layer-4 mark-existence · (e) crystallized/budget label re-verify.
  • MAP-ONLY (evidence-đủ, không chạy suite): lớp-1 ±half-constant (N/A by-design, xem §D) · lớp-2 grep-class (đã dẫn Test-Quoted shared-fn) · lớp-4 phép-thử grep-trước-hành-động (đã minh-hoạ bằng chính mark-S123) · lớp-5 hash-2-đường (đã dẫn recipe file:line, không re-send email).

Kết-luận T2: 7/7 lớp ADOPTED (1 nuance by-design) · 6/6 dấu-hiệu DÍNH-đã-có-sàn · 0 GAP ẩn · 2 KNOWN-OPEN owner/hub-gated · 3/3 quick-test BẮT BUỘC PASS.