@chrono-meta/fh-gate 3.27.0 → 3.29.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-plugin/marketplace.json +4 -4
- package/CHEATSHEET.md +2 -2
- package/CLAUDE.md +6 -3
- package/README.ja.md +2 -4
- package/README.ko.md +2 -4
- package/README.md +19 -19
- package/README.zh.md +2 -4
- package/docs/REFERENCE.md +4 -1
- package/knowledge/shared/harness-core/claude_md_full_reference.md +2 -0
- package/knowledge/shared/harness-core/claude_md_gate_details.md +7 -0
- package/knowledge/shared/harness-core/dispatch_conditional_prohibition.md +12 -0
- package/knowledge/shared/harness-core/fh_module_contract.md +97 -0
- package/knowledge/shared/harness-core/fh_three_layer_canon.md +12 -0
- package/knowledge/shared/harness-core/measurement-integrity-checklist.md +16 -0
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +137 -0
- package/package.json +12 -1
- package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +84 -4
- package/plugins/fh-commons/skills/ko-tech-writer/fh-module.yaml +19 -0
- package/plugins/fh-commons/skills/ko-tech-writer/fixtures/known_negative.md +73 -1
- package/plugins/fh-commons/skills/ko-tech-writer/fixtures/known_positive.md +39 -1
- package/plugins/fh-commons/skills/ko-tech-writer/fixtures/known_unclosed.md +6 -0
- package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/CHANGELOG.md +32 -0
- package/plugins/fh-meta/skills/auto-decorrelation/SKILL.md +17 -0
- package/plugins/fh-meta/skills/frontier-digest/SKILL.md +14 -10
- package/plugins/fh-meta/skills/frontier-digest/SKILL_detail.md +17 -1
- package/plugins/fh-meta/skills/sim-conductor/SKILL.md +2 -2
- package/plugins/fh-meta/skills/sim-conductor/SKILL_detail.md +3 -3
- package/plugins/fh-meta/skills/steel-quench/SKILL.md +25 -1
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/degrade_direction_scan.sh +43 -0
- package/scripts/dispatch_receipt.py +185 -0
- package/scripts/doc_claim_triad_scan.py +43 -4
- package/scripts/fh-gate.sh +71 -11
- package/scripts/fh_module_check.py +686 -0
- package/scripts/finding_fleet.sh +15 -3
- package/scripts/fixtures/frontier_digest_recall.tsv +5 -0
- package/scripts/ko_tech_writer_calibrate.py +288 -15
- package/scripts/package_coverage_check.sh +5 -0
- package/scripts/probe_live_eval.sh +19 -1
- package/scripts/probe_live_eval_lib.py +174 -5
- package/scripts/resident_cost.py +1 -1
- package/scripts/selfcheck.sh +48 -21
- package/scripts/session_checklist.py +214 -5
- package/scripts/session_close_check.sh +44 -0
- package/scripts/sim_isolated_run.sh +31 -0
- package/scripts/test_claude_md_size_lanes.sh +22 -7
- package/scripts/test_degrade_scan_shell_probes.sh +81 -0
- package/scripts/test_dispatch_receipt_lanes.sh +95 -0
- package/scripts/test_doc_claim_triad_lanes.sh +30 -0
- package/scripts/test_fh_audit_check_lanes.sh +10 -5
- package/scripts/test_fh_gate_regressions.sh +71 -1
- package/scripts/test_fh_module_check_lanes.sh +581 -0
- package/scripts/test_finding_pipeline_lanes.sh +83 -0
- package/scripts/test_frontier_digest_recall.sh +26 -0
- package/scripts/test_frontier_digest_recall_negctl.sh +15 -0
- package/scripts/test_ko_tech_writer_lanes.sh +1 -1
- package/scripts/test_locale_invariance_lanes.sh +19 -0
- package/scripts/test_mutation_probe_lanes.sh +22 -6
- package/scripts/test_probe_live_eval_lanes.sh +116 -0
- package/scripts/test_resident_cost_lanes.sh +1 -1
- package/scripts/test_selfcheck_state_lanes.sh +32 -0
- package/scripts/test_session_checklist_lanes.sh +167 -0
- package/scripts/test_sim_isolated_run_lanes.sh +51 -0
- package/scripts/test_utterance_checklist_hook_lanes.sh +175 -0
- package/scripts/utterance_checklist_hook.py +193 -0
- package/scripts/utterance_checklist_hook.sh +31 -0
- package/templates/PRE-PUBLISH-CHECKLIST.md +10 -0
- package/templates/degrade_direction_scan.sh +43 -0
|
@@ -364,6 +364,50 @@ else
|
|
|
364
364
|
echo "⚠️ ①-f utterance_intake.sh 없음 — skipped, not passed (UNMEASURED)"
|
|
365
365
|
fi
|
|
366
366
|
|
|
367
|
+
# ── ①-g REQUEST CHECKLIST RESULT SHEET (advisory) ─────────────────────────────
|
|
368
|
+
# WHY. ①-f asks «did the utterance reach a record»; the operator asked a different question twice:
|
|
369
|
+
# «체크리스트에 받아적고 마무리시점이나 중간에 한번씩 파악해보는거» (2026-10-18) and, on 2026-09-18, a close
|
|
370
|
+
# report «like TCs — done / partly / not done, with reasons and proposals» (fh_signal_2026-09-18_request-
|
|
371
|
+
# checklist-close-report.md). session_checklist.py was built for that and never called from here; ①-f's own
|
|
372
|
+
# history (a checker with zero call sites) repeated. utterance_checklist_hook.sh nudges it mid-session; this
|
|
373
|
+
# line asks for it at the close. Advisory: the table is a surface the operator reads and contests row by row,
|
|
374
|
+
# not a gate (form is checked, truth is not — session_checklist.py header).
|
|
375
|
+
_SC_PY="$FH/scripts/session_checklist.py"
|
|
376
|
+
if [ -f "$_SC_PY" ]; then
|
|
377
|
+
_SC_FILES=()
|
|
378
|
+
# this session's sheet (any date — a session can cross midnight); without a session id, today's sheets
|
|
379
|
+
# (codex R1 B11: a sheet from another session must not satisfy this one's close)
|
|
380
|
+
if [ -n "${_UI_SID:-}" ]; then
|
|
381
|
+
for _p in "$FH"/tracks/_meta/session_checklist_*_"${_UI_SID:0:8}".md; do [ -f "$_p" ] && _SC_FILES+=("$_p"); done
|
|
382
|
+
else
|
|
383
|
+
for _p in "$FH"/tracks/_meta/session_checklist_"$TODAY"_*.md; do [ -f "$_p" ] && _SC_FILES+=("$_p"); done
|
|
384
|
+
[ "${#_SC_FILES[@]}" -gt 0 ] && echo "ℹ️ ①-g 세션 id 미상 — 오늘자 결과서 ${#_SC_FILES[@]} 개를 본다(다른 세션 것일 수 있다: «이 세션 결과서가 있다» 의 증명이 아니다)"
|
|
385
|
+
fi
|
|
386
|
+
if [ "${#_SC_FILES[@]}" -eq 0 ]; then
|
|
387
|
+
echo "⚠️ ①-g 오늘자 요청 체크리스트 결과서가 없다 — advisory, 막지 않는다"
|
|
388
|
+
if [ -n "${_UI_TR:-}" ] && [ -f "${_UI_TR:-/nonexistent}" ]; then
|
|
389
|
+
printf ' 만들기: python3 scripts/session_checklist.py extract --transcript %q --out %q\n' "$_UI_TR" "tracks/_meta/session_checklist_${TODAY}_${_UI_SID:0:8}.md"
|
|
390
|
+
else
|
|
391
|
+
echo " 만들기: python3 scripts/session_checklist.py extract --transcript <이 세션 전사본> --out tracks/_meta/session_checklist_${TODAY}_<세션8>.md"
|
|
392
|
+
fi
|
|
393
|
+
echo " → 상태 칸을 증거·사유와 함께 채우고, 열린 줄을 운영자에게 표로 보여라(영혼 다지기)."
|
|
394
|
+
else
|
|
395
|
+
for _f in "${_SC_FILES[@]}"; do
|
|
396
|
+
_SC_OUT=$(python3 "$_SC_PY" check --file "$_f" 2>&1); _SC_RC=$?
|
|
397
|
+
case "$_SC_RC" in
|
|
398
|
+
0) echo "✅ ①-g 결과서 형식 OK — ${_f#$FH/} (형식만 본다: 상태가 참인지는 운영자가 본다)" ;;
|
|
399
|
+
1) echo "⚠️ ①-g 결과서에 빈 칸·사유 없는 미완 줄이 있다 — ${_f#$FH/}"
|
|
400
|
+
printf '%s\n' "$_SC_OUT" | tail -8 | sed 's/^/ /' ;;
|
|
401
|
+
4) echo "⚠️ ①-g 결과서 표에 행이 0 개다(DEAD CONTROL) — ${_f#$FH/} · «잴 게 없었다» 가 아니라 «안 적었다» 다" ;;
|
|
402
|
+
*) echo "⚠️ ①-g 결과서 검사 UNMEASURED (rc=$_SC_RC) — ${_f#$FH/}"
|
|
403
|
+
printf '%s\n' "$_SC_OUT" | tail -4 | sed 's/^/ /' ;;
|
|
404
|
+
esac
|
|
405
|
+
done
|
|
406
|
+
fi
|
|
407
|
+
else
|
|
408
|
+
echo "⚠️ ①-g session_checklist.py 없음 — skipped, not passed (UNMEASURED)"
|
|
409
|
+
fi
|
|
410
|
+
|
|
367
411
|
# ② FH assets changed today → harvest-loop owed
|
|
368
412
|
# NOTE: no `grep -q` here — under `set -o pipefail`, -q's early exit SIGPIPEs git log (141),
|
|
369
413
|
# masking a real match as pipeline failure so the warning NEVER fired on true positives
|
|
@@ -571,6 +571,10 @@ snapshot "$OUTDIR/_machine_before.txt"
|
|
|
571
571
|
|
|
572
572
|
CONTAMINATED=0
|
|
573
573
|
for r in $(seq 1 "$REPS"); do
|
|
574
|
+
# A reused --out must not carry the previous run's budget record into a rep that fails before
|
|
575
|
+
# writing its own (clone failure `continue`s first) — a stale `ended_at_cap=no` would be read as
|
|
576
|
+
# this run's. Same for the per-turn table the budget line reads.
|
|
577
|
+
rm -f "$OUTDIR/${ARM}_r${r}.meta.tsv" "$OUTDIR/${ARM}_r${r}.turns.tsv"
|
|
574
578
|
# Each clone gets its OWN parent directory. Siblings under one parent are visible to `../`,
|
|
575
579
|
# and that is not hypothetical: an arm measured 2026-08-29 scanned its parent for mappable
|
|
576
580
|
# projects and reported finding "iso_A, door_CTRL" — the other arms' work dirs. Content stayed
|
|
@@ -758,6 +762,33 @@ for r in $(seq 1 "$REPS"); do
|
|
|
758
762
|
fi
|
|
759
763
|
bytes=$(wc -c < "$OUTDIR/${ARM}_r${r}.txt" | tr -d ' ')
|
|
760
764
|
|
|
765
|
+
# ── BUDGET LINE (2026-10-17) — which cap this episode ran under, and did it END at that cap. ──
|
|
766
|
+
# Caps are read off the ARGV actually handed to `claude -p` (TOOLS/MCPARGS arrays) and the env it
|
|
767
|
+
# inherited — never retyped. `timeout_s` is the very $TIMEOUT fed to fh_timeout above.
|
|
768
|
+
# ended_at_cap is three-valued, never defaulted to "no":
|
|
769
|
+
# yes rc=124 — fh_timeout's own convention for all three kinds (gnu / gtimeout / bash watchdog)
|
|
770
|
+
# no rc=0 AND no turn/token cap was set (nothing else could have stopped it early)
|
|
771
|
+
# UNKNOWN anything else: rc=0 with a turn/token cap set (a max-turns stop exits 0 and this
|
|
772
|
+
# runner reads no stop reason), or a non-124 failure (crash vs kill is not told apart)
|
|
773
|
+
_cap_arg() { local _f="$1"; shift; while [ $# -gt 0 ]; do [ "$1" = "$_f" ] && { printf '%s' "${2:-unset}"; return; }; shift; done; printf 'unset'; }
|
|
774
|
+
_cap_turns="$(_cap_arg --max-turns "${TOOLS[@]}" ${MCPARGS[@]+"${MCPARGS[@]}"})"
|
|
775
|
+
_cap_tokens="${CLAUDE_CODE_MAX_OUTPUT_TOKENS:-unset}"
|
|
776
|
+
# Multi-turn: the rep returns its FIRST failing rc, so turn 1 rc=7 + turn 2 rc=124 returns 7 and
|
|
777
|
+
# would hide the timeout. Any turn row with rc=124 makes the episode `yes`. timeout_s is per turn.
|
|
778
|
+
_turn_timeout=0
|
|
779
|
+
[ -f "$OUTDIR/${ARM}_r${r}.turns.tsv" ] && \
|
|
780
|
+
awk -F'\t' 'NR>1 && $2==124 {f=1} END {exit !f}' "$OUTDIR/${ARM}_r${r}.turns.tsv" && _turn_timeout=1
|
|
781
|
+
if [ "$rc" -eq 124 ] || [ "$_turn_timeout" -eq 1 ]; then _cap_end=yes
|
|
782
|
+
elif [ "$rc" -eq 0 ] && [ "$_cap_turns" = unset ] && [ "$_cap_tokens" = unset ]; then _cap_end=no
|
|
783
|
+
else _cap_end=UNKNOWN; fi
|
|
784
|
+
{
|
|
785
|
+
printf 'rc\t%s\n' "$rc"
|
|
786
|
+
printf 'timeout_s\t%s\n' "$TIMEOUT"
|
|
787
|
+
printf 'max_turns\t%s\n' "$_cap_turns"
|
|
788
|
+
printf 'token_cap\t%s\n' "$_cap_tokens"
|
|
789
|
+
printf 'ended_at_cap\t%s\n' "$_cap_end"
|
|
790
|
+
} >> "$OUTDIR/${ARM}_r${r}.meta.tsv"
|
|
791
|
+
|
|
761
792
|
# 🟥 An empty output is NOT a "no" answer. The first version of tonight's runner used
|
|
762
793
|
# `timeout 300`, which killed exactly the heavy arms — the ones where the behaviour under test
|
|
763
794
|
# actually fired — and left 0-byte files that read as "the identity did not fire". A false RED
|
|
@@ -4,14 +4,18 @@
|
|
|
4
4
|
# 왜: Claude Code 는 세션 시작 시 CLAUDE.md 가 150.0k **문자**를 넘으면
|
|
5
5
|
# `⚠ CLAUDE.md is over the 150.0k-char limit` 경고를 띄운다. 허브 CLAUDE.md 는 tracked·출하 파일이라
|
|
6
6
|
# README 주 경로(git clone)로 들어온 모든 사용자가 그 경고를 본다(v3.16.0~v3.21.0 실측: 150,733 → 154,149).
|
|
7
|
-
# 파일은 주당 ~1k 씩 자라므로, 경고가 뜨기 **전에** 이 레인이 빨개지도록 한계를 145,000 으로
|
|
7
|
+
# 파일은 주당 ~1k 씩 자라므로, 경고가 뜨기 **전에** 이 레인이 빨개지도록 한계를 145,000 으로 두었다(과거).
|
|
8
|
+
# 2026-10-17 래칫: v3.27.0 다이어트로 95줄 14,697자가 됐는데 한계가 145,000 이라 10배 재팽창까지 아무것도
|
|
9
|
+
# 안 막았다(운영자 «클로드md 자수는 앞으로도 잘 관리되겠지?»). 한계 = 18,000(지금 +22%). 넘으면 옮기거나,
|
|
10
|
+
# 정말 상주가 필요하면 **이 숫자를 올리는 커밋**으로 늘린다 — 그래야 늘어난 이유가 기록에 남는다.
|
|
11
|
+
# L7(advisory): 이 머신에 CLAUDE.local.md 가 있으면 합계를 같이 찍는다. CC 경고는 지침 파일 «합계» 150k 를 센다.
|
|
8
12
|
# 무엇을 세나: Python `len()` 을 UTF-8 디코드한 텍스트에 건다 = **문자 수**(바이트 아님). CC 경고가 문자를
|
|
9
13
|
# 세므로 같은 단위다. `wc -c` 는 바이트라 한글 한 글자를 3 으로 세어 과차단한다(L4 가 그 차이를 박는다).
|
|
10
14
|
# 처방: 빨개지면 지우지 말고 **옮겨라** — 근거·실측·철회 경위를 detail 파일로 verbatim 이관하고 상주에는
|
|
11
15
|
# 규칙 + 포인터만 남긴다(선례: tracks/_meta/claude_md_diet_2026-09-26/ 의 diet.py·verify.py).
|
|
12
16
|
set -uo pipefail
|
|
13
17
|
HERE="$(cd "$(dirname "$0")" && pwd)"; ROOT="$(cd "$HERE/.." && pwd)"
|
|
14
|
-
LIMIT=
|
|
18
|
+
LIMIT="${FH_CLAUDE_MD_LIMIT:-18000}" # 포크는 자기 CLAUDE.md 에 맞춰 올려도 된다(이건 FH 허브 상주 래칫이다)
|
|
15
19
|
PASS=0; FAIL=0
|
|
16
20
|
ok(){ PASS=$((PASS+1)); printf ' ✅ %s\n' "$1"; }
|
|
17
21
|
no(){ FAIL=$((FAIL+1)); printf ' ❌ %s — %s\n' "$1" "${2:-}"; }
|
|
@@ -45,11 +49,12 @@ printf '# small\n' > "$D/small.md"
|
|
|
45
49
|
OUT=$(size_check "$D/small.md" "$LIMIT"); RC=$?
|
|
46
50
|
[ "$RC" -eq 0 ] && ok "L3 known-negative: 작은 파일 → PASS" || no "L3 known-negative" "rc=$RC out=$OUT"
|
|
47
51
|
|
|
48
|
-
# L4 unit = characters, not bytes:
|
|
49
|
-
|
|
52
|
+
# L4 unit = characters, not bytes: LIMIT/2 Hangul chars = 1.5×LIMIT bytes must PASS.
|
|
53
|
+
HALF=$((LIMIT/2))
|
|
54
|
+
python3 -c 'import sys; open(sys.argv[1],"w",encoding="utf-8").write("가"*int(sys.argv[2]))' "$D/ko.md" "$HALF"
|
|
50
55
|
OUT=$(size_check "$D/ko.md" "$LIMIT"); RC=$?; BYTES=$(wc -c < "$D/ko.md" | tr -d ' ')
|
|
51
|
-
[ "$RC" -eq 0 ] && [ "$OUT" = "
|
|
52
|
-
&& ok "L4 단위 = 문자: 한글
|
|
56
|
+
[ "$RC" -eq 0 ] && [ "$OUT" = "$HALF" ] && [ "$BYTES" -gt "$LIMIT" ] \
|
|
57
|
+
&& ok "L4 단위 = 문자: 한글 ${HALF}자(${BYTES} bytes) → PASS" || no "L4 단위" "rc=$RC chars=$OUT bytes=$BYTES — 바이트를 세고 있다"
|
|
53
58
|
|
|
54
59
|
# L5 boundary: exactly LIMIT passes, LIMIT+1 fails.
|
|
55
60
|
python3 -c 'import sys; open(sys.argv[1],"w",encoding="utf-8").write("a"*int(sys.argv[2]))' "$D/eq.md" "$LIMIT"
|
|
@@ -66,9 +71,19 @@ if [ ! -f "$ROOT/CLAUDE.md" ]; then
|
|
|
66
71
|
no "L1 CLAUDE.md" "파일 부재 — 미측정(통과 아님)"
|
|
67
72
|
else
|
|
68
73
|
OUT=$(size_check "$ROOT/CLAUDE.md" "$LIMIT"); RC=$?
|
|
69
|
-
if [ "$RC" -eq 0 ]; then ok "L1 CLAUDE.md = ${OUT}자 ≤ ${LIMIT} (
|
|
74
|
+
if [ "$RC" -eq 0 ]; then ok "L1 CLAUDE.md = ${OUT}자 ≤ ${LIMIT} (한계까지 $((LIMIT-OUT)) · CC 경고선 150,000)"
|
|
70
75
|
else no "L1 CLAUDE.md" "${OUT}자 > ${LIMIT} — 지우지 말고 detail 파일로 옮겨라(헤더 처방)"; fi
|
|
71
76
|
fi
|
|
72
77
|
|
|
78
|
+
# L7 advisory (never fails): the CC warning counts ALL instruction files (150k total). CLAUDE.local.md is
|
|
79
|
+
# gitignored, so CI never sees it — on a machine that has one, print the pair's total so growth is visible.
|
|
80
|
+
if [ -f "$ROOT/CLAUDE.local.md" ] && [ -f "$ROOT/CLAUDE.md" ]; then
|
|
81
|
+
A=$(size_check "$ROOT/CLAUDE.md" 999999999); B=$(size_check "$ROOT/CLAUDE.local.md" 999999999)
|
|
82
|
+
case "$A$B" in *UNMEASURED*) echo " ℹ️ L7 합계 미측정 ($A / $B)" ;;
|
|
83
|
+
*) echo " ℹ️ L7 CLAUDE.md ${A} + CLAUDE.local.md ${B} = $((A+B))자 (CC 합계 경고 150,000 · 전역 ~/.claude/CLAUDE.md 는 scripts/resident_cost.py 로)" ;; esac
|
|
84
|
+
else
|
|
85
|
+
echo " ℹ️ L7 CLAUDE.local.md 없음 — 합계 미측정(0 아님)"
|
|
86
|
+
fi
|
|
87
|
+
|
|
73
88
|
echo "PASS=$PASS FAIL=$FAIL"
|
|
74
89
|
[ "$FAIL" -eq 0 ] || { echo "FAILED=1"; exit 1; }
|
|
@@ -835,5 +835,86 @@ else
|
|
|
835
835
|
fi
|
|
836
836
|
rm -rf "$_s1bc"
|
|
837
837
|
|
|
838
|
+
# ── S7: `set -e` under an exit contract with its own error code, no ERR trap (fh-gate.sh, 2026-10-20) ──
|
|
839
|
+
# POS = the pre-#927 shape. CTL1 = same file with the ERR trap. CTL2 = a contract with no separate error
|
|
840
|
+
# code ("0 pass / 1 fail" — an unexpected 1 already points the safe way). POS must fire for the two
|
|
841
|
+
# zeros to be readable.
|
|
842
|
+
_s7=$(mktemp -d "${TMPDIR:-/tmp}/s7_XXXXXX")
|
|
843
|
+
cat > "$_s7/pos.sh" <<'P1'
|
|
844
|
+
#!/usr/bin/env bash
|
|
845
|
+
# Exit codes:
|
|
846
|
+
# 0 — PASS
|
|
847
|
+
# 1 — PENDING (proceed with awareness)
|
|
848
|
+
# 10 — Harness error
|
|
849
|
+
set -euo pipefail
|
|
850
|
+
F=$(mktemp "$TMPDIR/x_XXXXXX")
|
|
851
|
+
echo "FH_GATE_VERDICT: PASS"; exit 0
|
|
852
|
+
P1
|
|
853
|
+
cat > "$_s7/ctl1.sh" <<'P2'
|
|
854
|
+
#!/usr/bin/env bash
|
|
855
|
+
# Exit codes:
|
|
856
|
+
# 0 — PASS
|
|
857
|
+
# 1 — PENDING (proceed with awareness)
|
|
858
|
+
# 10 — Harness error
|
|
859
|
+
set -euo pipefail
|
|
860
|
+
trap 'exit 10' ERR
|
|
861
|
+
F=$(mktemp "$TMPDIR/x_XXXXXX")
|
|
862
|
+
echo "FH_GATE_VERDICT: PASS"; exit 0
|
|
863
|
+
P2
|
|
864
|
+
cat > "$_s7/ctl2.sh" <<'P3'
|
|
865
|
+
#!/usr/bin/env bash
|
|
866
|
+
# Exit: 0 = all assertions pass; 1 = a regression.
|
|
867
|
+
set -euo pipefail
|
|
868
|
+
run_assertions
|
|
869
|
+
P3
|
|
870
|
+
# Round-1 cross-family additions: a trap that does not exit is no guard (POS2); `set -o errexit` with an
|
|
871
|
+
# EXIT_*ERROR constant and no comment header is the same contract (POS3); a named handler that exits is a
|
|
872
|
+
# guard (CTL3).
|
|
873
|
+
cat > "$_s7/pos2.sh" <<'P4'
|
|
874
|
+
#!/usr/bin/env bash
|
|
875
|
+
# Exit codes: 0 PASS · 1 PENDING · 10 harness error
|
|
876
|
+
set -euo pipefail
|
|
877
|
+
cleanup() { rm -f "$F"; }
|
|
878
|
+
trap cleanup ERR
|
|
879
|
+
F=$(mktemp "$TMPDIR/x_XXXXXX")
|
|
880
|
+
P4
|
|
881
|
+
cat > "$_s7/pos3.sh" <<'P5'
|
|
882
|
+
#!/usr/bin/env bash
|
|
883
|
+
set -o errexit
|
|
884
|
+
EXIT_PASS=0
|
|
885
|
+
EXIT_HARNESS_ERROR=10
|
|
886
|
+
F=$(mktemp "$TMPDIR/x_XXXXXX")
|
|
887
|
+
P5
|
|
888
|
+
cat > "$_s7/ctl3.sh" <<'P6'
|
|
889
|
+
#!/usr/bin/env bash
|
|
890
|
+
# Exit codes: 0 PASS · 1 PENDING · 10 harness error
|
|
891
|
+
set -euo pipefail
|
|
892
|
+
on_err() {
|
|
893
|
+
echo "failed" >&2
|
|
894
|
+
exit 10
|
|
895
|
+
}
|
|
896
|
+
trap on_err ERR
|
|
897
|
+
F=$(mktemp "$TMPDIR/x_XXXXXX")
|
|
898
|
+
P6
|
|
899
|
+
_s7n(){ bash "$SCAN" "$1" 2>/dev/null | grep -c 'S7:' || true; }
|
|
900
|
+
_p=$(_s7n "$_s7/pos.sh"); _c1=$(_s7n "$_s7/ctl1.sh"); _c2=$(_s7n "$_s7/ctl2.sh")
|
|
901
|
+
_p2=$(_s7n "$_s7/pos2.sh"); _p3=$(_s7n "$_s7/pos3.sh"); _c3=$(_s7n "$_s7/ctl3.sh")
|
|
902
|
+
if [ "$_p2" -eq 1 ]; then ok "S7 POS2: a trap that does not exit (trap cleanup ERR) is not a guard"
|
|
903
|
+
else bad "S7 POS2: trap cleanup ERR suppressed the finding ($_p2)"; fi
|
|
904
|
+
if [ "$_p3" -eq 1 ]; then ok "S7 POS3: set -o errexit + EXIT_HARNESS_ERROR constant (no comment header) is flagged"
|
|
905
|
+
else bad "S7 POS3: errexit/constant spelling missed ($_p3)"; fi
|
|
906
|
+
if [ "$_c3" -eq 0 ]; then ok "S7 CTL3: a named ERR handler that exits is a guard"
|
|
907
|
+
else bad "S7 CTL3: flagged a file whose ERR handler exits ($_c3)"; fi
|
|
908
|
+
if [ "$_p" -eq 1 ]; then
|
|
909
|
+
ok "S7 POS: set -e + own error code + no ERR trap is flagged once ($_p)"
|
|
910
|
+
if [ "$_c1" -eq 0 ]; then ok "S7 CTL1: the same file with an ERR trap is silent"
|
|
911
|
+
else bad "S7 CTL1: flagged a file that has the ERR trap ($_c1)"; fi
|
|
912
|
+
if [ "$_c2" -eq 0 ]; then ok "S7 CTL2: a pass/fail-only contract is silent"
|
|
913
|
+
else bad "S7 CTL2: flagged a contract without a separate error code ($_c2)"; fi
|
|
914
|
+
else
|
|
915
|
+
bad "S7 POS: expected exactly 1 hit, got $_p — CTL results UNINTERPRETABLE"
|
|
916
|
+
fi
|
|
917
|
+
rm -rf "$_s7"
|
|
918
|
+
|
|
838
919
|
echo "degrade-scan shell probes: $pass passed, $fail failed"
|
|
839
920
|
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_dispatch_receipt_lanes.sh — lanes for scripts/dispatch_receipt.py (governor's receipt for dispatched edit work).
|
|
3
|
+
# Each lane builds a throwaway git repo under mktemp. Exit: 0 all lanes pass · 1 a lane failed · 10 harness error.
|
|
4
|
+
# codex 2026-10-20 R1 shaped the second half: quoted paths, renames, submodules, swallowed tool errors, rewritten claims, and a
|
|
5
|
+
# revert probe that runs the mismatch lanes themselves against a mutant (they must go red there).
|
|
6
|
+
set -uo pipefail
|
|
7
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
8
|
+
R="$HERE/dispatch_receipt.py"
|
|
9
|
+
[ -r "$R" ] || { echo "HARNESS-ERROR: $R missing"; exit 10; }
|
|
10
|
+
command -v python3 >/dev/null || { echo "HARNESS-ERROR: python3 missing"; exit 10; }
|
|
11
|
+
T=$(mktemp -d) || exit 10; trap 'rm -rf "$T"' EXIT
|
|
12
|
+
FAIL=0
|
|
13
|
+
TOOL=$R
|
|
14
|
+
check(){ local want=$1 pat=$2; shift 2; local out rc
|
|
15
|
+
out=$(python3 "$TOOL" "$@" 2>&1); rc=$?
|
|
16
|
+
[ "$rc" = "$want" ] && { [ -z "$pat" ] || grep -qE -- "$pat" <<<"$out"; }; } # here-string, not a pipe: grep -q + pipefail = SIGPIPE flip
|
|
17
|
+
lane(){ local name=$1; shift
|
|
18
|
+
if check "$@"; then echo " ✅ $name"; else echo " ❌ $name — want rc=$1 /$2/"; local o; o=$(python3 "$TOOL" "${@:3}" 2>&1); sed -n '1,8s/^/ /p' <<<"$o"; FAIL=1; fi; }
|
|
19
|
+
|
|
20
|
+
mk(){ local d="$T/$1"; mkdir -p "$d"; git -C "$d" init -q; git -C "$d" config user.email t@t; git -C "$d" config user.name t
|
|
21
|
+
git -C "$d" config commit.gpgsign false; echo base > "$d/base.txt"; echo old > "$d/old.txt"; git -C "$d" add base.txt old.txt
|
|
22
|
+
git -C "$d" commit -qm base; echo "$d"; }
|
|
23
|
+
|
|
24
|
+
echo "── dispatch_receipt lanes ──"
|
|
25
|
+
A=$(mk a); echo x > "$A/a.txt"; echo y > "$A/sp ace.txt"; git -C "$A" add a.txt "sp ace.txt"; git -C "$A" commit -qm work
|
|
26
|
+
lane "L1 claimed = changed → match" 0 'CLAIMED-MATCHES: 2' "$A" HEAD~1 --claimed "a.txt,sp ace.txt"
|
|
27
|
+
lane "L2 claimed a path that did not change" 1 '^ b\.txt$' "$A" HEAD~1 --claimed "a.txt,sp ace.txt,b.txt"
|
|
28
|
+
lane "L3 changed a path the claim left out" 1 '^ sp ace\.txt$' "$A" HEAD~1 --claimed "a.txt"
|
|
29
|
+
lane "L4 no claim: receipt only" 0 'commits=1 paths=2' "$A" HEAD~1
|
|
30
|
+
lane "L4b per-path hash line" 0 '^ path [0-9a-f]{16} +a\.txt$' "$A" HEAD~1
|
|
31
|
+
B=$(mk b)
|
|
32
|
+
lane "L5 nothing changed but paths claimed → rc 1" 1 'CLAIMED-NOT-CHANGED:' "$B" HEAD --claimed "a.txt"
|
|
33
|
+
lane "L5b nothing changed, nothing claimed" 0 'paths=0' "$B" HEAD
|
|
34
|
+
echo dirty >> "$B/base.txt"
|
|
35
|
+
lane "L6 uncommitted tracked change" 1 'NOT-COMMITTED: 1' "$B" HEAD
|
|
36
|
+
lane "L7 unresolvable base → harness error" 10 'HARNESS-ERROR' "$A" no-such-ref
|
|
37
|
+
lane "L8 not a directory → harness error" 10 'not a directory' "$T/nope" HEAD
|
|
38
|
+
lane "L9 usage" 2 'usage:' "$A"
|
|
39
|
+
lane "L9b unknown option" 2 'usage:' "$A" HEAD --bogus
|
|
40
|
+
# ── codex R1 cases ──
|
|
41
|
+
C=$(mk c); git -C "$C" mv old.txt new.txt; git -C "$C" commit -qm mv
|
|
42
|
+
lane "R1 a rename lists BOTH paths (claiming only the new one is rc 1)" 1 '^ old\.txt$' "$C" HEAD~1 --claimed "new.txt"
|
|
43
|
+
lane "R1b claiming both sides of the move matches" 0 'CLAIMED-MATCHES: 2' "$C" HEAD~1 --claimed "new.txt,old.txt"
|
|
44
|
+
D=$(mk d); printf 'z\n' > "$D/$(printf 'nl\nname')"; git -C "$D" add -A; git -C "$D" commit -qm nl
|
|
45
|
+
git -C "$D" -c core.quotePath=true diff --name-only HEAD~1 HEAD > "$T/claim_quoted" # git's own quoted spelling, taken from git
|
|
46
|
+
grep -qx '"nl\\nname"' "$T/claim_quoted" || { echo "HARNESS-ERROR: fixture is not git's quoted spelling: $(cat "$T/claim_quoted")"; exit 10; }
|
|
47
|
+
lane "R2 git's quoted spelling of a newline path is not that path" 1 'CLAIMED-NOT-CHANGED' "$D" HEAD~1 --claimed-file "$T/claim_quoted"
|
|
48
|
+
printf 'nl\nname\0' > "$T/claim_nul"
|
|
49
|
+
lane "R2b the real newline path (NUL-separated claim) matches" 0 'CLAIMED-MATCHES: 1' "$D" HEAD~1 --claimed-file "$T/claim_nul"
|
|
50
|
+
lane "R3 a claim with a stray space is refused, not rewritten" 2 'leading/trailing space' "$A" HEAD~1 --claimed " a.txt,sp ace.txt"
|
|
51
|
+
lane "R3b an empty entry (trailing comma) is refused" 2 'empty entry' "$A" HEAD~1 --claimed "a.txt,sp ace.txt,"
|
|
52
|
+
lane "R3c a duplicate entry is refused" 2 'duplicate' "$A" HEAD~1 --claimed "a.txt,a.txt"
|
|
53
|
+
E=$(mk e); S=$(mk sub); git -C "$E" -c protocol.file.allow=always submodule add -q "$S" sm 2>/dev/null; git -C "$E" commit -qm sm
|
|
54
|
+
lane "R4 a submodule is shown as a submodule, not hashed as a blob" 0 '^ path submodule [0-9a-f]{12} +sm$' "$E" HEAD~1
|
|
55
|
+
SIDE=$(git -C "$A" commit-tree "HEAD~1^{tree}" -p HEAD~1 -m side) # same repo, diverged: not an ancestor of HEAD
|
|
56
|
+
lane "R5 base not an ancestor of head → harness error" 10 'not an ancestor' "$A" "$SIDE"
|
|
57
|
+
lane "R5b (a foreign sha is unresolvable here)" 10 'HARNESS-ERROR' "$A" 0000000000000000000000000000000000000001
|
|
58
|
+
|
|
59
|
+
# ── codex R2 cases ──
|
|
60
|
+
F=$(mk f); S2=$(mk sub2); git -C "$F" -c protocol.file.allow=always submodule add -q "$S2" sm 2>/dev/null; git -C "$F" commit -qm sm
|
|
61
|
+
echo more > "$S2/m.txt"; git -C "$S2" add m.txt; git -C "$S2" commit -qm m; git -C "$F/sm" pull -q 2>/dev/null; git -C "$F" add sm; git -C "$F" commit -qm bump
|
|
62
|
+
git -C "$F" config diff.ignoreSubmodules all
|
|
63
|
+
lane "R6 repo config diff.ignoreSubmodules=all cannot hide a gitlink bump" 1 '^ sm$' "$F" HEAD~1 --claimed "x.txt"
|
|
64
|
+
G=$(mk g); git -C "$G" update-index --assume-unchanged base.txt; echo edited >> "$G/base.txt"
|
|
65
|
+
lane "R7 an assume-unchanged edit makes «committed» unprovable" 1 'UNPROVABLE-CLEAN: 1' "$G" HEAD
|
|
66
|
+
printf 'a.txt\n\n' > "$T/claim_dbl"
|
|
67
|
+
lane "R8 a doubled trailing terminator is an empty entry" 2 'empty entry' "$A" HEAD~1 --claimed-file "$T/claim_dbl"
|
|
68
|
+
printf 'a.txt\n' > "$T/claim_one"
|
|
69
|
+
lane "R9 a duplicate across --claimed and --claimed-file is refused" 2 'across claim options' "$A" HEAD~1 --claimed "a.txt,sp ace.txt" --claimed-file "$T/claim_one"
|
|
70
|
+
lane "R9b … and across two --claimed options" 2 'across claim options' "$A" HEAD~1 --claimed "a.txt" --claimed "a.txt"
|
|
71
|
+
|
|
72
|
+
# ── codex R3 cases ──
|
|
73
|
+
H=$(mk h); mkdir -p "$H/sub"; echo s > "$H/sub/in.txt"; git -C "$H" add sub/in.txt; git -C "$H" commit -qm sub; echo o >> "$H/old.txt"; git -C "$H" commit -qam outside
|
|
74
|
+
git -C "$H" config diff.relative true
|
|
75
|
+
lane "R10 run from a subdirectory with diff.relative=true still sees the outside change" 1 '^ old\.txt$' "$H/sub" HEAD~1 --claimed "x.txt"
|
|
76
|
+
I=$(mk i); echo y > "$I/z.txt"; git -C "$I" add z.txt; git -C "$I" commit -qm z
|
|
77
|
+
if out=$(GIT_DIR="$B/.git" GIT_WORK_TREE="$B" python3 "$R" "$I" HEAD~1 --claimed "z.txt" 2>&1) && grep -q 'CLAIMED-MATCHES: 1' <<<"$out"; then
|
|
78
|
+
echo " ✅ R11 inherited GIT_DIR/GIT_WORK_TREE do not redirect the measurement"
|
|
79
|
+
else echo " ❌ R11 inherited GIT_DIR redirected the receipt"; sed -n '1,5s/^/ /p' <<<"$out"; FAIL=1; fi
|
|
80
|
+
|
|
81
|
+
# ── revert probe: neuter the claimed-vs-actual comparison; the mismatch lanes (L2, L3, L5, R1) must go RED on the mutant ──
|
|
82
|
+
M="$T/mut.py"; sed 's/missing, extra = sorted(claim - actual), sorted(actual - claim)/missing, extra = [], []/' "$R" > "$M"
|
|
83
|
+
if grep -q 'missing, extra = \[\], \[\]' "$M"; then
|
|
84
|
+
TOOL=$M; red=0
|
|
85
|
+
check 1 '^ b\.txt$' "$A" HEAD~1 --claimed "a.txt,sp ace.txt,b.txt" || red=$((red+1))
|
|
86
|
+
check 1 '^ sp ace\.txt$' "$A" HEAD~1 --claimed "a.txt" || red=$((red+1))
|
|
87
|
+
check 1 'CLAIMED-NOT-CHANGED:' "$B" HEAD --claimed "a.txt" || red=$((red+1))
|
|
88
|
+
check 1 '^ old\.txt$' "$C" HEAD~1 --claimed "new.txt" || red=$((red+1))
|
|
89
|
+
TOOL=$R
|
|
90
|
+
if [ "$red" = 4 ]; then echo " ✅ RV comparison off → 4/4 mismatch lanes red on the mutant"
|
|
91
|
+
else echo " ❌ RV only $red/4 mismatch lanes went red on the mutant — they do not measure the comparison"; FAIL=1; fi
|
|
92
|
+
else echo " ❌ RV mutation did not apply (HARNESS-ERROR in the probe)"; FAIL=1; fi
|
|
93
|
+
|
|
94
|
+
[ "$FAIL" = 0 ] && echo "── all lanes ok ──"
|
|
95
|
+
exit "$FAIL"
|
|
@@ -119,6 +119,36 @@ else
|
|
|
119
119
|
no "L7 되돌림 전이" "주입rc=$INJ 복원rc=$RST 잔존=$LEFT"
|
|
120
120
|
fi
|
|
121
121
|
|
|
122
|
+
# L9 — 2026-10-20: 이름 대체 찾기는 git 이면 «추적된» 파일만 본다. 미추적 사본(실험 복제본)이 이름을 겹치게 해 보정이 거짓 실패하던 것.
|
|
123
|
+
G8="$TMP/l8repo"; mkdir -p "$G8/templates" "$G8/junk/a" "$G8/junk/b" "$TMP/l8plain"
|
|
124
|
+
git -C "$G8" init -q && echo t > "$G8/templates/known.sh" && git -C "$G8" add templates/known.sh \
|
|
125
|
+
&& git -C "$G8" -c user.email=t@t -c user.name=t -c commit.gpgsign=false commit -qm k
|
|
126
|
+
cp "$G8/templates/known.sh" "$G8/junk/a/known.sh"; cp "$G8/templates/known.sh" "$G8/junk/b/known.sh"; echo u > "$G8/junk/a/only_untracked.sh"
|
|
127
|
+
echo p > "$TMP/l8plain/plain.sh"
|
|
128
|
+
L8=$(python3 - "$SCAN" "$G8" "$TMP/l8plain" <<'PY8'
|
|
129
|
+
import importlib.util, sys
|
|
130
|
+
spec = importlib.util.spec_from_file_location("s", sys.argv[1]); m = importlib.util.module_from_spec(spec); spec.loader.exec_module(m)
|
|
131
|
+
g, plain = sys.argv[2], sys.argv[3]
|
|
132
|
+
a = m.resolve(g, "scripts/known.sh")
|
|
133
|
+
b = m.resolve(g, "scripts/only_untracked.sh")
|
|
134
|
+
c = m.resolve(plain, "x/plain.sh")
|
|
135
|
+
print("A=%s B=%s C=%s" % (bool(a and a.endswith("templates/known.sh")), b is None, bool(c and c.endswith("plain.sh"))))
|
|
136
|
+
PY8
|
|
137
|
+
)
|
|
138
|
+
if [ "$L8" = "A=True B=True C=True" ]; then ok "L9 이름 찾기: 미추적 사본 둘이 있어도 추적된 하나 · 미추적에만 있으면 없음 · git 밖은 종전대로"
|
|
139
|
+
else no "L9 이름 찾기 (추적 파일 기준)" "$L8"; fi
|
|
140
|
+
|
|
141
|
+
# L9b — codex R1: git 이 «git 밖» 이 아닌 이유로 실패하면 옛 전체 훑기로 돌아가지 않고 못 찾은 것으로 닫힌다
|
|
142
|
+
mkdir -p "$TMP/fakegit"; printf '#!/bin/sh\necho "fatal: index file corrupt" >&2\nexit 128\n' > "$TMP/fakegit/git"; chmod +x "$TMP/fakegit/git"
|
|
143
|
+
L9B=$(PATH="$TMP/fakegit:/usr/bin:/bin" python3 - "$SCAN" "$G8" <<'PY9'
|
|
144
|
+
import importlib.util, sys
|
|
145
|
+
spec = importlib.util.spec_from_file_location("s", sys.argv[1]); m = importlib.util.module_from_spec(spec); spec.loader.exec_module(m)
|
|
146
|
+
print("FAILED=%s R=%s" % (m._tracked(sys.argv[2]) == m._INVENTORY_FAILED, m.resolve(sys.argv[2], "templates/known.sh")))
|
|
147
|
+
PY9
|
|
148
|
+
)
|
|
149
|
+
if [ "$L9B" = "FAILED=True R=None" ]; then ok "L9b git 목록 실패 → 못 찾음(닫힌 쪽) · 옛 전체 훑기로 안 떨어진다"
|
|
150
|
+
else no "L9b git 목록 실패의 방향" "$L9B"; fi
|
|
151
|
+
|
|
122
152
|
echo "── PASS=$PASS FAIL=$FAIL ──"
|
|
123
153
|
[ "$FAIL" -eq 0 ] || { echo "FAILED=1"; exit 1; }
|
|
124
154
|
echo "FAILED=0"
|
|
@@ -89,10 +89,11 @@ run_new() {
|
|
|
89
89
|
echo "── ② frontier digest"
|
|
90
90
|
hasnt "$S" "$F8" "$T/f8.sent" "frontier" "L8 old diagnosis file, fresh digest → silent"
|
|
91
91
|
has "$S" "$F9" "$T/f9.sent" "frontier_digest 10d" "L9 KP: digest 10d → warns"
|
|
92
|
-
echo "── ③ sim Area B"
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
echo "── ③ sim Area B — event-bound since 2026-10-19: no terminal line at any age"
|
|
93
|
+
hasnt "$S" "$F4" "$T/f4.sent" "FH internal sim" "L4 Area B 40d → silent (event-bound, no clock)"
|
|
94
|
+
hasnt "$S" "$F5" "$T/f5.sent" "FH internal sim" "L5 Area B 116d → silent (the old true alarm is retired by decision)"
|
|
95
95
|
hasnt "$S" "$F1" "$T/f1.sent" "FH internal sim" "L5b Area B 3d → silent"
|
|
96
|
+
has "$S" "$F2" "$T/f2.sent" "weekly_audit 10d" "L5c control: the banner still prints (removal did not silence ①)"
|
|
96
97
|
echo "── ④ sentinels"
|
|
97
98
|
for m in projA_mapping_skipped projB_wizard_done projC_wizard_declined projD_wizard_reminder_muted; do
|
|
98
99
|
hasnt "$S" "$F6" "$S6" "$m sentinel" "L6 state marker $m not aged"
|
|
@@ -127,11 +128,15 @@ probe() { # name sed-expr lane-fn
|
|
|
127
128
|
}
|
|
128
129
|
lane1() { hasnt "$1" "$F1" "$T/f1.sent" "weekly audit history" "L1-probe"; }
|
|
129
130
|
lane2() { hasnt "$1" "$F8" "$T/f8.sent" "frontier" "L8-probe"; has "$1" "$F9" "$T/f9.sent" "frontier_digest 10d" "L9-probe"; }
|
|
130
|
-
lane3
|
|
131
|
+
# lane3: the retired ③ — a warning-presence mutant: insert an Area B line (no threshold, no dir guard)
|
|
132
|
+
# in a copy; the 116d fixture must make it speak, so the lane proves «no Area B line» is really asserted
|
|
133
|
+
lane3() { hasnt "$1" "$F5" "$T/f5.sent" "FH internal sim" "L5-probe"; }
|
|
131
134
|
lane4() { hasnt "$1" "$F6" "$S6" "projA_mapping_skipped sentinel" "L6-probe"; }
|
|
132
135
|
probe weekly 's#tracks/_audit"/weekly_audit_\*\.md#tracks/_audit"/harvest_*.md#' lane1
|
|
133
136
|
probe frontier 's#tracks/_meta"/frontier_digest_\*\.md#knowledge/shared/harness-core"/harness_frontier_diagnosis_*.md#' lane2
|
|
134
|
-
probe sim '
|
|
137
|
+
probe sim '/# ④ Custom sentinels/i\
|
|
138
|
+
local -a _fh_sims; _fh_sims=( "${FH_DIR}/tracks/_meta"/sim_*_area_B*.md(N.om) ); local sim="${_fh_sims[1]:-}"; [[ -n "$sim" ]] \&\& warns+=("FH internal sim (re-inserted mutant)")
|
|
139
|
+
' lane3
|
|
135
140
|
probe sentinel '/\*_wizard_done|\*_mapping_skipped/d' lane4
|
|
136
141
|
lane5() { hasntk "$1" "$F10" "$T/f10.sent" "weekly_audit" "L10-probe"; }
|
|
137
142
|
probe emulate '/^ emulate -L zsh$/d' lane5
|
|
@@ -250,13 +250,83 @@ check_out "cross: both legs' findings survive the union" 2 'FH_GATE_LEGS: claude
|
|
|
250
250
|
run_cross "$CROSS_BLOCK" "$CROSS_BLOCK"
|
|
251
251
|
# A machine with only one family is the COMMON case, not an edge case. It must not be silent.
|
|
252
252
|
ONELEG="$TMPROOT/oneleg"; mkdir -p "$ONELEG"; cp "$FAKEBIN/claude" "$ONELEG/claude"
|
|
253
|
-
|
|
253
|
+
# the gate needs jq; with PATH cut to $ONELEG:/usr/bin:/bin a Homebrew-only jq vanishes and every single-leg lane
|
|
254
|
+
# would end at 10 before reaching the code under test (codex R1, 2026-10-22) — carry jq, never the other backend
|
|
255
|
+
_jq=$(command -v jq 2>/dev/null) && [ ! -e "$ONELEG/jq" ] && ln -s "$_jq" "$ONELEG/jq"
|
|
256
|
+
check_out "cross: codex absent → single leg, DECORRELATED: no" 3 'FH_GATE_DECORRELATED: no' \
|
|
254
257
|
env PATH="$ONELEG:/usr/bin:/bin" FH_BACKEND=cross FH_MODEL=fake \
|
|
255
258
|
FAKE_PAYLOAD_CLAUDE="$CROSS_PASS" FAKE_PAYLOAD="$CROSS_PASS" \
|
|
256
259
|
bash "$GATE" "$SUBJECT" quick test
|
|
260
|
+
# 🟥 2026-10-22: a single-leg PASS used to exit 0 — the same code as a two-family PASS, so a caller that reads
|
|
261
|
+
# only the exit code (a pre-commit hook, `fh-gate && merge`) could not tell them apart; only text lines differed
|
|
262
|
+
# (LLM call-site inventory, arXiv:2610.24545). Cross was REQUESTED, so a run that could not provide it is not
|
|
263
|
+
# a pass: it goes to a person (ESCALATE, 3) with the reason in a machine-readable line.
|
|
264
|
+
check_out "cross: single leg PASS → ESCALATE (3), not a pass" 3 'FH_GATE_VERDICT: ESCALATE' \
|
|
265
|
+
env PATH="$ONELEG:/usr/bin:/bin" FH_BACKEND=cross FH_MODEL=fake \
|
|
266
|
+
FAKE_PAYLOAD_CLAUDE="$CROSS_PASS" FAKE_PAYLOAD="$CROSS_PASS" \
|
|
267
|
+
bash "$GATE" "$SUBJECT" quick test
|
|
268
|
+
check_out "cross: single leg PASS → the reason is machine-readable" 3 '^FH_GATE_ESCALATE_REASON: cross-degraded' \
|
|
269
|
+
env PATH="$ONELEG:/usr/bin:/bin" FH_BACKEND=cross FH_MODEL=fake \
|
|
270
|
+
FAKE_PAYLOAD_CLAUDE="$CROSS_PASS" FAKE_PAYLOAD="$CROSS_PASS" \
|
|
271
|
+
bash "$GATE" "$SUBJECT" quick test
|
|
272
|
+
CROSS_PEND='{"status":"SUCCESS","verdict":"PENDING","findings_count":1,"findings_a":0,"findings_b":1,"findings":[{"grade":"B","location":"x:1","title":"t","evidence":"e","fix":"f"}]}'
|
|
273
|
+
check_out "cross: single leg PENDING → ESCALATE (1 is «proceed»)" 3 'FH_GATE_VERDICT: ESCALATE' \
|
|
274
|
+
env PATH="$ONELEG:/usr/bin:/bin" FH_BACKEND=cross FH_MODEL=fake \
|
|
275
|
+
FAKE_PAYLOAD_CLAUDE="$CROSS_PEND" FAKE_PAYLOAD="$CROSS_PEND" \
|
|
276
|
+
bash "$GATE" "$SUBJECT" quick test
|
|
277
|
+
# control: a single-leg BLOCKED keeps its own, stricter code
|
|
278
|
+
check_out "cross: single leg BLOCKED stays BLOCKED (2)" 2 'FH_GATE_VERDICT: BLOCKED' \
|
|
279
|
+
env PATH="$ONELEG:/usr/bin:/bin" FH_BACKEND=cross FH_MODEL=fake \
|
|
280
|
+
FAKE_PAYLOAD_CLAUDE="$CROSS_BLOCK" FAKE_PAYLOAD="$CROSS_BLOCK" \
|
|
281
|
+
bash "$GATE" "$SUBJECT" quick test
|
|
282
|
+
# the explicit, logged override keeps the leg's verdict — and says so in the output
|
|
283
|
+
check_out "cross: single leg + FH_GATE_CROSS_ALLOW_SINGLE=1 → PASS, override logged" 0 '^FH_GATE_CROSS_OVERRIDE: FH_GATE_CROSS_ALLOW_SINGLE=1' \
|
|
284
|
+
env PATH="$ONELEG:/usr/bin:/bin" FH_BACKEND=cross FH_MODEL=fake FH_GATE_CROSS_ALLOW_SINGLE=1 \
|
|
285
|
+
FAKE_PAYLOAD_CLAUDE="$CROSS_PASS" FAKE_PAYLOAD="$CROSS_PASS" \
|
|
286
|
+
bash "$GATE" "$SUBJECT" quick test
|
|
287
|
+
# control: the override is exact — any other value does not unlock it
|
|
288
|
+
check_out "cross: FH_GATE_CROSS_ALLOW_SINGLE=yes is not the override" 3 'FH_GATE_VERDICT: ESCALATE' \
|
|
289
|
+
env PATH="$ONELEG:/usr/bin:/bin" FH_BACKEND=cross FH_MODEL=fake FH_GATE_CROSS_ALLOW_SINGLE=yes \
|
|
290
|
+
FAKE_PAYLOAD_CLAUDE="$CROSS_PASS" FAKE_PAYLOAD="$CROSS_PASS" \
|
|
291
|
+
bash "$GATE" "$SUBJECT" quick test
|
|
257
292
|
check "cross: no family available → fails closed" 10 \
|
|
258
293
|
env PATH="/usr/bin:/bin" FH_BACKEND=cross bash "$GATE" "$SUBJECT" quick test
|
|
259
294
|
|
|
295
|
+
# An unexpected failure must not leave as status 1 (= PENDING, "proceed"). Reported from outside
|
|
296
|
+
# (2026-10-20); measured: `mktemp` failing under `set -e` ended the gate with 1, also through the npm bin.
|
|
297
|
+
check "unexpected failure (mktemp) → HARNESS_ERROR, not PENDING" 10 \
|
|
298
|
+
env TMPDIR="$TMPROOT/does-not-exist" FH_DRY_RUN=1 bash "$GATE" "$SUBJECT" quick test
|
|
299
|
+
check "unexpected failure via npm bin → HARNESS_ERROR, not PENDING" 10 \
|
|
300
|
+
env TMPDIR="$TMPROOT/does-not-exist" FH_DRY_RUN=1 node bin/fh-gate.js "$SUBJECT" quick test
|
|
301
|
+
# `set -u` ends the script with 1 WITHOUT firing ERR — only the exit-time check sees it (cross-family review).
|
|
302
|
+
# Outside an FH checkout the record base falls back to $HOME, so an unset HOME is an unbound variable there.
|
|
303
|
+
# cross mode must pass a leg's 11/12 through — every leg gets the same arguments (local-model self-audit
|
|
304
|
+
# candidate, reproduced 2026-10-20: both came out as 10). Control: the non-cross bad level is 11.
|
|
305
|
+
check "cross + bad gate level → 11 (argument error), not 10" 11 \
|
|
306
|
+
env PATH="$FAKEBIN:/usr/bin:/bin" FH_BACKEND=cross FH_MODEL=fake bash "$GATE" "$SUBJECT" medium test
|
|
307
|
+
check "cross + FH_DRY_RUN=1 → 12 (dry-run), not 10" 12 \
|
|
308
|
+
env PATH="$FAKEBIN:/usr/bin:/bin" FH_BACKEND=cross FH_DRY_RUN=1 FH_MODEL=fake bash "$GATE" "$SUBJECT" quick test
|
|
309
|
+
check_out "cross + FH_DRY_RUN=1 → the prompt is printed" 12 'FH GOVERNANCE GATE' \
|
|
310
|
+
env PATH="$FAKEBIN:/usr/bin:/bin" FH_BACKEND=cross FH_DRY_RUN=1 FH_MODEL=fake bash "$GATE" "$SUBJECT" quick test
|
|
311
|
+
check "control: non-cross bad gate level → 11" 11 \
|
|
312
|
+
env PATH="$FAKEBIN:/usr/bin:/bin" FH_BACKEND=claude FH_MODEL=fake bash "$GATE" "$SUBJECT" medium test
|
|
313
|
+
# With stderr closed every message fails; the handlers' own messages must not stop their `exit`, and a real
|
|
314
|
+
# verdict must keep its code (cross-family review round 2: `--invalid 2>&-` returned 1).
|
|
315
|
+
check "stderr closed + unexpected failure → still HARNESS_ERROR" 10 \
|
|
316
|
+
env TMPDIR="$TMPROOT/does-not-exist" FH_DRY_RUN=1 bash -c 'exec 2>&-; exec bash "$@"' _ "$GATE" "$SUBJECT" quick test
|
|
317
|
+
# With stderr closed a PASS run either keeps 0 or fails closed with 10 — which one depends on whether some
|
|
318
|
+
# ordinary `>&2` line on the way fails first (macOS bash 3.2 here: 0; the Linux CI runner: 10). What it must
|
|
319
|
+
# never do is leave as 1/2/3, i.e. a verdict it did not reach. (First draft pinned 0 and CI showed 10.)
|
|
320
|
+
env PATH="$FAKEBIN:/usr/bin:/bin" FH_BACKEND=claude FH_MODEL=fake FAKE_PAYLOAD="$CROSS_PASS" \
|
|
321
|
+
bash -c 'exec 2>&-; exec bash "$@"' _ "$GATE" "$SUBJECT" quick test >/dev/null 2>&1
|
|
322
|
+
_sc=$?
|
|
323
|
+
case "$_sc" in
|
|
324
|
+
0|10) printf 'PASS %-58s (exit %s)\n' "stderr closed + PASS run → 0 or 10, never a lower verdict" "$_sc"; pass=$((pass + 1)) ;;
|
|
325
|
+
*) printf 'FAIL %-58s expected 0 or 10, got %s\n' "stderr closed + PASS run → 0 or 10, never a lower verdict" "$_sc"; fail=$((fail + 1)) ;;
|
|
326
|
+
esac
|
|
327
|
+
check "unbound variable (HOME unset, outside a checkout) → HARNESS_ERROR" 10 \
|
|
328
|
+
env -u HOME FH_DRY_RUN=1 bash -c 'cd "$1" && exec bash "$2" "$3" quick test' _ "$TMPROOT" "$PWD/$GATE" "$SUBJECT"
|
|
329
|
+
|
|
260
330
|
echo
|
|
261
331
|
echo "────────────────────────────────────────────────────────────────────"
|
|
262
332
|
printf 'fh-gate regressions: %d passed, %d failed\n' "$pass" "$fail"
|