[CLAUDE] Infra: W5 - engine roster B1 + FIX bug $userMemDir hardcode (fault-inject nay CO LAP duoc)
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 5m31s

W5a -- harness-11-engine.md: 4 hit roster -> 0 occurrence (do bang grep -o|wc -l, KHONG grep -c).
  :269 "12 sub tools:" -> "sub read-only tools:"
  :322 "MOI vai roster 12" -> "MOI vai trong roster hien-hanh" + tro canonical
  :332 GAP-1 "nhan ca 12 vai" -> "nhan TOAN roster" + lich-su 9->12->14 + tro canonical
  :345 x2 -- BAY MEGA-LINE: sua phan "(i) Vai owner-gan" roi VAN con "VALID_ROLES = 12"
       o doan SAU cua CHINH DONG DO. Sua 1 cho tuong xong = dung bay grep -c da ghi WAL 2 lan.
  + danh-sach vai khai ro la BAN SAO; nguon that = hmw.js VALID_ROLES :22-36; lech => tin hmw.js.

W5b -- scripts/governance-detectors.ps1:363 bug $userMemDir:
  TRUOC: $userMemDir = 'C:\Users\pqhuy\.claude\projects\D--Dropbox-...\memory'
  ...nam NGAY DUOI comment ghi "Derive from this machine's project slug".
  => Comment mo-ta Y DINH; code hardcode ca path tuyet-doi LAN username. Loi noi doi
     nam ngay canh dong no noi doi ve.

  2 HAI CU-THE (khong phai style):
  1) -RepoRoot <cay-tam> VAN doc user-memory THAT => fault-inject KHONG co lap duoc
     => teeth-test C1-wikilink bat-kha-thi => cong-cu dung de CHUNG-MINH-CO-RANG
        lai khong co rang cua chinh no.
  2) hardcode 'pqhuy' => may/acc khac se im lang roi xuong else-branch, va mot su
     degrade IM LANG doc y het "sach".

  SAU: $projectSlug = $RepoRoot -replace '[:\/_]', '-'
       $userMemDir  = Join-Path $env:USERPROFILE ".claude\projects\$projectSlug\memory"

  VERIFY 2 CHIEU (do that, khong suy):
  - slug derive tu RepoRoot that == literal hardcode cu, KHOP 100%; Test-Path = True
    => hanh-vi KHONG doi (TOTAL van 45, user-memory van duoc quet)
  - -RepoRoot cay-tam => slug khac => "[note] user-memory path not reachable (...fake-repo\memory)"
    => CO LAP; ro path THAT = 0 hit.

SWEEP CUOI toan repo: 8 hit / 6 file, 0 cai thuoc nhom "doc dan-xuat khai so roster SAI
nhu su-that hien-hanh" => acceptance MOI FIX#6 DAT; nhom "chua toi luot" nay RONG sau W5.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-07-15 15:12:14 +07:00
parent a09dcae999
commit c39ba9d28e
2 changed files with 24 additions and 7 deletions

View File

@ -358,9 +358,26 @@ else {
# ---------------------------------------------------------------------------
Write-Section 'C1 - dangling wikilink'
# user-memory dir (outside repo). Derive from this machine's project slug; if not
# reachable, fall back to in-repo agent-memory only + emit a note.
$userMemDir = 'C:\Users\pqhuy\.claude\projects\D--Dropbox-CONG-VIEC-SOLUTION-SOLUTION-ERP\memory'
# user-memory dir (outside repo). DERIVED from $RepoRoot, not hardcoded.
#
# FIXED S122 W5 -- the old line was:
# $userMemDir = 'C:\Users\pqhuy\.claude\projects\D--Dropbox-...-SOLUTION-ERP\memory'
# ...directly under a comment that claimed "Derive from this machine's project slug".
# The comment described the INTENT; the code hardcoded an absolute path AND a username.
# Two concrete harms, not style:
# 1) -RepoRoot <temp-tree> still read the REAL user-memory => fault-injection could not
# isolate. The C1-wikilink teeth-test (prove the detector FLAGS on injected breakage)
# was therefore unrunnable -- the one tool built to prove teeth had no teeth itself.
# 2) Hardcoded 'pqhuy' => the script silently degrades to the else-branch on any other
# machine/account, and a silent degrade reads exactly like "clean".
#
# The Claude Code project slug IS $RepoRoot with [:\/_] collapsed to '-'. Verified S122:
# D:\Dropbox\CONG_VIEC\SOLUTION\SOLUTION_ERP -> D--Dropbox-CONG-VIEC-SOLUTION-SOLUTION-ERP
# (exact match against the previously hardcoded literal; Test-Path = True)
# and a temp RepoRoot yields a different slug whose path does NOT exist => the else-branch
# fires => fault-injection isolates. That is the whole point of deriving it.
$projectSlug = $RepoRoot -replace '[:\\/_]', '-'
$userMemDir = Join-Path $env:USERPROFILE ".claude\projects\$projectSlug\memory"
$agentMemDir = Join-Path $RepoRoot '.claude\agent-memory'
$memScopes = @()