@chrono-meta/fh-gate 3.29.0 → 3.30.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/AGENTS.md +7 -2
- package/knowledge/shared/harness-core/claude_md_gate_details.md +1 -1
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +105 -0
- package/package.json +2 -1
- package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/CHANGELOG.md +19 -0
- package/plugins/fh-meta/skills/phantom-quench/SKILL.md +1 -1
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/mapped_tracks.sh +20 -13
- package/scripts/memory_gc_report.py +55 -5
- package/scripts/pr_merge_verified.sh +56 -8
- package/scripts/selfcheck.sh +2 -0
- package/scripts/session_checklist.py +3 -2
- package/scripts/session_close_check.sh +1 -1
- package/scripts/sim_isolated_run.sh +62 -0
- package/scripts/stale_ref_scan.py +47 -3
- package/scripts/test_hook_source_gate_lanes.sh +16 -2
- package/scripts/test_mapped_tracks_lanes.sh +55 -1
- package/scripts/test_memory_gc_report_lanes.sh +91 -1
- package/scripts/test_mutation_probe_lanes.sh +18 -2
- package/scripts/test_pr_merge_verified_lanes.sh +48 -1
- package/scripts/test_prepush_real_fire_lanes.sh +215 -0
- package/scripts/test_session_checklist_lanes.sh +34 -0
- package/scripts/test_sim_isolated_run_lanes.sh +88 -0
- package/scripts/test_stale_ref_scan_lanes.sh +11 -1
- package/templates/.git-hooks/pre-push +82 -1
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_prepush_real_fire_lanes.sh — does git ACTUALLY run the pre-push hook, with the ref lines its header claims,
|
|
3
|
+
# for every destructive push the header says it covers? And does the remote stay untouched when it blocks?
|
|
4
|
+
#
|
|
5
|
+
# ── WHY THIS FILE EXISTS ─────────────────────────────────────────────────────────────────────────
|
|
6
|
+
# templates/.git-hooks/pre-push claims (header, «honest scope») to cover: remote branch deletion · tag / notes ref
|
|
7
|
+
# deletion · force / non-fast-forward push · implicit deletes from `git push --mirror` / `--prune`.
|
|
8
|
+
# scripts/test_prepush_destructive_lanes.sh anchors the hook's VERDICT by printing synthetic ref lines into its stdin.
|
|
9
|
+
# Nothing measured the other half: that git invokes the hook for each of those operations and hands it those lines.
|
|
10
|
+
# A sibling harness lost 366 protected files to exactly that gap (2026-10-23, reported back to this hub): a guard's header said
|
|
11
|
+
# «only this hook sees fast-forward merges», and a scratch-repo count showed the hook fired 0 times on
|
|
12
|
+
# `git merge --ff-only`. A claim about WHEN a hook fires is a claim about git, and only running git measures it.
|
|
13
|
+
#
|
|
14
|
+
# Each lane runs a real `git push` from a clone (core.hooksPath → a wrapper that counts calls and records stdin, then
|
|
15
|
+
# execs the real hook) to a real bare remote, and asserts three things: the hook fired, its stdin carried the ref line
|
|
16
|
+
# the claim depends on, and the remote ref is unchanged after the block. L0 is the control: with no hook wired, the
|
|
17
|
+
# same delete succeeds — so «remote unchanged» is something these lanes can see fail.
|
|
18
|
+
#
|
|
19
|
+
# Usage: bash scripts/test_prepush_real_fire_lanes.sh → exit 0 all lanes hold · 1 a lane failed · 2 setup failed
|
|
20
|
+
set -uo pipefail
|
|
21
|
+
. "$(dirname "${BASH_SOURCE[0]}")/fixture_guard_lib.sh" # 픽스처는 실레포에 쓰지 않는다
|
|
22
|
+
|
|
23
|
+
REPO_ROOT="${FH_TEST_SUBJECT_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"
|
|
24
|
+
HOOK_SRC="$REPO_ROOT/templates/.git-hooks/pre-push"
|
|
25
|
+
DEF_SRC="$REPO_ROOT/.claude/rules/.public-surface-patterns.defaults"
|
|
26
|
+
[ -f "$HOOK_SRC" ] || { echo "HARNESS_ERROR — pre-push hook not found at $HOOK_SRC (subject absent; NOT a pass)"; exit 2; }
|
|
27
|
+
|
|
28
|
+
WORK="$(fh_fixture_root "$(mktemp -d)")" || exit 2
|
|
29
|
+
: "${WORK:?fixture root unset — refusing to run git in cwd}"
|
|
30
|
+
trap 'rm -rf "$WORK"' EXIT
|
|
31
|
+
PASSED=0; FAILED=0
|
|
32
|
+
ok() { PASSED=$((PASSED + 1)); echo " ✅ $1"; }
|
|
33
|
+
bad() { FAILED=$((FAILED + 1)); echo " ❌ $1"; }
|
|
34
|
+
|
|
35
|
+
# ── fixture: bare remote with main · feat · old (merged into main) · uniq (one commit off main) · tag v1 · notes ─────
|
|
36
|
+
# The hook allows deleting a fully merged branch by design (pre-push «SAFE: fully merged … allowed») and holds one
|
|
37
|
+
# with unique work — so the delete lanes target `uniq`, and deleting `old` is a known-negative (fires, passes).
|
|
38
|
+
setup() { # $1 = name; wires the hook unless $2 = nohook
|
|
39
|
+
local d="$WORK/$1"
|
|
40
|
+
mkdir -p "$d" || return 1
|
|
41
|
+
git init -q --bare "$d/remote.git" || return 1
|
|
42
|
+
git -C "$d/remote.git" symbolic-ref HEAD refs/heads/main || return 1
|
|
43
|
+
mkdir -p "$d/seed" && (
|
|
44
|
+
cd "$d/seed" || exit 1
|
|
45
|
+
git init -q && git symbolic-ref HEAD refs/heads/main && git config user.email t@example.com && git config user.name t || exit 1
|
|
46
|
+
printf 'base\n' > a.txt && git add a.txt && git commit -qm base || exit 1
|
|
47
|
+
git branch old && git branch feat && git tag v1 || exit 1
|
|
48
|
+
git notes add -m n HEAD || exit 1
|
|
49
|
+
git switch -q -c uniq && printf 'u\n' > u.txt && git add u.txt && git commit -qm uniq && git switch -q main || exit 1
|
|
50
|
+
git switch -q feat && printf 'f1\n' > f.txt && git add f.txt && git commit -qm f1 || exit 1
|
|
51
|
+
git push -q "$d/remote.git" main old feat uniq v1 refs/notes/commits 2>/dev/null || exit 1
|
|
52
|
+
) || return 1
|
|
53
|
+
git clone -q "$d/remote.git" "$d/clone" 2>/dev/null || return 1
|
|
54
|
+
(
|
|
55
|
+
cd "$d/clone" || exit 1
|
|
56
|
+
git config user.email t@example.com && git config user.name t || exit 1
|
|
57
|
+
git fetch -q origin 'refs/notes/*:refs/notes/*' 'refs/tags/*:refs/tags/*' || exit 1
|
|
58
|
+
git branch -q --track feat origin/feat 2>/dev/null; git branch -q --track old origin/old 2>/dev/null; git branch -q --track uniq origin/uniq 2>/dev/null; true
|
|
59
|
+
) || return 1
|
|
60
|
+
if [ "${2:-}" != nohook ]; then
|
|
61
|
+
mkdir -p "$d/clone/.claude/rules" "$d/clone/scripts" "$d/hooks" || return 1
|
|
62
|
+
[ -f "$DEF_SRC" ] && cp "$DEF_SRC" "$d/clone/.claude/rules/.public-surface-patterns.defaults"
|
|
63
|
+
[ -f "$REPO_ROOT/scripts/psa_scan_lib.sh" ] && cp "$REPO_ROOT/scripts/psa_scan_lib.sh" "$d/clone/scripts/psa_scan_lib.sh"
|
|
64
|
+
cp "$HOOK_SRC" "$d/hooks/pre-push.real" || return 1
|
|
65
|
+
# wrapper: count the call, keep a copy of stdin, then hand the same bytes to the real hook
|
|
66
|
+
cat > "$d/hooks/pre-push" <<EOF
|
|
67
|
+
#!/usr/bin/env bash
|
|
68
|
+
echo x >> "$d/fired"
|
|
69
|
+
tee "$d/stdin.\$(wc -l < "$d/fired" | tr -d ' ')" | bash "$d/hooks/pre-push.real" "\$@"
|
|
70
|
+
exit \${PIPESTATUS[1]}
|
|
71
|
+
EOF
|
|
72
|
+
chmod +x "$d/hooks/pre-push" || return 1
|
|
73
|
+
git -C "$d/clone" config core.hooksPath "$d/hooks" || return 1
|
|
74
|
+
fi
|
|
75
|
+
: > "$d/fired"
|
|
76
|
+
printf '%s' "$d"
|
|
77
|
+
}
|
|
78
|
+
remote_ref() { git -C "$1/remote.git" rev-parse -q --verify "$2" 2>/dev/null || echo ABSENT; }
|
|
79
|
+
fired() { wc -l < "$1/fired" | tr -d ' '; }
|
|
80
|
+
stdin_has() { cat "$1"/stdin.* 2>/dev/null | grep -qE "$2"; }
|
|
81
|
+
|
|
82
|
+
# run_lane <name> <ref-to-watch> <stdin-regex> <push args...>
|
|
83
|
+
run_lane() {
|
|
84
|
+
local name="$1" ref="$2" rx="$3"; shift 3
|
|
85
|
+
local d; d=$(setup "$name") || { echo " ⛔ SETUP FAILED ($name) — HARNESS_ERROR, not a pass"; exit 2; }
|
|
86
|
+
local before; before=$(remote_ref "$d" "$ref")
|
|
87
|
+
[ "$before" = ABSENT ] && { echo " ⛔ SETUP: $ref missing on the remote before the lane ($name)"; exit 2; }
|
|
88
|
+
( cd "$d/clone" && env -u DESTRUCTIVE_OP_OK -u MAIN_PUSH_OK git push "$@" >/dev/null 2>&1 ); local rc=$?
|
|
89
|
+
local after; after=$(remote_ref "$d" "$ref")
|
|
90
|
+
local f; f=$(fired "$d")
|
|
91
|
+
if [ "$f" -ge 1 ] && stdin_has "$d" "$rx" && [ "$rc" -ne 0 ] && [ "$after" = "$before" ]; then
|
|
92
|
+
ok "$name — hook fired ${f}× · stdin carried the claimed ref line · push refused · $ref unchanged"
|
|
93
|
+
else
|
|
94
|
+
bad "$name — fired=$f stdin_match=$(stdin_has "$d" "$rx" && echo yes || echo no) push_rc=$rc $ref: $before → $after"
|
|
95
|
+
fi
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
ZERO40='0{40}'
|
|
99
|
+
echo "pre-push real-fire lanes (subject: $HOOK_SRC)"
|
|
100
|
+
|
|
101
|
+
# L0 control — no hook wired: the same remote delete goes through. Without this, «remote unchanged» could be a property
|
|
102
|
+
# of the fixture (e.g. a push that never reached the remote) rather than of the hook.
|
|
103
|
+
d0=$(setup L0 nohook) || { echo " ⛔ SETUP FAILED (L0)"; exit 2; }
|
|
104
|
+
( cd "$d0/clone" && git push origin --delete old >/dev/null 2>&1 )
|
|
105
|
+
[ "$(remote_ref "$d0" refs/heads/old)" = ABSENT ] && ok "L0 control — no hook: the delete reaches the remote (the lanes can see a real change)" \
|
|
106
|
+
|| bad "L0 control — without a hook the delete did NOT land: the fixture cannot show a hook's effect"
|
|
107
|
+
|
|
108
|
+
# L1 known-negative — an ordinary fast-forward push of a feature branch fires the hook and is NOT refused
|
|
109
|
+
d1=$(setup L1) || { echo " ⛔ SETUP FAILED (L1)"; exit 2; }
|
|
110
|
+
before1=$(remote_ref "$d1" refs/heads/feat)
|
|
111
|
+
( cd "$d1/clone" && git switch -q feat && printf 'f2\n' >> f.txt && git commit -qam f2 && env -u DESTRUCTIVE_OP_OK git push -q origin feat >/dev/null 2>&1 ); rc1=$?
|
|
112
|
+
if [ "$(fired "$d1")" -ge 1 ] && [ "$rc1" -eq 0 ] && [ "$(remote_ref "$d1" refs/heads/feat)" != "$before1" ]; then
|
|
113
|
+
ok "L1 known-negative — fast-forward feature push: hook fired, push accepted, remote advanced"
|
|
114
|
+
else
|
|
115
|
+
bad "L1 known-negative — fired=$(fired "$d1") rc=$rc1 (a plain ff push must pass; otherwise every block below is uninformative)"
|
|
116
|
+
fi
|
|
117
|
+
|
|
118
|
+
# L2b known-negative — deleting a FULLY MERGED branch fires the hook and is allowed (by design: nothing unique is lost)
|
|
119
|
+
d2b=$(setup L2b) || { echo " ⛔ SETUP FAILED (L2b)"; exit 2; }
|
|
120
|
+
( cd "$d2b/clone" && env -u DESTRUCTIVE_OP_OK git push origin --delete old >/dev/null 2>&1 ); rc2b=$?
|
|
121
|
+
if [ "$(fired "$d2b")" -ge 1 ] && stdin_has "$d2b" "^\(delete\) ${ZERO40} refs/heads/old " && [ "$rc2b" -eq 0 ] && [ "$(remote_ref "$d2b" refs/heads/old)" = ABSENT ]; then
|
|
122
|
+
ok "L2b known-negative — merged branch delete: hook fired with the (delete) line and allowed it (SAFE)"
|
|
123
|
+
else
|
|
124
|
+
bad "L2b known-negative — fired=$(fired "$d2b") rc=$rc2b (a fully merged delete is allowed by design)"
|
|
125
|
+
fi
|
|
126
|
+
run_lane "L2 unmerged branch delete (--delete)" refs/heads/uniq "^\(delete\) ${ZERO40} refs/heads/uniq " origin --delete uniq
|
|
127
|
+
run_lane "L3 unmerged branch delete (:ref)" refs/heads/uniq "^\(delete\) ${ZERO40} refs/heads/uniq " origin :uniq
|
|
128
|
+
run_lane "L4 tag delete" refs/tags/v1 "^\(delete\) ${ZERO40} refs/tags/v1 " origin :refs/tags/v1
|
|
129
|
+
run_lane "L5 notes ref delete" refs/notes/commits "^\(delete\) ${ZERO40} refs/notes/commits " origin :refs/notes/commits
|
|
130
|
+
|
|
131
|
+
# L6 force / non-fast-forward: rewrite feat locally, then force-push
|
|
132
|
+
d6=$(setup L6) || { echo " ⛔ SETUP FAILED (L6)"; exit 2; }
|
|
133
|
+
before6=$(remote_ref "$d6" refs/heads/feat)
|
|
134
|
+
( cd "$d6/clone" && git switch -q feat && git reset -q --hard HEAD~1 && printf 'rewritten\n' > r.txt && git add r.txt && git commit -qm rewrite \
|
|
135
|
+
&& env -u DESTRUCTIVE_OP_OK git push -f origin feat >/dev/null 2>&1 ); rc6=$?
|
|
136
|
+
if [ "$(fired "$d6")" -ge 1 ] && stdin_has "$d6" "^refs/heads/feat [0-9a-f]{40} refs/heads/feat ${before6}" && [ "$rc6" -ne 0 ] && [ "$(remote_ref "$d6" refs/heads/feat)" = "$before6" ]; then
|
|
137
|
+
ok "L6 force push — hook fired · stdin carried the old remote tip · refused · feat unchanged"
|
|
138
|
+
else
|
|
139
|
+
bad "L6 force push — fired=$(fired "$d6") rc=$rc6 feat: $before6 → $(remote_ref "$d6" refs/heads/feat)"
|
|
140
|
+
fi
|
|
141
|
+
|
|
142
|
+
# L7 --prune: a branch deleted locally disappears on the remote through a refspec push with --prune
|
|
143
|
+
d7=$(setup L7) || { echo " ⛔ SETUP FAILED (L7)"; exit 2; }
|
|
144
|
+
before7=$(remote_ref "$d7" refs/heads/uniq)
|
|
145
|
+
( cd "$d7/clone" && git branch -q -D uniq && env -u DESTRUCTIVE_OP_OK git push --prune origin 'refs/heads/*:refs/heads/*' >/dev/null 2>&1 ); rc7=$?
|
|
146
|
+
if [ "$(fired "$d7")" -ge 1 ] && stdin_has "$d7" "^\(delete\) ${ZERO40} refs/heads/uniq " && [ "$rc7" -ne 0 ] && [ "$(remote_ref "$d7" refs/heads/uniq)" = "$before7" ]; then
|
|
147
|
+
ok "L7 --prune — the implicit delete reached the hook as a (delete) line · refused · uniq unchanged"
|
|
148
|
+
else
|
|
149
|
+
bad "L7 --prune — fired=$(fired "$d7") rc=$rc7 uniq: $before7 → $(remote_ref "$d7" refs/heads/uniq)"
|
|
150
|
+
fi
|
|
151
|
+
|
|
152
|
+
# L8 --mirror: a mirror push from a clone missing `uniq` locally would delete it on the remote
|
|
153
|
+
d8=$(setup L8) || { echo " ⛔ SETUP FAILED (L8)"; exit 2; }
|
|
154
|
+
before8=$(remote_ref "$d8" refs/heads/uniq)
|
|
155
|
+
( cd "$d8/clone" && git branch -q -D uniq && git update-ref -d refs/remotes/origin/uniq && env -u DESTRUCTIVE_OP_OK git push --mirror origin >"$d8/push.out" 2>&1 ); rc8=$?
|
|
156
|
+
if [ "$(fired "$d8")" -ge 1 ] && [ "$rc8" -ne 0 ] && [ "$(remote_ref "$d8" refs/heads/uniq)" = "$before8" ] \
|
|
157
|
+
&& grep -q "refs/heads/uniq — REVIEW" "$d8/push.out"; then # the refusal must be the uniq verdict, not any refusal (cross-family R1)
|
|
158
|
+
ok "L8 --mirror — hook fired · refused · uniq unchanged (stdin carried: $(cat "$d8"/stdin.* 2>/dev/null | awk '{print $1" "$3}' | paste -sd',' - | cut -c1-120))"
|
|
159
|
+
else
|
|
160
|
+
bad "L8 --mirror — fired=$(fired "$d8") rc=$rc8 uniq: $before8 → $(remote_ref "$d8" refs/heads/uniq)" ; echo " stdin the hook got:"; sed "s/^/ /" "$d8"/stdin.* 2>/dev/null; echo " push output (tail):"; tail -12 "$d8/push.out" | sed "s/^/ /"
|
|
161
|
+
fi
|
|
162
|
+
|
|
163
|
+
# L8-ctl — no hook: the same mirror push really deletes `uniq` (so L8's «unchanged» is the hook's doing)
|
|
164
|
+
d8x=$(setup L8x nohook) || { echo " ⛔ SETUP FAILED (L8x)"; exit 2; }
|
|
165
|
+
( cd "$d8x/clone" && git branch -q -D uniq && git update-ref -d refs/remotes/origin/uniq && git push --mirror origin >/dev/null 2>&1 )
|
|
166
|
+
[ "$(remote_ref "$d8x" refs/heads/uniq)" = ABSENT ] && ok "L8-ctl — no hook: the mirror push deletes uniq on the remote" \
|
|
167
|
+
|| bad "L8-ctl — without a hook the mirror push did NOT delete uniq: L8 cannot show the hook's effect"
|
|
168
|
+
|
|
169
|
+
# L8d — abbreviated option: git accepts `--mir` for --mirror
|
|
170
|
+
d8d=$(setup L8d) || { echo " ⛔ SETUP FAILED (L8d)"; exit 2; }
|
|
171
|
+
before8d=$(remote_ref "$d8d" refs/heads/uniq)
|
|
172
|
+
( cd "$d8d/clone" && git branch -q -D uniq && git update-ref -d refs/remotes/origin/uniq && env -u DESTRUCTIVE_OP_OK git push --mir origin >"$d8d/push.out" 2>&1 ); rc8d=$?
|
|
173
|
+
if [ "$rc8d" -ne 0 ] && [ "$(remote_ref "$d8d" refs/heads/uniq)" = "$before8d" ] && grep -q "refs/heads/uniq — REVIEW" "$d8d/push.out"; then
|
|
174
|
+
ok "L8d --mir (abbreviation) — detected as a mirror push · uniq held"
|
|
175
|
+
else
|
|
176
|
+
bad "L8d --mir — rc=$rc8d uniq: $before8d → $(remote_ref "$d8d" refs/heads/uniq)"; tail -6 "$d8d/push.out" | sed 's/^/ /'
|
|
177
|
+
fi
|
|
178
|
+
|
|
179
|
+
# L8e — git itself refuses `--no-mirror <refspec>` when remote.<name>.mirror is set (measured: «--mirror can't be combined
|
|
180
|
+
# with refspecs»), so the hook does not treat --no-mirror as overriding the config. This lane pins git's refusal: if a
|
|
181
|
+
# future git accepts it, the hook's «config ⇒ mirror» rule needs revisiting and this lane goes red to say so.
|
|
182
|
+
d8e=$(setup L8e) || { echo " ⛔ SETUP FAILED (L8e)"; exit 2; }
|
|
183
|
+
( cd "$d8e/clone" && { git config remote.origin.mirror true && git switch -q feat && printf 'f3\n' >> f.txt && git commit -qam f3 \
|
|
184
|
+
&& env -u DESTRUCTIVE_OP_OK git push --no-mirror origin feat; } >"$d8e/push.out" 2>&1 ); rc8e=$?
|
|
185
|
+
if [ "$rc8e" -ne 0 ] && grep -q "can't be combined with refspecs" "$d8e/push.out" && [ "$(fired "$d8e")" -eq 0 ]; then
|
|
186
|
+
ok "L8e git refuses --no-mirror <refspec> under a mirror config (before any hook runs) — config ⇒ mirror stays safe"
|
|
187
|
+
else
|
|
188
|
+
bad "L8e git's behaviour changed — rc=$rc8e fired=$(fired "$d8e"): revisit the hook's config ⇒ mirror rule"; tail -4 "$d8e/push.out" | sed 's/^/ /'
|
|
189
|
+
fi
|
|
190
|
+
|
|
191
|
+
# L8b known-negative — a mirror push that deletes nothing (every remote branch/tag/note exists locally) is not refused
|
|
192
|
+
d8b=$(setup L8b) || { echo " ⛔ SETUP FAILED (L8b)"; exit 2; }
|
|
193
|
+
( cd "$d8b/clone" && env -u DESTRUCTIVE_OP_OK git push --mirror origin >"$d8b/push.out" 2>&1 ); rc8b=$?
|
|
194
|
+
if [ "$(fired "$d8b")" -ge 1 ] && [ "$rc8b" -eq 0 ] && [ "$(remote_ref "$d8b" refs/heads/uniq)" != ABSENT ]; then
|
|
195
|
+
ok "L8b known-negative — mirror push with nothing to delete: hook fired, push accepted"
|
|
196
|
+
else
|
|
197
|
+
bad "L8b known-negative — fired=$(fired "$d8b") rc=$rc8b (a mirror push that deletes nothing must pass)"; tail -8 "$d8b/push.out" | sed 's/^/ /'
|
|
198
|
+
fi
|
|
199
|
+
|
|
200
|
+
# L8c — mirror by CONFIG (remote.origin.mirror=true, plain `git push`): no --mirror on any command line
|
|
201
|
+
d8c=$(setup L8c) || { echo " ⛔ SETUP FAILED (L8c)"; exit 2; }
|
|
202
|
+
before8c=$(remote_ref "$d8c" refs/heads/uniq)
|
|
203
|
+
( cd "$d8c/clone" && git config remote.origin.mirror true && git branch -q -D uniq && git update-ref -d refs/remotes/origin/uniq \
|
|
204
|
+
&& env -u DESTRUCTIVE_OP_OK git push origin >"$d8c/push.out" 2>&1 ); rc8c=$?
|
|
205
|
+
if [ "$(fired "$d8c")" -ge 1 ] && [ "$rc8c" -ne 0 ] && [ "$(remote_ref "$d8c" refs/heads/uniq)" = "$before8c" ] \
|
|
206
|
+
&& grep -q "refs/heads/uniq — REVIEW" "$d8c/push.out"; then
|
|
207
|
+
ok "L8c mirror by config — hook fired · refused · uniq unchanged"
|
|
208
|
+
else
|
|
209
|
+
bad "L8c mirror by config — fired=$(fired "$d8c") rc=$rc8c uniq: $before8c → $(remote_ref "$d8c" refs/heads/uniq)"; tail -8 "$d8c/push.out" | sed 's/^/ /'
|
|
210
|
+
fi
|
|
211
|
+
# Not measured here (named): a mirror push whose `git ls-remote` fails while the push itself would work — the hook
|
|
212
|
+
# blocks it (MIRROR_UNREADABLE), but no fixture makes ls-remote fail without also failing the push.
|
|
213
|
+
|
|
214
|
+
echo "── pre-push real-fire: $PASSED passed, $FAILED failed ──"
|
|
215
|
+
[ "$FAILED" -eq 0 ]
|
|
@@ -905,6 +905,40 @@ for L in L46 L47 L47b L48 L48b L49 L50 L51; do
|
|
|
905
905
|
esac
|
|
906
906
|
done
|
|
907
907
|
|
|
908
|
+
# L52 — `unblocked` on a sheet with an empty 상태 cell must not crash (TypeError: None in keys, 2026-10-23)
|
|
909
|
+
L52_FILE="$TMPDIR_ROOT/l52.md"
|
|
910
|
+
{
|
|
911
|
+
echo "| # | 시각 | 발화(요지) | 상태 | 증거 | 사유 / 남은 것 | 제안 |"
|
|
912
|
+
echo "|---|---|---|---|---|---|---|"
|
|
913
|
+
echo "| A1 | 10-01 09:00 | first | ✅DONE | e | - | - |"
|
|
914
|
+
echo "| A2 | 10-01 09:01 | second, blocked on A1 | ⏳IN-PROGRESS | e | A1 선행 | next |"
|
|
915
|
+
echo "| A3 | 10-01 09:02 | never filled | | | | |"
|
|
916
|
+
} >"$L52_FILE"
|
|
917
|
+
run "$TMPDIR_ROOT/l52.out" unblocked --file "$L52_FILE"
|
|
918
|
+
if [ "$RC" -eq 1 ] && grep -q "A2 is still open, but its blocker A1 reads DONE" "$TMPDIR_ROOT/l52.out" \
|
|
919
|
+
&& ! grep -q "Traceback" "$TMPDIR_ROOT/l52.out"; then
|
|
920
|
+
pass "L52 unblocked survives an empty 상태 cell and still reports the real finding"
|
|
921
|
+
else
|
|
922
|
+
fail "L52 unblocked rc=$RC (want 1, finding A2/A1, no Traceback) — $(tail -2 "$TMPDIR_ROOT/l52.out" | tr '\n' ' ')"
|
|
923
|
+
fi
|
|
924
|
+
|
|
925
|
+
# L52b — an N/A row whose blocker reads DONE is closed, not «still open» (the key is "N/A"; a "n/a" compare never matched)
|
|
926
|
+
L52B_FILE="$TMPDIR_ROOT/l52b.md"
|
|
927
|
+
{
|
|
928
|
+
echo "| # | 시각 | 발화(요지) | 상태 | 증거 | 사유 / 남은 것 | 제안 |"
|
|
929
|
+
echo "|---|---|---|---|---|---|---|"
|
|
930
|
+
echo "| A1 | 10-01 09:00 | first | ✅DONE | e | - | - |"
|
|
931
|
+
echo "| A2 | 10-01 09:01 | second, blocked on A1 | ⏳IN-PROGRESS | e | A1 선행 | next |"
|
|
932
|
+
echo "| A3 | 10-01 09:02 | dropped, blocked on A1 | N/A | e | A1 선행 — 범위 밖 | - |"
|
|
933
|
+
} >"$L52B_FILE"
|
|
934
|
+
run "$TMPDIR_ROOT/l52b.out" unblocked --file "$L52B_FILE"
|
|
935
|
+
if [ "$RC" -eq 1 ] && grep -q "A2 is still open, but its blocker A1 reads DONE" "$TMPDIR_ROOT/l52b.out" \
|
|
936
|
+
&& ! grep -q "A3 is still open" "$TMPDIR_ROOT/l52b.out"; then
|
|
937
|
+
pass "L52b unblocked treats an N/A row as closed (A2 reported, A3 not)"
|
|
938
|
+
else
|
|
939
|
+
fail "L52b unblocked rc=$RC (want 1, A2 reported, A3 silent) — $(tail -3 "$TMPDIR_ROOT/l52b.out" | tr '\n' ' ')"
|
|
940
|
+
fi
|
|
941
|
+
|
|
908
942
|
echo "── $PASS_COUNT passed, $FAIL_COUNT failed ──"
|
|
909
943
|
|
|
910
944
|
if [ "$FAIL_COUNT" -gt 0 ]; then
|
|
@@ -574,5 +574,93 @@ printf 'rc\t0\nended_at_cap\tno\n' > "$WORKROOT/o_b29f/a_r1.meta.tsv"
|
|
|
574
574
|
&& ok "L29f clone failure on a reused --out leaves no stale ended_at_cap=no behind" \
|
|
575
575
|
|| no "L29f stale meta survived (clone-fail seen: $(grep -c 'BASE CLONE FAILED' "$WORKROOT/o_b29f.log"))"
|
|
576
576
|
|
|
577
|
+
# L30 (2026-10-23) — an --out under instruction files refuses BEFORE any arm runs; the logged override proceeds.
|
|
578
|
+
# Known pair: same runner, same stub, the only difference is a CLAUDE.md in an ancestor of --out.
|
|
579
|
+
INH="$WORKROOT/inherit_parent"; mkdir -p "$INH"; printf '# parent instructions\n' > "$INH/CLAUDE.md"
|
|
580
|
+
LOG30="$WORKROOT/argv30.log"; : > "$LOG30"
|
|
581
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG30" \
|
|
582
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$INH/o30" ) >"$WORKROOT/o30.log" 2>&1; RC30=$?
|
|
583
|
+
{ [ "$RC30" = 2 ] && grep -q "REFUSED: --out" "$WORKROOT/o30.log" && grep -q "inherit_parent/CLAUDE.md" "$WORKROOT/o30.log" && [ ! -s "$LOG30" ]; } \
|
|
584
|
+
&& ok "L30a --out under a CLAUDE.md ancestor → rc 2 · REFUSED names the file · no arm invoked" \
|
|
585
|
+
|| no "L30a inherited instructions not refused (rc=$RC30 · argv lines=$(wc -l < "$LOG30" | tr -d ' '))"
|
|
586
|
+
LOG30b="$WORKROOT/argv30b.log"; : > "$LOG30b"
|
|
587
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG30b" FH_SIM_ALLOW_INHERIT=1 \
|
|
588
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$INH/o30b" ) >"$WORKROOT/o30b.log" 2>&1
|
|
589
|
+
{ grep -q "FH_SIM_ALLOW_INHERIT=1 — arms WILL inherit" "$WORKROOT/o30b.log" && [ -s "$LOG30b" ]; } \
|
|
590
|
+
&& ok "L30b FH_SIM_ALLOW_INHERIT=1 → printed warning, the arm runs" \
|
|
591
|
+
|| no "L30b override did not proceed visibly (argv lines=$(wc -l < "$LOG30b" | tr -d ' '))"
|
|
592
|
+
rm -rf "$INH"
|
|
593
|
+
# L30c known-NEGATIVE — a parent with only a bare .git (no instruction file) is NOT refused (codex R1: over-block)
|
|
594
|
+
mkdir -p "$WORKROOT/bare_git_parent/.git"; LOG30c="$WORKROOT/argv30c.log"; : > "$LOG30c"
|
|
595
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG30c" \
|
|
596
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$WORKROOT/bare_git_parent/o" ) >"$WORKROOT/o30c.log" 2>&1
|
|
597
|
+
{ ! grep -q "REFUSED" "$WORKROOT/o30c.log" && [ -s "$LOG30c" ]; } \
|
|
598
|
+
&& ok "L30c bare .git parent, no instruction file → not refused, the arm runs" \
|
|
599
|
+
|| no "L30c a bare .git parent was refused or the arm did not run"
|
|
600
|
+
# L30d ancestor .claude/rules/*.md counts as an instruction source (codex R1)
|
|
601
|
+
mkdir -p "$WORKROOT/rules_parent/.claude/rules"; printf 'x\n' > "$WORKROOT/rules_parent/.claude/rules/r.md"
|
|
602
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say \
|
|
603
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$WORKROOT/rules_parent/o" ) >"$WORKROOT/o30d.log" 2>&1; RC30d=$?
|
|
604
|
+
{ [ "$RC30d" = 2 ] && grep -q "rules_parent/.claude/rules/" "$WORKROOT/o30d.log"; } \
|
|
605
|
+
&& ok "L30d ancestor .claude/rules/*.md → refused (rc 2, names the rules dir)" \
|
|
606
|
+
|| no "L30d ancestor rules not refused (rc=$RC30d)"
|
|
607
|
+
# L30e a reused --out whose rep wrapper already holds a CLAUDE.md → refused at the rep (codex R1)
|
|
608
|
+
mkdir -p "$WORKROOT/o30e/w_a_r1"; printf 'x\n' > "$WORKROOT/o30e/w_a_r1/CLAUDE.md"; LOG30e="$WORKROOT/argv30e.log"; : > "$LOG30e"
|
|
609
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG30e" \
|
|
610
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$WORKROOT/o30e" ) >"$WORKROOT/o30e.log" 2>&1; RC30e=$?
|
|
611
|
+
{ [ "$RC30e" = 2 ] && grep -q "REFUSED: rep wrapper" "$WORKROOT/o30e.log" && [ ! -s "$LOG30e" ]; } \
|
|
612
|
+
&& ok "L30e pre-existing w_a_r1/CLAUDE.md → refused at the rep, no arm invoked" \
|
|
613
|
+
|| no "L30e pre-existing wrapper instructions slipped through (rc=$RC30e · argv lines=$(wc -l < "$LOG30e" | tr -d ' '))"
|
|
614
|
+
# L30f an unresolvable --out stops at once (Gemini R1: empty path looped on dirname "")
|
|
615
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say \
|
|
616
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "/dev/null/x" ) >"$WORKROOT/o30f.log" 2>&1; RC30f=$?
|
|
617
|
+
[ "$RC30f" = 2 ] && ok "L30f unresolvable --out → rc 2, no hang" || no "L30f unresolvable --out rc=$RC30f"
|
|
618
|
+
rm -rf "$WORKROOT/bare_git_parent" "$WORKROOT/rules_parent" "$WORKROOT/o30e"
|
|
619
|
+
# L30g symlinked rules dir in an ancestor still counts (codex R2) · L30h GEMINI.md alone is not a Claude source (codex R2)
|
|
620
|
+
mkdir -p "$WORKROOT/sym_parent/.claude/rules" "$WORKROOT/sym_parent/shared-rules"; printf 'x\n' > "$WORKROOT/sym_parent/shared-rules/policy.md"
|
|
621
|
+
ln -s ../../shared-rules "$WORKROOT/sym_parent/.claude/rules/shared"
|
|
622
|
+
LOG30g="$WORKROOT/argv30g.log"; : > "$LOG30g"
|
|
623
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG30g" \
|
|
624
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$WORKROOT/sym_parent/o" ) >"$WORKROOT/o30g.log" 2>&1; RC30g=$?
|
|
625
|
+
{ [ "$RC30g" = 2 ] && grep -q "sym_parent/.claude/rules/" "$WORKROOT/o30g.log" && [ ! -s "$LOG30g" ]; } \
|
|
626
|
+
&& ok "L30g symlinked ancestor rules dir → refused (rc 2, names the rules dir, no arm invoked)" \
|
|
627
|
+
|| no "L30g symlinked rules slipped through (rc=$RC30g · argv lines=$(wc -l < "$LOG30g" | tr -d ' '))"
|
|
628
|
+
mkdir -p "$WORKROOT/gem_parent"; printf 'x\n' > "$WORKROOT/gem_parent/GEMINI.md"; LOG30h="$WORKROOT/argv30h.log"; : > "$LOG30h"
|
|
629
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG30h" \
|
|
630
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$WORKROOT/gem_parent/o" ) >"$WORKROOT/o30h.log" 2>&1
|
|
631
|
+
{ ! grep -q REFUSED "$WORKROOT/o30h.log" && [ -s "$LOG30h" ]; } && ok "L30h GEMINI.md-only parent → not refused, the arm runs" || no "L30h GEMINI.md over-blocked"
|
|
632
|
+
rm -rf "$WORKROOT/sym_parent" "$WORKROOT/gem_parent"
|
|
633
|
+
# L30i an ancestor with only .claude/AGENTS.md is an instruction source (Gemini R3)
|
|
634
|
+
mkdir -p "$WORKROOT/cagents_parent/.claude"; printf 'x\n' > "$WORKROOT/cagents_parent/.claude/AGENTS.md"; LOG30i="$WORKROOT/argv30i.log"; : > "$LOG30i"
|
|
635
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG30i" \
|
|
636
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$WORKROOT/cagents_parent/o" ) >"$WORKROOT/o30i.log" 2>&1; RC30i=$?
|
|
637
|
+
{ [ "$RC30i" = 2 ] && grep -q "cagents_parent/.claude/AGENTS.md" "$WORKROOT/o30i.log" && [ ! -s "$LOG30i" ]; } \
|
|
638
|
+
&& ok "L30i ancestor .claude/AGENTS.md only → refused (rc 2, names it, no arm invoked)" \
|
|
639
|
+
|| no "L30i .claude/AGENTS.md not refused (rc=$RC30i · argv lines=$(wc -l < "$LOG30i" | tr -d ' '))"
|
|
640
|
+
rm -rf "$WORKROOT/cagents_parent"
|
|
641
|
+
# L30j the user config dir is not an ancestor hit: HOME with ~/.claude/CLAUDE.md + --out under HOME → not refused,
|
|
642
|
+
# the informational user-level line prints once (CLAUDE_CONFIG_DIR unset). L30k known-positive: a plain ~/CLAUDE.md still refuses.
|
|
643
|
+
mkdir -p "$FAKEHOME/.claude" "$FAKEHOME/clean"; printf 'user\n' > "$FAKEHOME/.claude/CLAUDE.md"; LOG30j="$WORKROOT/argv30j.log"; : > "$LOG30j"
|
|
644
|
+
( cd "$SRC" && env -u CLAUDE_CONFIG_DIR PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG30j" \
|
|
645
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$FAKEHOME/clean/o" ) >"$WORKROOT/o30j.log" 2>&1
|
|
646
|
+
{ ! grep -q REFUSED "$WORKROOT/o30j.log" && [ -s "$LOG30j" ] && [ "$(grep -c 'user-level instructions load' "$WORKROOT/o30j.log")" = 1 ]; } \
|
|
647
|
+
&& ok "L30j HOME/.claude/CLAUDE.md + --out under HOME → not refused, arm runs, user-level line printed once" \
|
|
648
|
+
|| no "L30j user config dir over-blocked or info line wrong (argv lines=$(wc -l < "$LOG30j" | tr -d ' ') · info=$(grep -c 'user-level instructions load' "$WORKROOT/o30j.log"))"
|
|
649
|
+
printf 'plain\n' > "$FAKEHOME/CLAUDE.md"; LOG30k="$WORKROOT/argv30k.log"; : > "$LOG30k"
|
|
650
|
+
( cd "$SRC" && env -u CLAUDE_CONFIG_DIR PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG30k" \
|
|
651
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$FAKEHOME/clean/o2" ) >"$WORKROOT/o30k.log" 2>&1; RC30k=$?
|
|
652
|
+
{ [ "$RC30k" = 2 ] && grep -q "home/CLAUDE.md" "$WORKROOT/o30k.log" && [ ! -s "$LOG30k" ]; } \
|
|
653
|
+
&& ok "L30k plain HOME/CLAUDE.md → refused (rc 2, names it, no arm invoked)" \
|
|
654
|
+
|| no "L30k plain HOME CLAUDE.md slipped through (rc=$RC30k · argv lines=$(wc -l < "$LOG30k" | tr -d ' '))"
|
|
655
|
+
rm -rf "$FAKEHOME/CLAUDE.md" "$FAKEHOME/.claude" "$FAKEHOME/clean"
|
|
656
|
+
# L30l override with --reps 2: the inherit warning prints once, not per rep
|
|
657
|
+
mkdir -p "$WORKROOT/inh2"; printf 'x\n' > "$WORKROOT/inh2/CLAUDE.md"
|
|
658
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_SIM_ALLOW_INHERIT=1 \
|
|
659
|
+
bash "$SUT" --arm a --reps 2 --prompt p --out "$WORKROOT/inh2/o" ) >"$WORKROOT/o30l.log" 2>&1
|
|
660
|
+
[ "$(grep -c 'arms WILL inherit' "$WORKROOT/o30l.log")" = 1 ] \
|
|
661
|
+
&& ok "L30l FH_SIM_ALLOW_INHERIT=1 --reps 2 → inherit warning exactly once" \
|
|
662
|
+
|| no "L30l inherit warning count=$(grep -c 'arms WILL inherit' "$WORKROOT/o30l.log")"
|
|
663
|
+
rm -rf "$WORKROOT/inh2"
|
|
664
|
+
|
|
577
665
|
echo "sim_isolated_run lanes: $pass passed, $fail failed"
|
|
578
666
|
[ "$fail" -eq 0 ] || exit 1
|
|
@@ -62,7 +62,7 @@ run () { python3 scripts/stale_ref_scan.py --offline-fixture "$TMP/fx.json" --bo
|
|
|
62
62
|
# ── L1 자기검사가 실제로 돈다 ─────────────────────────────────────────────────
|
|
63
63
|
python3 scripts/stale_ref_scan.py --self-check > "$TMP/sc" 2>&1; rc=$?
|
|
64
64
|
n_pass=$(/usr/bin/grep -c '^ PASS' "$TMP/sc" || true)
|
|
65
|
-
if [ "$rc" = "0" ] && [ "$n_pass" -ge
|
|
65
|
+
if [ "$rc" = "0" ] && [ "$n_pass" -ge 25 ]; then ok "L1 --self-check rc=0 · PASS 레인 $n_pass (>=25)"
|
|
66
66
|
else ng "L1 --self-check rc=$rc · PASS $n_pass"; fi
|
|
67
67
|
|
|
68
68
|
# ── L2 known-POSITIVE: <wbr> 분할 DOI 가 SUPERSEDED 로 잡힌다 ─────────────────
|
|
@@ -92,6 +92,13 @@ rc=$(run "$TMP/d.html")
|
|
|
92
92
|
if [ "$rc" = "0" ] && /usr/bin/grep -q 'CHANGELOG-EXCLUDED=1' "$TMP/out"; then ok "L5 pin 마커 → rc=0"
|
|
93
93
|
else ng "L5 rc=$rc — pin 이 안 먹는다"; fi
|
|
94
94
|
|
|
95
|
+
# ── L5b 줄 pin — 그 줄만 제외, 같은 파일의 다른 낡은 인용은 그대로 잡힌다 ─────────────
|
|
96
|
+
printf 'v1 paper 10.5281/zenodo.20397566 old name <!-- stale-ref: pinned-line=20397566 -->\nlater cite 10.5281/zenodo.20397566 again\n' > "$TMP/d2.md"
|
|
97
|
+
rc=$(run "$TMP/d2.md")
|
|
98
|
+
if [ "$rc" = "1" ] && /usr/bin/grep -q 'SUPERSEDED=1' "$TMP/out" && /usr/bin/grep -q 'CHANGELOG-EXCLUDED=1' "$TMP/out"; then
|
|
99
|
+
ok "L5b 줄 pin → 같은 id 의 고정 줄은 제외 · 고정 안 된 줄은 SUPERSEDED 1 rc=1 (main 의 id 묶음 통과)"
|
|
100
|
+
else ng "L5b rc=$rc · $(/usr/bin/grep -o 'SUPERSEDED=[0-9]* .*CHANGELOG-EXCLUDED=[0-9]*' "$TMP/out" | head -1)"; fi
|
|
101
|
+
|
|
95
102
|
# ── L6 🟥 못 읽은 입력은 UNSCANNABLE + rc=10 (적대검증 S-1) ───────────────────
|
|
96
103
|
printf '%%PDF-1.4\000\000binary\n' > "$TMP/e.pdf"
|
|
97
104
|
rc=$(run "$TMP/e.pdf")
|
|
@@ -123,6 +130,9 @@ PYX
|
|
|
123
130
|
}
|
|
124
131
|
probe "L8 scan_body 죽이기" " return sites" " return []"
|
|
125
132
|
probe "L9 rc 지배 제거" " if unresolved or unscannable:" " if False:"
|
|
133
|
+
probe "L10b 줄 pin 제거" "in_changelog or m.group(1) in line_pinned))" "in_changelog))"
|
|
134
|
+
probe "L10d 줄 pin 이 id 를 안 가림" "in_changelog or m.group(1) in line_pinned))" "in_changelog or bool(line_pinned)))"
|
|
135
|
+
probe "L10c 파일 pin 접두 일치" 'pinned(?=\s|-->)", re.IGNORECASE)' 'pinned", re.IGNORECASE)'
|
|
126
136
|
probe "L10 바이너리 검사 제거" ' if b"\x00" in raw:' " if False:"
|
|
127
137
|
|
|
128
138
|
# 원본 불변 확인 — 프로브가 대상을 건드리지 않았나
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
# • tag / notes ref deletion (git push origin :refs/tags/vX)
|
|
9
9
|
# • FORCE / non-fast-forward push (history rewrite — git push -f)
|
|
10
10
|
# • implicit deletes from git push --mirror / --prune
|
|
11
|
+
# (--prune: git lists the deletes on stdin. --mirror: git does NOT — measured 2026-10-24, git 2.50.1 — so the
|
|
12
|
+
# hook detects a mirror push and computes the deletes from `git ls-remote`; see the mirror block below.)
|
|
13
|
+
# Each line above is measured by a REAL push in scripts/test_prepush_real_fire_lanes.sh (hook fired · stdin line ·
|
|
14
|
+
# remote unchanged), not only by synthetic stdin in test_prepush_destructive_lanes.sh.
|
|
11
15
|
#
|
|
12
16
|
# What it is and is NOT (honest scope):
|
|
13
17
|
# • It closes the **honest-weak-model** gap: an agent that simply *forgot* the prose
|
|
@@ -333,6 +337,75 @@ while read -r local_ref local_sha remote_ref remote_sha; do
|
|
|
333
337
|
# remote_sha == ZERO → creating a new branch (not destructive) → ignore
|
|
334
338
|
done
|
|
335
339
|
|
|
340
|
+
# ── `git push --mirror` deletes refs WITHOUT telling this hook (2026-10-24, sibling-harness report) ──────────────
|
|
341
|
+
# Measured with git 2.50.1 (scripts/test_prepush_real_fire_lanes.sh L8): a mirror push deleted an unmerged remote
|
|
342
|
+
# branch and the stdin above carried NO `(delete)` line for it — only the refs the push creates. The header's claim
|
|
343
|
+
# «covers implicit deletes from --mirror» was a statement about git that no lane had run, and it was false.
|
|
344
|
+
# So when the push is a mirror push, compute the deletions here: every remote ref that does not exist locally is
|
|
345
|
+
# deleted by it. They join the same lists the verdict below already judges (merged branch = SAFE, unique work =
|
|
346
|
+
# held, tags/notes = held). Cannot read the remote's refs → cannot classify → block (irreversible surface).
|
|
347
|
+
# Mirror detection: `remote.<name>.mirror` config, or `--mirror` on the `git push` command line of an ancestor
|
|
348
|
+
# process (the hook may sit behind a wrapper, so walk up to 4 levels). Named residual: with `ps` unavailable and no
|
|
349
|
+
# mirror config, a mirror push is not detected — server-side branch protection stays the hard floor (header).
|
|
350
|
+
# Second named residual (cross-family R1): `ls-remote` reads the upload-pack advertisement; a server that hides refs
|
|
351
|
+
# from upload-pack (uploadpack.hideRefs) but not from receive-pack can omit a ref the mirror deletes. Same hard floor.
|
|
352
|
+
MIRROR_UNREADABLE=""
|
|
353
|
+
_fh_cfg=0
|
|
354
|
+
[ "$(git config --bool "remote.${PUSH_REMOTE}.mirror" 2>/dev/null)" = true ] && _fh_cfg=1
|
|
355
|
+
# A mirror config makes the push a mirror push (git refuses `--no-mirror <refspec>` against it — measured: «--mirror
|
|
356
|
+
# can't be combined with refspecs» — so the config is not overridden here; fail-closed). The command line is read from the
|
|
357
|
+
# nearest ancestor whose EXECUTABLE is git (the hook may sit behind a wrapper; an unrelated shell whose text merely
|
|
358
|
+
# contains «push --mirror» is not git and is skipped — cross-family R1). argv is split without globbing (read -a).
|
|
359
|
+
# git accepts unambiguous abbreviations, so every prefix of --mirror down to --mi counts (cross-family R1: `--mir`).
|
|
360
|
+
_fh_cli=""
|
|
361
|
+
_fh_pid=$PPID
|
|
362
|
+
for _fh_i in 1 2 3 4 5; do
|
|
363
|
+
case "${_fh_pid:-}" in ''|0|1) break ;; esac
|
|
364
|
+
_fh_comm=$(ps -o comm= -p "$_fh_pid" 2>/dev/null) || break
|
|
365
|
+
case "${_fh_comm##*/}" in
|
|
366
|
+
git|git-push)
|
|
367
|
+
_fh_args=$(ps -o args= -p "$_fh_pid" 2>/dev/null) || break
|
|
368
|
+
read -r -a _fh_av <<< "$_fh_args"
|
|
369
|
+
for _fh_w in "${_fh_av[@]}"; do
|
|
370
|
+
case "$_fh_w" in
|
|
371
|
+
--mi|--mir|--mirr|--mirro|--mirror|--mirror=*) _fh_cli=mirror ;;
|
|
372
|
+
esac
|
|
373
|
+
done
|
|
374
|
+
break ;;
|
|
375
|
+
esac
|
|
376
|
+
_fh_pid=$(ps -o ppid= -p "$_fh_pid" 2>/dev/null | tr -d ' ')
|
|
377
|
+
done
|
|
378
|
+
case "$_fh_cli" in mirror) _fh_mirror=1 ;; *) _fh_mirror=$_fh_cfg ;; esac
|
|
379
|
+
if [ "$_fh_mirror" = 1 ]; then
|
|
380
|
+
# bounded and non-interactive (cross-family R1): a stalled transport or an auth prompt must end as «unreadable» → block
|
|
381
|
+
# The deadline covers the whole transport process group (cross-family R2: `alarm; exec` killed git but an ssh/helper
|
|
382
|
+
# child holding stdout kept a $(...) waiting past it). Output goes to a file, not a command substitution.
|
|
383
|
+
_fh_lr_out=$(mktemp "${TMPDIR:-/tmp}/fh-mirror-lsr.XXXXXX") || _fh_lr_out=""
|
|
384
|
+
if [ -n "$_fh_lr_out" ]; then
|
|
385
|
+
GIT_TERMINAL_PROMPT=0 GIT_ASKPASS=/usr/bin/false perl -e '
|
|
386
|
+
my $p = fork; die "fork" unless defined $p;
|
|
387
|
+
if (!$p) { setpgrp(0, 0); exec @ARGV; exit 127 }
|
|
388
|
+
$SIG{ALRM} = sub { kill "KILL", -$p; exit 124 };
|
|
389
|
+
alarm 30; waitpid($p, 0); exit($? >> 8)' git ls-remote "${2:-$PUSH_REMOTE}" >"$_fh_lr_out" 2>/dev/null; _fh_rc=$?
|
|
390
|
+
_fh_remote_refs=$(cat "$_fh_lr_out" 2>/dev/null); rm -f "$_fh_lr_out"
|
|
391
|
+
else
|
|
392
|
+
_fh_rc=1
|
|
393
|
+
fi
|
|
394
|
+
if [ "$_fh_rc" -ne 0 ]; then
|
|
395
|
+
MIRROR_UNREADABLE="${2:-$PUSH_REMOTE}"
|
|
396
|
+
else
|
|
397
|
+
while read -r _fh_sha _fh_ref; do
|
|
398
|
+
case "$_fh_ref" in ''|HEAD|*'^{}') continue ;; esac
|
|
399
|
+
git show-ref --verify -q "$_fh_ref" 2>/dev/null && continue # exists locally → the mirror keeps it
|
|
400
|
+
case " $DEL_BRANCHES $DEL_OTHER " in *"|${_fh_ref} "*|*" ${_fh_ref} "*) continue ;; esac # stdin already named it
|
|
401
|
+
case "$_fh_ref" in
|
|
402
|
+
refs/heads/*) DEL_BRANCHES="$DEL_BRANCHES ${_fh_sha}|${_fh_ref}" ;;
|
|
403
|
+
*) DEL_OTHER="$DEL_OTHER $_fh_ref" ;;
|
|
404
|
+
esac
|
|
405
|
+
done <<< "$_fh_remote_refs"
|
|
406
|
+
fi
|
|
407
|
+
fi
|
|
408
|
+
|
|
336
409
|
# ── Confidentiality at the PUBLISH boundary — instrument completeness + content ───
|
|
337
410
|
# Pattern loading and matching come from scripts/psa_scan_lib.sh, the single implementation shared
|
|
338
411
|
# with pre-commit and the publish scanner. Every confidentiality defect found in the 2026-07-26
|
|
@@ -663,7 +736,7 @@ fi
|
|
|
663
736
|
# push. Running AFTER classification removes the hazard structurally (the refs are already read
|
|
664
737
|
# into variables); the `< /dev/null` guard is kept as defense in depth, not as the fix.
|
|
665
738
|
# Nothing destructive and nothing unclassifiable → ordinary ff push / new branch → allow.
|
|
666
|
-
if [ -z "$DEL_BRANCHES$DEL_OTHER$FORCED_REFS$UNCLASSIFIED" ]; then
|
|
739
|
+
if [ -z "$DEL_BRANCHES$DEL_OTHER$FORCED_REFS$UNCLASSIFIED$MIRROR_UNREADABLE" ]; then
|
|
667
740
|
exit 0
|
|
668
741
|
fi
|
|
669
742
|
|
|
@@ -695,6 +768,14 @@ for r in $FORCED_REFS; do
|
|
|
695
768
|
BLOCK=1
|
|
696
769
|
done
|
|
697
770
|
|
|
771
|
+
# ── Mirror push whose remote refs could not be read: the deletions are unknown → fail-closed ──
|
|
772
|
+
if [ -n "$MIRROR_UNREADABLE" ]; then
|
|
773
|
+
echo " CANNOT CLASSIFY (mirror push, remote refs unreadable): $MIRROR_UNREADABLE"
|
|
774
|
+
echo " → a --mirror push deletes every remote ref missing locally; git does not list those deletes for this hook."
|
|
775
|
+
echo " Make the remote readable (git ls-remote) and re-push, or push explicit refspecs instead of --mirror."
|
|
776
|
+
BLOCK=1
|
|
777
|
+
fi
|
|
778
|
+
|
|
698
779
|
# ── Unclassifiable (remote tip not fetched): fail-closed, accurate message ──
|
|
699
780
|
for r in $UNCLASSIFIED; do
|
|
700
781
|
echo " CANNOT CLASSIFY (remote tip not fetched): $r"
|