[CLAUDE] Docs: thi hanh tron plan adap dot-2 (P2/P3/P5/P7i + W4 + khoan 5/6)

Chu du an chot 6 cau @S181; so quyet-dinh o
runs/2026-08-07-S180-adap-upgrade-pack-phased/owner-decisions-07-08-2026-dot-2.md

- P2=PB-2 sua luat da ratify du 2 SITE (tiep.md §3-bis canonical + pause.md
  b6 chi TRO). Cau cam san-3 GIU NGUYEN, chi them ranh REQUEST ⟂ TASK.
- W4: docs/governance/so-yeu-cau-chu-du-an.md 3 khoi, ma YC/ST/PN vinh vien.
  Config: tiep_reload.sources 8->9 + owner_request_verbatim_char_cap.
  nhip-no-probe ve-5 "so-yc treo/nhac2+", fault-inject 5/5, phan biet
  chua-co-du-lieu ⟂ treo 0. Ky luat ghi-NGAY + A5 cam CLAUDE.md + rules.md §6.0.
- P5: ACTIVE-MARKS §LT3 luat tu-tri 3 bac + mark RC-...-07-08-2026-20-57-48.
- P7(i): docs/governance/expensive-runs-view.md derive-view 5 cot.
- P3=B: niem phong _sealed_P3B_S181 (forward-only). Phep thu A10 da co rang
  (fault-inject: class tu che => exit 2; class hop le => exit 0).
- Khoan 6: scripts/naming-baseline.json = NGUON, script chi doc.
  Fault-inject 6/6 hai chieu. 7/7 baseline xanh. 0 byte non-ASCII.
- Khoan 5: broadcasts/_index.md +cot "ap" cuoi hang, backfill 42/4/23 = 69.
- W3 acceptance 6/6 dong + va defect con-tro bang-19-cua (view-stale-status).

Con treo: P8/W4b, W5, P7 ve (ii), VK-5, P3 hoi-to hay forward-only.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-08-07 21:25:50 +07:00
parent cca2bc1aa8
commit a3776eaac4
21 changed files with 444 additions and 95 deletions

View File

@ -0,0 +1,19 @@
{
"_what": "NGUON DUY-NHAT cua 7 baseline ky-vong cho scripts/naming-scan.ps1. Owner chot phuong an (b) tach-file-du-lieu @S181 2026-08-07 (cau 6 goi adap 7-GD).",
"_rang_buoc": "🔴 File nay la NGUON. naming-scan.ps1 chi DOC. CAM chep so nguoc vao script — chep nguoc = de nguon-doi, dung thu phuong an (b) sinh ra de chan.",
"_y_nghia_so": "So ky-vong = MAU SO cho guard A2 (naming-scan.ps1:99). Tap vang mat => phep do khong ton tai, mau so = 0/<ky-vong>. Vi vay khoa THIEU o day KHONG duoc phep am tham thanh 0 — may in co LOUD roi bo qua nhom do.",
"_khong_phai_su_that": "Day la KY-VONG, khong phai su-that. Lech => tripwire VANG (ngoai bo dem LECH), y nghia la 'chuan hoac kho da doi, doc lai naming-standard.md'. KHONG phai loi.",
"_do_lai": "powershell -ExecutionPolicy Bypass -File scripts/naming-scan.ps1 => doc dong 'mau so: N' cua tung nhom.",
"_updated": "2026-08-07",
"_updated_boi": "S181 (phien-LOGIC 12) - do tuoi sau khi land W3 + P5/P7i + W4 (so yeu-cau).",
"_lich_su_thoi": "S180 va :174 tu 54 -> 55; do lai @S181 cung ngay da la 56. 3/7 khoa thoi trong ~1 ngay. Do la ly do khoa nay co _updated: doc so ma khong biet no cu bao lau thi khong danh gia duoc.",
"sets": {
"vai": 27,
"nhat-ky-vai": 26,
"lenh": 19,
"kich-ban": 57,
"moc-phien": 93,
"so-governance": 19,
"hook": 1
}
}

View File

@ -59,6 +59,40 @@ $script:Pep8 = 0
$script:MissingSets = 0
$script:LechList = @()
# ---------- baseline ky-vong ----------
# NGUON DUY-NHAT = scripts/naming-baseline.json (chu du an chot phuong an (b) @S181, cau 6).
# (a) Script nay chi DOC. CAM chep so nguoc vao day -- chep nguoc = de nguon-doi,
# dung thu ma phuong an (b) sinh ra de chan.
# (b) Nap tu $PSScriptRoot, KHONG phai $RepoRoot: fault-inject chay -RepoRoot <cay-tam>
# nhung baseline la thuoc tinh cua CHUAN, khong phai cua cay dang quet.
# (c) Thieu khoa / hong tep => IN LOUD roi tra $null. CAM tra 0: so 0 se lam mau so
# cua guard A2 (:99) thanh "0/0", va "0/0" doc thanh SACH. Do dung la bay
# "vang mat trong giong on" ma guard A2 duoc dung len de chan.
$script:BaselinePath = Join-Path $PSScriptRoot 'naming-baseline.json'
$script:Baseline = $null
$script:BaselineUpdated = '(khong ro)'
if (Test-Path -LiteralPath $script:BaselinePath) {
try {
$bj = Get-Content -LiteralPath $script:BaselinePath -Raw | ConvertFrom-Json
$script:Baseline = $bj.sets
if ($bj._updated) { $script:BaselineUpdated = [string]$bj._updated }
} catch {
Write-Host ("FLAG BASELINE-HONG: doc duoc '{0}' nhung khong parse duoc JSON: {1}" -f $script:BaselinePath, $_.Exception.Message) -ForegroundColor Red
}
} else {
Write-Host ("FLAG BASELINE-VANG: khong thay '{0}'. Moi nhom se chay KHONG co ky-vong." -f $script:BaselinePath) -ForegroundColor Red
}
function Get-Baseline([string]$Label) {
if ($null -eq $script:Baseline) { return $null }
$p = $script:Baseline.PSObject.Properties[$Label]
if ($null -eq $p) {
Write-Host (" FLAG BASELINE-THIEU-KHOA: '{0}' khong co trong naming-baseline.json" -f $Label) -ForegroundColor Red
return $null
}
return [int]$p.Value
}
function Write-Head([string]$t) { Write-Host ''; Write-Host $t -ForegroundColor Cyan }
function Add-Verdict {
@ -84,19 +118,31 @@ function Scan-Set {
# 'Item' = ca tep LAN thu muc. Bat buoc cho scripts/ va docs/governance/ vi
# tap 231 dem theo don vi "muc" o hai nhom do (bay don-vi: tep != muc).
[ValidateSet('File', 'Dir', 'Item')][string]$Kind,
[int]$Expect,
# -1 = khong truyen tay => tra cuu tu naming-baseline.json theo $Label.
# KHONG dat mac dinh 0: xem ghi chu (c) o khoi nap baseline.
[int]$Expect = -1,
[scriptblock]$Rule,
[string]$Filter = '*',
[switch]$Recurse
)
if ($Expect -lt 0) {
$b = Get-Baseline $Label
if ($null -ne $b) { $Expect = $b }
}
$hasExpect = ($Expect -ge 0)
$full = Join-Path $RepoRoot $RelPath
Write-Head ("--- NHOM: {0} [{1}]" -f $Label, $RelPath)
if (-not (Test-Path -LiteralPath $full)) {
$script:MissingSets++
Write-Host (" FLAG THIEU-TAP: khong tim thay '{0}'." -f $RelPath) -ForegroundColor Red
Write-Host (" Day KHONG phai [skip]. Tap vang mat => phep do khong ton tai, mau so = 0/{0} ky vong." -f $Expect) -ForegroundColor Red
if ($hasExpect) {
Write-Host (" Day KHONG phai [skip]. Tap vang mat => phep do khong ton tai, mau so = 0/{0} ky vong." -f $Expect) -ForegroundColor Red
} else {
Write-Host " Day KHONG phai [skip]. Tap vang mat => phep do khong ton tai, va KHONG CO ky-vong lam mau so (baseline thieu) => CAM doc thanh sach." -ForegroundColor Red
}
Write-Host " Nguyen nhan thuong gap: thu muc vua bi doi ten => moi may neo vao no cung mu theo."
return
}
@ -127,8 +173,10 @@ function Scan-Set {
}
Write-Host (" mau so: {0} {1}" -f $n, $unit) -NoNewline
if ($n -ne $Expect) {
Write-Host (" [!] lech ky vong {0} - chuan hoac kho da doi, doc lai naming-standard.md" -f $Expect) -ForegroundColor Yellow
if (-not $hasExpect) {
Write-Host " [!] KHONG CO ky-vong cho nhom nay trong naming-baseline.json" -ForegroundColor Red
} elseif ($n -ne $Expect) {
Write-Host (" [!] lech ky vong {0} (do ngay {1}) - chuan hoac kho da doi, doc lai naming-standard.md" -f $Expect, $script:BaselineUpdated) -ForegroundColor Yellow
} else { Write-Host '' }
Write-Host (" OK {0}/{1} | LECH {2}/{1} | MIEN-theo-luat {3}/{1}" -f $lo, $n, $lk, $lm)
@ -148,7 +196,7 @@ Write-Host "Chuan : docs/governance/naming-standard.md"
Write-Host "Tap do : 231 ten vat-bo-may, 0 mien tru VUNG (khong quet 1.545 tep .md - bay-4)."
# 1/7 - vai
Scan-Set -Label 'vai' -RelPath '.claude/agents' -Kind File -Expect 27 -Filter '*.md' -Rule {
Scan-Set -Label 'vai' -RelPath '.claude/agents' -Kind File -Filter '*.md' -Rule {
param($f)
if ($f.Name -eq 'README.md') { return @('MIEN', 'quy uoc pho quat (luat L4)') }
if ($f.BaseName -cmatch $RX_KEBAB) { return @('OK', '') }
@ -156,14 +204,14 @@ Scan-Set -Label 'vai' -RelPath '.claude/agents' -Kind File -Expect 27 -Filter '*
}
# 2/7 - thu muc nhat ky vai
Scan-Set -Label 'nhat-ky-vai' -RelPath '.claude/agent-memory' -Kind Dir -Expect 26 -Rule {
Scan-Set -Label 'nhat-ky-vai' -RelPath '.claude/agent-memory' -Kind Dir -Rule {
param($d)
if ($d.Name -cmatch $RX_KEBAB) { return @('OK', '') }
return @('LECH', 'thu muc nhat ky phai trung ten vai (kebab thuan)')
}
# 3/7 - lenh
Scan-Set -Label 'lenh' -RelPath '.claude/commands' -Kind File -Expect 19 -Rule {
Scan-Set -Label 'lenh' -RelPath '.claude/commands' -Kind File -Rule {
param($f)
if ($f.Name -eq 'README.md') { return @('MIEN', 'quy uoc pho quat (luat L4)') }
if ($f.BaseName -cmatch $RX_KEBAB) { return @('OK', '') }
@ -171,7 +219,7 @@ Scan-Set -Label 'lenh' -RelPath '.claude/commands' -Kind File -Expect 19 -Rule {
}
# 4/7 - kich ban (2 quy uoc ngon ngu, luat L4). Don vi = MUC (co ca thu muc con).
Scan-Set -Label 'kich-ban' -RelPath 'scripts' -Kind Item -Expect 55 -Rule {
Scan-Set -Label 'kich-ban' -RelPath 'scripts' -Kind Item -Rule {
param($f)
if ($f.Name -eq 'README.md') { return @('MIEN', 'quy uoc pho quat (luat L4)') }
if ($f.Name -eq '__pycache__') { return @('MIEN', 'vat sinh tu dong (luat L4)') }
@ -189,7 +237,7 @@ Scan-Set -Label 'kich-ban' -RelPath 'scripts' -Kind Item -Expect 55 -Rule {
}
# 5/7 - tep moc phien. BUOC -Recurse: tep nam trong session-<N>/, khong nam o goc.
Scan-Set -Label 'moc-phien' -RelPath '.claude/sessions' -Kind File -Expect 90 -Recurse -Rule {
Scan-Set -Label 'moc-phien' -RelPath '.claude/sessions' -Kind File -Recurse -Rule {
param($f)
if ($f.Name -cmatch $RX_SESSFAM) { return @('OK', '') }
if ($f.Name -cmatch '^pause-') {
@ -202,7 +250,7 @@ Scan-Set -Label 'moc-phien' -RelPath '.claude/sessions' -Kind File -Expect 90 -R
}
# 6/7 - so. Don vi = MUC (co ca thu muc con adap-reports/ adap-requests/).
Scan-Set -Label 'so-governance' -RelPath 'docs/governance' -Kind Item -Expect 16 -Rule {
Scan-Set -Label 'so-governance' -RelPath 'docs/governance' -Kind Item -Rule {
param($f)
if ($f.Name -eq 'README.md') { return @('MIEN', 'quy uoc pho quat (luat L4)') }
if ($f.BaseName -cmatch $RX_KEBAB) { return @('OK', '') }
@ -210,7 +258,7 @@ Scan-Set -Label 'so-governance' -RelPath 'docs/governance' -Kind Item -Expect 16
}
# 7/7 - hook
Scan-Set -Label 'hook' -RelPath '.claude/hooks' -Kind File -Expect 1 -Rule {
Scan-Set -Label 'hook' -RelPath '.claude/hooks' -Kind File -Rule {
param($f)
if ($f.BaseName -cmatch $RX_KEBAB) { return @('OK', '') }
return @('LECH', 'hook phai kebab')

View File

@ -220,7 +220,47 @@ try {
$pullSeg = 'pull-cach n-a'
}
Write-Host ("NHIP-NO: kiem {0} | {1} | {2} | {3}" -f $kiemSeg, $tranSeg, $runSeg, $pullSeg)
# -----------------------------------------------------------------------
# (5) SO YEU-CAU CHU DU AN (C4-06 / W4, S181) - hai ve: dang-treo + nhac-tu-lan-2.
#
# (!) PHAN BIET HAI THU KHAC NHAU, in HAI CHUOI KHAC NHAU:
# 'chua-co-du-lieu' = so vang / khong doc duoc / 0 dong YC -> phep do KHONG TON TAI
# 'treo 0 / nhac2+ 0' = da doc duoc n dong, dem ra bang 0 -> phep do CO, ket qua 0
# Gop hai cai nay lam mot chinh la 'den xanh gia' ma hub goi ten (A4).
# (!) Dong khong tach duoc cot thi DEM RIENG va IN RA, khong bo im lang
# (loi cam 4c 'liet-khong-co' / '[skip] im lang').
# (!) Cot trang thai mang chu co DAU ('mo' co dau moc). File nay BAT BUOC pure-ASCII
# (gotcha #30) nen dung CODE-POINT, khong go chu co dau vao day.
$ycSeg = 'so-yc chua-co-du-lieu'
try {
$ycPath = Join-Path $RepoRoot 'docs/governance/so-yeu-cau-chu-du-an.md'
if (Test-Path -LiteralPath $ycPath) {
# -Encoding UTF8 BAT BUOC: PS 5.1 mac dinh doc theo codepage ANSI, so do
# chu co dau trong cot trang thai bi bien dang TRUOC khi so sanh => dem ra 0
# trong khi so co dong MO that. Da xay ra that o lan cam dau tien (S181).
$ycLines = Get-Content -LiteralPath $ycPath -Encoding UTF8
$OPEN = 'm' + [char]0x1EDF # "mo" voi dau moc = trang thai MO cua yeu-cau
$tot = 0; $treo = 0; $nhac2 = 0; $bad = 0
foreach ($L in $ycLines) {
if ($L -notmatch '^\|\s*`YC-\d+`') { continue }
$tot++
$c = $L -split '\|'
if ($c.Count -lt 8) { $bad++; continue }
if ($c[4].Trim() -eq $OPEN) { $treo++ }
$m = [regex]::Match($c[5], '\d+')
if ($m.Success -and [int]$m.Value -ge 2) { $nhac2++ }
}
if ($tot -gt 0) {
$ycSeg = ("so-yc treo {0} / nhac2+ {1}" -f $treo, $nhac2)
if ($bad -gt 0) { $ycSeg += (" / {0} dong KHONG TACH DUOC COT" -f $bad) }
}
}
}
catch {
$ycSeg = 'so-yc chua-co-du-lieu'
}
Write-Host ("NHIP-NO: kiem {0} | {1} | {2} | {3} | {4}" -f $kiemSeg, $tranSeg, $runSeg, $pullSeg, $ycSeg)
}
catch {
# A probe NEVER blocks a stop point. Any failure prints one generic line.