@chrono-meta/fh-gate 3.39.1 → 3.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/regression/probes_live.yaml +9 -2
- package/.claude-plugin/marketplace.json +4 -4
- package/CLAUDE.md +2 -2
- package/README.ja.md +20 -18
- package/README.zh.md +20 -18
- package/knowledge/shared/harness-core/claude_md_full_reference.md +8 -1
- package/knowledge/shared/harness-core/dispatch_conditional_prohibition.md +9 -0
- package/knowledge/shared/harness-core/fh_module_contract.md +55 -1
- package/knowledge/shared/harness-core/lease_record_channel.md +26 -2
- package/knowledge/shared/harness-core/onboarding_acceleration_autopilot.md +7 -0
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +36 -0
- package/knowledge/shared/rules/operations.md +1 -0
- package/package.json +14 -1
- package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/CHANGELOG.md +52 -0
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/adapters/gstack_content_safety.sh +2 -2
- package/scripts/adapters/mate_agent_boundary.sh +2 -2
- package/scripts/adapters/qasp_new_code_anchor.sh +2 -2
- package/scripts/adapters/qasp_web_rules.sh +2 -2
- package/scripts/agent_tools_pin.txt +16 -0
- package/scripts/catch_tally.py +216 -0
- package/scripts/claim_precision_report.py +138 -0
- package/scripts/fh_module_check.py +182 -1
- package/scripts/fh_session_load.sh +3 -1
- package/scripts/fixture_guard_lib.sh +38 -0
- package/scripts/generated_harness_check.py +4 -0
- package/scripts/lane_identity_tripwire.sh +35 -0
- package/scripts/package_coverage_check.sh +6 -2
- package/scripts/post_squash_verify.sh +53 -1
- package/scripts/pr_merge_verified.sh +57 -1
- package/scripts/probe_live_eval.sh +61 -0
- package/scripts/probe_live_eval_lib.py +47 -4
- package/scripts/selfcheck.sh +17 -0
- package/scripts/selfdev_merge_tier.sh +153 -0
- package/scripts/session_checklist.py +38 -1
- package/scripts/session_close_check.sh +79 -1
- package/scripts/shell_name_boundary_scan.sh +11 -3
- package/scripts/sim_isolated_run.sh +62 -1
- package/scripts/test_adapter_lanes.sh +3 -3
- package/scripts/test_agent_tools_pin_lanes.sh +73 -0
- package/scripts/test_catch_tally_lanes.sh +10 -0
- package/scripts/test_claim_precision_report_lanes.sh +77 -0
- package/scripts/test_doc_claims_1113_lanes.sh +36 -0
- package/scripts/test_fh_module_check_lanes.sh +106 -1
- package/scripts/test_fh_run_resolver_lanes.sh +1 -1
- package/scripts/test_fixture_git_env_lanes.sh +87 -0
- package/scripts/test_generated_harness_check_lanes.sh +8 -0
- package/scripts/test_lane_gap_hint_lanes.sh +2 -2
- package/scripts/test_locale_invariance_lanes.sh +3 -3
- package/scripts/test_name_boundary_locale_lanes.sh +66 -0
- package/scripts/test_package_coverage_lanes.sh +10 -0
- package/scripts/test_post_squash_verify_lanes.sh +23 -2
- package/scripts/test_pr_merge_verified_lanes.sh +62 -3
- package/scripts/test_probe_live_eval_lanes.sh +160 -5
- package/scripts/test_selfdev_merge_tier_lanes.sh +128 -0
- package/scripts/test_session_checklist_lanes.sh +57 -0
- package/scripts/test_session_close_chain_lanes.sh +93 -0
- package/scripts/test_session_close_lanes.sh +11 -0
- package/scripts/test_sim_isolated_run_lanes.sh +67 -0
- package/scripts/test_temper_check_lanes.sh +1 -1
- package/scripts/test_verdict_watermark_lanes.sh +1 -1
- package/templates/harness_birth_core.md +57 -0
|
@@ -389,14 +389,14 @@ _revert_probe() {
|
|
|
389
389
|
# «레인이 튼튼하다» 고 읽는 것이 이 프로브의 최대 실패모드다.
|
|
390
390
|
sed -i.bak "$sedexpr" "$C/peer_resolve.sh" && rm -f "$C/peer_resolve.sh.bak"
|
|
391
391
|
if ! grep -q "$applied_marker" "$C/peer_resolve.sh"; then
|
|
392
|
-
echo " ❌ $name — 중화가 적용되지 않았다(마커 «$applied_marker» 부재). 프로브를 신뢰할 수 없다"
|
|
392
|
+
echo " ❌ $name — 중화가 적용되지 않았다(마커 «${applied_marker}» 부재). 프로브를 신뢰할 수 없다"
|
|
393
393
|
return 1
|
|
394
394
|
fi
|
|
395
395
|
# 중화한 파일 말고는 사본이 실물과 동일해야 한다(다른 변수를 안 건드렸다는 확인).
|
|
396
396
|
local other_diff
|
|
397
397
|
other_diff="$(diff -rq "$REPO_ROOT/scripts/adapters" "$C" 2>/dev/null | grep -v 'peer_resolve.sh' | wc -l | tr -d ' ')"
|
|
398
398
|
if [ "$other_diff" != "0" ]; then
|
|
399
|
-
echo " ❌ $name — 사본이 peer_resolve.sh 외에도 다르다($other_diff건). 프로브 격리 실패"
|
|
399
|
+
echo " ❌ $name — 사본이 peer_resolve.sh 외에도 다르다(${other_diff}건). 프로브 격리 실패"
|
|
400
400
|
return 1
|
|
401
401
|
fi
|
|
402
402
|
# ── 2단 실행: 사본을 대상으로 레인을 통째로 다시 돌린다.
|
|
@@ -445,7 +445,7 @@ esac
|
|
|
445
445
|
|
|
446
446
|
echo
|
|
447
447
|
if [ "$FAIL" -eq 0 ]; then
|
|
448
|
-
# ★`${N}` 로 감싼다 — 한글이 바로 뒤에 오면 bash 가 `$N
|
|
448
|
+
# ★`${N}` 로 감싼다 — 한글이 바로 뒤에 오면 bash 가 `$N` 바로 뒤 `개` 를 **변수명 `N개`** 로 읽어
|
|
449
449
|
# `unbound variable` 로 죽는다(실측 2026-08-16: 레인 23개 전부 초록인데 마지막 요약
|
|
450
450
|
# 줄에서 rc=1). 계기가 자기 보고 줄에서 죽으면 초록이 빨강으로 렌더된다.
|
|
451
451
|
echo "✅ 레인 ${N}개 전부 기대대로"
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Pin each agent definition's `tools:` restriction against scripts/agent_tools_pin.txt.
|
|
3
|
+
# Origin: digest 2026-11-11 (arXiv:2611.09895, «restriction silently deleted» mutant). Measured that
|
|
4
|
+
# day: deleting all 14 `tools:` lines left validate_yaml and the whole selfcheck unchanged — the
|
|
5
|
+
# restrictions were held by prose only. This lane asserts a property of the record (present and equal
|
|
6
|
+
# to the declared value), not whether the restriction is right.
|
|
7
|
+
# T1 every declared file exists and its `tools:` line equals the declared value
|
|
8
|
+
# T2 every agent file under plugins/*/agents and .claude/agents that has a `tools:` line is declared
|
|
9
|
+
# K1-K3 known pair on a temp copy: deletion / widening / undeclared new agent → red; untouched → green
|
|
10
|
+
set -u
|
|
11
|
+
ROOT="${1:-$(cd "$(dirname "$0")/.." && pwd)}"
|
|
12
|
+
PIN="$ROOT/scripts/agent_tools_pin.txt"
|
|
13
|
+
|
|
14
|
+
# `tools:` read from the YAML frontmatter only (between the first two `---` lines) — a body line that
|
|
15
|
+
# happens to say «tools: Read» is not a restriction (codex R1).
|
|
16
|
+
fm_tools() { awk 'NR==1 && $0=="---" {f=1; next} f && $0=="---" {exit} f && /^tools:/ {sub(/^tools: */, ""); print; exit}' "$1"; }
|
|
17
|
+
|
|
18
|
+
check() { # $1 = repo root; prints problems, returns count via rc (capped)
|
|
19
|
+
local root="$1" pin="$1/scripts/agent_tools_pin.txt" n=0 f want got
|
|
20
|
+
[ -f "$pin" ] || { echo " pin list missing: $pin"; return 1; }
|
|
21
|
+
while IFS='|' read -r f want || [ -n "$f" ]; do
|
|
22
|
+
case "$f" in ''|\#*) continue ;; esac
|
|
23
|
+
if [ ! -f "$root/$f" ]; then echo " declared but missing: $f"; n=$((n+1)); continue; fi
|
|
24
|
+
got="$(fm_tools "$root/$f")"
|
|
25
|
+
if [ -z "$got" ]; then echo " tools: line deleted: $f (declared: $want)"; n=$((n+1))
|
|
26
|
+
elif [ "$got" != "$want" ]; then echo " tools: changed: $f «${got}» (declared: «${want}»)"; n=$((n+1)); fi
|
|
27
|
+
done < "$pin"
|
|
28
|
+
local found frc d dirs=()
|
|
29
|
+
# .claude/agents may legitimately not exist — only existing roots go to find, so any find error
|
|
30
|
+
# (GNU quotes paths ‘…’, BSD does not — a message-text filter broke on CI) is an incomplete measurement.
|
|
31
|
+
for d in "$root/plugins" "$root/.claude/agents"; do [ -d "$d" ] && dirs+=("$d"); done
|
|
32
|
+
[ "${#dirs[@]}" -gt 0 ] || { echo " discovery incomplete (no agent roots) — not measured"; return 1; }
|
|
33
|
+
found="$(find "${dirs[@]}" -path '*agents*' -name '*.md' -type f 2>&1)"; frc=$?
|
|
34
|
+
if [ "$frc" -ne 0 ]; then echo " discovery incomplete (find rc=$frc) — not measured"; n=$((n+1)); fi
|
|
35
|
+
while IFS= read -r f; do
|
|
36
|
+
case "$f" in find:*|'') continue ;; esac
|
|
37
|
+
rel="${f#"$root"/}"
|
|
38
|
+
[ -n "$(fm_tools "$f")" ] || continue
|
|
39
|
+
grep -q "^$rel|" "$pin" || { echo " undeclared tools: line: $rel"; n=$((n+1)); }
|
|
40
|
+
done <<< "$found"
|
|
41
|
+
[ "$n" -eq 0 ]
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
fail=0
|
|
45
|
+
declared=$(grep -cvE '^(#|$)' "$PIN" 2>/dev/null); declared=${declared:-0}
|
|
46
|
+
if [ "$declared" -eq 0 ]; then echo " ❌ T0 pin list empty or missing — nothing measured"; fail=1
|
|
47
|
+
elif out="$(check "$ROOT")"; then echo " ✅ T1/T2 $declared declared tools: lines present, unchanged, none undeclared"
|
|
48
|
+
else echo "$out"; echo " ❌ T1/T2 tools: pin drift"; fail=1; fi
|
|
49
|
+
|
|
50
|
+
# Known pair on a temp copy of just the files involved.
|
|
51
|
+
T="$(mktemp -d "${TMPDIR:-/tmp}/atp.XXXXXX")"; trap 'rm -rf "$T"' EXIT
|
|
52
|
+
mk() { rm -rf "$T/r"; mkdir -p "$T/r/scripts"; cp "$PIN" "$T/r/scripts/"
|
|
53
|
+
( cd "$ROOT" && find plugins .claude/agents -path '*agents*' -name '*.md' -type f 2>/dev/null ) \
|
|
54
|
+
| while IFS= read -r f; do mkdir -p "$T/r/$(dirname "$f")"; cp "$ROOT/$f" "$T/r/$f"; done; }
|
|
55
|
+
first="$(grep -vE '^(#|$)' "$PIN" | head -1 | cut -d'|' -f1)"
|
|
56
|
+
mk; check "$T/r" >/dev/null && echo " ✅ K0 untouched copy green (control)" || { echo " ❌ K0 control red"; fail=1; }
|
|
57
|
+
mk; sed -i.bak '/^tools:/d' "$T/r/$first"
|
|
58
|
+
check "$T/r" >/dev/null && { echo " ❌ K1 deletion not caught"; fail=1; } || echo " ✅ K1 deleted restriction → red"
|
|
59
|
+
mk; sed -i.bak 's/^tools: .*/&, Bash/' "$T/r/$first"
|
|
60
|
+
check "$T/r" >/dev/null && { echo " ❌ K2 widening not caught"; fail=1; } || echo " ✅ K2 widened restriction (+Bash) → red"
|
|
61
|
+
mk; mkdir -p "$T/r/plugins/zz/agents"; printf -- '---\nname: x\ntools: Read\n---\n' > "$T/r/plugins/zz/agents/x.md"
|
|
62
|
+
check "$T/r" >/dev/null && { echo " ❌ K3 undeclared agent not caught"; fail=1; } || echo " ✅ K3 undeclared new tools: line → red"
|
|
63
|
+
|
|
64
|
+
# K4 frontmatter restriction deleted, same text left in the body → still red (codex R1)
|
|
65
|
+
mk; awk 'BEGIN{d=0} /^tools:/ && !d {t=$0; d=1; next} {print} END{print ""; print t}' "$T/r/$first" > "$T/x" && mv "$T/x" "$T/r/$first"
|
|
66
|
+
check "$T/r" >/dev/null && { echo " ❌ K4 body-only tools: line accepted"; fail=1; } || echo " ✅ K4 restriction moved out of frontmatter → red"
|
|
67
|
+
# K5 pin list without a trailing newline still checks its last entry (codex R1)
|
|
68
|
+
mk; printf '%s' "$(cat "$T/r/scripts/agent_tools_pin.txt")" > "$T/r/scripts/agent_tools_pin.txt"
|
|
69
|
+
last="$(grep -vE '^(#|$)' "$PIN" | tail -1 | cut -d'|' -f1)"; sed -i.bak '/^tools:/d' "$T/r/$last"
|
|
70
|
+
check "$T/r" >/dev/null && { echo " ❌ K5 last unterminated entry skipped"; fail=1; } || echo " ✅ K5 unterminated last entry still checked → red"
|
|
71
|
+
|
|
72
|
+
echo "agent_tools_pin lanes: $([ $fail = 0 ] && echo PASS || echo FAIL)"
|
|
73
|
+
exit $fail
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_catch_tally_lanes.sh — catch_tally.py 의 기록 규칙 known-pair (얇은 래퍼).
|
|
3
|
+
# 절 없는 날·범위 없는 0건 = 미기록(0 아님) · 목록 밖 방법/놓친 쪽 = INVALID(세지 않음)
|
|
4
|
+
# · 다른 절·범위 밖 날은 안 셈 · 컨트롤(유효 기록만이면 rc=0). 레인은 파이썬 안에 있다.
|
|
5
|
+
# exit: 0 전 레인 PASS · 1 실패 · 10 harness error(python3 부재)
|
|
6
|
+
set -uo pipefail
|
|
7
|
+
SRC="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
8
|
+
command -v python3 >/dev/null 2>&1 || {
|
|
9
|
+
echo "harness error: python3 absent -- cannot measure. Not a pass." >&2; exit 10; }
|
|
10
|
+
python3 "$SRC/catch_tally.py" --self-test
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Lanes for scripts/claim_precision_report.py — known pair + channel-gap cases.
|
|
3
|
+
# P1 DONE → PARTIAL in a later sheet → M=1 (known-positive)
|
|
4
|
+
# P2 DONE → DONE → M=0 (known-negative, same run)
|
|
5
|
+
# P3 DONE → empty 상태 → B=1, M unchanged (not re-judged ≠ corrected)
|
|
6
|
+
# P4 a session with one sheet → listed NOT MEASURED, contributes nothing
|
|
7
|
+
# P5 empty folder → rc 10, NOT MEASURED (absence ≠ 0)
|
|
8
|
+
set -u
|
|
9
|
+
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
10
|
+
R="$HERE/claim_precision_report.py"
|
|
11
|
+
T="$(mktemp -d "${TMPDIR:-/tmp}/cpr.XXXXXX")"
|
|
12
|
+
trap 'rm -rf "$T"' EXIT
|
|
13
|
+
pass=0; fail=0
|
|
14
|
+
ok(){ echo " ✅ $1"; pass=$((pass+1)); }
|
|
15
|
+
ng(){ echo " ❌ $1"; fail=$((fail+1)); }
|
|
16
|
+
|
|
17
|
+
hdr='| # | 시각 | 발화(요지) | 상태 | 증거 | 사유 / 남은 것 | 제안(이번 세션 vs 이월) |
|
|
18
|
+
|---|---|---|---|---|---|---|'
|
|
19
|
+
mkdir -p "$T/d"
|
|
20
|
+
{ echo "$hdr"
|
|
21
|
+
echo '| 1 | 11-01 10:00 | alpha request | ✅DONE | e1 | — | — |'
|
|
22
|
+
echo '| 2 | 11-01 11:00 | beta request | ✅DONE | e2 | — | — |'
|
|
23
|
+
echo '| 3 | 11-01 12:00 | gamma request | ✅DONE | e3 | — | — |'; } > "$T/d/session_checklist_2026-11-01_sA.md"
|
|
24
|
+
{ echo "$hdr"
|
|
25
|
+
echo '| 1 | 11-01 10:00 | alpha request | 🟡PARTIAL | e1 | narrowed | later |'
|
|
26
|
+
echo '| 2 | 11-01 11:00 | beta request | ✅DONE | e2 | — | — |'
|
|
27
|
+
echo '| 3 | 11-01 12:00 | gamma request | | | | |'; } > "$T/d/session_checklist_2026-11-02_sA.md"
|
|
28
|
+
{ echo "$hdr"
|
|
29
|
+
echo '| 1 | 11-03 09:00 | solo request | ✅DONE | e | — | — |'; } > "$T/d/session_checklist_2026-11-03_sB.md"
|
|
30
|
+
|
|
31
|
+
out="$(python3 "$R" --dir "$T/d" 2>&1)"; rc=$?
|
|
32
|
+
echo "$out" | sed 's/^/ | /'
|
|
33
|
+
[ "$rc" = 0 ] && ok "rc 0 on sheets" || ng "rc=$rc"
|
|
34
|
+
echo "$out" | grep -q 'N done-rows=3 ' && ok "P2 N=3 (DONE rows of the measured session)" || ng "P2 N"
|
|
35
|
+
echo "$out" | grep -q 'M later reopened (non-DONE in the enum)=1 ' && ok "P1 M=1 known-positive" || ng "P1 M"
|
|
36
|
+
echo "$out" | grep -q 'alpha request' && ok "P1 reopened row is the alpha row" || ng "P1 row identity"
|
|
37
|
+
echo "$out" | grep -q 'beta request' && ng "P2 known-negative listed as reopened" || ok "P2 beta not listed"
|
|
38
|
+
echo "$out" | grep -q 'B not re-judged in newest sheet (blank, absent or outside the enum)=1 ' && ok "P3 blank counted apart (B=1)" || ng "P3 B"
|
|
39
|
+
echo "$out" | grep -q 'not-measured(<2 readable sheets)=1' && echo "$out" | grep -q 'readable sheets sB' \
|
|
40
|
+
&& ok "P4 single-sheet session named NOT MEASURED" || ng "P4"
|
|
41
|
+
|
|
42
|
+
mkdir -p "$T/empty"
|
|
43
|
+
out="$(python3 "$R" --dir "$T/empty" 2>&1)"; rc=$?
|
|
44
|
+
[ "$rc" = 10 ] && echo "$out" | grep -q 'NOT MEASURED' && ok "P5 empty folder → rc 10 NOT MEASURED" || ng "P5 rc=$rc"
|
|
45
|
+
|
|
46
|
+
# Codex R1 (2026-11-11) — each reproduced red against the first version before the fix.
|
|
47
|
+
# P6 two sheets that cannot be parsed → not measured, never «measured=1 N=0 M=0».
|
|
48
|
+
mkdir -p "$T/bad"; : > "$T/bad/session_checklist_2026-11-01_sC.md"; : > "$T/bad/session_checklist_2026-11-02_sC.md"
|
|
49
|
+
out="$(python3 "$R" --dir "$T/bad" 2>&1)"
|
|
50
|
+
echo "$out" | grep -q 'measured=0 ' && echo "$out" | grep -q 'unreadable sheets session_checklist_2026-11-01_sC.md' \
|
|
51
|
+
&& ok "P6 unreadable sheets → measured=0, named" || ng "P6"
|
|
52
|
+
# P7 DONE → PARTIAL → DONE: the reopening stays counted (sticky).
|
|
53
|
+
mkdir -p "$T/sticky"
|
|
54
|
+
{ echo "$hdr"; echo '| 1 | 11-01 10:00 | delta request | ✅DONE | e | — | — |'; } > "$T/sticky/session_checklist_2026-11-01_sD.md"
|
|
55
|
+
{ echo "$hdr"; echo '| 1 | 11-01 10:00 | delta request | 🟡PARTIAL | e | x | y |'; } > "$T/sticky/session_checklist_2026-11-02_sD.md"
|
|
56
|
+
{ echo "$hdr"; echo '| 1 | 11-01 10:00 | delta request | ✅DONE | e | — | — |'; } > "$T/sticky/session_checklist_2026-11-03_sD.md"
|
|
57
|
+
python3 "$R" --dir "$T/sticky" 2>&1 | grep -q 'M later reopened (non-DONE in the enum)=1 ' && ok "P7 reopening is sticky" || ng "P7"
|
|
58
|
+
# P8 a DONE row absent from the newest sheet counts in B (not re-judged), not as silence.
|
|
59
|
+
mkdir -p "$T/gone"
|
|
60
|
+
{ echo "$hdr"; echo '| 1 | 11-01 10:00 | eps request | ✅DONE | e | — | — |'; } > "$T/gone/session_checklist_2026-11-01_sE.md"
|
|
61
|
+
{ echo "$hdr"; echo '| 1 | 11-02 10:00 | other request | ✅DONE | e | — | — |'; } > "$T/gone/session_checklist_2026-11-02_sE.md"
|
|
62
|
+
python3 "$R" --dir "$T/gone" 2>&1 | grep -q '(blank, absent or outside the enum)=1 ' && ok "P8 absent row counted in B" || ng "P8"
|
|
63
|
+
|
|
64
|
+
# Codex R2: P9 sheets whose 상태 table lacks 시각/발화 → nothing measurable → not measured.
|
|
65
|
+
mkdir -p "$T/nocols"
|
|
66
|
+
for d in 01 02; do printf '| 상태 | 메모 |\n|---|---|\n| ✅DONE | x |\n' > "$T/nocols/session_checklist_2026-11-${d}_sF.md"; done
|
|
67
|
+
python3 "$R" --dir "$T/nocols" 2>&1 | grep -q 'measured=0 ' && ok "P9 no 시각/발화 columns → measured=0" || ng "P9"
|
|
68
|
+
|
|
69
|
+
# P10 a later «—» (outside the enum) is not a reopening: it counts in B, M stays 0.
|
|
70
|
+
mkdir -p "$T/dash"
|
|
71
|
+
{ echo "$hdr"; echo '| 1 | 11-01 10:00 | zeta request | ✅DONE | e | — | — |'; } > "$T/dash/session_checklist_2026-11-01_sG.md"
|
|
72
|
+
{ echo "$hdr"; echo '| 1 | 11-01 10:00 | zeta request | — | e | — | — |'; } > "$T/dash/session_checklist_2026-11-02_sG.md"
|
|
73
|
+
o="$(python3 "$R" --dir "$T/dash" 2>&1)"
|
|
74
|
+
echo "$o" | grep -q 'M later reopened (non-DONE in the enum)=0 ' && echo "$o" | grep -q 'outside the enum)=1 ' && ok "P10 «—» → B, not M" || ng "P10"
|
|
75
|
+
|
|
76
|
+
echo "claim_precision_report lanes: pass=$pass fail=$fail"
|
|
77
|
+
[ "$fail" = 0 ]
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_doc_claims_1113_lanes.sh — pins three doc claims a 3.40.0 reader review (2026-11-13) found stale or missing.
|
|
3
|
+
# Each lane reads the shipped text, not a copy. Exit 0 = all pass, 1 = a lane failed, 2 = a subject file is missing.
|
|
4
|
+
set -u
|
|
5
|
+
cd "$(dirname "$0")/.." || exit 2
|
|
6
|
+
PASS=0; FAIL=0
|
|
7
|
+
ok() { PASS=$((PASS+1)); printf ' ✅ %s\n' "$1"; }
|
|
8
|
+
bad() { FAIL=$((FAIL+1)); printf ' ❌ %s\n' "$1"; }
|
|
9
|
+
C=knowledge/shared/harness-core/fh_module_contract.md; T=scripts/catch_tally.py; L=plugins/fh-meta/CHANGELOG.md
|
|
10
|
+
for f in "$C" "$T" "$L"; do [ -f "$f" ] || { echo "HARNESS-ERROR: $f missing"; exit 2; }; done
|
|
11
|
+
|
|
12
|
+
# D1 the module contract no longer calls the merged fh-cartridges PRs «open»
|
|
13
|
+
if grep -qE 'fh-cartridges PR #(19|20), open' "$C"; then bad "D1 contract still calls fh-cartridges #19/#20 open"
|
|
14
|
+
elif grep -qE 'fh-cartridges PR #19, merged' "$C" && grep -qE 'fh-cartridges PR #20, merged' "$C"; then ok "D1 contract: #19 and #20 marked merged"
|
|
15
|
+
else bad "D1 contract: #19/#20 references not found"; fi
|
|
16
|
+
|
|
17
|
+
# D2 catch_tally's docstring discloses the «## Catches» heading its regex accepts
|
|
18
|
+
if grep -q 'English heading `## Catches` is accepted' <(python3 - "$T" <<'PY'
|
|
19
|
+
import ast,sys; print(ast.get_docstring(ast.parse(open(sys.argv[1]).read())) or "")
|
|
20
|
+
PY
|
|
21
|
+
); then ok "D2 catch_tally docstring says «## Catches» is accepted"; else bad "D2 catch_tally accepts «## Catches» but its docstring does not say so"; fi
|
|
22
|
+
if python3 - "$T" <<'PY'
|
|
23
|
+
import importlib.util,sys
|
|
24
|
+
s=importlib.util.spec_from_file_location("ct",sys.argv[1]); m=importlib.util.module_from_spec(s); s.loader.exec_module(m)
|
|
25
|
+
r=m.HEAD_RE
|
|
26
|
+
sys.exit(0 if r.match("## Catches") and r.match("## 잡은 것") and not r.match("## Catch") else 1)
|
|
27
|
+
PY
|
|
28
|
+
then ok "D2b control: HEAD_RE accepts «## Catches» and «## 잡은 것», rejects «## Catch»"
|
|
29
|
+
else bad "D2b HEAD_RE behaviour changed — D2's documented claim may be wrong"; fi
|
|
30
|
+
|
|
31
|
+
# D3 the changelog tells a --lease caller what happens when the tier cannot be read
|
|
32
|
+
if sed -n '/### \[Unreleased\]/,/### \[3.40.0\]/p' "$L" | grep -q 'other than `NONE` or `operator…`.*fetch, merge-base, diff or tier run fails.*exits 7 like a `HOLD` and merges nothing. Drop `--lease`'; then ok "D3 changelog notes --lease scope, exit 7, merges nothing, and the remedy"
|
|
33
|
+
else bad "D3 changelog silent on --lease without origin/main"; fi
|
|
34
|
+
|
|
35
|
+
printf 'PASS %d · FAIL %d\n' "$PASS" "$FAIL"
|
|
36
|
+
[ "$FAIL" -eq 0 ]
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
# Revert probe: FH_MODULE_PROBE=<name> neuters one check in a TEMP COPY of the checker (never the real
|
|
7
7
|
# one) and the matching lane must go red:
|
|
8
8
|
# hook-action | enum | route | strictest | dependants | unreadable | gating | corepat | irrverb |
|
|
9
|
-
# case | shape | filescan | events | uncalmerge | uncal | dupkey | mergefloor | mergevalid | emptyinst
|
|
9
|
+
# case | shape | filescan | events | uncalmerge | uncal | dupkey | mergefloor | mergevalid | emptyinst |
|
|
10
|
+
# rtguard | rtscan | rtpkg | rtdyn | rtnear | rtdef | rtshadow | rtattr | rtenc | rtwalk |
|
|
11
|
+
# rtkw | rtbuiltins | rtarg | rtmeth | rtgen
|
|
10
12
|
set -u
|
|
11
13
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
12
14
|
REPO="$(dirname "$HERE")"
|
|
@@ -31,6 +33,21 @@ if [ -n "${FH_MODULE_PROBE:-}" ]; then
|
|
|
31
33
|
mergefloor) needle='merged = {ax: AXES[ax].index(v) for ax, v in CORE_FLOOR.items()}'; repl='merged = {}' ;;
|
|
32
34
|
mergevalid) needle=' for x in sub.blocks: vd.block("%s: %s" % (p, x))'; repl=' pass' ;;
|
|
33
35
|
emptyinst) needle=' if not files:'; repl=' if False:' ;;
|
|
36
|
+
rtguard) needle=' if node.lineno in guarded:'; repl=' if True:' ;;
|
|
37
|
+
rtscan) needle=' runtime_deps(m, repo, vd)'; repl=' pass' ;;
|
|
38
|
+
rtpkg) needle='or os.path.join(d, mod, "__init__.py") in shipped:'; repl=':' ;;
|
|
39
|
+
rtdyn) needle=' elif _dynamic_import(node, bare):'; repl=' elif False:' ;;
|
|
40
|
+
rtnear) needle='or _is_stdlib(mod) or _is_local(mod, f):'; repl='or _is_stdlib(mod) or mod in {os.path.splitext(os.path.basename(x))[0] for x in shipped}:' ;;
|
|
41
|
+
rtdef) needle=' if isinstance(n, (ast.FunctionDef, ast.AsyncFunctionDef, ast.Lambda)):'; repl=' if False:' ;;
|
|
42
|
+
rtshadow) needle=' return x.id in _CATCH and x.id not in bound'; repl=' return x.id in _CATCH' ;;
|
|
43
|
+
rtattr) needle=' return (isinstance(x, ast.Attribute)'; repl=' return False and (isinstance(x, ast.Attribute)' ;;
|
|
44
|
+
rtkw) needle='next((k.value for k in n.keywords if k.arg == "name"), None)'; repl='None' ;;
|
|
45
|
+
rtbuiltins) needle='and "builtins" not in bound and x.attr in _CATCH'; repl='and x.attr in _CATCH' ;;
|
|
46
|
+
rtarg) needle=' out.add(n.arg)'; repl=' pass' ;;
|
|
47
|
+
rtmeth) needle=' and f.value.id == "importlib")):'; repl=' or True)):' ;;
|
|
48
|
+
rtgen) needle=' if isinstance(n, ast.GeneratorExp):'; repl=' if False:' ;;
|
|
49
|
+
rtwalk) needle=' files += [os.path.join(dp, f) for f in sorted(fns) if f.endswith(".py")]'; repl=' pass' ;;
|
|
50
|
+
rtenc) needle=' with tokenize.open(f) as fh:'; repl=' with open(f, encoding="utf-8") as fh:' ;;
|
|
34
51
|
hook-action) needle='elif act not in HOOK_ACTIONS:'; repl='elif False:' ;;
|
|
35
52
|
enum) needle='if h.get("event") not in HOOK_EVENTS:'; repl='if False:' ;;
|
|
36
53
|
route) needle='if route not in gates:'; repl='if False:' ;;
|
|
@@ -577,5 +594,93 @@ run "EX12 calibration rc 2 is UNMEASURED, not BLOCK (2)" 2 c expo
|
|
|
577
594
|
if [ ! -e "$W/out8" ] && [ ! -e "$W/out12" ] && [ ! -e "$R/inside" ] && ! ls -d "$W"/.fh-export-* >/dev/null 2>&1; then PASS=$((PASS+1)); echo "PASS EX13 refused or failed exports leave no folder and no staging"
|
|
578
595
|
else FAIL=$((FAIL+1)); echo "FAIL EX13 leftovers after a refused export"; fi
|
|
579
596
|
|
|
597
|
+
# RD — runtime dependencies (spec 2b; A/B C10 2026-11-08: a guarded PyYAML import lost 9/9 runs in an env without it)
|
|
598
|
+
printf 'import yaml\nprint(yaml)\n' > "$R/mod/dep_bad.py"
|
|
599
|
+
printf 'import json\ntry:\n import yaml\nexcept ImportError:\n yaml = None\n' > "$R/mod/dep_guard.py"
|
|
600
|
+
printf 'import json, os, re\nfrom collections import OrderedDict\n' > "$R/mod/dep_std.py"
|
|
601
|
+
printf 'def f():\n import requests\n return requests\n' > "$R/mod/dep_lazy.py"
|
|
602
|
+
printf 'import dep_std\n' > "$R/mod/dep_local.py"
|
|
603
|
+
printf 'def broken(:\n' > "$R/mod/dep_syntax.py"
|
|
604
|
+
for n in bad guard std lazy local syntax; do
|
|
605
|
+
extra=""; [ "$n" = local ] && extra=", mod/dep_std.py"
|
|
606
|
+
mk "rd_$n" <<YAML
|
|
607
|
+
id: rd-$n
|
|
608
|
+
version: 1.0.0
|
|
609
|
+
touches_irreversible: none
|
|
610
|
+
files: [mod/dep_$n.py$extra]
|
|
611
|
+
$TAIL
|
|
612
|
+
YAML
|
|
613
|
+
done
|
|
614
|
+
run "RD1 unguarded non-stdlib import blocks (1)" 1 c check "$W/rd_bad/fh-module.yaml"
|
|
615
|
+
run "RD2 guarded non-stdlib import passes with a NOTE (0)" 0 c check "$W/rd_guard/fh-module.yaml"
|
|
616
|
+
out="$(c check "$W/rd_guard/fh-module.yaml" 2>&1)"
|
|
617
|
+
if printf '%s\n' "$out" | grep -q '^NOTE: runtime dependency yaml (mod/dep_guard.py:3)'; then PASS=$((PASS+1)); echo "PASS RD2b the NOTE names the module and the line"
|
|
618
|
+
else FAIL=$((FAIL+1)); echo "FAIL RD2b no NOTE naming yaml"; echo "$out" | sed 's/^/ /'; fi
|
|
619
|
+
run "RD3 stdlib-only passes (0)" 0 c check "$W/rd_std/fh-module.yaml"
|
|
620
|
+
run "RD4 unguarded lazy import inside a function blocks (1)" 1 c check "$W/rd_lazy/fh-module.yaml"
|
|
621
|
+
run "RD5 a sibling module the module ships is not a dependency (0)" 0 c check "$W/rd_local/fh-module.yaml"
|
|
622
|
+
run "RD6 unparsable python is UNMEASURED, not OK (2)" 2 c check "$W/rd_syntax/fh-module.yaml"
|
|
623
|
+
mkdir -p "$R/mod/dep_pkg/helpers"; : > "$R/mod/dep_pkg/helpers/__init__.py"; printf 'import helpers\n' > "$R/mod/dep_pkg/main.py"
|
|
624
|
+
mk rd_pkg <<YAML
|
|
625
|
+
id: rd-pkg
|
|
626
|
+
version: 1.0.0
|
|
627
|
+
touches_irreversible: none
|
|
628
|
+
files: [mod/dep_pkg]
|
|
629
|
+
$TAIL
|
|
630
|
+
YAML
|
|
631
|
+
run "RD7 a package folder the module ships is not a dependency (0)" 0 c check "$W/rd_pkg/fh-module.yaml"
|
|
632
|
+
# RD8–RD13 — codex R1 on the first draft (2026-11-09), one lane per verified finding
|
|
633
|
+
mkdir -p "$R/mod/dep_far/elsewhere"
|
|
634
|
+
printf 'import importlib\nimportlib.import_module("fh_missing_dep")\n' > "$R/mod/dep_dyn.py"
|
|
635
|
+
printf 'import fh_missing_dep\n' > "$R/mod/dep_far/main.py"; : > "$R/mod/dep_far/elsewhere/fh_missing_dep.py"
|
|
636
|
+
printf 'try:\n def f():\n import fh_missing_dep\nexcept ImportError:\n pass\nf()\n' > "$R/mod/dep_def.py"
|
|
637
|
+
printf 'ImportError = ValueError\ntry:\n import fh_missing_dep\nexcept ImportError:\n pass\n' > "$R/mod/dep_shadow.py"
|
|
638
|
+
printf 'import builtins\ntry:\n import fh_missing_dep\nexcept builtins.ImportError:\n fh_missing_dep = None\n' > "$R/mod/dep_attr.py"
|
|
639
|
+
printf '# coding: latin-1\nlabel = "caf\351"\nimport json\n' > "$R/mod/dep_enc.py"
|
|
640
|
+
for n in dyn far def shadow attr enc; do
|
|
641
|
+
tgt="mod/dep_$n.py"; [ "$n" = far ] && tgt="mod/dep_far"
|
|
642
|
+
mk "rd_$n" <<YAML
|
|
643
|
+
id: rd-$n
|
|
644
|
+
version: 1.0.0
|
|
645
|
+
touches_irreversible: none
|
|
646
|
+
files: [$tgt]
|
|
647
|
+
$TAIL
|
|
648
|
+
YAML
|
|
649
|
+
done
|
|
650
|
+
run "RD8 a literal importlib/__import__ of a non-stdlib module blocks (1)" 1 c check "$W/rd_dyn/fh-module.yaml"
|
|
651
|
+
run "RD9 a same-named file in an unrelated folder does not satisfy it (1)" 1 c check "$W/rd_far/fh-module.yaml"
|
|
652
|
+
run "RD10 a try around a def does not guard the import inside it (1)" 1 c check "$W/rd_def/fh-module.yaml"
|
|
653
|
+
run "RD11 a rebound ImportError does not count as a guard (1)" 1 c check "$W/rd_shadow/fh-module.yaml"
|
|
654
|
+
run "RD12 except builtins.ImportError is a guard (0, NOTE)" 0 c check "$W/rd_attr/fh-module.yaml"
|
|
655
|
+
run "RD13 a latin-1 coding cookie is read, not UNMEASURED (0)" 0 c check "$W/rd_enc/fh-module.yaml"
|
|
656
|
+
# RD14–RD17 — codex R2 (2026-11-09): new gaps in the R1 fixes
|
|
657
|
+
printf 'import importlib\nimportlib.import_module(name="fh_missing_dep")\n' > "$R/mod/dep_kw.py"
|
|
658
|
+
printf 'import types\nbuiltins = types.SimpleNamespace(ImportError=ValueError)\ntry:\n import fh_missing_dep\nexcept builtins.ImportError:\n pass\n' > "$R/mod/dep_builtins.py"
|
|
659
|
+
printf 'def f(ImportError=ValueError):\n try:\n import fh_missing_dep\n except ImportError:\n pass\nf()\n' > "$R/mod/dep_arg.py"
|
|
660
|
+
printf 'class Loader:\n def import_module(self, name):\n return name\nLoader().import_module("label")\n' > "$R/mod/dep_meth.py"
|
|
661
|
+
for n in kw builtins arg meth; do
|
|
662
|
+
mk "rd_$n" <<YAML
|
|
663
|
+
id: rd-$n
|
|
664
|
+
version: 1.0.0
|
|
665
|
+
touches_irreversible: none
|
|
666
|
+
files: [mod/dep_$n.py]
|
|
667
|
+
$TAIL
|
|
668
|
+
YAML
|
|
669
|
+
done
|
|
670
|
+
run "RD14 import_module(name=\"…\") with a literal blocks (1)" 1 c check "$W/rd_kw/fh-module.yaml"
|
|
671
|
+
run "RD15 a rebound builtins receiver does not count as a guard (1)" 1 c check "$W/rd_builtins/fh-module.yaml"
|
|
672
|
+
run "RD16 a parameter named ImportError does not count as a guard (1)" 1 c check "$W/rd_arg/fh-module.yaml"
|
|
673
|
+
run "RD17 a method named import_module is not a dependency (0)" 0 c check "$W/rd_meth/fh-module.yaml"
|
|
674
|
+
# RD18 — codex R3: a generator inside the try runs on next(), outside it
|
|
675
|
+
printf 'import importlib\nrows = [[1]]\ntry:\n arrays = (importlib.import_module("fh_missing_dep").array(r) for r in rows)\nexcept ImportError:\n arrays = iter(rows)\nnext(arrays)\n' > "$R/mod/dep_gen.py"
|
|
676
|
+
mk rd_gen <<YAML
|
|
677
|
+
id: rd-gen
|
|
678
|
+
version: 1.0.0
|
|
679
|
+
touches_irreversible: none
|
|
680
|
+
files: [mod/dep_gen.py]
|
|
681
|
+
$TAIL
|
|
682
|
+
YAML
|
|
683
|
+
run "RD18 an import inside a generator in a try is not guarded by it (1)" 1 c check "$W/rd_gen/fh-module.yaml"
|
|
684
|
+
|
|
580
685
|
echo "lanes: pass=$PASS fail=$FAIL"
|
|
581
686
|
[ "$FAIL" = 0 ]
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
# 첫 검증에서 그걸 겪었다.)
|
|
15
15
|
#
|
|
16
16
|
# 실행: bash scripts/test_fh_run_resolver_lanes.sh
|
|
17
|
-
# 🟥 이 파일의 모든
|
|
17
|
+
# 🟥 이 파일의 모든 « $VAR » 꼴(붙여 쓴 것)은 `${VAR}` 로 쓴다 — 변수 뒤에 ASCII 가 아닌 글자(» 등)가 바로
|
|
18
18
|
# 붙으면 셸이 그 바이트를 **변수 이름에 먹어** `VAR?: unbound variable` 로 죽는다.
|
|
19
19
|
# 이 세션에 같은 결함을 두 번 냈다(한 번 고치고 새 파일에 또 썼다). 중괄호가 그 경계다.
|
|
20
20
|
set -uo pipefail
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_fixture_git_env_lanes.sh — a fixture commit must never land in the repo named by an inherited
|
|
3
|
+
# GIT_DIR / GIT_INDEX_FILE / GIT_COMMON_DIR. SUBJECT: scripts/fixture_guard_lib.sh (+ the selfcheck.sh
|
|
4
|
+
# scrub line and scripts/lane_identity_tripwire.sh).
|
|
5
|
+
#
|
|
6
|
+
# Every case uses a DECOY «victim» repo under a temp dir — never a real repo. The victim gets a
|
|
7
|
+
# base commit and three staged files; its fingerprint (refs · local config · index · object count ·
|
|
8
|
+
# authors) must be identical before and after.
|
|
9
|
+
#
|
|
10
|
+
# Revert probe: delete the `for _fg_v in $FH_FIXTURE_GIT_ENV; do unset …` line in the lib → L1-L3 go red.
|
|
11
|
+
set -u
|
|
12
|
+
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
|
13
|
+
LIB="$PWD/scripts/fixture_guard_lib.sh"; TRIP="$PWD/scripts/lane_identity_tripwire.sh"
|
|
14
|
+
pass=0; fail=0
|
|
15
|
+
chk() { if [ "$1" -eq 0 ]; then pass=$((pass+1)); echo " PASS $2"; else fail=$((fail+1)); echo " FAIL $2"; fi; }
|
|
16
|
+
for f in "$LIB" "$TRIP"; do [ -f "$f" ] || { echo "HARNESS-ERROR missing $f"; exit 2; }; done
|
|
17
|
+
|
|
18
|
+
T="$(mktemp -d "${TMPDIR:-/tmp}/fgenv.XXXXXX")"; trap 'rm -rf "$T"' EXIT
|
|
19
|
+
clean() { env -u GIT_DIR -u GIT_INDEX_FILE -u GIT_WORK_TREE -u GIT_COMMON_DIR -u GIT_OBJECT_DIRECTORY "$@"; }
|
|
20
|
+
mkvictim() { rm -rf "$1"; mkdir -p "$1"; ( cd "$1" && clean git init -q && clean git -c user.name=v -c user.email=v@v commit -q --allow-empty -m root \
|
|
21
|
+
&& for i in 1 2 3; do echo "s$i" > "s$i.txt"; done && clean git add s1.txt s2.txt s3.txt ); }
|
|
22
|
+
snap() { ( cd "$1" && clean bash -c 'git for-each-ref --format="%(refname) %(objectname)"; git config --local --list | sort; git ls-files -s; git count-objects -v | grep -E "^(count|in-pack)"; git log --all --format="%ae %s"' ); }
|
|
23
|
+
|
|
24
|
+
# a lane-shaped body: source the lib, make a fixture, init + commit as the lane identity
|
|
25
|
+
LANE='. "$LIB"; d="$(fh_fixture_root "$(mktemp -d "$T/fx.XXXXXX")")" || exit 3
|
|
26
|
+
git -C "$d" init -q && echo a > "$d/a" && git -C "$d" add a && git -C "$d" -c core.hooksPath=/nonexistent -c user.name=lane -c user.email=lane@example.invalid commit -q --no-verify -m base || exit 4
|
|
27
|
+
git -C "$d" log --format=%s | grep -qx base || exit 5'
|
|
28
|
+
|
|
29
|
+
# ── C0 control: no inherited env → lane commits in its fixture, victim untouched ──
|
|
30
|
+
V="$T/v0"; mkvictim "$V"; b="$(snap "$V")"
|
|
31
|
+
clean env LIB="$LIB" T="$T" bash -c "$LANE"; rc=$?
|
|
32
|
+
[ "$rc" -eq 0 ] && [ "$b" = "$(snap "$V")" ]; chk $? "C0 control: no env → fixture commit ok (rc=$rc), victim unchanged"
|
|
33
|
+
|
|
34
|
+
# ── C0b control: the leak is real — without the lib, exported GIT_DIR lands the commit in the victim ──
|
|
35
|
+
V="$T/vc"; mkvictim "$V"; b="$(snap "$V")"
|
|
36
|
+
d="$(mktemp -d "$T/raw.XXXXXX")"
|
|
37
|
+
GIT_DIR="$V/.git" bash -c 'git -C "$1" init -q; git -C "$1" -c user.name=lane -c user.email=lane@example.invalid commit -q --allow-empty -m base' _ "$d" >/dev/null 2>&1
|
|
38
|
+
[ "$b" != "$(snap "$V")" ]; chk $? "C0b control: unguarded git -C under GIT_DIR DOES write the victim (leak reproduced)"
|
|
39
|
+
|
|
40
|
+
# ── L1-L3: inherited env, guarded lane → victim untouched ──
|
|
41
|
+
for spec in "GIT_DIR=.git" "GIT_INDEX_FILE=.git/index" "GIT_COMMON_DIR=.git"; do
|
|
42
|
+
var="${spec%%=*}"; V="$T/v_$var"; mkvictim "$V"; b="$(snap "$V")"
|
|
43
|
+
env "$var=$V/${spec#*=}" LIB="$LIB" T="$T" bash -c "$LANE" >/dev/null 2>&1; rc=$?
|
|
44
|
+
[ "$rc" -eq 0 ] && [ "$b" = "$(snap "$V")" ]; chk $? "L $var exported at victim → lane rc=$rc, victim unchanged"
|
|
45
|
+
done
|
|
46
|
+
V="$T/v_dw"; mkvictim "$V"; b="$(snap "$V")"
|
|
47
|
+
GIT_DIR="$V/.git" GIT_WORK_TREE="$V" LIB="$LIB" T="$T" bash -c "$LANE" >/dev/null 2>&1; rc=$?
|
|
48
|
+
[ "$rc" -eq 0 ] && [ "$b" = "$(snap "$V")" ]; chk $? "L GIT_DIR+GIT_WORK_TREE → lane rc=$rc, victim unchanged"
|
|
49
|
+
|
|
50
|
+
# ── L4: env re-exported AFTER sourcing → fh_fixture_root refuses (fail-closed, HARNESS-ERROR) ──
|
|
51
|
+
V="$T/v4"; mkvictim "$V"; b="$(snap "$V")"
|
|
52
|
+
out="$(LIB="$LIB" T="$T" V="$V" bash -c '. "$LIB"; export GIT_DIR="$V/.git"; fh_fixture_root "$(mktemp -d "$T/fx.XXXXXX")"' 2>&1)"; rc=$?
|
|
53
|
+
[ "$rc" -ne 0 ] && printf '%s' "$out" | grep -q 'HARNESS-ERROR inherited GIT_DIR' && [ "$b" = "$(snap "$V")" ]; chk $? "L4 GIT_DIR re-exported after source → refused (rc=$rc)"
|
|
54
|
+
|
|
55
|
+
# ── L5: fixture root inside a repo's work tree → git resolves it outside → refused ──
|
|
56
|
+
V="$T/v5"; mkvictim "$V"; mkdir -p "$V/sub"
|
|
57
|
+
out="$(LIB="$LIB" V="$V" bash -c '. "$LIB"; fh_fixture_root "$V/sub"' 2>&1)"; rc=$?
|
|
58
|
+
[ "$rc" -ne 0 ] && printf '%s' "$out" | grep -q 'outside the fixture'; chk $? "L5 root inside another repo's work tree → refused (rc=$rc)"
|
|
59
|
+
|
|
60
|
+
# ── L6: fh_fixture_git_check — own repo passes, foreign git dir refuses ──
|
|
61
|
+
d="$(mktemp -d "$T/gc.XXXXXX")"; clean git -C "$d" init -q
|
|
62
|
+
LIB="$LIB" bash -c '. "$LIB"; fh_fixture_git_check "$1"' _ "$d" >/dev/null 2>&1; chk $? "L6a git_check on the fixture's own repo → ok"
|
|
63
|
+
d2="$(mktemp -d "$T/gc2.XXXXXX")"
|
|
64
|
+
LIB="$LIB" V="$T/v5" bash -c '. "$LIB"; mkdir -p "$V/x"; fh_fixture_git_check "$V/x"' >/dev/null 2>&1; rc=$?
|
|
65
|
+
[ "$rc" -ne 0 ]; chk $? "L6b git_check on a dir that git resolves to another repo → refused (rc=$rc)"
|
|
66
|
+
|
|
67
|
+
# ── L7: selfcheck.sh scrubs the same list before any lane runs ──
|
|
68
|
+
line="$(grep -m1 '^unset GIT_ALTERNATE_OBJECT_DIRECTORIES' scripts/selfcheck.sh)"; miss=0
|
|
69
|
+
list="$(LIB="$LIB" bash -c '. "$LIB"; echo $FH_FIXTURE_GIT_ENV')"
|
|
70
|
+
for v in $list; do case " $line " in *" $v "*) ;; *) miss=$((miss+1)); echo " missing in selfcheck: $v" ;; esac; done
|
|
71
|
+
[ -n "$line" ] && [ "$miss" -eq 0 ] && [ "$(grep -n '^unset GIT_ALTERNATE' scripts/selfcheck.sh | cut -d: -f1)" -lt "$(grep -n '^cd "\$(dirname' scripts/selfcheck.sh | head -1 | cut -d: -f1)" ]
|
|
72
|
+
chk $? "L7 selfcheck.sh unsets all $(echo $list | wc -w | tr -d ' ') vars before cd/lanes"
|
|
73
|
+
|
|
74
|
+
# ── L8: tripwire known pair + harness error ──
|
|
75
|
+
V="$T/v8"; mkvictim "$V"; out="$(bash "$TRIP" "$V")"; rc=$?
|
|
76
|
+
[ "$rc" -eq 0 ] && printf '%s' "$out" | grep -q '^LANE-TRIPWIRE ok: 0'; chk $? "L8a tripwire clean repo → ok, rc=0"
|
|
77
|
+
( cd "$V" && clean git -c user.name=lane -c user.email=lane@example.invalid commit -q --allow-empty -m base )
|
|
78
|
+
out="$(bash "$TRIP" "$V")"; rc=$?
|
|
79
|
+
[ "$rc" -eq 0 ] && printf '%s' "$out" | grep -q 'WARN: 1 commit'; chk $? "L8b tripwire lane commit → WARN, record-only rc=0"
|
|
80
|
+
bash "$TRIP" "$V" --strict >/dev/null; rc=$?; [ "$rc" -eq 1 ]; chk $? "L8c tripwire --strict → rc=1 (got $rc)"
|
|
81
|
+
( cd "$V" && clean git -c user.name=v -c user.email=v@v commit -q --allow-empty -m tip && clean git rev-parse HEAD > "$T/shallow" )
|
|
82
|
+
out="$(GIT_SHALLOW_FILE="$T/shallow" bash "$TRIP" "$V")"; rc=$?
|
|
83
|
+
printf '%s' "$out" | grep -q 'WARN: 1 commit'; chk $? "L8e inherited GIT_SHALLOW_FILE cutting history at the tip → lane commit still found (codex R1)"
|
|
84
|
+
bash "$TRIP" "$T/nope" >/dev/null; rc=$?; [ "$rc" -eq 2 ]; chk $? "L8d tripwire on non-repo → HARNESS-ERROR rc=2, not «ok» (got $rc)"
|
|
85
|
+
|
|
86
|
+
echo "fixture-git-env lanes: $pass passed, $fail failed"
|
|
87
|
+
[ "$fail" -eq 0 ]
|
|
@@ -321,5 +321,13 @@ OUT=$("$PY" "$CHK" "$D/lnk" --json 2>&1); RC=$?
|
|
|
321
321
|
N=$(printf '%s' "$OUT" | "$PY" -c 'import json,sys; print(sum(1 for x in json.load(sys.stdin)["human_review"] if x["id"]=="H2"))' 2>/dev/null)
|
|
322
322
|
[ "$RC" -eq 1 ] && [ "$N" = "1" ] && ok "L14 링크된 .claude/CLAUDE.md 는 두 번 세지 않는다 (H2=1, rc=1)" || no "L14 링크 중복" "rc=$RC H2=$N"
|
|
323
323
|
|
|
324
|
+
# L15 — W8 (정보): description 에 질문 모양이 없으면 표시, 있으면 표시 없음. rc 는 둘 다 0 (정보는 판정에 영향 없음)
|
|
325
|
+
mkdir -p "$D/w8a/.claude/skills/a" "$D/w8b/.claude/skills/b"
|
|
326
|
+
printf -- '---\nname: a\ndescription: Use when reviewing a SQL migration\n---\n## Done When\n- x\n' > "$D/w8a/.claude/skills/a/SKILL.md"
|
|
327
|
+
printf -- '---\nname: b\ndescription: Use when reviewing a SQL migration, or asked «will this migration wipe data?»\n---\n## Done When\n- x\n' > "$D/w8b/.claude/skills/b/SKILL.md"
|
|
328
|
+
OUTA=$("$PY" "$CHK" "$D/w8a" 2>&1); RCA=$?; OUTB=$("$PY" "$CHK" "$D/w8b" 2>&1); RCB=$?
|
|
329
|
+
[ "$RCA" -eq 0 ] && [ "$RCB" -eq 0 ] && printf '%s' "$OUTA" | /usr/bin/grep -qE '^ W8 ' && ! printf '%s' "$OUTB" | /usr/bin/grep -qE '^ W8 ' \
|
|
330
|
+
&& ok "L15 W8: 질문 모양 없는 description 표시 · 있는 쪽 표시 없음 · rc 0/0" || no "L15 W8" "rcA=$RCA rcB=$RCB $OUTA"
|
|
331
|
+
|
|
324
332
|
/bin/rm -rf "$D"
|
|
325
333
|
echo "PASS=$PASS FAIL=$FAIL"; [ "$FAIL" -eq 0 ] && { echo "FAILED=0"; exit 0; } || { echo "FAILED=1"; exit 1; }
|
|
@@ -76,7 +76,7 @@ run "$W/cut.jsonl"
|
|
|
76
76
|
SNIP="$HERE/../templates/settings.LaneGap.snippet.json"
|
|
77
77
|
CMD=$(python3 -c "import json,sys;print(json.load(open(sys.argv[1]))['project_settings_json']['hooks']['UserPromptSubmit'][0]['hooks'][0]['command'])" "$SNIP")
|
|
78
78
|
O1=$(cd "$W" && env CLAUDE_PROJECT_DIR="$W" FH_LANE_GAP_HINT=0 sh -c "$CMD" 2>&1 </dev/null); O2=$(cd "$W" && env CLAUDE_PROJECT_DIR="$W" sh -c "$CMD" 2>&1 </dev/null)
|
|
79
|
-
[ -z "$O1" ] && printf '%s' "$O2" | grep -q 'lane-gap' && ok "G14 the wrapper honours FH_LANE_GAP_HINT=0 even when the script is missing (control: without it, it warns)" || bad "G14 (off=«$O1» on=«$O2»)"
|
|
79
|
+
[ -z "$O1" ] && printf '%s' "$O2" | grep -q 'lane-gap' && ok "G14 the wrapper honours FH_LANE_GAP_HINT=0 even when the script is missing (control: without it, it warns)" || bad "G14 (off=«${O1}» on=«${O2}»)"
|
|
80
80
|
mk cm "Edit|/r/scripts/a.sh" "Bash|echo done # note; pytest -q" "Bash|cat <<EOF
|
|
81
81
|
pytest -q
|
|
82
82
|
EOF"; run "$W/cm.jsonl"
|
|
@@ -85,7 +85,7 @@ say && ok "G15 a test named inside a comment or a heredoc body is text, not a ru
|
|
|
85
85
|
O3=$(printf '{"transcript_path":"%s"}' "$W/gap.jsonl" | bash "$HERE/lane_gap_hint.sh"); R3=$?
|
|
86
86
|
O4=$(printf '{"transcript_path":"%s"}' "$W/gap.jsonl" | FH_LANE_GAP_HINT=0 bash "$HERE/lane_gap_hint.sh")
|
|
87
87
|
[ "$R3" = 0 ] && printf '%s' "$O3" | grep -q 'lane-gap' && [ -z "$O4" ] && grep -q 'scripts/lane_gap_hint.sh' "$HERE/../templates/settings.LaneGap.snippet.json" \
|
|
88
|
-
&& ok "G16 the snippet calls the .sh wrapper, which passes stdin to the hint and honours the opt-out" || bad "G16 (rc=$R3 · on=«$O3» · off=«$O4»)"
|
|
88
|
+
&& ok "G16 the snippet calls the .sh wrapper, which passes stdin to the hint and honours the opt-out" || bad "G16 (rc=$R3 · on=«${O3}» · off=«${O4}»)"
|
|
89
89
|
[ $((pass+fail)) -eq 16 ] || { echo "HARNESS-ERROR: counted $((pass+fail)) lanes, expected 16"; exit 2; }
|
|
90
90
|
echo "lane_gap_hint lanes: $pass passed · $fail failed"
|
|
91
91
|
[ "$fail" -eq 0 ]
|
|
@@ -162,7 +162,7 @@ while IFS='|' read -r _exp _s; do
|
|
|
162
162
|
[ -n "$_exp" ] || continue
|
|
163
163
|
_r=$(_ref_words "$_s")
|
|
164
164
|
if [ "$_r" != "$_exp" ]; then
|
|
165
|
-
echo "❌ HARNESS-ERROR — 코퍼스 기대값이 대조군과 어긋난다: «$_s» exp=$_exp ref=$_r"; exit 2
|
|
165
|
+
echo "❌ HARNESS-ERROR — 코퍼스 기대값이 대조군과 어긋난다: «${_s}» exp=$_exp ref=$_r"; exit 2
|
|
166
166
|
fi
|
|
167
167
|
for _L in POSIX "$UTF8"; do
|
|
168
168
|
_h=$(LC_ALL="$_L" bash -c "printf '%s\n' \"\$1\" | $EXPR" _ "$_s")
|
|
@@ -281,7 +281,7 @@ _t "L7 되돌림 — 옛 셈법은 판정을 로케일에 따라 갈리게 만
|
|
|
281
281
|
m_p=0; _run_aff POSIX "$T/fn_wc.sh" || m_p=1
|
|
282
282
|
m_u=0; _run_aff "$UTF8" "$T/fn_wc.sh" || m_u=1
|
|
283
283
|
if [ "$m_p" -ne "$m_u" ]; then _ok
|
|
284
|
-
else _no "변이체가 두 로케일에서 같은 판정(rc=$m_p) — 이 팔은 셈법을 안 보고 있다(이빨 없음). 실측 옛 wc -w: POSIX=$s_p $UTF8=$s_u · 문턱=$AFF_THR · 픽스처=«$STRADDLE»"; fi
|
|
284
|
+
else _no "변이체가 두 로케일에서 같은 판정(rc=$m_p) — 이 팔은 셈법을 안 보고 있다(이빨 없음). 실측 옛 wc -w: POSIX=$s_p $UTF8=$s_u · 문턱=$AFF_THR · 픽스처=«${STRADDLE}»"; fi
|
|
285
285
|
|
|
286
286
|
# ── L8 컨트롤: **같은 픽스처·같은 러너**로 지금의 훅은 두 로케일 판정이 같다 ────
|
|
287
287
|
# L7 과 L8 이 known-pair 를 이룬다 — 바뀐 것은 셈법 하나뿐이므로, L7 이 갈리고 L8 이
|
|
@@ -542,7 +542,7 @@ else
|
|
|
542
542
|
'동일한 스테이지드 diff 를 둘 다에게' 'ran bash x.sh, 30/30 PASS' ''; do
|
|
543
543
|
_n1=$(LC_ALL="$UTF8" bash -c 'printf "%s" "${#1}"' _ "$_sv")
|
|
544
544
|
_n2=$(LC_ALL="$UTF8" bash -c '. "$1"; _charlen "$2"' _ "$T/fn_cl_now.sh" "$_sv")
|
|
545
|
-
[ "$_n1" = "$_n2" ] || _cl_bad="$_cl_bad '$_sv'($_n1≠$_n2)"
|
|
545
|
+
[ "$_n1" = "$_n2" ] || _cl_bad="$_cl_bad '$_sv'(${_n1}≠$_n2)"
|
|
546
546
|
done
|
|
547
547
|
if [ -z "$_cl_bad" ]; then _ok
|
|
548
548
|
else _no "UTF-8 기계에서 수가 움직인다 —$_cl_bad. 기존 문턱값이 재교정 없이 못 쓴다"; fi
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_name_boundary_locale_lanes.sh — "$NAME" directly followed by a non-ASCII character.
|
|
3
|
+
#
|
|
4
|
+
# Under a UTF-8 locale on macOS (ko_KR.UTF-8 and en_US.UTF-8 both; measured 2026-11-13 with
|
|
5
|
+
# /bin/bash 3.2 and Homebrew bash 5), bash reads the following multibyte character's bytes as part
|
|
6
|
+
# of the variable name: "lease «$LEASE" + "»" written together → `LEASE<bytes>: unbound variable`, rc 127. Only LC_ALL=C
|
|
7
|
+
# is safe. Linux CI never shows it, so the static lane (B1–B3) is what keeps it fixed there.
|
|
8
|
+
#
|
|
9
|
+
# B1 scanner red on a planted "$V" + "»" written together (known-positive)
|
|
10
|
+
# B2 scanner green on "${V}»" (known-negative)
|
|
11
|
+
# B3 every tracked shell file (*.sh + shebang shell files) has 0 code-line hits
|
|
12
|
+
# B4 behaviour: /bin/bash + ko_KR.UTF-8 runs the pr_merge_verified lanes (lease path S1–S3)
|
|
13
|
+
# to rc 0 with no "unbound variable" — only where that locale exists, else a named SKIP
|
|
14
|
+
# (a SKIP is not a pass). B4c checks the locale really triggers the defect (control).
|
|
15
|
+
set -uo pipefail
|
|
16
|
+
cd "$(dirname "$0")/.." || exit 2
|
|
17
|
+
SCAN=scripts/shell_name_boundary_scan.sh
|
|
18
|
+
P=0; F=0; K=0
|
|
19
|
+
ok() { echo " ✅ $*"; P=$((P+1)); }
|
|
20
|
+
bad() { echo " ❌ $*"; F=$((F+1)); }
|
|
21
|
+
skip(){ echo " ⏭️ SKIP $* (not a pass)"; K=$((K+1)); }
|
|
22
|
+
T=$(mktemp -d); trap 'rm -rf "$T"' EXIT
|
|
23
|
+
|
|
24
|
+
printf '#!/usr/bin/env bash\necho "lease \302\253$LEASE\302\273"\n' > "$T/pos.sh"
|
|
25
|
+
printf '#!/usr/bin/env bash\necho "lease \302\253${LEASE}\302\273"\n' > "$T/neg.sh"
|
|
26
|
+
printf '#!/usr/bin/env bash\necho "start\n# $C\302\273 inside a string\n"\n' > "$T/hash.sh"
|
|
27
|
+
|
|
28
|
+
out=$(bash "$SCAN" --nonascii-only "$T/pos.sh"); rc=$?
|
|
29
|
+
{ [ "$rc" -eq 1 ] && printf '%s' "$out" | grep -q 'pos.sh:2'; } && ok "B1 planted unbraced V + » → hit at pos.sh:2, rc 1" || bad "B1 rc=$rc out=$out"
|
|
30
|
+
|
|
31
|
+
out=$(bash "$SCAN" --nonascii-only "$T/neg.sh"); rc=$?
|
|
32
|
+
[ "$rc" -eq 0 ] && ok "B2 \"\${V}»\" → 0 hits, rc 0" || bad "B2 rc=$rc out=$out"
|
|
33
|
+
out=$(bash "$SCAN" --nonascii-only "$T/hash.sh"); rc=$?
|
|
34
|
+
[ "$rc" -eq 1 ] && ok "B2h a «#» line inside a multi-line string is still scanned (it runs) → hit" || bad "B2h rc=$rc out=$out"
|
|
35
|
+
out=$(bash "$SCAN" --nonascii-only 2>&1); rc=$?
|
|
36
|
+
[ "$rc" -eq 2 ] && ok "B2e the mode flag with no files → rc 2, never «0 hits»" || bad "B2e rc=$rc out=$out"
|
|
37
|
+
|
|
38
|
+
sh_files=$(git ls-files '*.sh') || bad "B3 git ls-files '*.sh' failed — file list incomplete"
|
|
39
|
+
all_files=$(git ls-files) || bad "B3 git ls-files failed — file list incomplete"
|
|
40
|
+
files=$(printf '%s\n' "$sh_files"; printf '%s\n' "$all_files" | grep -v '\.sh$' | while IFS= read -r f; do
|
|
41
|
+
[ -f "$f" ] && head -1 "$f" | grep -qE '^#!.*(bash|/sh)( |$)' && printf '%s\n' "$f"; done)
|
|
42
|
+
n=$(printf '%s\n' "$files" | grep -c .)
|
|
43
|
+
out=$(printf '%s\n' "$files" | tr '\n' '\0' | xargs -0 bash "$SCAN" --nonascii-only); rc=$?
|
|
44
|
+
{ [ "$rc" -eq 0 ] && [ "$n" -gt 100 ]; } && ok "B3 $n tracked shell files → 0 code-line hits" \
|
|
45
|
+
|| bad "B3 files=$n rc=$rc — brace them as \${NAME}:"$'\n'"$(printf '%s' "$out" | grep '🟥' | head -20)"
|
|
46
|
+
|
|
47
|
+
LOCALES=$(locale -a 2>/dev/null) # captured first: grep -q under pipefail would SIGPIPE locale -a into a false SKIP
|
|
48
|
+
if [ -x /bin/bash ] && printf "%s\n" "$LOCALES" | grep -iE '^ko_KR\.utf-?8$' >/dev/null; then
|
|
49
|
+
shape=$(printf 'set -u; V=ok; echo "$V\302\273"') # built from bytes so B3 does not flag this file
|
|
50
|
+
c=$(env LANG=ko_KR.UTF-8 LC_ALL=ko_KR.UTF-8 /bin/bash -c "$shape" 2>&1); crc=$?
|
|
51
|
+
if [ "$crc" -ne 0 ]; then
|
|
52
|
+
ok "B4c control: the unbraced shape dies under /bin/bash + ko_KR.UTF-8 (rc $crc)"
|
|
53
|
+
mkdir -p "$T/pin" && ln -s /bin/bash "$T/pin/bash" # the lanes call PATH «bash» — pin it to /bin/bash too
|
|
54
|
+
o=$(env PATH="$T/pin:$PATH" LANG=ko_KR.UTF-8 LC_ALL=ko_KR.UTF-8 /bin/bash scripts/test_pr_merge_verified_lanes.sh 2>&1); r=$?
|
|
55
|
+
{ [ "$r" -eq 0 ] && ! grep -qE 'unbound variable|바인딩 해제' <<<"$o"; } \
|
|
56
|
+
&& ok "B4 pr_merge_verified lanes under /bin/bash + ko_KR.UTF-8 → rc 0, no unbound variable" \
|
|
57
|
+
|| bad "B4 rc=$r"$'\n'"$(printf '%s' "$o" | grep -E 'unbound|바인딩|❌' | head -5)"
|
|
58
|
+
else
|
|
59
|
+
skip "B4 — this /bin/bash does not show the defect under ko_KR.UTF-8 (control rc 0), so B4 would prove nothing"
|
|
60
|
+
fi
|
|
61
|
+
else
|
|
62
|
+
skip "B4 — no /bin/bash or no ko_KR.UTF-8 locale here"
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
echo "PASS $P · FAIL $F · SKIP $K"
|
|
66
|
+
[ "$F" -eq 0 ]
|
|
@@ -286,6 +286,16 @@ else
|
|
|
286
286
|
else bad "L8c named+present: expected rc=0 and $ACC_ONE not STALE (rc=$_LAST_RC)" "$_LAST_OUT"; fi
|
|
287
287
|
fi
|
|
288
288
|
|
|
289
|
+
# ── lane L9: this repo's own ACCEPTED_ABSENT list carries no stale entry (2026-11-13) ──
|
|
290
|
+
# The check only WARNS on a stale exception (rc stays 0), so nothing turned red when
|
|
291
|
+
# selfdev_merge_tier.sh and its lane started shipping (#1068) while still listed as accepted-absent.
|
|
292
|
+
# A stale exception is where a later real omission lands silently; pin the live list here.
|
|
293
|
+
cd "$REPO_ROOT" || exit 10
|
|
294
|
+
o=$(bash "$SUBJECT" 2>&1); rc=$?
|
|
295
|
+
if [ "$rc" = 0 ] && ! printf '%s' "$o" | grep -q "no longer exercised"; then
|
|
296
|
+
ok "L9 live ACCEPTED_ABSENT list has no stale entry"
|
|
297
|
+
else bad "L9 live list: stale ACCEPTED_ABSENT entries (rc=$rc)" "$(printf '%s' "$o" | grep -A4 'no longer exercised')"; fi
|
|
298
|
+
|
|
289
299
|
echo
|
|
290
300
|
if [ "$skipped" -gt 0 ]; then
|
|
291
301
|
echo "package-coverage lanes: ${pass} passed, ${fail} failed, ${skipped} UNCALIBRATED (not verified here)"
|