@chrono-meta/fh-gate 3.15.0 → 3.17.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 +27 -0
- package/CATALOG.md +60 -0
- package/CLAUDE.md +5 -0
- package/README.ja.md +2 -2
- package/README.ko.md +2 -2
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/docs/OUTPUT_EVIDENCE.md +1 -1
- package/docs/codex-compat.md +24 -0
- package/knowledge/shared/harness-core/checkout_layer_drift.md +301 -0
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +66 -0
- package/package.json +13 -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 +42 -0
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-preprep/skills/preprep/SKILL.md +5 -0
- package/plugins/fh-preprep/skills/preprep/lane_font_embed.py +235 -0
- package/plugins/fh-preprep/skills/preprep/ooxml/gate.py +67 -5
- package/plugins/fh-preprep/skills/preprep/ooxml/test_gate_exitcodes.py +136 -0
- package/plugins/fh-preprep/skills/preprep/preprep.py +16 -1
- package/plugins/fh-preprep/skills/preprep/presentation_checklist.md +108 -6
- package/plugins/fh-preprep/skills/preprep/safe_install.py +22 -3
- package/plugins/fh-preprep/skills/preprep/surfaces.example.yaml +11 -0
- package/plugins/fh-preprep/skills/preprep/test_lane_font_embed.py +117 -0
- package/plugins/fh-preprep/skills/preprep/test_safe_install_app_xml.py +77 -0
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/count_check.sh +46 -14
- package/scripts/daily_report.sh +17 -1
- package/scripts/env_layer_fingerprint.sh +309 -0
- package/scripts/gate_bootstrap_ephemeral.sh +248 -0
- package/scripts/governor_board.sh +841 -0
- package/scripts/map_postprocess.py +89 -4
- package/scripts/multibyte_bracket_lint.sh +135 -0
- package/scripts/outbound_pr_gate.sh +12 -0
- package/scripts/package_coverage_check.sh +34 -0
- package/scripts/selfcheck.sh +263 -0
- package/scripts/session_close_check.sh +96 -1
- package/scripts/stale_ref_scan.py +511 -0
- package/scripts/test_count_check_decl_lanes.sh +176 -0
- package/scripts/test_env_layer_fingerprint_lanes.sh +192 -0
- package/scripts/test_gate_bootstrap_ephemeral_lanes.sh +262 -0
- package/scripts/test_locale_invariance_lanes.sh +581 -0
- package/scripts/test_map_postprocess_lanes.sh +84 -4
- package/scripts/test_marker_crossfamily_lanes.sh +5 -1
- package/scripts/test_marker_defense_lanes.sh +5 -1
- package/scripts/test_marker_standpoint_lanes.sh +5 -1
- package/scripts/test_marker_thirdparty_lanes.sh +5 -1
- package/scripts/test_multibyte_bracket_lint_lanes.sh +107 -0
- package/scripts/test_outbound_pr_gate_lanes.sh +133 -0
- package/scripts/test_preprep_drift_anchor.sh +34 -9
- package/scripts/test_preprep_drift_anchor_lanes.sh +64 -2
- package/scripts/test_session_close_chain_lanes.sh +45 -0
- package/scripts/test_stale_ref_close_lanes.sh +197 -0
- package/scripts/test_stale_ref_scan_lanes.sh +134 -0
- package/scripts/test_worktree_reclaim_lanes.sh +267 -1
- package/scripts/worktree_reclaim.sh +246 -11
- package/templates/.git-hooks/pre-commit +108 -27
- package/templates/settings.PreToolUse.snippet.json +54 -1
|
@@ -280,6 +280,51 @@ _gap "①-b gh ERROR is silent (indistinguishable from zero PRs)" "$_g" \
|
|
|
280
280
|
The sweep 'not run' and the sweep 'found nothing' look identical. Advisory surface, so not \
|
|
281
281
|
fail-closed — but it should print 'sweep UNAVAILABLE' rather than nothing."
|
|
282
282
|
|
|
283
|
+
# AUTHOR UNION. `--author "@me"` resolves to the LOCAL user; a PR opened by a cloud session is
|
|
284
|
+
# authored by the GitHub App `app/claude`, so a sweep filtered on "@me" alone reports 0 while
|
|
285
|
+
# cloud PRs are open — and the close then passes as "no open PRs". Measured 2026-09-21 on this
|
|
286
|
+
# repo with a known pair over MERGED PRs (the open set was empty that day, so the 0-case could
|
|
287
|
+
# not calibrate it): `--author app/claude` returned #785 #784 #783 #782 #781 and `--author @me`
|
|
288
|
+
# returned #779 #773 #772 ... — DISJOINT sets. These two lanes are the known pair for the fix.
|
|
289
|
+
_ghstub_author() { # $1=repo $2=json for @me $3=json for app/claude
|
|
290
|
+
mkdir -p "$1/bin"
|
|
291
|
+
{
|
|
292
|
+
printf '%s\n' '#!/usr/bin/env bash'
|
|
293
|
+
printf '%s\n' '_a=""'
|
|
294
|
+
printf '%s\n' 'while [ $# -gt 0 ]; do case "$1" in --author) _a="$2"; shift 2 ;; *) shift ;; esac; done'
|
|
295
|
+
printf '%s\n' 'case "$_a" in'
|
|
296
|
+
printf ' "@me") printf %s%s%s "%s" ;;\n' "'" '%s\n' "'" "$2"
|
|
297
|
+
printf ' "app/claude") printf %s%s%s "%s" ;;\n' "'" '%s\n' "'" "$3"
|
|
298
|
+
printf '%s\n' ' *) printf "[]\n" ;;'
|
|
299
|
+
printf '%s\n' 'esac'
|
|
300
|
+
printf '%s\n' 'exit 0'
|
|
301
|
+
} > "$1/bin/gh"
|
|
302
|
+
chmod +x "$1/bin/gh"
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
# known-POSITIVE: the cloud-only case the old line was blind to. Pre-fix this printed NOTHING.
|
|
306
|
+
T=$(_repo b_bot); _artifacts "$T"
|
|
307
|
+
_ghstub_author "$T" '[]' '[{\"number\":782},{\"number\":785}]'
|
|
308
|
+
_run_with_gh "$T"
|
|
309
|
+
_line "①-b-P4 cloud-only PRs (app/claude) → sweep says 2" '①-b 2 open PR' 1 "$OUT"
|
|
310
|
+
|
|
311
|
+
# OVER-COUNT CONTROL: if the two author filters ever return the SAME PR, the union must dedup by
|
|
312
|
+
# number and say 1 — not 2. A union that concatenates without `sort -u` passes P4 and fails here,
|
|
313
|
+
# which is why the pair is two lanes and not one.
|
|
314
|
+
T=$(_repo b_overlap); _artifacts "$T"
|
|
315
|
+
_ghstub_author "$T" '[{\"number\":777}]' '[{\"number\":777}]'
|
|
316
|
+
_run_with_gh "$T"
|
|
317
|
+
_line "①-b-P5 same PR under both authors → deduped to 1 (over-count control)" '①-b 1 open PR' 1 "$OUT"
|
|
318
|
+
|
|
319
|
+
# JSON SHAPE. `gh` emits compact JSON when piped today, but the extractor must not depend on that:
|
|
320
|
+
# a naive '"number":[0-9]*' matches zero digits on `{"number": 782}` and the count silently becomes
|
|
321
|
+
# 0 — the same fail-open direction (toward "no open PRs") this step exists to close. Known pair:
|
|
322
|
+
# this lane is the spaced body, and ①-b-P3 above is the compact body that must stay green.
|
|
323
|
+
T=$(_repo b_spaced); _artifacts "$T"
|
|
324
|
+
_ghstub_author "$T" '[]' '[{\"number\": 782},{\"number\": 785}]'
|
|
325
|
+
_run_with_gh "$T"
|
|
326
|
+
_line "①-b-P6 pretty-printed JSON (space after colon) → still says 2" '①-b 2 open PR' 1 "$OUT"
|
|
327
|
+
|
|
283
328
|
echo
|
|
284
329
|
echo "══ ④-log real-time completion log (the exit-1 FAIL path) ══"
|
|
285
330
|
# NOTE the label: this is NOT CLAUDE.md's ④ (memory hygiene, deliberately unmechanized — see
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_stale_ref_close_lanes.sh — known pairs + revert probes for the ①-g STALE REF advisory
|
|
3
|
+
# block in `scripts/session_close_check.sh`.
|
|
4
|
+
#
|
|
5
|
+
# WHY THIS EXISTS
|
|
6
|
+
# #770 built `scripts/stale_ref_scan.py` and #773 shipped it with its own residual written down:
|
|
7
|
+
# «배선 안 함 — 이 계기는 지금 아무도 안 부른다». Measured 2026-09-21: its only call sites were
|
|
8
|
+
# its own lane suite and that suite's selfcheck wiring, and BOTH pass `--offline-fixture`. The
|
|
9
|
+
# tool was fully anchored and had never once been pointed at the real corpus. ①-g is that call
|
|
10
|
+
# site. Without these lanes the block can be deleted, or quietly turned into a silent pass, with
|
|
11
|
+
# every gate still green — the decoration class `new_code_anchor_check` exists to catch.
|
|
12
|
+
#
|
|
13
|
+
# SCOPE, stated honestly: these lanes exercise the CALLER CONTRACT — what ①-g does with each
|
|
14
|
+
# verdict shape the scanner can produce (defect · unreadable · no verdict at all · scanner absent)
|
|
15
|
+
# and that it never blocks. The scanner's own verdicts are anchored separately by
|
|
16
|
+
# `scripts/test_stale_ref_scan_lanes.sh`. The block is EXTRACTED from the subject rather than
|
|
17
|
+
# restated here: a restated copy drifts from the thing it claims to verify.
|
|
18
|
+
# 🟥 No network. The subject under test is the caller, so the scanner is a stub whose verdict
|
|
19
|
+
# line is the lane's input — a live scan would make these lanes depend on Zenodo's state.
|
|
20
|
+
set -uo pipefail
|
|
21
|
+
|
|
22
|
+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
23
|
+
cd "$REPO_ROOT" || exit 10
|
|
24
|
+
pass=0; fail=0
|
|
25
|
+
ok() { printf ' \342\234\205 %s\n' "$1"; pass=$((pass+1)); }
|
|
26
|
+
bad() { printf ' \342\235\214 %s\n' "$1"; fail=$((fail+1)); }
|
|
27
|
+
|
|
28
|
+
SUBJECT="$REPO_ROOT/scripts/session_close_check.sh"
|
|
29
|
+
if [ ! -f "$SUBJECT" ]; then
|
|
30
|
+
printf '\360\237\237\245 HARNESS ERROR — session_close_check.sh 가 없다. 「0 실패」가 아니라 계기 부재다.\n'
|
|
31
|
+
exit 10
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
BLOCK=$(awk '/^# ── ①-g STALE REF \(advisory\)/,/^echo "── close check:/' "$SUBJECT" | sed '$d')
|
|
35
|
+
if [ -z "$BLOCK" ] || ! printf '%s' "$BLOCK" | grep -q '_SR_SCAN'; then
|
|
36
|
+
bad "①-g 블록을 subject 에서 못 찾았다 — 못 찾는 것을 검증할 수는 없다"
|
|
37
|
+
echo "----"; echo "stale-ref close lanes: $pass passed, $fail failed"; exit 1
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
if ! command -v git >/dev/null 2>&1; then
|
|
41
|
+
printf '\360\237\237\245 HARNESS ERROR — git 이 없다. 픽스처 트리를 못 만든다(「0 실패」가 아니다).\n'
|
|
42
|
+
exit 10
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
TMP="$(mktemp -d)"; trap 'rm -rf "$TMP"' EXIT
|
|
46
|
+
|
|
47
|
+
# make_tree <stub-body|NOSCAN> — a minimal tracked tree carrying one Zenodo reference
|
|
48
|
+
make_tree() {
|
|
49
|
+
local t; t="$(mktemp -d "$TMP/tree.XXXXXX")"
|
|
50
|
+
( cd "$t" && git init -q . && git config user.email t@t && git config user.name t ) || return 1
|
|
51
|
+
mkdir -p "$t/scripts" "$t/tracks"
|
|
52
|
+
printf 'see 10.5281/zenodo.20397566 for the method\n' > "$t/DOC.md"
|
|
53
|
+
# a tracks/ file that MUST be excluded from the scanned set
|
|
54
|
+
printf 'old record 10.5281/zenodo.11111111\n' > "$t/tracks/old_note.md"
|
|
55
|
+
if [ "$1" != "NOSCAN" ]; then
|
|
56
|
+
printf '%s\n' "$1" > "$t/scripts/stale_ref_scan.py"
|
|
57
|
+
chmod +x "$t/scripts/stale_ref_scan.py"
|
|
58
|
+
fi
|
|
59
|
+
( cd "$t" && git add -A >/dev/null 2>&1 ) || return 1
|
|
60
|
+
printf '%s' "$t"
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
# run_block <tree> [block-override] — echoes the block's output, then a FAIL= line
|
|
64
|
+
run_block() {
|
|
65
|
+
local tree="$1" blk="${2:-$BLOCK}"
|
|
66
|
+
FH="$tree" BLK="$blk" bash -c '
|
|
67
|
+
set -uo pipefail
|
|
68
|
+
FH="$FH"; FAIL=0
|
|
69
|
+
eval "$BLK"
|
|
70
|
+
echo "FAILVAR=$FAIL"
|
|
71
|
+
' 2>&1
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
STUB_HEAD='#!/usr/bin/env python3
|
|
75
|
+
import sys
|
|
76
|
+
print("stale-ref-scan · stub")'
|
|
77
|
+
|
|
78
|
+
stub_with() { # stub_with <verdict-tail> [extra-detail-line]
|
|
79
|
+
printf '%s\n' "$STUB_HEAD"
|
|
80
|
+
[ -n "${2:-}" ] && printf 'print(%s)\n' "\"$2\""
|
|
81
|
+
printf 'print("stale-ref verdict: %s")\n' "$1"
|
|
82
|
+
printf 'sys.exit(1)\n'
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
# ── L0 dead control — an all-clean verdict must produce the ✅ line ───────────
|
|
86
|
+
t=$(make_tree "$(stub_with 'SUPERSEDED=0 UNRESOLVED=0 UNSCANNABLE=0 CONCEPT=1 CURRENT=2 CHANGELOG-EXCLUDED=0 rc=0')")
|
|
87
|
+
out=$(run_block "$t")
|
|
88
|
+
case "$out" in
|
|
89
|
+
*"✅ ①-g"*) ok "L0 dead-control — 깨끗한 판정에서 ✅ 가 난다 (블록이 실제로 돈다)" ;;
|
|
90
|
+
*) bad "L0 dead-control — 깨끗한 판정에서도 ✅ 가 없다. 아래 판정은 무의미하다: $out"
|
|
91
|
+
echo "----"; echo "stale-ref close lanes: $pass passed, $fail failed"; exit 1 ;;
|
|
92
|
+
esac
|
|
93
|
+
|
|
94
|
+
# ── L1 known-POS defect — SUPERSEDED>0 surfaces, and the detail line rides along
|
|
95
|
+
t=$(make_tree "$(stub_with 'SUPERSEDED=2 UNRESOLVED=0 UNSCANNABLE=0 CONCEPT=0 CURRENT=1 CHANGELOG-EXCLUDED=0 rc=1' ' 🟥 SUPERSEDED [20397566] cited ×3 — DOC.md:1')")
|
|
96
|
+
out=$(run_block "$t")
|
|
97
|
+
if printf '%s' "$out" | grep -q '①-g stale-ref: 2 개 id' && printf '%s' "$out" | grep -q 'SUPERSEDED \[20397566\]'; then
|
|
98
|
+
ok "L1 known-POS — 폐기 인용이 개수와 자리까지 표면화된다"
|
|
99
|
+
else
|
|
100
|
+
bad "L1 known-POS — 폐기 인용이 안 나왔다: $out"
|
|
101
|
+
fi
|
|
102
|
+
|
|
103
|
+
# ── L2 advisory — a defect must NOT raise FAIL (reversible surface) ──────────
|
|
104
|
+
case "$out" in
|
|
105
|
+
*"FAILVAR=0"*) ok "L2 advisory — 결함을 찾아도 FAIL 을 안 올린다 (막지 않는다)" ;;
|
|
106
|
+
*) bad "L2 advisory — 결함에서 FAIL 이 올라갔다. 과차단은 --no-verify 를 학습시킨다: $out" ;;
|
|
107
|
+
esac
|
|
108
|
+
|
|
109
|
+
# ── L3 못 읽음 ≠ 깨끗함 — UNRESOLVED>0 must read UNMEASURED, never ✅ ─────────
|
|
110
|
+
t=$(make_tree "$(stub_with 'SUPERSEDED=0 UNRESOLVED=7 UNSCANNABLE=0 CONCEPT=0 CURRENT=0 CHANGELOG-EXCLUDED=0 rc=1')")
|
|
111
|
+
out=$(run_block "$t")
|
|
112
|
+
if printf '%s' "$out" | grep -q 'UNMEASURED' && ! printf '%s' "$out" | grep -q '✅ ①-g'; then
|
|
113
|
+
ok "L3 못 읽음 ≠ 깨끗함 — UNRESOLVED 가 UNMEASURED 로 나오고 ✅ 는 안 난다"
|
|
114
|
+
else
|
|
115
|
+
bad "L3 UNRESOLVED 를 깨끗함으로 읽었다: $out"
|
|
116
|
+
fi
|
|
117
|
+
|
|
118
|
+
# ── L4 계기 오류 — no verdict line at all is UNMEASURED, not silence ─────────
|
|
119
|
+
t=$(make_tree '#!/usr/bin/env python3
|
|
120
|
+
import sys
|
|
121
|
+
sys.stderr.write("boom\n"); sys.exit(2)')
|
|
122
|
+
out=$(run_block "$t")
|
|
123
|
+
if printf '%s' "$out" | grep -q '판정 줄을 안 냈다'; then
|
|
124
|
+
ok "L4 계기 오류 — 판정 줄이 없으면 UNMEASURED 로 말한다 (침묵 아님)"
|
|
125
|
+
else
|
|
126
|
+
bad "L4 판정 줄 부재가 조용히 지나갔다: $out"
|
|
127
|
+
fi
|
|
128
|
+
|
|
129
|
+
# ── L5 부재≠통과 — scanner missing must say skipped-not-passed ───────────────
|
|
130
|
+
t=$(make_tree NOSCAN)
|
|
131
|
+
out=$(run_block "$t")
|
|
132
|
+
if printf '%s' "$out" | grep -q 'skipped, not passed'; then
|
|
133
|
+
ok "L5 계기 부재 — skipped, not passed (UNMEASURED) 로 말한다"
|
|
134
|
+
else
|
|
135
|
+
bad "L5 계기 부재가 통과처럼 지나갔다: $out"
|
|
136
|
+
fi
|
|
137
|
+
|
|
138
|
+
# ── L6 scope — tracks/** must not reach the scanner ──────────────────────────
|
|
139
|
+
# 🟥 The block swallows the scanner's stdout into a variable, so the argv must be observed on
|
|
140
|
+
# a side channel — asserting on stdout here would have measured nothing.
|
|
141
|
+
t=$(make_tree '#!/usr/bin/env python3
|
|
142
|
+
import sys
|
|
143
|
+
args=[a for a in sys.argv[1:] if not a.startswith("-")]
|
|
144
|
+
open("ARGV_SEEN.txt","w").write(",".join(args))
|
|
145
|
+
print("stale-ref verdict: SUPERSEDED=0 UNRESOLVED=0 UNSCANNABLE=0 CONCEPT=0 CURRENT=0 CHANGELOG-EXCLUDED=0 rc=0")
|
|
146
|
+
sys.exit(0)')
|
|
147
|
+
out=$(run_block "$t")
|
|
148
|
+
seen=$(cat "$t/ARGV_SEEN.txt" 2>/dev/null || echo "__NOFILE__")
|
|
149
|
+
if [ "$seen" = "__NOFILE__" ]; then
|
|
150
|
+
bad "L6 HARNESS ERROR — 스텁이 argv 를 안 남겼다. 스코프를 잰 적이 없다"
|
|
151
|
+
elif printf '%s' "$seen" | grep -q 'DOC.md' && ! printf '%s' "$seen" | grep -q 'tracks/'; then
|
|
152
|
+
ok "L6 스코프 — 추적 파일은 넘기고 tracks/** 는 제외한다"
|
|
153
|
+
else
|
|
154
|
+
bad "L6 스코프 — 스캐너가 받은 파일 집합이 틀렸다: $seen"
|
|
155
|
+
fi
|
|
156
|
+
|
|
157
|
+
# ── L7 revert probe: drop the SUPERSEDED branch → L1 must go silent ──────────
|
|
158
|
+
MUT=$(printf '%s' "$BLOCK" | sed 's/if \[ "${_sr_sup:-0}" -gt 0 \] 2>\/dev\/null; then/if false; then/')
|
|
159
|
+
if [ "$MUT" = "$BLOCK" ]; then
|
|
160
|
+
bad "L7 HARNESS ERROR — 뮤턴트 생성 실패 (치환 대상 없음). 「안 빨개졌다」와 구별이 안 된다"
|
|
161
|
+
else
|
|
162
|
+
t=$(make_tree "$(stub_with 'SUPERSEDED=2 UNRESOLVED=0 UNSCANNABLE=0 CONCEPT=0 CURRENT=1 CHANGELOG-EXCLUDED=0 rc=1' ' 🟥 SUPERSEDED [20397566] cited ×3 — DOC.md:1')")
|
|
163
|
+
out=$(run_block "$t" "$MUT")
|
|
164
|
+
if printf '%s' "$out" | grep -q '①-g stale-ref: 2 개 id'; then
|
|
165
|
+
bad "L7 되돌림 — 분기를 죽였는데도 L1 이 초록이다. L1 은 그 분기 덕분이 아닐 수 있다"
|
|
166
|
+
else
|
|
167
|
+
ok "L7 되돌림 — SUPERSEDED 분기를 죽이자 표면화가 사라진다 (앵커가 장식이 아니다)"
|
|
168
|
+
fi
|
|
169
|
+
fi
|
|
170
|
+
|
|
171
|
+
# ── L8 revert probe: treat a missing verdict as clean → L4 must go silent ────
|
|
172
|
+
MUT=$(printf '%s' "$BLOCK" | sed 's/UNMEASURED — 스캐너가 판정 줄을 안 냈다 (0 으로 읽지 마라)/(quiet)/')
|
|
173
|
+
if [ "$MUT" = "$BLOCK" ]; then
|
|
174
|
+
bad "L8 HARNESS ERROR — 뮤턴트 생성 실패 (치환 대상 없음)"
|
|
175
|
+
else
|
|
176
|
+
t=$(make_tree '#!/usr/bin/env python3
|
|
177
|
+
import sys
|
|
178
|
+
sys.exit(2)')
|
|
179
|
+
out=$(run_block "$t" "$MUT")
|
|
180
|
+
if printf '%s' "$out" | grep -q '판정 줄을 안 냈다'; then
|
|
181
|
+
bad "L8 되돌림 — 문구를 지웠는데도 L4 가 초록이다"
|
|
182
|
+
else
|
|
183
|
+
ok "L8 되돌림 — 계기-오류 보고를 지우자 L4 가 침묵한다 (그 줄이 L4 를 지고 있다)"
|
|
184
|
+
fi
|
|
185
|
+
fi
|
|
186
|
+
|
|
187
|
+
# ── L9 containment — the real repo was not touched ───────────────────────────
|
|
188
|
+
# 🟥 초판은 여기서 `git diff --quiet … || true` 를 불렀다 — 항상 참이라 아무것도 안 재는
|
|
189
|
+
# 장식이었다. 실제 단언은 픽스처 위치 하나다.
|
|
190
|
+
case "$TMP" in
|
|
191
|
+
"$REPO_ROOT"*) bad "L9 containment — 픽스처가 실제 레포 안에 있다" ;;
|
|
192
|
+
*) ok "L9 containment — 픽스처는 레포 밖 임시 트리다 (실제 레포 미변경)" ;;
|
|
193
|
+
esac
|
|
194
|
+
|
|
195
|
+
echo "----"
|
|
196
|
+
echo "stale-ref close lanes: $pass passed, $fail failed"
|
|
197
|
+
[ "$fail" -eq 0 ]
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_stale_ref_scan_lanes.sh — known pairs + revert probes for scripts/stale_ref_scan.py
|
|
3
|
+
#
|
|
4
|
+
# WHY THIS SUITE EXISTS AT ALL
|
|
5
|
+
# `new-code-anchor` caught the author's own admission: the scanner shipped with no lane that
|
|
6
|
+
# RUNS it. The commit message said «배선 안 함» and the gate turned that sentence into a red
|
|
7
|
+
# check. 🟥 A `--self-check` inside the tool is not an anchor — nothing on a runner surface
|
|
8
|
+
# executes it, so «a green suite total» would mean «nothing touched this file».
|
|
9
|
+
#
|
|
10
|
+
# WHY LANES ON FIXTURES, NOT ON THE REPO'S OWN PAPERS
|
|
11
|
+
# The three demonstrations the author ran (v1.0.3 · v1.0.4 · CITATION.cff) need the LIVE Zenodo
|
|
12
|
+
# API and drift with every future deposit. Both are disqualifying for a consumer install. So the
|
|
13
|
+
# network arms here go through `--offline-fixture`, and the shapes are copied byte-for-byte from
|
|
14
|
+
# the real corpus (fixture shape from the artifact, not a mental model):
|
|
15
|
+
# · `10.5281/<wbr>zenodo.<wbr>20397566` paper/forge_harness_v1.0.3.html:159
|
|
16
|
+
# · `[Zenodo](https://zenodo.org/records/22542168)` README.md:418 **as of c4b4ffa**
|
|
17
|
+
# 🟥 That README line has since moved to the v1.0.2 id (`22843702`), so the pointer is
|
|
18
|
+
# pinned to a commit rather than to HEAD. The fixture KEEPS the superseded id on
|
|
19
|
+
# purpose — a stale-ref lane needs a stale ref — so this is a provenance note, not a
|
|
20
|
+
# value to sync. The lane is synthetic and stays green either way, which is exactly
|
|
21
|
+
# why the drift would otherwise be silent.
|
|
22
|
+
# · `# forge-harness (fh-meta) Changelog` plugins/fh-meta/CHANGELOG.md:1
|
|
23
|
+
#
|
|
24
|
+
# THE TWO-SIGNALS RULE
|
|
25
|
+
# A 0 is evidence only if the instrument SAW something. L3 asserts the id was extracted AND
|
|
26
|
+
# classified as changelog; L6 asserts a binary body is named UNSCANNABLE rather than silently
|
|
27
|
+
# producing «0 sites», which is exactly the defect the adversarial round measured (S-1).
|
|
28
|
+
#
|
|
29
|
+
# REVERT PROBES (a mechanism is load-bearing only if removing it turns a known pair red)
|
|
30
|
+
# L8 scan_body · L9 rc dominance · L10 binary detection. Each mutates a COPY by source edit,
|
|
31
|
+
# asserts the copy's --self-check goes red, and byte-compares the original before and after.
|
|
32
|
+
# 🟥 Before the 2026-09-20 hardening, mutating scan_body left --self-check at 4/4 PASS.
|
|
33
|
+
#
|
|
34
|
+
# 🟥 PITFALL (this repo's lanes): `out="$(cmd)"` runs in a SUBSHELL, so `rc=$?` after it is the
|
|
35
|
+
# assignment's status. Every lane below redirects to a file and reads `$?` directly.
|
|
36
|
+
set -u
|
|
37
|
+
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
38
|
+
cd "$ROOT" || { printf '🟥 HARNESS ERROR — 레포 루트로 못 갔다\n'; exit 10; }
|
|
39
|
+
SCAN="scripts/stale_ref_scan.py"
|
|
40
|
+
# 🟥 인터프리터도 «리터럴» 이어야 한다 — new_code_anchor_check 의 인보커 정규식이
|
|
41
|
+
# (bash|sh|zsh|python3?|source|.) 리터럴을 요구한다. 변수로 부르면 MENTION_ONLY 로 막힌다(실측 2회).
|
|
42
|
+
# 🟥 **리터럴 경로로 부른다.** 변수 경유 호출은 `new_code_anchor_check.sh` 가 «실행» 으로
|
|
43
|
+
# 못 읽어서 MENTION_ONLY 로 막았다(실측) — 그 게이트가 잡는 것이 바로 «이름만 부르는 레인» 이다.
|
|
44
|
+
PASS=0; FAIL=0
|
|
45
|
+
ok () { printf ' ✅ %s\n' "$1"; PASS=$((PASS+1)); }
|
|
46
|
+
ng () { printf ' ❌ %s\n' "$1"; FAIL=$((FAIL+1)); }
|
|
47
|
+
TMP="$(mktemp -d)"; trap 'rm -rf "$TMP"' EXIT
|
|
48
|
+
|
|
49
|
+
if [ ! -f scripts/stale_ref_scan.py ]; then
|
|
50
|
+
printf '🟥 HARNESS ERROR — scripts/stale_ref_scan.py 가 없다. 「0 실패」가 아니라 계기 부재다.\n'; exit 10
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
# 오프라인 픽스처 — 실물 id 관계를 그대로 옮긴다(라이브 API 직독 2026-09-20)
|
|
54
|
+
cat > "$TMP/fx.json" <<'JSON'
|
|
55
|
+
{ "20397566": {"id": 20397566, "conceptrecid": "20397565"},
|
|
56
|
+
"22843702": {"id": 22843702, "conceptrecid": "20397565"},
|
|
57
|
+
"20397565": {"id": 22843702, "conceptrecid": "20397565"},
|
|
58
|
+
"22542168": {"id": 22542168, "conceptrecid": "20397565"} }
|
|
59
|
+
JSON
|
|
60
|
+
run () { python3 scripts/stale_ref_scan.py --offline-fixture "$TMP/fx.json" --body "$@" > "$TMP/out" 2>&1; echo $?; }
|
|
61
|
+
|
|
62
|
+
# ── L1 자기검사가 실제로 돈다 ─────────────────────────────────────────────────
|
|
63
|
+
python3 scripts/stale_ref_scan.py --self-check > "$TMP/sc" 2>&1; rc=$?
|
|
64
|
+
n_pass=$(/usr/bin/grep -c '^ PASS' "$TMP/sc" || true)
|
|
65
|
+
if [ "$rc" = "0" ] && [ "$n_pass" -ge 17 ]; then ok "L1 --self-check rc=0 · PASS 레인 $n_pass (>=17)"
|
|
66
|
+
else ng "L1 --self-check rc=$rc · PASS $n_pass"; fi
|
|
67
|
+
|
|
68
|
+
# ── L2 known-POSITIVE: <wbr> 분할 DOI 가 SUPERSEDED 로 잡힌다 ─────────────────
|
|
69
|
+
printf '<tr><td>forge-harness</td><td>10.5281/<wbr>zenodo.<wbr>20397566</td></tr>\n' > "$TMP/a.html"
|
|
70
|
+
rc=$(run "$TMP/a.html")
|
|
71
|
+
if [ "$rc" = "1" ] && /usr/bin/grep -q 'SUPERSEDED=1' "$TMP/out"; then ok "L2 <wbr> 분할 DOI → SUPERSEDED rc=1"
|
|
72
|
+
else ng "L2 rc=$rc · $(/usr/bin/grep -o 'SUPERSEDED=[0-9]*' "$TMP/out" | head -1)"; fi
|
|
73
|
+
|
|
74
|
+
# ── L3 changelog 제외 — 🟥 «봤는데 제외했다» 를 같이 단언한다 ─────────────────
|
|
75
|
+
printf '# forge-harness (fh-meta) Changelog\nsee 10.5281/zenodo.20397566 for what was wrong\n' > "$TMP/b.md"
|
|
76
|
+
rc=$(run "$TMP/b.md")
|
|
77
|
+
if [ "$rc" = "0" ] && /usr/bin/grep -q 'CHANGELOG-EXCLUDED=1' "$TMP/out" \
|
|
78
|
+
&& /usr/bin/grep -q 'SUPERSEDED=0' "$TMP/out"; then
|
|
79
|
+
ok "L3 '# <이름> Changelog' → 제외 1건 · SUPERSEDED 0 (봤고 제외했다)"
|
|
80
|
+
else ng "L3 rc=$rc · $(/usr/bin/grep -o 'CHANGELOG-EXCLUDED=[0-9]*' "$TMP/out" | head -1)"; fi
|
|
81
|
+
|
|
82
|
+
# ── L4 known-NEGATIVE: 본문 산문의 «changelog» 는 컷오프가 아니다 ────────────
|
|
83
|
+
printf 'We keep a changelog for this reason.\ncite 10.5281/zenodo.20397566 here\n' > "$TMP/c.md"
|
|
84
|
+
rc=$(run "$TMP/c.md")
|
|
85
|
+
if [ "$rc" = "1" ] && /usr/bin/grep -q 'SUPERSEDED=1' "$TMP/out"; then
|
|
86
|
+
ok "L4 NEG 산문의 changelog 는 컷오프가 아니다 — 인용이 살아 있다"
|
|
87
|
+
else ng "L4 rc=$rc — 산문 낱말이 진짜 인용을 삼켰다"; fi
|
|
88
|
+
|
|
89
|
+
# ── L5 pin 마커 — 발행 스냅샷은 통째로 기록 ───────────────────────────────────
|
|
90
|
+
printf '<!-- stale-ref: pinned — published snapshot -->\n10.5281/zenodo.20397566\n' > "$TMP/d.html"
|
|
91
|
+
rc=$(run "$TMP/d.html")
|
|
92
|
+
if [ "$rc" = "0" ] && /usr/bin/grep -q 'CHANGELOG-EXCLUDED=1' "$TMP/out"; then ok "L5 pin 마커 → rc=0"
|
|
93
|
+
else ng "L5 rc=$rc — pin 이 안 먹는다"; fi
|
|
94
|
+
|
|
95
|
+
# ── L6 🟥 못 읽은 입력은 UNSCANNABLE + rc=10 (적대검증 S-1) ───────────────────
|
|
96
|
+
printf '%%PDF-1.4\000\000binary\n' > "$TMP/e.pdf"
|
|
97
|
+
rc=$(run "$TMP/e.pdf")
|
|
98
|
+
if [ "$rc" = "10" ] && /usr/bin/grep -q 'UNSCANNABLE=1' "$TMP/out"; then
|
|
99
|
+
ok "L6 바이너리 → UNSCANNABLE rc=10 (0 sites rc=0 아님)"
|
|
100
|
+
else ng "L6 rc=$rc — 못 읽은 것이 «깨끗함» 으로 나간다"; fi
|
|
101
|
+
|
|
102
|
+
# ── L7 컨셉 DOI 는 CONCEPT · 최신 버전은 CURRENT ──────────────────────────────
|
|
103
|
+
printf '10.5281/zenodo.20397565 and 10.5281/zenodo.22843702\n' > "$TMP/f.md"
|
|
104
|
+
rc=$(run "$TMP/f.md")
|
|
105
|
+
if [ "$rc" = "0" ] && /usr/bin/grep -q 'CONCEPT=1' "$TMP/out" && /usr/bin/grep -q 'CURRENT=1' "$TMP/out"; then
|
|
106
|
+
ok "L7 컨셉→CONCEPT · 최신→CURRENT rc=0"
|
|
107
|
+
else ng "L7 rc=$rc · $(/usr/bin/grep -o 'CONCEPT=[0-9]* CURRENT=[0-9]*' "$TMP/out" | head -1)"; fi
|
|
108
|
+
|
|
109
|
+
# ── 되돌림 프로브 ─────────────────────────────────────────────────────────────
|
|
110
|
+
probe () { # $1=이름 $2=원문 $3=치환문
|
|
111
|
+
cp scripts/stale_ref_scan.py "$TMP/mut.py"
|
|
112
|
+
python3 - "$TMP/mut.py" "$2" "$3" <<'PYX'
|
|
113
|
+
import io,sys
|
|
114
|
+
p,a,b=sys.argv[1],sys.argv[2],sys.argv[3]
|
|
115
|
+
s=io.open(p,encoding="utf-8").read()
|
|
116
|
+
if s.count(a)!=1: sys.exit(3)
|
|
117
|
+
io.open(p,"w",encoding="utf-8").write(s.replace(a,b,1))
|
|
118
|
+
PYX
|
|
119
|
+
if [ $? -ne 0 ]; then ng "$1 — 뮤턴트 생성 실패(치환 대상 부재). HARNESS ERROR, 초록으로 안 읽는다"; return; fi
|
|
120
|
+
python3 "$TMP/mut.py" --self-check > "$TMP/mo" 2>&1; mrc=$?
|
|
121
|
+
if [ "$mrc" != "0" ] && /usr/bin/grep -q '^ FAIL' "$TMP/mo"; then ok "$1 — 뮤턴트가 빨개진다"
|
|
122
|
+
else ng "$1 — 뮤턴트인데 self-check 가 초록이다(앵커가 장식)"; fi
|
|
123
|
+
}
|
|
124
|
+
probe "L8 scan_body 죽이기" " return sites" " return []"
|
|
125
|
+
probe "L9 rc 지배 제거" " if unresolved or unscannable:" " if False:"
|
|
126
|
+
probe "L10 바이너리 검사 제거" ' if b"\x00" in raw:' " if False:"
|
|
127
|
+
|
|
128
|
+
# 원본 불변 확인 — 프로브가 대상을 건드리지 않았나
|
|
129
|
+
python3 scripts/stale_ref_scan.py --self-check > "$TMP/sc2" 2>&1
|
|
130
|
+
if [ $? -eq 0 ]; then ok "L11 프로브 후에도 원본 --self-check rc=0 (사본만 건드렸다)"
|
|
131
|
+
else ng "L11 원본이 오염됐다"; fi
|
|
132
|
+
|
|
133
|
+
printf '\n PASS %d FAIL %d\n' "$PASS" "$FAIL"
|
|
134
|
+
[ "$FAIL" -eq 0 ] || exit 1
|