@chrono-meta/fh-gate 3.25.1 → 3.26.1

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.
Files changed (86) hide show
  1. package/.claude/regression/probes_live.yaml +9 -3
  2. package/.claude/rules/fh_4axis_gate.md +2 -0
  3. package/.claude-plugin/marketplace.json +4 -4
  4. package/AGENTS.md +69 -13
  5. package/CLAUDE.md +3 -3
  6. package/README.ja.md +90 -379
  7. package/README.ko.md +130 -379
  8. package/README.md +122 -364
  9. package/README.zh.md +90 -346
  10. package/docs/REFERENCE.md +465 -0
  11. package/docs/USER_GUIDE.md +19 -0
  12. package/docs/codex-compat.md +36 -9
  13. package/knowledge/shared/harness-core/agents_md_runtime_details.md +49 -5
  14. package/knowledge/shared/harness-core/multi_model_sidecar_strategy.md +7 -3
  15. package/knowledge/shared/learnings/subagent_invocations_log.yaml +73 -0
  16. package/knowledge/shared/rules/operations.md +3 -2
  17. package/package.json +10 -1
  18. package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
  19. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  20. package/plugins/fh-meta/CHANGELOG.md +24 -0
  21. package/plugins/fh-meta/skills/prompt-regression/SKILL.md +2 -2
  22. package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
  23. package/plugins/fh-preprep/skills/preprep/lane_speech_coach.py +0 -18
  24. package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
  25. package/scripts/fixtures/generated_harness/P1_r1/.claude/agents/todo-developer.md +28 -0
  26. package/scripts/fixtures/generated_harness/P1_r1/.claude/agents/todo-qa.md +25 -0
  27. package/scripts/fixtures/generated_harness/P1_r1/.claude/skills/harness/SKILL.md +6 -0
  28. package/scripts/fixtures/generated_harness/P1_r1/.claude/skills/todo-dev/SKILL.md +37 -0
  29. package/scripts/fixtures/generated_harness/P1_r1/CLAUDE.md +10 -0
  30. package/scripts/fixtures/generated_harness/P1_r1/tests/test_cli.py +1 -0
  31. package/scripts/fixtures/generated_harness/P1_r1/todo/cli.py +13 -0
  32. package/scripts/fixtures/generated_harness/P2_r2/.claude/agents/note-organizer.md +26 -0
  33. package/scripts/fixtures/generated_harness/P2_r2/.claude/agents/summary-reviewer.md +20 -0
  34. package/scripts/fixtures/generated_harness/P2_r2/.claude/agents/summary-writer.md +23 -0
  35. package/scripts/fixtures/generated_harness/P2_r2/.claude/skills/meeting-notes-organize/SKILL.md +23 -0
  36. package/scripts/fixtures/generated_harness/P2_r2/.claude/skills/weekly-meeting-summary/SKILL.md +39 -0
  37. package/scripts/fixtures/generated_harness/P2_r2/.claude/skills/weekly-summary-write/SKILL.md +25 -0
  38. package/scripts/fixtures/generated_harness/P2_r2/CLAUDE.md +10 -0
  39. package/scripts/fixtures/generated_harness/P2_r2/tests/test_cli.py +1 -0
  40. package/scripts/fixtures/generated_harness/P2_r2/todo/cli.py +13 -0
  41. package/scripts/fixtures/generated_harness/P3_r1/.claude/agents/todo-developer.md +30 -0
  42. package/scripts/fixtures/generated_harness/P3_r1/.claude/agents/todo-reviewer.md +21 -0
  43. package/scripts/fixtures/generated_harness/P3_r1/.claude/agents/todo-tester.md +23 -0
  44. package/scripts/fixtures/generated_harness/P3_r1/.claude/settings.json +11 -0
  45. package/scripts/fixtures/generated_harness/P3_r1/.claude/skills/todo-dev/SKILL.md +38 -0
  46. package/scripts/fixtures/generated_harness/P3_r1/CLAUDE.md +12 -0
  47. package/scripts/fixtures/generated_harness/P3_r1/tests/test_cli.py +1 -0
  48. package/scripts/fixtures/generated_harness/P3_r1/todo/cli.py +13 -0
  49. package/scripts/fixtures/generated_harness/P3_r2/.claude/agents/todo-developer.md +27 -0
  50. package/scripts/fixtures/generated_harness/P3_r2/.claude/agents/todo-reviewer.md +15 -0
  51. package/scripts/fixtures/generated_harness/P3_r2/.claude/agents/todo-tester.md +20 -0
  52. package/scripts/fixtures/generated_harness/P3_r2/.claude/settings.json +12 -0
  53. package/scripts/fixtures/generated_harness/P3_r2/.claude/skills/todo-dev-team/SKILL.md +32 -0
  54. package/scripts/fixtures/generated_harness/P3_r2/CLAUDE.md +12 -0
  55. package/scripts/fixtures/generated_harness/P3_r2/tests/test_cli.py +1 -0
  56. package/scripts/fixtures/generated_harness/P3_r2/todo/cli.py +13 -0
  57. package/scripts/fixtures/generated_harness/P4_r2/.claude/agents/todo-developer.md +27 -0
  58. package/scripts/fixtures/generated_harness/P4_r2/.claude/agents/todo-qa.md +23 -0
  59. package/scripts/fixtures/generated_harness/P4_r2/.claude/skills/todo-dev/SKILL.md +19 -0
  60. package/scripts/fixtures/generated_harness/P4_r2/.claude/skills/todo-orchestrator/SKILL.md +33 -0
  61. package/scripts/fixtures/generated_harness/P4_r2/CLAUDE.md +10 -0
  62. package/scripts/fixtures/generated_harness/P4_r2/tests/test_cli.py +1 -0
  63. package/scripts/fixtures/generated_harness/P4_r2/todo/cli.py +13 -0
  64. package/scripts/gate_bootstrap_ephemeral.sh +0 -2
  65. package/scripts/generated_harness_check.py +740 -0
  66. package/scripts/lane_onoff_compare.py +138 -0
  67. package/scripts/lane_stub_env.allow +5 -0
  68. package/scripts/lane_stub_env.sh +63 -0
  69. package/scripts/mutation_probe.py +0 -5
  70. package/scripts/pr_merge_verified.sh +27 -3
  71. package/scripts/probe_live_eval.sh +1 -1
  72. package/scripts/probe_live_eval_lib.py +2 -2
  73. package/scripts/selfcheck.sh +22 -1
  74. package/scripts/test_axis4_lane_substitute_lanes.sh +93 -0
  75. package/scripts/test_card_drift_probe.sh +7 -0
  76. package/scripts/test_generated_harness_check_lanes.sh +325 -0
  77. package/scripts/test_hook_source_gate_lanes.sh +14 -3
  78. package/scripts/test_lane_stub_env_lanes.sh +218 -0
  79. package/scripts/test_marker_floor_lanes.sh +7 -0
  80. package/scripts/test_pr_merge_verified_lanes.sh +50 -3
  81. package/scripts/test_probe_live_eval_lanes.sh +1 -1
  82. package/scripts/test_push_zone_lanes.sh +6 -0
  83. package/scripts/test_session_close_lanes.sh +7 -0
  84. package/scripts/test_utterance_intake_lanes.sh +20 -1
  85. package/templates/.claude/rules/session.md +11 -0
  86. package/templates/.git-hooks/pre-commit +63 -21
@@ -0,0 +1,138 @@
1
+ #!/usr/bin/env python3
2
+ """lane_onoff_compare.py — 레인 하나를 FH_LANE_STUB=off / on 으로 돌려 «켠 것이 무엇을 바꿨나» 를 본다.
3
+
4
+ 설계 = tracks/_meta/design_light_gate_2026-10-12.md §11. 레인 rc 동일성은 충분조건이 아니라서
5
+ (경고가 사라져도 rc 는 같다) 다음을 비교한다.
6
+ ① 레인 출력의 «모든» 비지 않은 줄의 다중집합 — 정규화 없음. 실행마다 바뀌는 줄은 호출자가
7
+ --volatile REGEX 로 선언하고, 그 줄은 UNMEASURED 로 보고돼 승인 근거에서 빠진다(줄 수가 다르면 DIFF)
8
+ 🟥 비교하지 않는 것: 레인이 출력하지 않는 호출 기록. «스텁이 실제로 불렸나» 는 각 레인 자신의 단언이
9
+ 지고, 끈 팔의 진짜 gh 호출 횟수는 여기서 세지 않는다(codex 구현 R1 A3 — 잔여로 남긴다).
10
+ ② 종료 부류 — 0 · 3(픽스처 오류) · 그 외 비0
11
+ ③ (선택) --manifest 의 기대 줄이 양쪽에 다 있나 — 같은 줄이 «양쪽에서» 사라지는 것을 잡는다
12
+ 어느 팔이든 단언(✅ ❌ PASS FAIL …)이 하나도 없으면 HARNESS-ERROR — 비교할 것이 없는 것은 «같다» 가 아니다.
13
+
14
+ 사용 lane_onoff_compare.py run <lane.sh> [--manifest F] [--volatile REGEX]... [--save-dir D]
15
+ lane_onoff_compare.py files <off.txt> <rc_off> <on.txt> <rc_on> [--manifest F] [--volatile REGEX]...
16
+ lane_onoff_compare.py manifest <out.txt> (기대 줄 목록을 뽑는다)
17
+ 종료 0 같음 · 1 다름 · 3 HARNESS-ERROR · 2 사용법
18
+ """
19
+ import collections
20
+ import os
21
+ import re
22
+ import subprocess
23
+ import sys
24
+
25
+ # 비교 대상은 «모든» 비지 않은 줄이다 — 단언 줄만 고르는 정규식은 라운드마다 빠뜨린 형태가 나왔다
26
+ # (요약 필드 PASS=39 · CACHED · 기호 없는 UNMEASURED, codex 구현 R1~R3). 이 정규식은 «단언이 하나라도
27
+ # 있나» 를 보는 계기 확인용일 뿐이다.
28
+ ASSERT_RE = re.compile(r"✅|❌|(?<![A-Za-z])(?:PASS|FAIL)(?![A-Za-z])|HARNESS[-_ ]ERROR|FIXTURE ERROR") # BYPASS·PASSIVE·FAILURE 는 아니다
29
+ # 정규화는 «실행마다 바뀌는 것» 에만 — 임시 경로 · 날짜 · 시각 · 소요 시간 · 4자리 이상 수(pid 등).
30
+ # 레인 번호(L2)와 진단의 작은 수(SUPERSEDED=2)는 지키지 않으면 서로 다른 줄이 같아진다(codex A1).
31
+ def lines(text, volatile):
32
+ """→ (비교할 줄 다중집합, 휘발 선언 줄 수). 정규화는 없다 — 무엇이 «실행마다 바뀌나» 는 계기가 추측하지
33
+ 않고 호출자가 --volatile 로 선언한다(codex 구현 R1~R5: 계기가 고른 정규화는 매번 진짜 값을 지웠다)."""
34
+ keep, vol = collections.Counter(), 0
35
+ for l in text.split("\n"): # 줄 경계는 \n 하나 — splitlines 는 U+2028 등도 경계로 바꾼다(codex 구현 R6)
36
+ if not l.strip():
37
+ continue
38
+ if any(rx.search(l) for rx in volatile):
39
+ vol += 1
40
+ else:
41
+ keep[l] += 1 # 공백까지 그대로 — strip 은 선언 없는 정규화다
42
+ return keep, vol
43
+
44
+
45
+ def has_assertion(text):
46
+ return any(ASSERT_RE.search(l) for l in text.split("\n"))
47
+
48
+
49
+ def exit_class(rc):
50
+ return "0" if rc == 0 else ("3" if rc == 3 else "nonzero")
51
+
52
+
53
+ def compare(off_text, rc_off, on_text, rc_on, manifest=None, volatile=()):
54
+ (a_off, v_off), (a_on, v_on) = lines(off_text, volatile), lines(on_text, volatile)
55
+ if not has_assertion(off_text) or not has_assertion(on_text):
56
+ return 3, ["HARNESS-ERROR: 단언 줄이 없다 (off=%d줄 on=%d줄) — 레인이 판정을 안 냈다" % (sum(a_off.values()), sum(a_on.values()))]
57
+ out, rc = [], 0
58
+ if volatile:
59
+ out.append("UNMEASURED 휘발 선언 줄 off×%d on×%d — 비교·승인 근거에서 뺐다" % (v_off, v_on))
60
+ if v_off != v_on:
61
+ out.append("DIFF 휘발 선언 줄 수가 다르다 off×%d on×%d" % (v_off, v_on))
62
+ rc = 1
63
+ for line in sorted(set(a_off) | set(a_on)):
64
+ if a_off[line] != a_on[line]:
65
+ out.append("DIFF off×%d on×%d %s" % (a_off[line], a_on[line], line))
66
+ rc = 1
67
+ if exit_class(rc_off) != exit_class(rc_on):
68
+ out.append("DIFF 종료 부류 off=%s(rc %d) on=%s(rc %d)" % (exit_class(rc_off), rc_off, exit_class(rc_on), rc_on))
69
+ rc = 1
70
+ for want, n in collections.Counter(manifest or []).items(): # 개수까지 (codex A4)
71
+ if a_off[want] < n or a_on[want] < n:
72
+ out.append("MISSING manifest ×%d 기대, off×%d on×%d: %s" % (n, a_off[want], a_on[want], want))
73
+ rc = 1
74
+ return rc, out
75
+
76
+
77
+ def read_manifest(path):
78
+ with open(path, encoding="utf-8", errors="surrogateescape", newline="") as f:
79
+ return [l for l in f.read().split("\n") if l.strip()]
80
+
81
+
82
+ def run_lane(lane, arm):
83
+ env = dict(os.environ, FH_LANE_STUB=arm)
84
+ p = subprocess.run(["bash", lane], env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
85
+ stdin=subprocess.DEVNULL)
86
+ return p.stdout.decode("utf-8", "surrogateescape"), p.returncode # 바이트 무손실 — CR·잘못된 UTF-8 도 그대로(codex 구현 R7·R8)
87
+
88
+
89
+ def main(argv):
90
+ args = argv[1:]
91
+ manifest = None
92
+ if "--manifest" in args:
93
+ i = args.index("--manifest")
94
+ manifest = read_manifest(args[i + 1])
95
+ del args[i:i + 2]
96
+ volatile = []
97
+ while "--volatile" in args:
98
+ i = args.index("--volatile")
99
+ volatile.append(re.compile(args[i + 1]))
100
+ del args[i:i + 2]
101
+ save = None
102
+ if "--save-dir" in args:
103
+ i = args.index("--save-dir")
104
+ save = args[i + 1]
105
+ del args[i:i + 2]
106
+ if args[:1] == ["manifest"] and len(args) == 2:
107
+ with open(args[1], encoding="utf-8", errors="surrogateescape", newline="") as f:
108
+ for line in sorted(lines(f.read(), ())[0].elements()): # manifest 는 기계 입력 — 원 바이트 그대로(codex 구현 R9)
109
+ sys.stdout.buffer.write(line.encode("utf-8", "surrogateescape") + b"\n")
110
+ return 0
111
+ if args[:1] == ["files"] and len(args) == 5:
112
+ def rd(p):
113
+ with open(p, encoding="utf-8", errors="surrogateescape", newline="") as f:
114
+ return f.read()
115
+ rc, out = compare(rd(args[1]), int(rd(args[2]).strip()), rd(args[3]), int(rd(args[4]).strip()), manifest, volatile)
116
+ elif args[:1] == ["run"] and len(args) == 2:
117
+ off, rc_off = run_lane(args[1], "off")
118
+ on, rc_on = run_lane(args[1], "on")
119
+ if save:
120
+ os.makedirs(save, exist_ok=True)
121
+ base = os.path.basename(args[1])
122
+ for arm, txt, r in (("off", off, rc_off), ("on", on, rc_on)):
123
+ with open(os.path.join(save, "%s.%s.txt" % (base, arm)), "w", encoding="utf-8", errors="surrogateescape", newline="") as f:
124
+ f.write(txt)
125
+ with open(os.path.join(save, "%s.%s.rc" % (base, arm)), "w") as f:
126
+ f.write("%d\n" % r)
127
+ rc, out = compare(off, rc_off, on, rc_on, manifest, volatile)
128
+ else:
129
+ sys.stderr.write(__doc__)
130
+ return 2
131
+ for line in out: # 잘못된 바이트는 보일 때만 \xNN 로 — 비교는 원 바이트로 했다
132
+ print(line.encode("utf-8", "surrogateescape").decode("utf-8", "backslashreplace"))
133
+ print("lane-onoff: %s" % {0: "SAME", 1: "DIFFERENT", 3: "HARNESS-ERROR"}[rc])
134
+ return rc
135
+
136
+
137
+ if __name__ == "__main__":
138
+ sys.exit(main(sys.argv))
@@ -0,0 +1,5 @@
1
+ scripts/test_card_drift_probe.sh
2
+ scripts/test_session_close_lanes.sh
3
+ scripts/test_utterance_intake_lanes.sh
4
+ scripts/test_push_zone_lanes.sh
5
+ scripts/test_hook_source_gate_lanes.sh
@@ -0,0 +1,63 @@
1
+ # lane_stub_env.sh — source 전용. selfcheck 의 «비주제» 레인 안에서만 gh 와 ①-g 스캐너를 스텁한다.
2
+ #
3
+ # 왜: session_close_check.sh 를 부르는 레인 다섯이 ①-b(gh pr list)·①-g(stale_ref_scan.py)를 진짜로
4
+ # 돌렸다 — 네트워크에 기대고, selfcheck 한 번에 gh ≈66s · ①-g ≈39s(P0 측정 2026-10-12). 이 레인들의
5
+ # 단언은 ①-b·①-g 결과를 보지 않는다. 설계 = tracks/_meta/design_light_gate_2026-10-12.md §4·§5.
6
+ #
7
+ # 🟥 생산 체커는 안 고친다 — 스텁은 PATH 앞에 붙는 레인 프로세스 안의 디렉터리일 뿐이고 레인이
8
+ # 끝나면 사라진다. 훅·selfcheck 본체·주제 레인은 이 파일을 source 하지 않는다(test_lane_stub_env_lanes.sh 가 막는다).
9
+ # 🟥 허용 목록(scripts/lane_stub_env.allow, 레포 상대 경로)에 없는 파일이 부르면 거절한다(rc=9).
10
+ #
11
+ # lane_stub_env_on <tmpdir> gh|stale-ref ... 스텁을 켠다. FH_LANE_STUB=off 면 아무것도 안 한다(켠/끈 비교용)
12
+ # lane_stub_env_used gh|stale-ref 그 스텁이 실제로 불렸으면 rc=0 — 안 불렸으면 PATH 가 가려진 것
13
+ #
14
+ # gh 스텁: 호출을 기록하고 `pr list` 에는 `[]`. ①-g 스텁: python3 를 감싸 «첫 인자가» stale_ref_scan.py 인 호출만
15
+ # 가로채 아무것도 출력하지 않는다 → 체커는 «UNMEASURED — 스캐너가 판정 줄을 안 냈다» 를 낸다
16
+ # («대상 없음» 과 다른 문구). 나머지 python3 호출은 진짜 python3 로 넘긴다.
17
+
18
+ lane_stub_env_on() {
19
+ local dir="$1"; shift
20
+ # 허용 목록은 «레포 상대 경로» 다 — 이름만 같은 다른 자리의 파일은 통과 못 한다(codex 구현 R10)
21
+ local caller allow here root
22
+ here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"; root="$(cd "$here/.." && pwd -P)"
23
+ allow="$here/lane_stub_env.allow"
24
+ caller="$(cd "$(dirname "${BASH_SOURCE[1]:-/nonexistent}")" 2>/dev/null && pwd -P)/$(basename "${BASH_SOURCE[1]:-?}")"
25
+ caller="${caller#"$root"/}"
26
+ if ! /usr/bin/grep -qxF "$caller" "$allow" 2>/dev/null; then
27
+ echo "HARNESS-ERROR: lane_stub_env — $caller 는 허용 목록($allow)에 없다" >&2
28
+ echo " (허용 레인인데 이 줄이 났다면: 상대 경로로 실행된 레인이 cd 한 뒤 source 했다 — 절대 경로로 다시 실행하라)" >&2
29
+ return 9
30
+ fi
31
+ LANE_STUB_LOG="$dir/lane_stub_calls.log"; export LANE_STUB_LOG
32
+ : > "$LANE_STUB_LOG"
33
+ [ "${FH_LANE_STUB:-on}" = "off" ] && return 0
34
+ local bin="$dir/lane_stub_bin" kind real_py
35
+ mkdir -p "$bin"
36
+ for kind in "$@"; do
37
+ case "$kind" in
38
+ gh)
39
+ cat > "$bin/gh" <<'EOF'
40
+ #!/bin/sh
41
+ echo "gh $*" >> "$LANE_STUB_LOG"
42
+ case "$1 $2" in "pr list") echo '[]' ;; esac
43
+ exit 0
44
+ EOF
45
+ chmod +x "$bin/gh" ;;
46
+ stale-ref)
47
+ real_py=$(command -v python3) || { echo "HARNESS-ERROR: lane_stub_env — python3 없음" >&2; return 9; }
48
+ cat > "$bin/python3" <<EOF
49
+ #!/bin/sh
50
+ case "\$1" in */stale_ref_scan.py|stale_ref_scan.py) echo "stale-ref \$*" >> "\$LANE_STUB_LOG"; exit 0 ;; esac
51
+ exec "$real_py" "\$@"
52
+ EOF
53
+ chmod +x "$bin/python3" ;;
54
+ *) echo "HARNESS-ERROR: lane_stub_env — 모르는 스텁 '$kind'" >&2; return 9 ;;
55
+ esac
56
+ done
57
+ PATH="$bin:$PATH"; export PATH
58
+ }
59
+
60
+ lane_stub_env_used() {
61
+ [ "${FH_LANE_STUB:-on}" = "off" ] && return 0
62
+ [ -n "${LANE_STUB_LOG:-}" ] && /usr/bin/grep -q "^$1 " "$LANE_STUB_LOG" 2>/dev/null
63
+ }
@@ -1055,11 +1055,6 @@ def read_bytes(path):
1055
1055
  return fh.read()
1056
1056
 
1057
1057
 
1058
- def write_bytes(path, b):
1059
- with open(path, 'wb') as fh:
1060
- fh.write(b)
1061
-
1062
-
1063
1058
  def subject_pycs(subject):
1064
1059
  stem = os.path.splitext(os.path.basename(subject))[0]
1065
1060
  cache_dir = os.path.join(os.path.dirname(os.path.abspath(subject)), '__pycache__')
@@ -21,7 +21,9 @@
21
21
  # 2 usage (nothing merged) · 3 trivial --rerun refused (nothing merged)
22
22
  # 4 harness error (see message: before or after the merge)
23
23
  # 6 merge accepted but not completed (queue/lag) — NOT verified, nothing claimed
24
- # 5 merge itself failed (nothing merged)
24
+ # 5 merge NOT observed (gh failed and GitHub still reports OPEN/CLOSED after bounded re-reads —
25
+ # an observation, not proof: stale state can outlast the re-reads)
26
+ # (gh non-zero but GitHub says MERGED → continue to verify; state unreadable → 4, outcome UNKNOWN)
25
27
 
26
28
  set -uo pipefail
27
29
  PR=""; RERUN=""; RERUN_SET=0; REPO="."
@@ -57,9 +59,31 @@ echo "── PR #$PR head recorded: $HEAD_OID"
57
59
  # 2. merge
58
60
  # 🟥 cross-family W1: pin the merge to the head we RECORDED. Without it, a push landing between the
59
61
  # record and the merge gets squashed in unverified, and «merged and verified» describes a commit
60
- # nobody checked. GitHub refuses the merge if the head moved — that refusal is rc=5, nothing merged.
62
+ # nobody checked. GitHub refuses the merge if the head moved — that refusal is rc=5 (merge not observed).
63
+ # 🟥 gh's exit code is not the server's answer: gh merges on GitHub, THEN switches/deletes local
64
+ # branches, and that local half can fail (e.g. main checked out in another worktree) after the
65
+ # merge landed (2026-10-12, FoD #210 reported «nothing merged» while MERGED). Ask GitHub.
61
66
  if ! gh pr merge "$PR" --squash --delete-branch --admin --match-head-commit "$HEAD_OID" < /dev/null; then
62
- echo "🟥 merge failed — nothing merged" >&2; exit 5
67
+ # bounded re-reads: one OPEN right after a server merge can be API lag, not a refusal (codex A1)
68
+ ST=""; HO=""
69
+ for _try in 1 2 3; do
70
+ _sv=$(gh pr view "$PR" --json state,headRefOid -q '.state+" "+.headRefOid' < /dev/null) || _sv=""
71
+ ST=$(printf '%s' "$_sv" | awk '{print $1}'); HO=$(printf '%s' "$_sv" | awk '{print $2}')
72
+ [ "$ST" = "OPEN" ] || break
73
+ [ "$_try" -lt 3 ] && sleep "${PMV_RETRY_SLEEP:-2}"
74
+ done
75
+ case "$ST" in
76
+ MERGED)
77
+ # MERGED alone does not say WHICH head merged — someone may have pushed and merged after we
78
+ # recorded (codex A2). Only the recorded head may continue to verification.
79
+ [ "$HO" = "$HEAD_OID" ] || { echo "🟥 HARNESS-ERROR: gh pr merge failed, and PR #$PR is MERGED from head ${HO:-?}, not the recorded $HEAD_OID — NOT verified" >&2; exit 4; }
80
+ echo "⚠️ gh pr merge exited non-zero; GitHub reports MERGED from the recorded head — continuing to verify" >&2
81
+ echo " the head branch may still exist on origin — delete it by hand if so" >&2 ;;
82
+ # 🟥 a persistent OPEN cannot prove nothing merged (state may still be stale) — say what was seen
83
+ OPEN|CLOSED) echo "🟥 merge NOT observed — gh pr merge exited non-zero and GitHub reports $ST (read $_try time(s))" >&2
84
+ echo " if gh's error above was about LOCAL branches, re-check: gh pr view $PR --json state,mergeCommit" >&2; exit 5 ;;
85
+ *) echo "🟥 HARNESS-ERROR: gh pr merge failed and the PR state is unreadable — merge outcome UNKNOWN; check: gh pr view $PR --json state,mergeCommit" >&2; exit 4 ;;
86
+ esac
63
87
  fi
64
88
 
65
89
  # 3. merge commit
@@ -24,7 +24,7 @@
24
24
  # SELECTION. Not every probes.md row is live-runnable — see .claude/regression/probes_live.yaml's
25
25
  # header for the 4-step mechanical rule (class filter, utterance-shape filter, INERT-ANCHOR filter,
26
26
  # hand-curated CLI-event filter) and scripts/probe_live_eval_lib.py for the implementation. Run
27
- # `--dry-run` to see the full 33-row breakdown: which probes are selected, which are excluded and
27
+ # `--dry-run` to see the full 32-row breakdown: which probes are selected, which are excluded and
28
28
  # why, and which pass the mechanical rule but have no authored expect/control yet
29
29
  # (NOT-YET-AUTHORED — an honest gap, not a silent drop). As of 2026-09-14 that bucket is EMPTY:
30
30
  # G-LINT-01, its long-standing occupant, moved to ARM_CAPABILITY_EXCLUDE because the real blocker
@@ -28,7 +28,7 @@ VALID_CLASSES = ('mandatory-pass', 'measured', 'judged')
28
28
  # Claude talk about npm test", not "does npm test actually gate publish" — a different question the
29
29
  # probe was never about. Named here, not folded into the regex, so it stays greppable as a decision
30
30
  # rather than disappearing into pattern tuning.
31
- CLI_EVENT_EXCLUDE = {"G-CODE-01", "G-CODE-02", "G-CODE-03"}
31
+ CLI_EVENT_EXCLUDE = {"G-CODE-01", "G-CODE-02"}
32
32
 
33
33
  # The second judgment call, and a different one: these rows are perfectly good CHAT utterances, but
34
34
  # the behavior they check is delegated to a surface THE ARM DOES NOT HAVE. G-TRIG-03 is the measured
@@ -618,7 +618,7 @@ def render_report_md(select_result, score_result, run_date):
618
618
  "instrument failure produce this shape, and this file cannot tell them "
619
619
  "apart; the preserved response bodies can.")
620
620
  lines.append("")
621
- lines.append("## Excluded (from probes.md, 33-row snapshot)")
621
+ lines.append("## Excluded (from probes.md, 32-row snapshot)")
622
622
  lines.append("")
623
623
  lines.append("| Probe | Reason |")
624
624
  lines.append("|---|---|")
@@ -616,6 +616,22 @@ else
616
616
  fail=1
617
617
  fi
618
618
 
619
+ # 생성된 하네스 검사기 (2026-10-11) — 외부 생성기 산출을 받는 «뒷단». 실물 픽스처 위에서 H1/H2 가 갈리고
620
+ # 빈 입력이 PASS 로 새지 않는지(rc=3)를 잰다. 결론(안전)이 아니라 기록의 형태만 보는 검사기다.
621
+ if [ ! -f scripts/generated_harness_check.py ]; then
622
+ _absent_subject_verdict "generated-harness-check lanes" "scripts/generated_harness_check.py" || fail=1
623
+ elif [ -f scripts/test_generated_harness_check_lanes.sh ]; then
624
+ if ! python3 scripts/generated_harness_check.py --selftest >/dev/null 2>&1; then
625
+ echo "FAIL generated-harness-check selftest: known-pair calibration failed"; fail=1
626
+ fi
627
+ if ! bash scripts/test_generated_harness_check_lanes.sh; then
628
+ fail=1
629
+ fi
630
+ else
631
+ echo "FAIL generated-harness-check lanes: checker present but its anchor is missing"
632
+ fail=1
633
+ fi
634
+
619
635
  # pipefail 조기종료 클래스 잠금 (2026-09-21) — #785 가 한 자리를 고쳤고, 그 파일에 같은 형태가
620
636
  # **아직 셋** 남아 있었다(sync_to_be_lanes.sh:153·571·599, 생산자도 같은 `_sync_src`). 목록형
621
637
  # 잠금이 왜 안 되는지의 실물 증거다. 🟥 이 스캐너는 «레포 전체 0» 을 요구하지 않는다 — 오늘
@@ -983,6 +999,7 @@ for _pair in \
983
999
  "templates/.git-hooks/pre-commit|scripts/test_marker_oracle_lanes.sh" \
984
1000
  `# ── 경량 SKIP 의 «사유» 가 참인가 (2026-10-05, 클린룸 감사): 판정은 맞고 사유가 거짓이면 아무 레인도 안 빨개진다 ──` \
985
1001
  "templates/.git-hooks/pre-commit|scripts/test_axis23_skip_reason_lanes.sh" \
1002
+ "templates/.git-hooks/pre-commit|scripts/test_axis4_lane_substitute_lanes.sh" \
986
1003
  "templates/.git-hooks/pre-commit|scripts/test_marker_diff_sha_lanes.sh" \
987
1004
  `# ── 판정을 둘로 (2026-09-06, SWE-Gate 답습): 합성 «PASS» 가 acceptance-evidence 를 가리지 않는가 ──` \
988
1005
  "templates/.git-hooks/pre-commit|scripts/test_gate_two_verdicts_lanes.sh" \
@@ -1068,7 +1085,11 @@ for _pair in \
1068
1085
  "scripts/compaction_probe.sh|scripts/test_utterance_intake_lanes.sh" \
1069
1086
  "scripts/session_close_check.sh|scripts/test_utterance_intake_lanes.sh" \
1070
1087
  `# ── 워크트리 회수(2026-09-05, N=2 재발 → 스크립트). 사람이 부르는 도구지만 레인은 자동 ──` \
1071
- "scripts/worktree_reclaim.sh|scripts/test_worktree_reclaim_lanes.sh"
1088
+ "scripts/worktree_reclaim.sh|scripts/test_worktree_reclaim_lanes.sh" \
1089
+ `# ── 가벼운 게이트 P1·P2(2026-10-12): 비주제 레인의 gh·①-g 스텁 + 켠/끈 비교기 ──` \
1090
+ "scripts/lane_stub_env.sh|scripts/test_lane_stub_env_lanes.sh" \
1091
+ "scripts/lane_stub_env.allow|scripts/test_lane_stub_env_lanes.sh" \
1092
+ "scripts/lane_onoff_compare.py|scripts/test_lane_stub_env_lanes.sh"
1072
1093
  do
1073
1094
  _subj="${_pair%%|*}"; _anc="${_pair##*|}"; _lbl="${_anc##*/}"
1074
1095
  if [ ! -f "$_subj" ]; then
@@ -0,0 +1,93 @@
1
+ #!/usr/bin/env bash
2
+ # test_axis4_lane_substitute_lanes.sh — Axis 4 레인 갈음 (2026-10-11, P29 표본 n=20).
3
+ # pre-commit 의 Axis 4 검사기(heredoc Python)를 그대로 추출해 실행한다. 판정은 exit code:
4
+ # 0 통과 · 2 오늘자 엔트리 없음 · 4 갈음 거부. (가역 표면 완화 — 비가역 게이트와 무관)
5
+ # a 통과 · b 안 보는 것 빈칸 · c 레인 부재 · d 부재 주장 갈음 · e 오늘자 엔트리 없음 · f 종전 형식 컨트롤
6
+ # + 되돌림 3단(적용 확인 → 실행 → 복원): 갈음 허용 줄 / 부재 주장 판별 / not_seen 검사.
7
+ set -uo pipefail
8
+ REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
9
+ HOOK="$REPO_ROOT/templates/.git-hooks/pre-commit"
10
+ T=$(mktemp -d); trap 'rm -rf "$T"' EXIT
11
+ TODAY=2026-10-11
12
+ extract() { awk '/^python3 - "\$MANIFEST"|^ MANIFEST_MSG=\$\(python3 - /{f=1;next} f&&/^PYEOF$/{exit} f' "$1"; }
13
+ extract "$HOOK" > "$T/chk.py"
14
+ [ "$(wc -l < "$T/chk.py")" -gt 20 ] && grep -q 'lane substitution refused' "$T/chk.py" \
15
+ || { echo "❌ HARNESS-ERROR — Axis 4 checker did not extract (empty/old hook)"; exit 1; }
16
+ mkdir -p "$T/repo/scripts"; : > "$T/repo/scripts/test_real_lane.sh"; ln -s /etc/hosts "$T/repo/scripts/sym_out.sh"
17
+ FAIL=0
18
+ run() { # $1 py $2 yaml-body → rc
19
+ printf '%s\n' "$2" > "$T/m.yaml"; python3 "$1" "$T/m.yaml" "$TODAY" "$T/repo" >"$T/out" 2>&1; echo $?; }
20
+ lane() { # id expect-rc body [py]
21
+ local rc; rc=$(run "${4:-$T/chk.py}" "$3")
22
+ if [ "$rc" = "$2" ]; then printf ' ✅ %-34s rc=%s\n' "$1" "$rc"
23
+ else printf ' ❌ %-34s expected rc=%s got %s (%s)\n' "$1" "$2" "$rc" "$(head -c 160 "$T/out")"; FAIL=1; fi; }
24
+ E() { printf -- '- date: %s\n files: [a]\n intent: x\n%s\n' "$TODAY" "$1"; }
25
+ echo "== Axis 4 lane substitution =="
26
+ lane a-lane-and-not_seen-pass 0 "$(E ' lane: scripts/test_real_lane.sh
27
+ not_seen: 현장 노드의 실사용 결과는 보지 않는다')"
28
+ lane b-not_seen-blank 4 "$(E ' lane: scripts/test_real_lane.sh
29
+ not_seen: ""')"
30
+ lane b2-not_seen-placeholder 4 "$(E ' lane: scripts/test_real_lane.sh
31
+ not_seen: 없음')"
32
+ lane b3-not_seen-missing 4 "$(E ' lane: scripts/test_real_lane.sh')"
33
+ lane c-lane-path-missing 4 "$(E ' lane: scripts/test_nope.sh
34
+ not_seen: 현장 노드의 실사용 결과는 보지 않는다')"
35
+ lane c2-lane-dotdot 4 "$(E ' lane: ../outside.sh
36
+ not_seen: 현장 노드의 실사용 결과는 보지 않는다')"
37
+ lane d-absence-claim-ko 4 "$(E ' lane: scripts/test_real_lane.sh
38
+ not_seen: 현장 노드의 실사용 결과는 보지 않는다
39
+ predicted_impact: 미측정을 깨끗으로 렌더하는 경로가 남아 있지 않다')"
40
+ lane d2-absence-claim-en 4 "$(E ' lane: scripts/test_real_lane.sh
41
+ not_seen: 현장 노드의 실사용 결과는 보지 않는다
42
+ predicted_impact: the scanner never renders unmeasured as clean')"
43
+ lane e-no-entry-today 2 "- date: 2026-01-01
44
+ files: [a]
45
+ intent: old"
46
+ lane f-classic-prediction 0 "$(E ' predicted_impact: 경고 한 줄이 사라진다')"
47
+ lane f2-classic-absence-ok 0 "$(E ' predicted_impact: 그 경로가 남아 있지 않다')"
48
+ lane g-list-absence-claim 4 "$(E ' lane: scripts/test_real_lane.sh
49
+ not_seen: 현장 노드의 실사용 결과는 보지 않는다
50
+ predicted_impact:
51
+ - 그 경로가 전혀 남아 있지 않다')"
52
+ lane g2-impact-key-absence 4 "$(E ' lane: scripts/test_real_lane.sh
53
+ not_seen: 현장 노드의 실사용 결과는 보지 않는다
54
+ impact: 버그가 없어진다')"
55
+ lane h-symlink-outside-repo 4 "$(E ' lane: scripts/sym_out.sh
56
+ not_seen: 현장 노드의 실사용 결과는 보지 않는다')"
57
+ lane i-lane-null-is-classic 0 "$(E ' predicted_impact: 경고 한 줄이 사라진다
58
+ lane: null')"
59
+ lane j-stale-dead-lane-then-classic 0 "$(E ' lane: scripts/test_nope.sh
60
+ not_seen: 현장 노드의 실사용 결과는 보지 않는다')
61
+ $(E ' predicted_impact: 별건 종전 예측')"
62
+ lane k-bad-lane-after-valid-classic 4 "$(E ' predicted_impact: 아침 종전 커밋')
63
+ $(E ' lane: scripts/test_nope.sh
64
+ not_seen: 현장 노드의 실사용 결과는 보지 않는다')"
65
+ lane l-nominal-absence-ko 4 "$(E ' lane: scripts/test_real_lane.sh
66
+ not_seen: 현장 노드의 실사용 결과는 보지 않는다
67
+ predicted_impact: 커밋 시 경고 한 줄 사라짐')"
68
+ lane m-short-not_seen-ok 0 "$(E ' lane: scripts/test_real_lane.sh
69
+ not_seen: 실서버 미검증')"
70
+ lane n-mapping-key-not-scanned 0 "$(E ' lane: scripts/test_real_lane.sh
71
+ not_seen: runtime behavior
72
+ impact:
73
+ never: renamed to always')"
74
+ echo "== 되돌림 3단 =="
75
+ probe() { # id sed-expr expected-failing-lane-desc
76
+ sed "$2" "$T/chk.py" > "$T/mut.py"
77
+ if cmp -s "$T/chk.py" "$T/mut.py"; then echo " ❌ $1 적용 확인 실패(변이가 안 먹었다) — 계기 오류"; FAIL=1; return; fi
78
+ echo " · $1 변이 적용됨"; }
79
+ probe R1-allow-line 's/if not os.path.isfile(full):/if False:/'
80
+ rc=$(run "$T/mut.py" "$(E ' lane: scripts/test_nope.sh
81
+ not_seen: 현장 노드의 실사용 결과는 보지 않는다')"); [ "$rc" != 4 ] && echo " ✅ R1 되돌림 → (c) 빨강(rc=$rc)" || { echo " ❌ R1 되돌려도 (c) 초록"; FAIL=1; }
82
+ probe R2-absence 's/ for k in ("predicted_impact", "prediction", "impact"):/ for k in ():/'
83
+ rc=$(run "$T/mut.py" "$(E ' lane: scripts/test_real_lane.sh
84
+ not_seen: 현장 노드의 실사용 결과는 보지 않는다
85
+ predicted_impact: 그 경로가 남아 있지 않다')"); [ "$rc" != 4 ] && echo " ✅ R2 부재 판별 삭제 → (d) 빨강(rc=$rc)" || { echo " ❌ R2 삭제해도 (d) 초록"; FAIL=1; }
86
+ probe R3-not_seen 's/if not isinstance(ns, str) or ns.strip().lower() in _PH or len(ns.strip()) < 5:/if False:/'
87
+ rc=$(run "$T/mut.py" "$(E ' lane: scripts/test_real_lane.sh
88
+ not_seen: ""')"); [ "$rc" != 4 ] && echo " ✅ R3 not_seen 검사 삭제 → (b) 빨강(rc=$rc)" || { echo " ❌ R3 삭제해도 (b) 초록"; FAIL=1; }
89
+ # 복원 확인: 원본은 안 건드렸으니 다시 (a) 가 통과해야 한다
90
+ lane Z-restored-a-pass 0 "$(E ' lane: scripts/test_real_lane.sh
91
+ not_seen: 현장 노드의 실사용 결과는 보지 않는다')"
92
+ [ $FAIL -eq 0 ] && echo "AXIS4 LANE-SUBSTITUTE LANES: PASS" || echo "AXIS4 LANE-SUBSTITUTE LANES: FAIL"
93
+ exit $FAIL
@@ -45,6 +45,9 @@ unset FH_COMPANION_STORE FH_SESSION_CLOSE FH_CARRYOVER_OK FH_PEER_SCAN_FORCE FH_
45
45
  export FH_COMPANION_STORE=""
46
46
  CHECK="$SCRIPT_DIR/session_close_check.sh"
47
47
  FAILED=0
48
+ # 비주제 레인 — ①-b 의 gh 를 레인 안 스텁으로 (네트워크 의존 · selfcheck 에서 ≈66s). scripts/lane_stub_env.sh
49
+ . "$SCRIPT_DIR/lane_stub_env.sh"
50
+ _LS_DIR=$(mktemp -d) && lane_stub_env_on "$_LS_DIR" gh || { echo "HARNESS-ERROR: lane_stub_env 를 못 켰다"; exit 9; }
48
51
 
49
52
  run_fixture() { # $1=name $2=card-content $3=make-artifact(0/1) $4=expect-warn(0/1)
50
53
  local name="$1" card="$2" mkart="$3" expect="$4"
@@ -154,6 +157,10 @@ else
154
157
  echo "✅ locale-range lint: 비ASCII 문자 범위 없음"
155
158
  fi
156
159
 
160
+ if ! lane_stub_env_used gh; then
161
+ echo "❌ lane_stub_env: gh 스텁이 한 번도 안 불렸다 — 체커가 다른 gh 를 골랐다(PATH 가림)"; FAILED=1
162
+ fi
163
+ rm -rf "$_LS_DIR"
157
164
 
158
165
  echo "── card-drift probe calibration: $([ "$FAILED" -eq 0 ] && echo "PASS (전 픽스처) — 배선 가능" || echo "FAIL — 계기 불량, 배선 금지") ──"
159
166
  exit "$FAILED"