@chrono-meta/fh-gate 3.22.1 → 3.23.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.
- package/.claude-plugin/marketplace.json +4 -4
- package/knowledge/shared/harness-core/capability_composition_contract.md +21 -0
- package/knowledge/shared/harness-core/checkout_layer_drift.md +67 -0
- package/knowledge/shared/harness-core/gate_locality_principle.md +25 -2
- package/knowledge/shared/harness-core/hook_channel_visibility.md +23 -3
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +106 -0
- package/package.json +8 -2
- 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 +50 -0
- package/plugins/fh-meta/skills/agent-composer/SKILL.md +5 -0
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/context_continuity_score.sh +3 -1
- package/scripts/env_layer_fingerprint.sh +26 -10
- package/scripts/main_commit_guard.sh +47 -0
- package/scripts/mapped_tracks.sh +11 -1
- package/scripts/probe_live_eval.sh +11 -0
- package/scripts/round/nameleak_check.sh +85 -0
- package/scripts/selfcheck.sh +99 -8
- package/scripts/test_env_layer_fingerprint_lanes.sh +99 -0
- package/scripts/test_main_commit_guard_lanes.sh +72 -0
- package/scripts/test_mapped_tracks_lanes.sh +73 -0
- package/scripts/test_post_squash_verify_lanes.sh +183 -0
- package/scripts/test_pr_merge_verified_lanes.sh +104 -0
- package/scripts/test_probe_live_eval_lanes.sh +17 -1
- package/scripts/test_verdict_watermark_lanes.sh +8 -1
- package/templates/.git-hooks/pre-commit +12 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_post_squash_verify_lanes.sh — anchor for scripts/post_squash_verify.sh.
|
|
3
|
+
#
|
|
4
|
+
# Known pairs from the origin signal (fh_signal_2026-09-21_post-squash-verify.md §설계 조건):
|
|
5
|
+
# ⓐ a clean squash → pass ⓑ a squash that drops one file → 🟥 rc=1
|
|
6
|
+
# ⓒ no --rerun → rc=2 🟥 without ⓒ the "② is required" clause is decoration
|
|
7
|
+
# plus: trivial ② refused (rc=3) · failing ② (rc=1) · silent ② (rc=4) · a path main ALSO changed is
|
|
8
|
+
# COMBINED, not DIFFERS · an extra path in the squash is 🟥 EXTRA · the caller's HEAD is untouched.
|
|
9
|
+
# Every fixture is a throwaway repo built here (portable; no dependency on this repo's history).
|
|
10
|
+
set -uo pipefail
|
|
11
|
+
cd "$(dirname "$0")/.."
|
|
12
|
+
SC="$PWD/scripts/post_squash_verify.sh"
|
|
13
|
+
[ -f "$SC" ] || { echo "🟥 HARNESS-ERROR: target missing ($SC)" >&2; exit 9; }
|
|
14
|
+
|
|
15
|
+
PASS=0; FAIL=0
|
|
16
|
+
ok() { PASS=$((PASS+1)); printf ' ✅ %s\n' "$1"; }
|
|
17
|
+
bad() { FAIL=$((FAIL+1)); printf ' ❌ %s\n' "$1"; }
|
|
18
|
+
|
|
19
|
+
T=$(mktemp -d "${TMPDIR:-/tmp}/psv-lane-XXXXXX")
|
|
20
|
+
trap 'rm -rf "$T"' EXIT INT TERM
|
|
21
|
+
export GIT_AUTHOR_NAME=t GIT_AUTHOR_EMAIL=t@t GIT_COMMITTER_NAME=t GIT_COMMITTER_EMAIL=t@t
|
|
22
|
+
|
|
23
|
+
# mk <dir>: main has a,b,c · branch `feat` changes a and b · returns via globals TIP
|
|
24
|
+
mk() {
|
|
25
|
+
local d="$1"; git init -q -b main "$d"
|
|
26
|
+
printf 'a1\n' > "$d/a"; printf 'b1\n' > "$d/b"; printf 'c1\nc2\nc3\n' > "$d/c"
|
|
27
|
+
git -C "$d" add -A; git -C "$d" commit -qm init --no-verify
|
|
28
|
+
git -C "$d" switch -qc feat
|
|
29
|
+
printf 'a2\n' > "$d/a"; printf 'b2\n' > "$d/b"
|
|
30
|
+
git -C "$d" commit -qam feat --no-verify
|
|
31
|
+
TIP=$(git -C "$d" rev-parse HEAD)
|
|
32
|
+
git -C "$d" switch -q main
|
|
33
|
+
}
|
|
34
|
+
# squash <dir> [drop-path] : squash-merge feat into main, optionally reverting one path before commit
|
|
35
|
+
squash() {
|
|
36
|
+
local d="$1" drop="${2:-}"
|
|
37
|
+
git -C "$d" merge --squash -q feat >/dev/null 2>&1
|
|
38
|
+
[ -n "$drop" ] && git -C "$d" checkout -q HEAD -- "$drop"
|
|
39
|
+
git -C "$d" commit -qm squash --no-verify
|
|
40
|
+
}
|
|
41
|
+
run() { OUT=$(bash "$SC" --repo "$1" --tip "$2" "${@:3}" 2>&1); RC=$?; }
|
|
42
|
+
|
|
43
|
+
printf '── post_squash_verify ──\n'
|
|
44
|
+
GOOD='grep -q a2 a && grep -q b2 b && echo instrument-ok'
|
|
45
|
+
|
|
46
|
+
# ⓐ clean squash → rc=0
|
|
47
|
+
mk "$T/ok"; squash "$T/ok"; TIP_OK="$TIP"
|
|
48
|
+
# 🟥 every later "$T/ok" run uses TIP_OK, never the global: mk() for another repo overwrites TIP, and
|
|
49
|
+
# the stale value only "worked" when both repos committed in the same second (identical hashes).
|
|
50
|
+
# Found 2026-09-24 as a 1-in-2 flake: ② failing-lane got rc=4 «--tip not a commit».
|
|
51
|
+
run "$T/ok" "$TIP_OK" --rerun "$GOOD"
|
|
52
|
+
[ "$RC" -eq 0 ] && ok "ⓐ clean squash + live ② → rc=0" || { bad "ⓐ clean squash rc=$RC"; printf '%s\n' "$OUT" | tail -5; }
|
|
53
|
+
|
|
54
|
+
# ⓑ squash that silently dropped b → rc=1 with DIFFERS b (② checks only a, so ① alone must catch it)
|
|
55
|
+
mk "$T/drop"; squash "$T/drop" b
|
|
56
|
+
run "$T/drop" "$TIP" --rerun 'grep -q a2 a && echo a-ok'
|
|
57
|
+
{ [ "$RC" -eq 1 ] && printf '%s' "$OUT" | grep -q 'DIFFERS b'; } \
|
|
58
|
+
&& ok "ⓑ dropped file → rc=1 · DIFFERS b (① catches what a narrow ② misses)" \
|
|
59
|
+
|| { bad "ⓑ dropped file rc=$RC"; printf '%s\n' "$OUT" | tail -6; }
|
|
60
|
+
|
|
61
|
+
# ⓒ no --rerun → rc=2, and it must refuse BEFORE doing anything
|
|
62
|
+
run "$T/ok" "$TIP_OK"
|
|
63
|
+
[ "$RC" -eq 2 ] && ok "ⓒ no --rerun → rc=2 (① alone cannot go green)" || bad "ⓒ no --rerun rc=$RC"
|
|
64
|
+
|
|
65
|
+
# trivial ② refused — each spelling
|
|
66
|
+
_tf=0
|
|
67
|
+
for triv in ':' 'true' ' true ; ' 'exit 0' '' '/usr/bin/true'; do
|
|
68
|
+
run "$T/ok" "$TIP_OK" --rerun "$triv"
|
|
69
|
+
[ "$RC" -eq 3 ] || { bad "trivial ② '$triv' → rc=$RC (want 3)"; _tf=1; }
|
|
70
|
+
done
|
|
71
|
+
[ "$_tf" -eq 0 ] && ok "trivial ② (: · true · ' true ; ' · exit 0 · '' · /usr/bin/true) → rc=3 each"
|
|
72
|
+
|
|
73
|
+
# failing ② on a byte-correct merge → rc=1
|
|
74
|
+
run "$T/ok" "$TIP_OK" --rerun 'grep -q NOPE a'
|
|
75
|
+
[ "$RC" -eq 1 ] && ok "failing ② on a byte-correct squash → rc=1" || { bad "failing ② rc=$RC"; printf '%s\n' "$OUT" | tail -4; }
|
|
76
|
+
|
|
77
|
+
# silent ② (rc=0, no output) → rc=4, never a pass
|
|
78
|
+
run "$T/ok" "$TIP_OK" --rerun 'grep -q a2 a'
|
|
79
|
+
[ "$RC" -eq 4 ] && ok "silent ② (rc=0, empty output) → rc=4" || { bad "silent ② rc=$RC"; printf '%s\n' "$OUT" | tail -4; }
|
|
80
|
+
|
|
81
|
+
# COMBINED: main also changed a (different line region) after the branch was cut → not DIFFERS
|
|
82
|
+
mk "$T/comb"; printf 'c1\nc2\nc3\nc4\n' > "$T/comb/c"; git -C "$T/comb" commit -qam main-c --no-verify
|
|
83
|
+
git -C "$T/comb" switch -q feat; printf 'c0\nc1\nc2\nc3\n' > "$T/comb/c"; git -C "$T/comb" commit -qam feat-c --no-verify
|
|
84
|
+
TIP=$(git -C "$T/comb" rev-parse HEAD); git -C "$T/comb" switch -q main; squash "$T/comb"
|
|
85
|
+
run "$T/comb" "$TIP" --rerun 'grep -q c0 c && grep -q c4 c && echo merged-ok'
|
|
86
|
+
{ [ "$RC" -eq 0 ] && printf '%s' "$OUT" | grep -q 'COMBINED c'; } \
|
|
87
|
+
&& ok "path changed on both sides → COMBINED (not DIFFERS), rc=0 when ② passes" \
|
|
88
|
+
|| { bad "COMBINED rc=$RC"; printf '%s\n' "$OUT" | tail -6; }
|
|
89
|
+
|
|
90
|
+
# EXTRA: squash commit carries a path the branch never touched → rc=1
|
|
91
|
+
mk "$T/ext"; git -C "$T/ext" merge --squash -q feat >/dev/null 2>&1
|
|
92
|
+
printf 'x\n' > "$T/ext/extra"; git -C "$T/ext" add extra; git -C "$T/ext" commit -qm squash --no-verify
|
|
93
|
+
run "$T/ext" "$TIP" --rerun "$GOOD"
|
|
94
|
+
{ [ "$RC" -eq 1 ] && printf '%s' "$OUT" | grep -q 'EXTRA extra'; } \
|
|
95
|
+
&& ok "path in squash but not on branch → EXTRA · rc=1" || { bad "EXTRA rc=$RC"; printf '%s\n' "$OUT" | tail -4; }
|
|
96
|
+
|
|
97
|
+
# caller's HEAD and worktree list are untouched (② runs in a throwaway worktree)
|
|
98
|
+
H0=$(git -C "$T/ok" rev-parse HEAD); B0=$(git -C "$T/ok" branch --show-current)
|
|
99
|
+
run "$T/ok" "$TIP_OK" --rerun "$GOOD"
|
|
100
|
+
WTN=$(git -C "$T/ok" worktree list | wc -l | tr -d ' ')
|
|
101
|
+
{ [ "$(git -C "$T/ok" rev-parse HEAD)" = "$H0" ] && [ "$(git -C "$T/ok" branch --show-current)" = "$B0" ] && [ "$WTN" = "1" ]; } \
|
|
102
|
+
&& ok "caller HEAD/branch unchanged · throwaway worktree removed" || bad "side effect: HEAD/branch moved or worktrees=$WTN"
|
|
103
|
+
|
|
104
|
+
# ── cross-family R1 (codex/gpt-5.5, 2026-09-24) — each lane below was RED before its fix ──
|
|
105
|
+
# X1 newline in a path: --name-only C-quotes it, the quoted string is looked up literally, both
|
|
106
|
+
# sides read ABSENT and the path renders SAME. Squash drops the file → must be DIFFERS, rc=1.
|
|
107
|
+
mk "$T/nl"; git -C "$T/nl" switch -q feat; printf 'n\n' > "$T/nl/$(printf 'x\ny')"
|
|
108
|
+
git -C "$T/nl" add -A; git -C "$T/nl" commit -qm nl --no-verify; TIP_NL=$(git -C "$T/nl" rev-parse HEAD)
|
|
109
|
+
git -C "$T/nl" switch -q main; squash "$T/nl" "$(printf 'x\ny')" 2>/dev/null
|
|
110
|
+
git -C "$T/nl" rm -q --cached "$(printf 'x\ny')" 2>/dev/null; git -C "$T/nl" commit -q --amend --no-edit --no-verify 2>/dev/null
|
|
111
|
+
run "$T/nl" "$TIP_NL" --rerun 'echo hi && grep -q a2 a'
|
|
112
|
+
[ "$RC" -eq 1 ] && ok "X1 newline path dropped by squash → rc=1 (not SAME)" || { bad "X1 newline path rc=$RC"; printf '%s\n' "$OUT" | tail -5; }
|
|
113
|
+
|
|
114
|
+
# X2 --tip == --merge compares the commit to itself → rc=4, never a pass
|
|
115
|
+
M_OK=$(git -C "$T/ok" rev-parse HEAD)
|
|
116
|
+
run "$T/ok" "$M_OK" --rerun "$GOOD"
|
|
117
|
+
[ "$RC" -eq 4 ] && ok "X2 --tip == --merge → rc=4" || bad "X2 --tip == --merge rc=$RC"
|
|
118
|
+
|
|
119
|
+
# X3 echo/printf-only ② exercises nothing → rc=3 (the exact-string list missed these)
|
|
120
|
+
_tf=0
|
|
121
|
+
for triv in 'printf ok' 'echo ok; :' 'echo a && echo b' 'true; printf x'; do
|
|
122
|
+
run "$T/ok" "$TIP_OK" --rerun "$triv"
|
|
123
|
+
[ "$RC" -eq 3 ] || { bad "X3 echo-only ② '$triv' → rc=$RC (want 3)"; _tf=1; }
|
|
124
|
+
done
|
|
125
|
+
[ "$_tf" -eq 0 ] && ok "X3 echo/printf/:/true-only ② → rc=3"
|
|
126
|
+
# X3 control: a real command that ALSO echoes must still run (over-block guard)
|
|
127
|
+
run "$T/ok" "$TIP_OK" --rerun 'grep -q a2 a; echo checked'
|
|
128
|
+
[ "$RC" -eq 0 ] && ok "X3-ctrl grep + echo is not refused" || bad "X3-ctrl real command refused rc=$RC"
|
|
129
|
+
|
|
130
|
+
# X4 a true merge commit (2 parents) is not a squash → rc=4
|
|
131
|
+
mk "$T/mm"; git -C "$T/mm" merge -q --no-ff --no-edit feat >/dev/null 2>&1
|
|
132
|
+
run "$T/mm" "$TIP" --merge HEAD --rerun "$GOOD"
|
|
133
|
+
[ "$RC" -eq 4 ] && ok "X4 two-parent merge commit → rc=4" || bad "X4 multi-parent rc=$RC"
|
|
134
|
+
|
|
135
|
+
# ── cross-family R2 ──
|
|
136
|
+
# X5 a real \001 byte in a path collided with the R1 sentinel → dropped file rendered SAME
|
|
137
|
+
mk "$T/c1"; git -C "$T/c1" switch -q feat; printf 'q\n' > "$T/c1/$(printf 'x\001y')"
|
|
138
|
+
git -C "$T/c1" add -A; git -C "$T/c1" commit -qm c1 --no-verify; TIP_C1=$(git -C "$T/c1" rev-parse HEAD)
|
|
139
|
+
git -C "$T/c1" switch -q main; git -C "$T/c1" merge --squash -q feat >/dev/null 2>&1
|
|
140
|
+
git -C "$T/c1" rm -q --cached "$(printf 'x\001y')" >/dev/null 2>&1; git -C "$T/c1" commit -qm s --no-verify
|
|
141
|
+
run "$T/c1" "$TIP_C1" --rerun 'echo hi && grep -q a2 a'
|
|
142
|
+
[ "$RC" -eq 1 ] && ok "X5 \\001 byte in a dropped path → rc=1 (no sentinel collision)" || { bad "X5 \\001 path rc=$RC"; printf '%s\n' "$OUT" | tail -4; }
|
|
143
|
+
# X6 echo first, real check after `&&` → must NOT be refused (splitter over-block guard)
|
|
144
|
+
run "$T/ok" "$TIP_OK" --rerun 'echo checked && grep -q a2 a'
|
|
145
|
+
[ "$RC" -eq 0 ] && ok "X6 'echo … && grep …' runs (split on && works)" || bad "X6 echo-then-real refused rc=$RC"
|
|
146
|
+
# X7 a path with a space survives the array path end to end
|
|
147
|
+
mk "$T/sp"; git -C "$T/sp" switch -q feat; printf 's\n' > "$T/sp/has space"; git -C "$T/sp" add -A
|
|
148
|
+
git -C "$T/sp" commit -qm sp --no-verify; TIP_SP=$(git -C "$T/sp" rev-parse HEAD); git -C "$T/sp" switch -q main; squash "$T/sp"
|
|
149
|
+
run "$T/sp" "$TIP_SP" --rerun 'test -f "has space" && echo ok'
|
|
150
|
+
[ "$RC" -eq 0 ] && ok "X7 path with a space → SAME · rc=0" || { bad "X7 space path rc=$RC"; printf '%s\n' "$OUT" | tail -4; }
|
|
151
|
+
|
|
152
|
+
# ── cross-family R3 ──
|
|
153
|
+
# X8 an option with no operand must be a usage error, not an endless `shift 2` loop
|
|
154
|
+
_xf=0
|
|
155
|
+
for opt in --tip --merge --repo --rerun; do
|
|
156
|
+
OUT=$(timeout 10 bash "$SC" --repo "$T/ok" $opt 2>&1); RC=$?
|
|
157
|
+
[ "$RC" -eq 2 ] || { bad "X8 '$opt' with no operand → rc=$RC (want 2; 124 = hung)"; _xf=1; }
|
|
158
|
+
done
|
|
159
|
+
[ "$_xf" -eq 0 ] && ok "X8 option with no operand → rc=2 (checked: --tip --merge --repo --rerun)"
|
|
160
|
+
# X9 a failing `git diff` for the squash list must be rc=4, not an empty list that skips EXTRA
|
|
161
|
+
FB="$T/fakebin"; mkdir -p "$FB"; RG=$(command -v git)
|
|
162
|
+
printf '#!/bin/sh\ncase " $* " in *" diff "*"%s"*) exit 128 ;; esac\nexec "%s" "$@"\n' "$(git -C "$T/ext" rev-parse HEAD)" "$RG" > "$FB/git"; chmod +x "$FB/git"
|
|
163
|
+
OUT=$(PATH="$FB:$PATH" bash "$SC" --repo "$T/ext" --tip "$(git -C "$T/ext" rev-parse feat)" --rerun "$GOOD" 2>&1); RC=$?
|
|
164
|
+
# 🟥 rc=4 alone is not enough — «branch changed no paths» is also rc=4. Require the diff-failure message.
|
|
165
|
+
{ [ "$RC" -eq 4 ] && printf '%s' "$OUT" | grep -q 'git diff failed'; } && ok "X9 git diff fails on the squash list → rc=4 (named)" || { bad "X9 swallowed git diff failure rc=$RC"; printf '%s\n' "$OUT" | tail -3; }
|
|
166
|
+
|
|
167
|
+
# ── cross-family R4 ──
|
|
168
|
+
# X10 a mode-only change (chmod +x) dropped by the squash → same blob, different entry → rc=1.
|
|
169
|
+
# This is the exec-bit class that silently disarms git hooks ([[feedback_exec_bit_loss_disarms_hooks_silently]]).
|
|
170
|
+
mk "$T/md"; git -C "$T/md" switch -q feat; chmod +x "$T/md/a"; git -C "$T/md" add a
|
|
171
|
+
git -C "$T/md" commit -qm mode --no-verify; TIP_MD=$(git -C "$T/md" rev-parse HEAD); git -C "$T/md" switch -q main
|
|
172
|
+
git -C "$T/md" merge --squash -q feat >/dev/null 2>&1; chmod -x "$T/md/a"; git -C "$T/md" add a; git -C "$T/md" commit -qm s --no-verify
|
|
173
|
+
run "$T/md" "$TIP_MD" --rerun 'grep -q a2 a && echo ok'
|
|
174
|
+
{ [ "$RC" -eq 1 ] && printf '%s' "$OUT" | grep -q 'DIFFERS'; } && ok "X10 dropped mode change → DIFFERS · rc=1" || { bad "X10 mode-only drop rc=$RC"; printf '%s\n' "$OUT" | tail -4; }
|
|
175
|
+
|
|
176
|
+
# X11 --precheck validates --rerun with no git state: trivial → 3 · real → 0 · missing → 2 (no --tip needed)
|
|
177
|
+
_p1=$(bash "$SC" --precheck --rerun 'true' >/dev/null 2>&1; echo $?)
|
|
178
|
+
_p2=$(bash "$SC" --precheck --rerun 'grep -q x y; echo z' >/dev/null 2>&1; echo $?)
|
|
179
|
+
_p3=$(bash "$SC" --precheck >/dev/null 2>&1; echo $?)
|
|
180
|
+
[ "$_p1$_p2$_p3" = "302" ] && ok "X11 --precheck: trivial=3 · real=0 · missing=2" || bad "X11 --precheck got $_p1/$_p2/$_p3 (want 3/0/2)"
|
|
181
|
+
|
|
182
|
+
printf 'PASS %d · FAIL %d\n' "$PASS" "$FAIL"
|
|
183
|
+
[ "$FAIL" -eq 0 ]
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_pr_merge_verified_lanes.sh — anchor for scripts/pr_merge_verified.sh (the merge-path wiring of
|
|
3
|
+
# post_squash_verify.sh). Hermetic: a local bare "origin" and a fake `gh` on PATH; no network.
|
|
4
|
+
#
|
|
5
|
+
# The load-bearing lanes are the REFUSALS: a refusal must happen BEFORE the merge, so each refusal
|
|
6
|
+
# lane also asserts the fake gh never received `pr merge` (a merge log that stays empty).
|
|
7
|
+
set -uo pipefail
|
|
8
|
+
cd "$(dirname "$0")/.."
|
|
9
|
+
SC="$PWD/scripts/pr_merge_verified.sh"
|
|
10
|
+
[ -f "$SC" ] || { echo "🟥 HARNESS-ERROR: target missing ($SC)" >&2; exit 9; }
|
|
11
|
+
|
|
12
|
+
PASS=0; FAIL=0
|
|
13
|
+
ok() { PASS=$((PASS+1)); printf ' ✅ %s\n' "$1"; }
|
|
14
|
+
bad() { FAIL=$((FAIL+1)); printf ' ❌ %s\n' "$1"; }
|
|
15
|
+
T=$(mktemp -d "${TMPDIR:-/tmp}/pmv-lane-XXXXXX"); trap 'rm -rf "$T"' EXIT INT TERM
|
|
16
|
+
export GIT_AUTHOR_NAME=t GIT_AUTHOR_EMAIL=t@t GIT_COMMITTER_NAME=t GIT_COMMITTER_EMAIL=t@t
|
|
17
|
+
|
|
18
|
+
# setup <name> : bare origin with main(a,b) + feat(a2,b2); a clone at $T/<name>/work
|
|
19
|
+
setup() {
|
|
20
|
+
local d="$T/$1"; mkdir -p "$d"
|
|
21
|
+
git init -q --bare -b main "$d/origin.git"
|
|
22
|
+
git clone -q "$d/origin.git" "$d/seed" 2>/dev/null
|
|
23
|
+
printf 'a1\n' > "$d/seed/a"; printf 'b1\n' > "$d/seed/b"
|
|
24
|
+
git -C "$d/seed" add -A; git -C "$d/seed" commit -qm init --no-verify; git -C "$d/seed" push -q origin HEAD:main
|
|
25
|
+
git -C "$d/seed" switch -qc feat; printf 'a2\n' > "$d/seed/a"; printf 'b2\n' > "$d/seed/b"
|
|
26
|
+
git -C "$d/seed" commit -qam feat --no-verify; git -C "$d/seed" push -q origin feat
|
|
27
|
+
git clone -q "$d/origin.git" "$d/work" 2>/dev/null; git -C "$d/work" fetch -q origin feat
|
|
28
|
+
printf '%s' "$(git -C "$d/seed" rev-parse feat)" > "$d/head.oid"
|
|
29
|
+
}
|
|
30
|
+
# fake gh. Behaviour knobs via files in $D: view_fail · merge_fail · drop_b
|
|
31
|
+
mkgh() {
|
|
32
|
+
local D="$1"; mkdir -p "$D/bin"
|
|
33
|
+
cat > "$D/bin/gh" <<EOF
|
|
34
|
+
#!/bin/sh
|
|
35
|
+
D="$D"
|
|
36
|
+
case "\$1 \$2" in
|
|
37
|
+
"pr view")
|
|
38
|
+
[ -f "\$D/view_fail" ] && exit 1
|
|
39
|
+
case "\$*" in *headRefOid*) cat "\$D/head.oid"; echo ;;
|
|
40
|
+
*state*) if [ -f "\$D/merge.oid" ] && [ ! -f "\$D/queued" ]; then echo MERGED; else echo OPEN; fi ;;
|
|
41
|
+
*mergeCommit*) if [ -f "\$D/queued" ]; then echo null; else cat "\$D/merge.oid" 2>/dev/null; echo; fi ;; esac ;;
|
|
42
|
+
"pr merge")
|
|
43
|
+
echo "\$*" >> "\$D/merge.log"
|
|
44
|
+
[ -f "\$D/merge_fail" ] && exit 1
|
|
45
|
+
case "\$*" in *--match-head-commit*) mh=\$(echo "\$*" | sed 's/.*--match-head-commit \([0-9a-f]*\).*/\1/')
|
|
46
|
+
[ -f "\$D/moved" ] && { echo "Head branch was modified" >&2; exit 1; }
|
|
47
|
+
[ "\$mh" = "\$(cat "\$D/head.oid")" ] || exit 1 ;; esac
|
|
48
|
+
[ -f "\$D/queued" ] && { git -C "\$D/seed" rev-parse HEAD > "\$D/merge.oid"; exit 0; }
|
|
49
|
+
git -C "\$D/seed" switch -q main && git -C "\$D/seed" merge --squash -q feat >/dev/null 2>&1
|
|
50
|
+
[ -f "\$D/drop_b" ] && git -C "\$D/seed" checkout -q HEAD -- b
|
|
51
|
+
git -C "\$D/seed" commit -qm squash --no-verify && git -C "\$D/seed" push -q origin main
|
|
52
|
+
git -C "\$D/seed" rev-parse HEAD > "\$D/merge.oid" ;;
|
|
53
|
+
*) exit 2 ;;
|
|
54
|
+
esac
|
|
55
|
+
EOF
|
|
56
|
+
chmod +x "$D/bin/gh"
|
|
57
|
+
}
|
|
58
|
+
run() { local D="$1"; shift; OUT=$(cd "$D/work" && PATH="$D/bin:$PATH" bash "$SC" "$@" 2>&1); RC=$?; }
|
|
59
|
+
merged() { [ -s "$1/merge.log" ]; }
|
|
60
|
+
GOOD='grep -q a2 a && grep -q b2 b && echo instrument-ok'
|
|
61
|
+
|
|
62
|
+
printf '── pr_merge_verified ──\n'
|
|
63
|
+
|
|
64
|
+
setup ok; mkgh "$T/ok"; run "$T/ok" 7 --rerun "$GOOD"
|
|
65
|
+
{ [ "$RC" -eq 0 ] && printf '%s' "$OUT" | grep -q 'merged and verified'; } \
|
|
66
|
+
&& ok "L1 merge + verify → rc=0" || { bad "L1 happy path rc=$RC"; printf '%s\n' "$OUT" | tail -6; }
|
|
67
|
+
|
|
68
|
+
setup nore; mkgh "$T/nore"; run "$T/nore" 7
|
|
69
|
+
{ [ "$RC" -eq 2 ] && ! merged "$T/nore"; } && ok "L2 no --rerun → rc=2 and merge NEVER called" \
|
|
70
|
+
|| bad "L2 no --rerun rc=$RC merged=$(merged "$T/nore" && echo yes || echo no)"
|
|
71
|
+
|
|
72
|
+
setup mf; mkgh "$T/mf"; : > "$T/mf/merge_fail"; run "$T/mf" 7 --rerun "$GOOD"
|
|
73
|
+
[ "$RC" -eq 5 ] && ok "L3 merge fails → rc=5" || bad "L3 merge failure rc=$RC"
|
|
74
|
+
|
|
75
|
+
setup drop; mkgh "$T/drop"; : > "$T/drop/drop_b"; run "$T/drop" 7 --rerun 'grep -q a2 a && echo a-ok'
|
|
76
|
+
{ [ "$RC" -eq 1 ] && printf '%s' "$OUT" | grep -q 'IS MERGED but verification FAILED'; } \
|
|
77
|
+
&& ok "L4 squash dropped a file → rc=1 · says the merge stands" || { bad "L4 dropped file rc=$RC"; printf '%s\n' "$OUT" | tail -5; }
|
|
78
|
+
|
|
79
|
+
setup bad; mkgh "$T/bad"; run "$T/bad" 7x --rerun "$GOOD"
|
|
80
|
+
{ [ "$RC" -eq 2 ] && ! merged "$T/bad"; } && ok "L5 non-numeric PR → rc=2, no merge" || bad "L5 non-numeric PR rc=$RC"
|
|
81
|
+
|
|
82
|
+
setup vf; mkgh "$T/vf"; : > "$T/vf/view_fail"; run "$T/vf" 7 --rerun "$GOOD"
|
|
83
|
+
{ [ "$RC" -eq 4 ] && ! merged "$T/vf"; } && ok "L6 PR head unreadable → rc=4 BEFORE merge" \
|
|
84
|
+
|| bad "L6 head unreadable rc=$RC merged=$(merged "$T/vf" && echo yes || echo no)"
|
|
85
|
+
|
|
86
|
+
setup triv; mkgh "$T/triv"; run "$T/triv" 7 --rerun 'true'
|
|
87
|
+
# 🟥 the refusal must come BEFORE the merge — first draft refused it only after merging (rc=4 post-merge)
|
|
88
|
+
{ [ "$RC" -eq 3 ] && ! merged "$T/triv"; } \
|
|
89
|
+
&& ok "L7 trivial --rerun → rc=3 BEFORE merge (merge never called)" \
|
|
90
|
+
|| bad "L7 trivial rerun rc=$RC merged=$(merged "$T/triv" && echo yes || echo no)"
|
|
91
|
+
|
|
92
|
+
# ── cross-family W1 (codex/gpt-5.5) ──
|
|
93
|
+
# L8 the merge is pinned to the RECORDED head: gh gets --match-head-commit <oid>; a moved head → no merge (rc=5)
|
|
94
|
+
grep -q -- "--match-head-commit $(cat "$T/ok/head.oid")" "$T/ok/merge.log" \
|
|
95
|
+
&& ok "L8a merge call carries --match-head-commit <recorded head>" || bad "L8a merge not pinned to the recorded head: $(cat "$T/ok/merge.log")"
|
|
96
|
+
setup mv; mkgh "$T/mv"; : > "$T/mv/moved"; run "$T/mv" 7 --rerun "$GOOD"
|
|
97
|
+
[ "$RC" -eq 5 ] && ok "L8b head moved after recording → GitHub refuses, rc=5 (nothing merged)" || bad "L8b moved head rc=$RC"
|
|
98
|
+
# L9 merge accepted but not completed (queue / API lag: mergeCommit null) → rc=6, never «merged and verified», never «the merge stands»
|
|
99
|
+
setup q; mkgh "$T/q"; : > "$T/q/queued"; run "$T/q" 7 --rerun "$GOOD"
|
|
100
|
+
{ [ "$RC" -eq 6 ] && ! printf '%s' "$OUT" | grep -q 'merged and verified\|IS MERGED'; } \
|
|
101
|
+
&& ok "L9 merge queued / not completed → rc=6, reported as NOT verified" || { bad "L9 queued merge rc=$RC"; printf '%s\n' "$OUT" | tail -3; }
|
|
102
|
+
|
|
103
|
+
printf 'PASS %d · FAIL %d\n' "$PASS" "$FAIL"
|
|
104
|
+
[ "$FAIL" -eq 0 ]
|
|
@@ -47,7 +47,18 @@ command -v python3 >/dev/null 2>&1 || { echo "❌ HARNESS-ERROR — python3 miss
|
|
|
47
47
|
# this file's own header reserves for exactly this ("harness error (setup failed, not a verdict)").
|
|
48
48
|
# 🟥 This does NOT decide whether probes.md should ship. That is an operator call and is untouched;
|
|
49
49
|
# what changes is only that the non-answer stops rendering as a verdict.
|
|
50
|
-
|
|
50
|
+
# 🟢 2026-09-29: in an INSTALLED package (no .git at the root) the missing probes.md no longer kills the
|
|
51
|
+
# whole suite — the scorer-only lanes (score-pair · reason-pair · majority · blackout · control-b ·
|
|
52
|
+
# advisory) need neither probes.md nor a checkout, so they run; the lanes that read the real probe
|
|
53
|
+
# files (select-guard · dead-pointer · dry-run · fail-fast · evidence) are skipped BY NAME and
|
|
54
|
+
# counted. In a checkout the same absence is still exit 10 — there it means a broken tree.
|
|
55
|
+
NOPROBES=0
|
|
56
|
+
if [ ! -f "$PROBES_MD" ]; then
|
|
57
|
+
if [ ! -e "$REPO_ROOT/.git" ]; then NOPROBES=1
|
|
58
|
+
else echo "❌ HARNESS-ERROR — $PROBES_MD missing (not shipped in the npm package; the select/dry-run lanes need the hub repo)"; exit 10; fi
|
|
59
|
+
fi
|
|
60
|
+
SKIPPED_BLOCKS=""
|
|
61
|
+
_skipblock() { printf ' ⏭️ SKIP (PASS 아님 · 설치된 패키지 — probes.md 미출하) — %s\n' "$1"; SKIPPED_BLOCKS="$SKIPPED_BLOCKS [$1]"; }
|
|
51
62
|
[ -f "$PROBES_LIVE" ] || { echo "❌ HARNESS-ERROR — $PROBES_LIVE missing"; exit 10; }
|
|
52
63
|
|
|
53
64
|
T="$(mktemp -d)" || { echo "❌ HARNESS-ERROR — mktemp failed"; exit 10; }
|
|
@@ -186,6 +197,7 @@ out="$(_reason_row "$RROOT4" X4)"
|
|
|
186
197
|
_lane RF4 reason-pair "control — a PASS row carries no reason (field is FAILED-TO-RUN-only)" \
|
|
187
198
|
"PASS " "$out"
|
|
188
199
|
|
|
200
|
+
if [ "$NOPROBES" -eq 1 ]; then _skipblock "select-guard · dead-pointer · dry-run · fail-fast (read the real probes.md)"; else
|
|
189
201
|
# ── select-guard: mechanical rule reproduces the real 12/21 split ──────────────────────────────
|
|
190
202
|
echo ""
|
|
191
203
|
echo "── select-guard ──────────────────────────────────────────────────"
|
|
@@ -452,6 +464,7 @@ else
|
|
|
452
464
|
fi
|
|
453
465
|
|
|
454
466
|
|
|
467
|
+
fi
|
|
455
468
|
echo "── majority over reps (2026-09-06) ───────────────────────────────"
|
|
456
469
|
# WHY THESE LANES EXIST. Until 2026-09-06 the scorer read only `*_r1.txt`, so a probe's verdict was
|
|
457
470
|
# one sample. Re-scoring three real run artifacts then found 5 of 12 probes FLAKY — two runs 15
|
|
@@ -629,6 +642,7 @@ _lane AD1 advisory "advisory_re is recorded in reason and does not change the ve
|
|
|
629
642
|
"PASS|advisory[deep-clarify] 3/3" "$r"
|
|
630
643
|
|
|
631
644
|
echo ""
|
|
645
|
+
if [ "$NOPROBES" -eq 1 ]; then _skipblock "evidence preservation EV1-EV8 (runner --ids needs probes.md)"; else
|
|
632
646
|
echo "── evidence preservation (2026-09-14) ────────────────────────────"
|
|
633
647
|
# WHY. Every run's response bodies went into a mktemp and died with it, so 2026-09-12 (pass_rate
|
|
634
648
|
# 0.18) and 2026-09-13 (every probe 0/3) are PERMANENTLY unattributable — model blip, rate limit,
|
|
@@ -708,9 +722,11 @@ LIVE_EV="$REPO_ROOT/tracks/_meta/live_eval_runs"
|
|
|
708
722
|
_lane EV8 evidence "control — the LIVE evidence dir was not written by these lanes" \
|
|
709
723
|
"$LIVE_EV_BEFORE" "$([ -d "$LIVE_EV" ] && find "$LIVE_EV" -mindepth 1 -maxdepth 1 | wc -l | tr -d ' ' || echo ABSENT)"
|
|
710
724
|
|
|
725
|
+
fi
|
|
711
726
|
echo ""
|
|
712
727
|
echo "── summary ──────────────────────────────────────────────────────"
|
|
713
728
|
echo "lanes: $N failed: $([ "$FAIL" -eq 0 ] && echo 0 || echo '>=1')"
|
|
729
|
+
[ -n "$SKIPPED_BLOCKS" ] && echo "skipped (installed package, not a pass):$SKIPPED_BLOCKS"
|
|
714
730
|
if [ "$FAIL" -ne 0 ]; then
|
|
715
731
|
echo "RESULT: REGRESSION"
|
|
716
732
|
exit 1
|
|
@@ -16,6 +16,11 @@ T=$(mktemp -d); trap 'rm -rf "$T"' EXIT
|
|
|
16
16
|
pass=0; fail=0
|
|
17
17
|
ok(){ printf ' ✅ %s\n' "$1"; pass=$((pass+1)); }
|
|
18
18
|
no(){ printf ' ❌ %s\n' "$1"; fail=$((fail+1)); }
|
|
19
|
+
# 패키지 모드(.git 없음 = 설치된 npm 트리)에서만: 의도적으로 미출하한 round/ 계기나 git 트리를 전제하는
|
|
20
|
+
# 레인을 **이름 붙여** 건너뛴다 — PASS 로 세지 않는다. 체크아웃에서는 같은 부재가 여전히 ❌ 다.
|
|
21
|
+
_pkg(){ [ ! -e "$ROOT/.git" ]; }
|
|
22
|
+
skipped=0
|
|
23
|
+
sk(){ printf ' ⏭️ SKIP (PASS 아님 · 패키지 모드) — %s\n' "$1"; skipped=$((skipped+1)); }
|
|
19
24
|
[ -f "$S" ] || { echo "❌ HARNESS-ERROR — 채점기 없음: $S"; exit 10; }
|
|
20
25
|
|
|
21
26
|
# 🟥 미끼 토큰은 조립한다 — 리터럴로 적으면 그 순간 tracked 코퍼스에 들어가고,
|
|
@@ -354,6 +359,7 @@ if [ -x "$_NLK" ] && [ -f "$_GK" ] && [ -f "$_QK" ] && [ -f "$_SK" ]; then
|
|
|
354
359
|
bash "$_GK" "$_QK" "$_SK" post '' '' 'w12345678' 'w87654321' >/dev/null 2>&1
|
|
355
360
|
[ "$?" = 5 ] && ok "L25d 검사기 부재 → 실패(스킵 아님)" || no "L25d 부재를 스킵으로 접는다"
|
|
356
361
|
mv "$_mv" "$_NLK"; chmod +x "$_NLK"
|
|
362
|
+
elif _pkg && [ ! -f "$_GK" ]; then sk "L25a~d — 게이트 scripts/round/gatecheck_qset.sh 는 의도적 미출하(ACCEPTED_ABSENT)"
|
|
357
363
|
else no "L25 픽스처 없음 — 검사 못 함(스킵 아님)"; fi
|
|
358
364
|
|
|
359
365
|
# ── L25e 🟥 nameleak_check 를 «직접» 부른다 — L25a~d 는 게이트를 통한 간접 호출뿐이라
|
|
@@ -393,6 +399,7 @@ if [ -x "$ROOT/scripts/round/fallback_reach_probe.sh" ]; then
|
|
|
393
399
|
bash "$ROOT/scripts/round/fallback_reach_probe.sh" >/dev/null 2>&1 \
|
|
394
400
|
&& ok "L27 폴백이 실제로 탄다 (깨진 토큰 3종)" \
|
|
395
401
|
|| no "L27 폴백 미도달 — 폴백은 장식이고 48 바는 «인쇄»다"
|
|
402
|
+
elif _pkg; then sk "L27 — scripts/round/fallback_reach_probe.sh 는 의도적 미출하(ACCEPTED_ABSENT)"
|
|
396
403
|
else no "L27 프로브 없음 — 검사 못 함(스킵 아님)"; fi
|
|
397
404
|
|
|
398
405
|
# ── L28 🟥 «처치 둘을 곱했을 때» — deliver 분기가 누적된 $q 를 버리면 안 된다 ───
|
|
@@ -449,5 +456,5 @@ printf 'q1\tpositive\t질문P\tcontext_continuity\t\t\n' > "$T/q6c.tsv"
|
|
|
449
456
|
O=$(run29 "$T/q6c.tsv" "$T/o"); rc=$?
|
|
450
457
|
[ "$rc" = 5 ] && ok "L29d 6열 qset 의 tracked 토큰 → 오염 차단(5)" || no "L29d 6열 qset 에서 오염 게이트가 눈을 감는다 [rc=$rc]"
|
|
451
458
|
|
|
452
|
-
echo "verdict watermark lanes: $pass passed, $fail failed"
|
|
459
|
+
echo "verdict watermark lanes: $pass passed, $fail failed$( [ "$skipped" -gt 0 ] && printf ', %s skipped (package mode — not a pass)' "$skipped")"
|
|
453
460
|
[ "$fail" -eq 0 ] || exit 1
|
|
@@ -561,6 +561,18 @@ else
|
|
|
561
561
|
GATE_MODE="lightweight"
|
|
562
562
|
fi
|
|
563
563
|
|
|
564
|
+
# ── Main-commit guard (2026-09-29) — FH assets never land on main/master by a local commit ──
|
|
565
|
+
# Placed HERE, after the «no FH asset → exit 0» return, on purpose: the scope is FH assets only;
|
|
566
|
+
# a companion-store or non-FH commit must not reach it. Detail + override: scripts/main_commit_guard.sh
|
|
567
|
+
MCG="$REPO_ROOT/scripts/main_commit_guard.sh"
|
|
568
|
+
if [ -f "$MCG" ]; then
|
|
569
|
+
if ! EVIDENCE_ROOT="$EVIDENCE_ROOT" MAIN_GUARD_BRANCH="$BRANCH" bash "$MCG"; then
|
|
570
|
+
FAILED=1
|
|
571
|
+
fi
|
|
572
|
+
else
|
|
573
|
+
echo " ⚠️ main-commit guard NOT INSTALLED (scripts/main_commit_guard.sh) — skipped, not passed"
|
|
574
|
+
fi
|
|
575
|
+
|
|
564
576
|
# TOCTOU 완화: 앞선 branch-claim check 이후 게이트들이 도는 동안 peer 가 브랜치를 옮길 수
|
|
565
577
|
# 있다. 최종 판정 직전에 한 번 더 돌려 창을 좁힌다. (원자적 close 는 reference-transaction
|
|
566
578
|
# 훅의 몫 — 이건 완화이지 해결이 아니다.)
|