@chrono-meta/fh-gate 3.42.0 → 3.44.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/regression/probes_live.yaml +16 -8
- package/.claude/rules/fh_4axis_gate.md +8 -0
- package/.claude-plugin/marketplace.json +4 -4
- package/AGENTS.md +9 -0
- package/README.ja.md +2 -0
- package/README.ko.md +2 -0
- package/README.md +2 -0
- package/README.zh.md +2 -0
- package/docs/HOW_FH_DIFFERS.en.md +37 -0
- package/docs/HOW_FH_DIFFERS.md +39 -0
- package/docs/USER_GUIDE.md +208 -2
- package/docs/model_tier_expectations.md +8 -4
- package/knowledge/shared/harness-core/claude_md_full_reference.md +10 -0
- package/knowledge/shared/harness-core/dispatch_conditional_prohibition.md +18 -0
- package/knowledge/shared/harness-core/fh_module_contract.md +19 -0
- package/knowledge/shared/harness-core/governance_engineering_definition.md +16 -0
- package/knowledge/shared/harness-core/measurement-integrity-checklist.md +24 -0
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +42 -0
- package/knowledge/shared/plugin-catalog/recommended_plugins.md +53 -9
- package/package.json +13 -1
- package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +49 -14
- package/plugins/fh-commons/skills/ko-tech-writer/SKILL_detail.md +60 -0
- package/plugins/fh-commons/skills/ko-tech-writer/fixtures/sense_negative.md +30 -0
- package/plugins/fh-commons/skills/ko-tech-writer/fixtures/sense_positive.md +56 -0
- package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/CHANGELOG.md +55 -2
- package/plugins/fh-meta/skills/auto-decorrelation/SKILL.md +45 -1
- package/plugins/fh-meta/skills/edit-manifest/SKILL.md +14 -1
- package/plugins/fh-meta/skills/harvest-loop/SKILL.md +1 -1
- package/plugins/fh-meta/skills/meta-prompt-builder/SKILL.md +19 -0
- package/plugins/fh-meta/skills/sim-conductor/SKILL_detail.md +3 -3
- package/plugins/fh-meta/skills/steel-quench/SKILL_detail.md +8 -4
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/agy_launch_guard.sh +49 -0
- package/scripts/agy_remote_run.sh +187 -0
- package/scripts/capability_registry_check.sh +15 -2
- package/scripts/codex_launch_guard.sh +87 -0
- package/scripts/finding_fleet.sh +35 -2
- package/scripts/finding_verifier.sh +6 -2
- package/scripts/ko_tech_writer_calibrate.py +88 -1
- package/scripts/live_eval_trace.py +141 -0
- package/scripts/package_coverage_check.sh +7 -0
- package/scripts/pr_merge_verified.sh +7 -0
- package/scripts/prepush_guard_check.sh +33 -20
- package/scripts/probe_live_eval.sh +6 -3
- package/scripts/probe_live_eval_lib.py +92 -2
- package/scripts/remote_marker_gate.sh +56 -0
- package/scripts/selfcheck.sh +58 -2
- package/scripts/session_checklist.py +109 -5
- package/scripts/session_close_check.sh +16 -0
- package/scripts/sidecar_calibrate.sh +10 -2
- package/scripts/sidecar_wait.sh +21 -1
- package/scripts/sim_isolated_run.sh +17 -2
- package/scripts/test_agy_launch_guard_lanes.sh +227 -0
- package/scripts/test_agy_remote_run_lanes.sh +228 -0
- package/scripts/test_codex_launch_guard_lanes.sh +138 -0
- package/scripts/test_finding_pipeline_lanes.sh +6 -2
- package/scripts/test_fixture_guard_coverage_lanes.sh +71 -10
- package/scripts/test_live_eval_trace_lanes.sh +191 -0
- package/scripts/test_meta_prompt_restate_lanes.sh +36 -0
- package/scripts/test_mutation_probe_lanes.sh +26 -6
- package/scripts/test_pr_merge_verified_lanes.sh +23 -0
- package/scripts/test_preprep_speech_coach_lanes.sh +18 -2
- package/scripts/test_prepush_guard_failure_visibility_lanes.sh +152 -0
- package/scripts/test_remote_marker_gate_lanes.sh +96 -0
- package/scripts/test_session_checklist_lanes.sh +205 -0
- package/scripts/test_session_close_lanes.sh +7 -0
- package/scripts/test_sidecar_calibrate_lanes.sh +4 -0
- package/scripts/test_sidecar_wait_stdin.sh +18 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Lanes for live_eval_trace.py + the behave:/inventory layer in probe_live_eval_lib.score_run (FH-3).
|
|
3
|
+
# Fixtures carry the event keys a real `claude -p --output-format stream-json --verbose` run emits
|
|
4
|
+
# (system/init tools+mcp_servers · assistant message.content[].tool_use · result) — checked against a
|
|
5
|
+
# recorded stream on the author machine; set LIVE_TRACE_REAL=<file.jsonl> to re-check that shape (TR0).
|
|
6
|
+
# TR1 extract: result text + init inventory; a stream with no result event → rc 3 and empty text
|
|
7
|
+
# TR2 the calibration PAIR: «did it» (Read CATALOG.md) PASS/BEHAVIOUR · «said it» (names CATALOG, no call) FAIL
|
|
8
|
+
# TR3 first_read is order: CATALOG.md read second → FAIL
|
|
9
|
+
# TR4 control arm does the action too → UNCALIBRATED (cannot discriminate)
|
|
10
|
+
# TR5 no trace on disk → text verdict kept, scored_by=MENTION-ONLY, counted in mention_only_pass
|
|
11
|
+
# TR6 arms with different tool/MCP lists (82 vs 24) → INVALID-COMPARISON, overall has no pass_rate
|
|
12
|
+
# TR7 a malformed behave: spec → UNCALIBRATED with BAD-BEHAVE, never a silent text-only pass
|
|
13
|
+
# TR8 the runner refuses --trace with --turns (rc 2), never ignores it
|
|
14
|
+
# TR13 ablation_calibrate.sh (direct claude -p measurement path) pins MCP in every arm
|
|
15
|
+
# TR9 revert probe: a scorer without the «said, not done → FAIL» line turns TR2 red
|
|
16
|
+
# TR14 arms equal in tools/MCP but one loaded an extra plugin → INVALID-COMPARISON (2026-11-15 nightly shape)
|
|
17
|
+
# TR15 control: arms with the same plugin set stay comparable (PASS), also reordered or with a duplicate entry
|
|
18
|
+
# TR16 same plugin, different version → INVALID-COMPARISON (an auto-update moved a version mid-run)
|
|
19
|
+
# TR17 one arm's init carries a plugin list (or an empty one), the other's none → INVALID-COMPARISON (UNKNOWN ≠ «no plugins»)
|
|
20
|
+
# TR18 revert probe: an inventory without plugins turns TR14 back to comparable → TR14 would be red
|
|
21
|
+
set -u
|
|
22
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
23
|
+
LIB="${LIVE_EVAL_LIB_DIR:-$HERE}"
|
|
24
|
+
pass=0; fail=0; ok(){ pass=$((pass+1)); echo " ✅ $1"; }; bad(){ fail=$((fail+1)); echo " ❌ $1"; }
|
|
25
|
+
T="$(mktemp -d)"; trap 'rm -rf "$T"' EXIT
|
|
26
|
+
|
|
27
|
+
python3 "$HERE/live_eval_trace.py" extract /dev/null /dev/null /dev/null >/dev/null 2>&1; [ $? -eq 3 ] \
|
|
28
|
+
&& ok "TR0 the shipped file runs by its own path (empty stream → rc 3)" || bad "TR0 direct run"
|
|
29
|
+
if [ -n "${LIVE_TRACE_REAL:-}" ]; then
|
|
30
|
+
r=$(python3 "$HERE/live_eval_trace.py" extract "$LIVE_TRACE_REAL" "$T/real.txt" "$T/real.tools" ; echo "rc=$?")
|
|
31
|
+
grep -q '^tools=.*Read' "$T/real.tools" && [ -s "$T/real.txt" ] && grep -q '| plugins=\[' "$T/real.tools" \
|
|
32
|
+
&& echo " ℹ️ TR0b real stream shape read, plugin list included ($r)" \
|
|
33
|
+
|| echo " ⚠️ TR0b real stream NOT read ($r) — fixtures may not match the real shape"
|
|
34
|
+
else
|
|
35
|
+
echo " ℹ️ TR0b real-shape re-check UNMEASURED this run (LIVE_TRACE_REAL unset) — not a pass"
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# fixture writer: ev <file> <tools csv> <mcp csv> <result text> [ToolName=path ...]
|
|
39
|
+
cat > "$T/mk.py" <<'PY'
|
|
40
|
+
import json, sys
|
|
41
|
+
f, tools, mcp, res = sys.argv[1:5]
|
|
42
|
+
import os
|
|
43
|
+
ev = [{"type": "system", "subtype": "hook_started", "hook_name": "SessionStart"}]
|
|
44
|
+
if tools != "NOINIT":
|
|
45
|
+
init = {"type": "system", "subtype": "init", "tools": [t for t in tools.split(",") if t],
|
|
46
|
+
"mcp_servers": [{"name": m.split(":")[0], "status": (m.split(":") + ["connected"])[1]} for m in mcp.split(",") if m]}
|
|
47
|
+
# MK_PLUGINS: unset/empty = no plugins key (older shape); "-" = empty list; else csv of
|
|
48
|
+
# source[=version] — the real init carries {name, path, source, version?} per plugin.
|
|
49
|
+
pl = os.environ.get("MK_PLUGINS", "")
|
|
50
|
+
if pl:
|
|
51
|
+
init["plugins"] = [] if pl == "-" else [
|
|
52
|
+
dict({"name": x.split("=")[0].split("@")[0], "path": "/fixture", "source": x.split("=")[0]},
|
|
53
|
+
**({"version": x.split("=")[1]} if "=" in x else {})) for x in pl.split(",")]
|
|
54
|
+
ev.append(init)
|
|
55
|
+
# call forms: Read=path · ERR:Read=path (tool_result is_error) · SUB:Read=path (inside a subagent)
|
|
56
|
+
for n, c in enumerate(sys.argv[5:]):
|
|
57
|
+
flag = ""
|
|
58
|
+
if ":" in c.split("=", 1)[0]:
|
|
59
|
+
flag, c = c.split(":", 1)
|
|
60
|
+
name, p = c.split("=", 1)
|
|
61
|
+
key = "pattern" if name == "Glob" else "file_path" if name == "Read" else "path"
|
|
62
|
+
a = {"type": "assistant", "message": {"content": [{"type": "tool_use", "id": "t%d" % n, "name": name, "input": {key: p}}]}}
|
|
63
|
+
if flag == "SUB":
|
|
64
|
+
a["parent_tool_use_id"] = "task0"
|
|
65
|
+
ev.append(a)
|
|
66
|
+
ev.append({"type": "user", "message": {"content": [{"type": "tool_result", "tool_use_id": "t%d" % n, "is_error": flag == "ERR"}]}})
|
|
67
|
+
ev.append({"type": "result", "subtype": "success", "result": res})
|
|
68
|
+
open(f, "w").write("".join(json.dumps(e, ensure_ascii=False) + "\n" for e in ev))
|
|
69
|
+
PY
|
|
70
|
+
mk(){ python3 "$T/mk.py" "$@"; }
|
|
71
|
+
|
|
72
|
+
mk "$T/a.jsonl" "Read,Grep,Glob" "" "CATALOG says x" Read=CATALOG.md
|
|
73
|
+
python3 "$HERE/live_eval_trace.py" extract "$T/a.jsonl" "$T/a.txt" "$T/a.tools"; xrc=$?
|
|
74
|
+
printf '%s\n' '{"type":"system","subtype":"init","tools":["Read"]}' > "$T/nores.jsonl"
|
|
75
|
+
python3 "$HERE/live_eval_trace.py" extract "$T/nores.jsonl" "$T/n.txt" "$T/n.tools"; nrc=$?
|
|
76
|
+
[ $xrc -eq 0 ] && [ "$(cat "$T/a.txt")" = "CATALOG says x" ] && grep -qx 'tools=Glob,Grep,Read | mcp= | plugins=UNKNOWN' "$T/a.tools" \
|
|
77
|
+
&& [ $nrc -eq 3 ] && [ ! -s "$T/n.txt" ] \
|
|
78
|
+
&& ok "TR1 extract writes result + inventory; no result event → rc 3, empty text" \
|
|
79
|
+
|| bad "TR1 xrc=$xrc nrc=$nrc txt=$(cat "$T/a.txt") tools=$(cat "$T/a.tools")"
|
|
80
|
+
|
|
81
|
+
# run_root builder: build <root> <probe> <reps> <primary-spec|-> <control-spec|-> ; spec = "tools|mcp|text|calls..."
|
|
82
|
+
build(){ local root="$1" pid="$2" reps="$3" ps="$4" cs="$5" i arm spec
|
|
83
|
+
mkdir -p "$root/$pid"
|
|
84
|
+
for i in $(seq 1 "$reps"); do
|
|
85
|
+
for arm in primary control; do
|
|
86
|
+
[ $arm = primary ] && spec="$ps" || spec="$cs"
|
|
87
|
+
IFS='|' read -r tl mc tx calls pl <<<"$spec"
|
|
88
|
+
# 5th field = plugins for rep 1 only when it starts with «r1:» (a set that changed in one rep)
|
|
89
|
+
case "$pl" in r1:*) if [ "$i" -eq 1 ]; then pl="${pl#r1:}"; else pl="${PL_BASE:-}"; fi ;; esac
|
|
90
|
+
printf '%s' "$tx" > "$root/$pid/${arm}_r$i.txt"
|
|
91
|
+
if [ "$tl" != "-" ]; then set -f; MK_PLUGINS="$pl" mk "$root/$pid/${arm}_r$i.stream.jsonl" "$tl" "$mc" "$tx" $calls; set +f; fi
|
|
92
|
+
done
|
|
93
|
+
done; }
|
|
94
|
+
score(){ python3 - "$LIB" "$1" "$2" "$3" "${4:-}" <<'PY'
|
|
95
|
+
import sys, json; sys.path.insert(0, sys.argv[1]); import probe_live_eval_lib as L
|
|
96
|
+
root, pid, behave, pol = sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5] or 'present'
|
|
97
|
+
spec = {'id': pid, 'polarity': pol, 'expect_re': 'CATALOG'}
|
|
98
|
+
if behave: spec['behave'] = behave
|
|
99
|
+
r = L.score_run([spec], root, [pid], 0.8, 'sonnet', reps=3)
|
|
100
|
+
row = r['rows'][0]
|
|
101
|
+
print(row['verdict'], row['scored_by'], r['overall'], r['pass_rate'], r['mention_only_pass'], r['behaviour_backed'], '|', row['reason'])
|
|
102
|
+
PY
|
|
103
|
+
}
|
|
104
|
+
RT='Read,Grep,Glob'
|
|
105
|
+
build "$T/did" P 3 "$RT||CATALOG has it|Read=CATALOG.md Read=x.md" "$RT||오늘 맑아|"
|
|
106
|
+
build "$T/said" P 3 "$RT||I will read CATALOG.md first|" "$RT||오늘 맑아|"
|
|
107
|
+
d=$(score "$T/did" P 'first_read=CATALOG\.md'); s=$(score "$T/said" P 'first_read=CATALOG\.md')
|
|
108
|
+
[[ "$d" == "PASS BEHAVIOUR PASS 1.0 0 1 "* ]] && [[ "$s" == "FAIL BEHAVIOUR "* ]] \
|
|
109
|
+
&& ok "TR2 pair: did → PASS/BEHAVIOUR · said-only → FAIL (same text pattern hits both)" || bad "TR2 did=[$d] said=[$s]"
|
|
110
|
+
|
|
111
|
+
build "$T/order" P 3 "$RT||CATALOG has it|Grep=knowledge Read=CATALOG.md" "$RT||오늘 맑아|"
|
|
112
|
+
o=$(score "$T/order" P 'first_read=CATALOG\.md'); o2=$(score "$T/order" P 'read=CATALOG\.md')
|
|
113
|
+
[[ "$o" == FAIL* ]] && [[ "$o2" == PASS* ]] && ok "TR3 first_read reads order (second → FAIL; read= → PASS)" || bad "TR3 first=[$o] any=[$o2]"
|
|
114
|
+
|
|
115
|
+
build "$T/ctl" P 3 "$RT||CATALOG has it|Read=CATALOG.md" "$RT||오늘 맑아|Read=CATALOG.md"
|
|
116
|
+
c=$(score "$T/ctl" P 'read=CATALOG\.md')
|
|
117
|
+
[[ "$c" == "UNCALIBRATED "* ]] && ok "TR4 control does the action → UNCALIBRATED" || bad "TR4 [$c]"
|
|
118
|
+
|
|
119
|
+
build "$T/old" P 3 "-||CATALOG has it|" "-||오늘 맑아|"
|
|
120
|
+
m=$(score "$T/old" P 'read=CATALOG\.md'); m0=$(score "$T/old" P '')
|
|
121
|
+
[[ "$m" == "PASS MENTION-ONLY PASS 1.0 1 0 "* ]] && [[ "$m0" == "PASS MENTION-ONLY "* ]] \
|
|
122
|
+
&& ok "TR5 no trace → text verdict kept, labelled MENTION-ONLY, counted as mention-only" || bad "TR5 [$m] [$m0]"
|
|
123
|
+
|
|
124
|
+
build "$T/inv" P 3 "Read,Grep,Glob|drive,wiki|CATALOG has it|Read=CATALOG.md" "$RT||오늘 맑아|"
|
|
125
|
+
v=$(score "$T/inv" P 'read=CATALOG\.md')
|
|
126
|
+
[[ "$v" == "INVALID-COMPARISON MENTION-ONLY INVALID-COMPARISON None "* || "$v" == "INVALID-COMPARISON BEHAVIOUR INVALID-COMPARISON None "* ]] && [[ "$v" == *"different tool/MCP/plugin lists"* ]] \
|
|
127
|
+
&& ok "TR6 arms with different tool/MCP lists → INVALID-COMPARISON, no pass_rate" || bad "TR6 [$v]"
|
|
128
|
+
|
|
129
|
+
b=$(score "$T/did" P 'reads=CATALOG')
|
|
130
|
+
[[ "$b" == "UNCALIBRATED "* ]] && [[ "$b" == *BAD-BEHAVE* ]] && ok "TR7 malformed behave: → UNCALIBRATED/BAD-BEHAVE" || bad "TR7 [$b]"
|
|
131
|
+
|
|
132
|
+
tout=$(bash "$HERE/sim_isolated_run.sh" --arm primary --prompt x --trace --turns 'a' 2>&1); trc=$?
|
|
133
|
+
[ $trc -eq 2 ] && [[ "$tout" == *"--trace is single-shot only"* ]] && ok "TR8 runner refuses --trace with --turns (rc 2)" || bad "TR8 rc=$trc $tout"
|
|
134
|
+
|
|
135
|
+
mkdir -p "$T/mut"; cp "$LIB/live_eval_trace.py" "$T/mut/"
|
|
136
|
+
sed 's/^\( *\)v = FAIL # said it, did not do it$/\1pass/' "$LIB/probe_live_eval_lib.py" > "$T/mut/probe_live_eval_lib.py"
|
|
137
|
+
if grep -q 'said it, did not do it' "$T/mut/probe_live_eval_lib.py"; then bad "TR9 mutation did not apply (instrument error, not a pass)"
|
|
138
|
+
else ms=$(LIB="$T/mut" score "$T/said" P 'first_read=CATALOG\.md')
|
|
139
|
+
[[ "$ms" == PASS* ]] && ok "TR9 revert probe: without the line, said-only scores PASS → TR2 would be red" || bad "TR9 mutant still [$ms]"; fi
|
|
140
|
+
|
|
141
|
+
build "$T/deny" P 3 "$RT||CATALOG has it|ERR:Read=CATALOG.md" "$RT||오늘 맑아|"
|
|
142
|
+
build "$T/sub" P 3 "$RT||CATALOG has it|SUB:Read=CATALOG.md Read=x.md" "$RT||오늘 맑아|"
|
|
143
|
+
build "$T/grp" P 3 "$RT||CATALOG has it|Grep=. Glob=CATALOG.md" "$RT||오늘 맑아|"
|
|
144
|
+
dn=$(score "$T/deny" P 'read=CATALOG\.md'); sb=$(score "$T/sub" P 'read=CATALOG\.md'); gp=$(score "$T/grp" P 'read=CATALOG\.md')
|
|
145
|
+
[[ "$dn" == FAIL* ]] && [[ "$sb" == FAIL* ]] && [[ "$gp" == FAIL* ]] \
|
|
146
|
+
&& ok "TR10 a failed Read, a subagent's Read, and a Glob/Grep-pattern hit are not «read» (codex R1)" || bad "TR10 deny=[$dn] sub=[$sb] glob=[$gp]"
|
|
147
|
+
build "$T/noinit" P 3 "NOINIT||CATALOG has it|Read=CATALOG.md" "$RT||오늘 맑아|"
|
|
148
|
+
build "$T/mstat" P 3 "$RT|drive:connected|CATALOG has it|Read=CATALOG.md" "$RT|drive:failed|오늘 맑아|"
|
|
149
|
+
ni=$(score "$T/noinit" P 'read=CATALOG\.md'); ms2=$(score "$T/mstat" P 'read=CATALOG\.md')
|
|
150
|
+
[[ "$ni" == INVALID-COMPARISON* ]] && [[ "$ms2" == INVALID-COMPARISON* ]] \
|
|
151
|
+
&& ok "TR11 one arm without init, or MCP connected vs failed → INVALID-COMPARISON (codex R1)" || bad "TR11 noinit=[$ni] status=[$ms2]"
|
|
152
|
+
build "$T/half" P 3 "$RT||CATALOG has it|Read=CATALOG.md" "-||오늘 맑아|"
|
|
153
|
+
hf=$(score "$T/half" P 'read=CATALOG\.md')
|
|
154
|
+
[[ "$hf" == UNCALIBRATED* ]] && [[ "$hf" == *TRACE-INCOMPLETE* ]] && ok "TR12 a control arm with no trace while primary has one → UNCALIBRATED, not text-only PASS" || bad "TR12 [$hf]"
|
|
155
|
+
|
|
156
|
+
# TR13 the direct `claude -p` measurement path (not via sim_isolated_run) pins MCP in all three arms.
|
|
157
|
+
# Static check of the argv only — a pin is not proof; the recorded tool list (TR6/TR11) is the defence.
|
|
158
|
+
npin=$(grep -cE '^ (allowlist|denylist|baseline)\) +FLAGS=\(.*--strict-mcp-config' "$HERE/ablation_calibrate.sh")
|
|
159
|
+
[ "$npin" -eq 3 ] && ok "TR13 ablation_calibrate.sh pins MCP (--strict-mcp-config) in all 3 arms" || bad "TR13 pinned arms=$npin/3"
|
|
160
|
+
|
|
161
|
+
# ── plugins (2026-11-15): the nightly's G-GREET-01 / G-TRIG-05 had tools and MCP equal in every arm and
|
|
162
|
+
# one rep (primary_r1) with one extra builtin plugin; the scorer reported «1 distinct». Names below are
|
|
163
|
+
# synthetic — the shape (source@version, builtin with no version) is the real init's.
|
|
164
|
+
PB='fx-core@hub=3.42.0,fx-lsp@official=1.0.0,fx-telemetry@builtin'
|
|
165
|
+
PL_BASE="$PB" build "$T/plg" P 3 "$RT||CATALOG has it|Read=CATALOG.md|r1:$PB,fx-chart@builtin" "$RT||오늘 맑아||$PB"
|
|
166
|
+
pg=$(score "$T/plg" P 'read=CATALOG\.md')
|
|
167
|
+
[[ "$pg" == INVALID-COMPARISON* ]] && [[ "$pg" == *"saw 2 different"*"plugin lists"* ]] && [[ "$pg" != *UNKNOWN* ]] \
|
|
168
|
+
&& ok "TR14 one rep with an extra plugin (tools/MCP equal) → INVALID-COMPARISON" || bad "TR14 [$pg]"
|
|
169
|
+
build "$T/plq" P 3 "$RT||CATALOG has it|Read=CATALOG.md|$PB" "$RT||오늘 맑아||$PB"
|
|
170
|
+
pq=$(score "$T/plq" P 'read=CATALOG\.md')
|
|
171
|
+
PR='fx-telemetry@builtin,fx-lsp@official=1.0.0,fx-core@hub=3.42.0,fx-lsp@official=1.0.0' # same set: reordered + a duplicate
|
|
172
|
+
build "$T/plr" P 3 "$RT||CATALOG has it|Read=CATALOG.md|$PB" "$RT||오늘 맑아||$PR"
|
|
173
|
+
pr=$(score "$T/plr" P 'read=CATALOG\.md')
|
|
174
|
+
[[ "$pq" == "PASS BEHAVIOUR PASS 1.0 "* ]] && [[ "$pr" == "PASS BEHAVIOUR PASS 1.0 "* ]] && ok "TR15 control: same plugin set in every arm → comparable, PASS" || bad "TR15 same=[$pq] reordered+dup=[$pr]"
|
|
175
|
+
build "$T/plv" P 3 "$RT||CATALOG has it|Read=CATALOG.md|${PB/3.42.0/3.43.0}" "$RT||오늘 맑아||$PB"
|
|
176
|
+
pv=$(score "$T/plv" P 'read=CATALOG\.md')
|
|
177
|
+
[[ "$pv" == INVALID-COMPARISON* ]] && [[ "$pv" == *"saw 2 different"* ]] && [[ "$pv" != *UNKNOWN* ]] && ok "TR16 same plugin, different version → INVALID-COMPARISON" || bad "TR16 [$pv]"
|
|
178
|
+
build "$T/plu" P 3 "$RT||CATALOG has it|Read=CATALOG.md|$PB" "$RT||오늘 맑아|"
|
|
179
|
+
pu=$(score "$T/plu" P 'read=CATALOG\.md')
|
|
180
|
+
build "$T/ple" P 3 "$RT||CATALOG has it|Read=CATALOG.md|-" "$RT||오늘 맑아|"
|
|
181
|
+
pe=$(score "$T/ple" P 'read=CATALOG\.md')
|
|
182
|
+
[[ "$pu" == INVALID-COMPARISON* ]] && [[ "$pe" == INVALID-COMPARISON* ]] && ok "TR17 one arm with a plugin list, one without → INVALID-COMPARISON (UNKNOWN, not 0)" || bad "TR17 list=[$pu] empty-list=[$pe]"
|
|
183
|
+
mkdir -p "$T/mut2"; cp "$LIB/probe_live_eval_lib.py" "$T/mut2/"
|
|
184
|
+
sed "s/^\( *\)plug = 'UNKNOWN' if trace.get('plugins') is None else ','.join(trace\['plugins'\])$/\1plug = ''/" \
|
|
185
|
+
"$LIB/live_eval_trace.py" > "$T/mut2/live_eval_trace.py"
|
|
186
|
+
if grep -q "trace.get('plugins') is None" "$T/mut2/live_eval_trace.py"; then bad "TR18 mutation did not apply (instrument error, not a pass)"
|
|
187
|
+
else mp=$(LIB="$T/mut2" score "$T/plg" P 'read=CATALOG\.md')
|
|
188
|
+
[[ "$mp" == "PASS "* ]] && ok "TR18 revert probe: inventory without plugins → TR14's pair scores PASS (TR14 would be red)" || bad "TR18 mutant still [$mp]"; fi
|
|
189
|
+
|
|
190
|
+
[ $pass -eq 19 ] || bad "lane count $pass != 19 — a case did not run"
|
|
191
|
+
echo "live_eval_trace lanes: $pass passed, $fail failed"; [ $fail -eq 0 ]
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_meta_prompt_restate_lanes.sh — meta-prompt-builder carries the cold-reader restate check.
|
|
3
|
+
# Record-shape only: item 4 of Step 3 names the three fields, the GUESS -> WARN rule, the
|
|
4
|
+
# self-restate exclusion and the NOT RUN rule, and Done When lists it as a mandatory-pass row.
|
|
5
|
+
# Whether a session actually runs it is a blind sim, not this lane.
|
|
6
|
+
# Known-negative in-file: the same check on a copy with item 4 removed must FAIL.
|
|
7
|
+
# exit: 0 PASS · 1 FAIL · 10 harness error
|
|
8
|
+
set -uo pipefail
|
|
9
|
+
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
10
|
+
F="${1:-$ROOT/plugins/fh-meta/skills/meta-prompt-builder/SKILL.md}"
|
|
11
|
+
[ -f "$F" ] || { echo "harness error: $F missing -- not a pass" >&2; exit 10; }
|
|
12
|
+
|
|
13
|
+
check() { # $1 = file; prints findings, returns 0 if all present
|
|
14
|
+
local f="$1" item4 done_rows rc=0 n
|
|
15
|
+
# item 4 = from its own line to the next numbered item or "Items that fail"
|
|
16
|
+
item4=$(awk '/^4\. \*\*Restate check/{on=1} on && /^Items that fail/{on=0} on' "$f")
|
|
17
|
+
done_rows=$(awk '/^## Done When/{on=1;next} /^## /{on=0} on' "$f")
|
|
18
|
+
for n in 'GOAL' 'DONE' 'CONSTRAINTS' 'RESTATABLE' '`GUESS`' 'brief not restatable' \
|
|
19
|
+
'Do not tell the reader' 'Restating your own draft yourself does not count' 'NOT RUN'; do
|
|
20
|
+
printf '%s\n' "$item4" | grep -qF -- "$n" || { echo " missing in item 4: $n"; rc=1; }
|
|
21
|
+
done
|
|
22
|
+
printf '%s\n' "$done_rows" | grep -qF 'Step 3 item 4 ran on every draft' \
|
|
23
|
+
|| { echo " missing in Done When: item-4 row"; rc=1; }
|
|
24
|
+
return $rc
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if check "$F"; then echo "PASS: item 4 and its Done When row present"; else echo "FAIL: $F"; exit 1; fi
|
|
28
|
+
|
|
29
|
+
# known-negative: strip item 4 and its Done When row -> must fail
|
|
30
|
+
tmp=$(mktemp) || { echo "harness error: mktemp" >&2; exit 10; }
|
|
31
|
+
trap 'rm -f "$tmp"' EXIT
|
|
32
|
+
awk '/^4\. \*\*Restate check/{skip=1} skip && /^Items that fail/{skip=0} !skip' "$F" \
|
|
33
|
+
| grep -vF 'Step 3 item 4 ran on every draft' > "$tmp"
|
|
34
|
+
if check "$tmp" >/dev/null; then echo "FAIL: control alive check — stripped copy still passed (lane is decorative)"; exit 1; fi
|
|
35
|
+
echo "PASS: control — stripped copy fails"
|
|
36
|
+
exit 0
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
# the original · setsid escapees · --json only when measured · kernel shebang · mode bits · future
|
|
19
19
|
# mtime · inode-keyed leftovers) — each lane red on v6.
|
|
20
20
|
# G7 the v6 generator defect classes, pinned — fail-closed: an uncertain region yields no mutant.
|
|
21
|
-
# K0 the
|
|
21
|
+
# K0 the process counter used by N6/S7-5 (/proc, or ps on macOS), on a known pair, before either trusts it.
|
|
22
22
|
#
|
|
23
23
|
# Exit 0 = all lanes behave · 1 = regression (or an UNMEASURED lane — never folded into PASS).
|
|
24
24
|
set -uo pipefail
|
|
@@ -156,6 +156,9 @@ ibkpath() { python3 -c 'import os,sys;st=os.stat(sys.argv[1]);print("/tmp/mutati
|
|
|
156
156
|
sha_of() { python3 -c 'import hashlib,sys;print(hashlib.sha256(open(sys.argv[1],"rb").read()).hexdigest())' "$1"; }
|
|
157
157
|
procs_matching() { # count live processes whose WHOLE cmdline is $1 — /proc, not pgrep (pgrep absent → vacuous);
|
|
158
158
|
local n=0 c # exact match, so the counter never counts itself (a substring grep did)
|
|
159
|
+
if [ "$HAVE_PROC" -eq 0 ]; then # macOS: no /proc, but `ps` lists every process's argv — same exact-line rule
|
|
160
|
+
grep -cxF -- "$1" <<<"$(ps -axww -o command= 2>/dev/null)"; return 0
|
|
161
|
+
fi
|
|
159
162
|
for c in /proc/[0-9]*/cmdline; do [ -e "$c" ] || continue; [ "$(tr '\0' ' ' < "$c" 2>/dev/null)" = "$1 " ] && n=$((n+1)); done
|
|
160
163
|
echo "$n"
|
|
161
164
|
}
|
|
@@ -171,6 +174,15 @@ procs_matching() { # count live processes whose WHOLE cmdline is $1 — /proc,
|
|
|
171
174
|
_PSFX="$$${RANDOM}"
|
|
172
175
|
TOK_N6="4747.$_PSFX"; TOK_K0="4646.$_PSFX"; TOK_S75="4848.$_PSFX"
|
|
173
176
|
if [ -d /proc/self ]; then HAVE_PROC=1; else HAVE_PROC=0; fi
|
|
177
|
+
# HAVE_COUNTER (2026-11-14): N6 and K0 used to need /proc, so on macOS they printed UNMEASURED and the
|
|
178
|
+
# suite exited 1 on every local run — a red the author learned to read past (CI on Linux was green).
|
|
179
|
+
# N6 does not need /proc; it needs a process counter. `ps -axww -o command=` is one, and K0/K1 below
|
|
180
|
+
# calibrate whichever counter is in use on a known pair before N6 trusts it. No counter at all is
|
|
181
|
+
# still UNMEASURED (red), never a pass.
|
|
182
|
+
HAVE_COUNTER=0
|
|
183
|
+
if [ "$HAVE_PROC" -eq 1 ]; then HAVE_COUNTER=1; _COUNTER="/proc"
|
|
184
|
+
elif ps -axww -o command= >/dev/null 2>&1; then HAVE_COUNTER=1; _COUNTER="ps"; fi
|
|
185
|
+
NOT_APPLICABLE=0; NA_NAMES=""
|
|
174
186
|
|
|
175
187
|
# B4 — the baseline lane writes its own subject: refuse, and leave the ORIGINAL bytes
|
|
176
188
|
cp age.sh b4.sh; h0=$(sha_of b4.sh)
|
|
@@ -242,10 +254,10 @@ printf '. ./n1.sh\nis_adult 19 && exit 0\n( touch n6.started; exec sleep %s ) &\
|
|
|
242
254
|
rm -f n6.started
|
|
243
255
|
out=$(python3 "$PROBE" n1.sh lane_n6.sh --timeout 2 2>&1)
|
|
244
256
|
sleep 0.5
|
|
245
|
-
if [ "$
|
|
246
|
-
[ -e n6.started ] && grep -q 'TIMEOUT' <<<"$out" && [ "$(procs_matching "sleep $TOK_N6")" -eq 0 ] ; chk $? "N6 the timed-out lane's grandchildren are killed with its process group (counted via
|
|
257
|
+
if [ "$HAVE_COUNTER" -eq 1 ]; then
|
|
258
|
+
[ -e n6.started ] && grep -q 'TIMEOUT' <<<"$out" && [ "$(procs_matching "sleep $TOK_N6")" -eq 0 ] ; chk $? "N6 the timed-out lane's grandchildren are killed with its process group (counted via $_COUNTER, calibrated by K0 — v6 used pgrep, vacuous when absent)"
|
|
247
259
|
else
|
|
248
|
-
echo " ⚠️ N6 UNMEASURED — no /proc"; UNMEASURED=$((UNMEASURED+1))
|
|
260
|
+
echo " ⚠️ N6 UNMEASURED — no process counter (/proc absent and ps failed)"; UNMEASURED=$((UNMEASURED+1))
|
|
249
261
|
fi
|
|
250
262
|
|
|
251
263
|
# N2 · N3 · N7 — generator noise
|
|
@@ -564,9 +576,9 @@ printf '#!/bin/sh\n[ "$a" != b ] && echo d\n[ "$c" = d ] && echo e\n' > z28.sh
|
|
|
564
576
|
out=$(python3 "$PROBE" z28.sh --list 2>&1)
|
|
565
577
|
! grep -qF '==' <<<"$out" && grep -qF '[=→!=]' <<<"$out" ; chk $? "Z28 #!/bin/sh: '!=' is not flipped to the non-POSIX '==' (= → != still is)"
|
|
566
578
|
|
|
567
|
-
if [ "$
|
|
579
|
+
if [ "$HAVE_COUNTER" -eq 1 ]; then # the process counter itself, on a known pair, before any lane trusts it
|
|
568
580
|
sleep "$TOK_K0" & kp=$!; sleep 0.1; k1=$(procs_matching "sleep $TOK_K0"); kill "$kp"; wait "$kp" 2>/dev/null; k0=$(procs_matching "sleep $TOK_K0")
|
|
569
|
-
[ "$k1" -eq 1 ] && [ "$k0" -eq 0 ] ; chk $? "K0 the
|
|
581
|
+
[ "$k1" -eq 1 ] && [ "$k0" -eq 0 ] ; chk $? "K0 the process counter ($_COUNTER) sees a live sleep (1) and not a dead one (0) — and not itself"
|
|
570
582
|
# K1 (2026-10-26) — the token must be unique to this run, not merely exact. Known pair against a
|
|
571
583
|
# live FOREIGN process carrying the old shared name: the thing a concurrent sibling used to be.
|
|
572
584
|
sleep 4747 & kf=$!; sleep 0.1
|
|
@@ -615,6 +627,13 @@ if [ "$HAVE_PROC" -eq 1 ] && command -v setsid >/dev/null 2>&1; then
|
|
|
615
627
|
out=$(python3 "$PROBE" s75.sh lane_s75.sh --timeout 30 2>&1)
|
|
616
628
|
sleep 0.3
|
|
617
629
|
[ -e s75.started ] && grep -qE 'mutants=1 ' <<<"$out" && [ "$(procs_matching "sleep $TOK_S75")" -eq 0 ] ; chk $? "S7-5 a setsid descendant of the lane does not outlive the probe (v6: it kept running with the mutant)"
|
|
630
|
+
elif [ "$(uname -s)" != Linux ]; then
|
|
631
|
+
# NOT-APPLICABLE, not UNMEASURED: the subject itself declares this behaviour Linux-only
|
|
632
|
+
# (mutation_probe.py: PR_SET_CHILD_SUBREAPER; elsewhere it prints «no subreaper on this OS … named
|
|
633
|
+
# residual»). There is no contract here to measure. On Linux a missing /proc or setsid is still
|
|
634
|
+
# UNMEASURED and red — the platform is the oracle, not the tool's absence.
|
|
635
|
+
echo " ⏭️ S7-5 NOT-APPLICABLE on $(uname -s) — setsid-escapee kill is Linux-only by the probe's own contract (CI measures it)"
|
|
636
|
+
NOT_APPLICABLE=$((NOT_APPLICABLE+1)); NA_NAMES="$NA_NAMES S7-5"
|
|
618
637
|
else
|
|
619
638
|
echo " ⚠️ S7-5 UNMEASURED — no /proc or no setsid"; UNMEASURED=$((UNMEASURED+1))
|
|
620
639
|
fi
|
|
@@ -856,5 +875,6 @@ grep -q '\[>→>=\] cmd >= out.txt' <<<"$out" ; chk $? "RV2 without the (( )) re
|
|
|
856
875
|
|
|
857
876
|
echo ""
|
|
858
877
|
if [ "$FAILED" -eq 0 ] && [ "$UNMEASURED" -gt 0 ]; then echo "INCOMPLETE mutation probe: $PASS lanes passed, $UNMEASURED UNMEASURED — not a pass"; exit 1; fi
|
|
878
|
+
if [ "$FAILED" -eq 0 ] && [ "$NOT_APPLICABLE" -gt 0 ]; then echo "PASS mutation probe: $PASS lanes · $NOT_APPLICABLE NOT-APPLICABLE on $(uname -s) ($NA_NAMES ) — not measured here, not counted as passed"; exit 0; fi
|
|
859
879
|
if [ "$FAILED" -eq 0 ]; then echo "PASS mutation probe: $PASS lanes"; exit 0; fi
|
|
860
880
|
echo "FAIL mutation probe"; exit 1
|
|
@@ -31,6 +31,10 @@ setup() {
|
|
|
31
31
|
mkdir -p "$d/seed/plugins/p/skills/s"; printf 'Plain text one.\n' > "$d/seed/plugins/p/skills/s/SKILL.md"; git -C "$d/seed" add plugins
|
|
32
32
|
git -C "$d/seed" commit -qm skill --no-verify; git -C "$d/seed" push -q origin HEAD:main
|
|
33
33
|
git -C "$d/seed" switch -qc feat; printf 'Plain text two.\n' > "$d/seed/plugins/p/skills/s/SKILL.md"
|
|
34
|
+
elif [ -n "${SETUP_LANE:-}" ]; then # SETUP_LANE=1: the PR changes only a lane file (scripts/test_*)
|
|
35
|
+
mkdir -p "$d/seed/scripts"; printf 'echo l1\n' > "$d/seed/scripts/test_x_lanes.sh"; git -C "$d/seed" add scripts
|
|
36
|
+
git -C "$d/seed" commit -qm lane --no-verify; git -C "$d/seed" push -q origin HEAD:main
|
|
37
|
+
git -C "$d/seed" switch -qc feat; printf 'echo l2\n' > "$d/seed/scripts/test_x_lanes.sh"
|
|
34
38
|
elif [ -n "${SETUP_DOCS:-}" ]; then
|
|
35
39
|
mkdir -p "$d/seed/docs"; printf 'x1\n' > "$d/seed/docs/x.md"; git -C "$d/seed" add docs/x.md
|
|
36
40
|
git -C "$d/seed" commit -qm docs --no-verify; git -C "$d/seed" push -q origin HEAD:main
|
|
@@ -248,6 +252,25 @@ SETUP_EXTRA=1 setup cvd; mkgh "$T/cvd"; run "$T/cvd" 7 --rerun 'git --version &&
|
|
|
248
252
|
{ [ "$RC" -eq 0 ] && printf '%s' "$OUT" | grep -q 'mentions none of this PR'; } \
|
|
249
253
|
&& ok "L25b --rerun naming a tracked dir → advisory still fires (blobs only)" || bad "L25b rc=$RC (dir listing counted as coverage?)"
|
|
250
254
|
|
|
255
|
+
# ── defect-path prompt (1c — print only, 2026-11-14 harvest H2) ──
|
|
256
|
+
DP='name the path the defect travels'
|
|
257
|
+
# D1 a code-changing PR (a, b) → the one-line prompt prints, rc and merge unchanged (L24's run, covering --rerun)
|
|
258
|
+
setup dp1; mkgh "$T/dp1"; run "$T/dp1" 7 --rerun "$GOOD"
|
|
259
|
+
{ [ "$RC" -eq 0 ] && merged "$T/dp1" && [ "$(printf '%s\n' "$OUT" | grep -cF "$DP")" -eq 1 ]; } \
|
|
260
|
+
&& ok "D1 code-changing PR → exactly one defect-path line, merge + verify unchanged (rc=0)" || { bad "D1 rc=$RC"; printf '%s\n' "$OUT" | tail -4; }
|
|
261
|
+
# D2 docs-only PR → quiet (the condition is narrowed so doc PRs carry no noise)
|
|
262
|
+
SETUP_DOCS=1 setup dp2; mkgh "$T/dp2"; run "$T/dp2" 7 --rerun "$GOODX"
|
|
263
|
+
{ [ "$RC" -eq 0 ] && merged "$T/dp2" && ! printf '%s' "$OUT" | grep -qF "$DP"; } \
|
|
264
|
+
&& ok "D2 docs-only PR → no defect-path line" || bad "D2 rc=$RC (prompt fired on a docs-only PR?)"
|
|
265
|
+
# D3 lane-only PR → quiet
|
|
266
|
+
SETUP_LANE=1 setup dp3; mkgh "$T/dp3"; run "$T/dp3" 7 --rerun 'grep -q l2 scripts/test_x_lanes.sh && echo instrument-ok'
|
|
267
|
+
{ [ "$RC" -eq 0 ] && merged "$T/dp3" && ! printf '%s' "$OUT" | grep -qF "$DP"; } \
|
|
268
|
+
&& ok "D3 lane-only PR (scripts/test_*) → no defect-path line" || { bad "D3 rc=$RC (prompt fired on a lane-only PR?)"; printf '%s\n' "$OUT" | tail -3; }
|
|
269
|
+
# D4 it is printed BEFORE the merge: a run whose merge is refused still shows it (and still exits 5, nothing verified)
|
|
270
|
+
setup dp4; mkgh "$T/dp4"; : > "$T/dp4/merge_fail"; run "$T/dp4" 7 --rerun "$GOOD"
|
|
271
|
+
{ [ "$RC" -eq 5 ] && printf '%s' "$OUT" | grep -qF "$DP"; } \
|
|
272
|
+
&& ok "D4 merge refused → line was already printed (pre-merge), rc unchanged (5)" || { bad "D4 rc=$RC"; printf '%s\n' "$OUT" | tail -3; }
|
|
273
|
+
|
|
251
274
|
# ── completion record (tracks/_meta/fh_completed_<date>.md) ──
|
|
252
275
|
# cl_setup <name> : a work clone that HAS a tracks/ dir (a consumer without one is skipped silently — L30)
|
|
253
276
|
cl_setup() { setup "$1"; mkgh "$T/$1"; mkdir -p "$T/$1/work/tracks"; }
|
|
@@ -39,12 +39,28 @@ echo "$OUT" | grep -qE 'R1-b .*MUT [0-9]+' \
|
|
|
39
39
|
|| ng "되돌림 프로브 출력 없음 — 지역 문턱의 하중을 아무도 안 쟀다"
|
|
40
40
|
|
|
41
41
|
echo "== CLI 계약 — self-test 밖에서 한 번 더 =="
|
|
42
|
+
# The isolation that matters is «no ffmpeg on PATH». `command -v python3` can be a shell shim (pyenv,
|
|
43
|
+
# asdf: `#!/usr/bin/env bash`) that dies with rc 127 once PATH is empty — before the code under test
|
|
44
|
+
# runs. So resolve the real interpreter first, with the normal PATH, and run THAT under the empty PATH.
|
|
45
|
+
real_py() { "$1" -c 'import sys; print(sys.executable)' 2>/dev/null; }
|
|
46
|
+
PY=$(real_py "$(command -v python3)")
|
|
47
|
+
[ -n "$PY" ] && [ -x "$PY" ] || { echo "ⓘ could not resolve the real python3 interpreter — setup broke (NOT a pass)"; exit 10; }
|
|
42
48
|
EMPTY=$(mktemp -d) || exit 10
|
|
43
|
-
OUT=$(cd plugins/fh-preprep/skills/preprep && PATH="$EMPTY" "$
|
|
44
|
-
rmdir "$EMPTY"
|
|
49
|
+
OUT=$(cd plugins/fh-preprep/skills/preprep && PATH="$EMPTY" "$PY" lane_speech_coach.py /nonexistent.wav 2>&1); RC=$?
|
|
45
50
|
[ "$RC" -eq 2 ] && echo "$OUT" | grep -q '통과 아님' \
|
|
46
51
|
&& ok "ffmpeg 없음 → rc 2 · «통과 아님」 (0 도 1 도 아니다)" \
|
|
47
52
|
|| ng "ffmpeg 없음이 rc=$RC 로 나간다: $(echo "$OUT" | tail -3)"
|
|
53
|
+
# control: a bash-shim python3 (the shape that broke this probe on pyenv) still reaches rc 2 through
|
|
54
|
+
# the same resolution — and the shim itself, run directly under the empty PATH, really does die
|
|
55
|
+
SHIM=$(mktemp -d) || exit 10
|
|
56
|
+
printf '#!/usr/bin/env bash\nexec "%s" "$@"\n' "$PY" > "$SHIM/python3"; chmod +x "$SHIM/python3"
|
|
57
|
+
SPY=$(PATH="$SHIM:$PATH" real_py "$SHIM/python3")
|
|
58
|
+
OUT=$(cd plugins/fh-preprep/skills/preprep && PATH="$EMPTY" "$SPY" lane_speech_coach.py /nonexistent.wav 2>&1); RC=$?
|
|
59
|
+
DIRECT=$(cd plugins/fh-preprep/skills/preprep && PATH="$EMPTY" "$SHIM/python3" lane_speech_coach.py /nonexistent.wav >/dev/null 2>&1; echo $?)
|
|
60
|
+
[ "$RC" -eq 2 ] && [ "$DIRECT" -ne 2 ] \
|
|
61
|
+
&& ok "셸 래퍼 python3 컨트롤: 해석기 해석 경유 rc 2 · 래퍼 직접 실행은 rc=$DIRECT (래퍼가 실제로 죽는 모양)" \
|
|
62
|
+
|| ng "셸 래퍼 컨트롤: 해석 경유 rc=$RC · 직접 rc=$DIRECT"
|
|
63
|
+
rm -rf "$SHIM"; rmdir "$EMPTY"
|
|
48
64
|
|
|
49
65
|
grep -q "lane_speech_coach" plugins/fh-preprep/skills/preprep/SKILL.md \
|
|
50
66
|
&& ok "명세: SKILL.md 가 이 레인을 적는다(고아 구현 아님)" \
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_prepush_guard_failure_visibility_lanes.sh — when a known pair in prepush_guard_check.sh breaks,
|
|
3
|
+
# the reader of a TRUNCATED log must still see which pair broke, its exit code and how long it ran.
|
|
4
|
+
#
|
|
5
|
+
# WHY. A downstream consumer reported `[prepush-guard] ❌ BLOCKED — a known pair broke.` from a 2h+
|
|
6
|
+
# selfcheck under heavy load, and nobody could say which pair: selfcheck printed only the last 12
|
|
7
|
+
# lines of the check, the BLOCKED line named nothing, and the failing pair's own ❌ line sat above
|
|
8
|
+
# the cut. The cause of that failure is still UNMEASURED; these lanes only guard the instrument, so
|
|
9
|
+
# that a recurrence can be read as a timeout (long elapsed) or a wrong verdict (short elapsed).
|
|
10
|
+
#
|
|
11
|
+
# HOW. A throwaway repo gets the real hook, scan library, pattern defaults and the check under test.
|
|
12
|
+
# One arm is left clean; the other has one planted defect: the stacked-branch advisory's marker is
|
|
13
|
+
# renamed in the hook, so every pair that expects a warning now gets none (a broken pair, on purpose).
|
|
14
|
+
# V1 clean arm passes and prints no BLOCKED line (control: the plant is what breaks it)
|
|
15
|
+
# V2 the plant really landed (application check: marker gone from the planted hook only)
|
|
16
|
+
# V3 planted arm exits 1
|
|
17
|
+
# V4 the last 12 lines name every broken pair, with rc= and an elapsed time
|
|
18
|
+
# V5 every pair line (✅ and ❌) carries an elapsed stamp [Ns]
|
|
19
|
+
# V6 selfcheck's own renderer (_show_failure, extracted from selfcheck.sh and run) shows the names
|
|
20
|
+
# V7 selfcheck's prepush-guard block renders through _show_failure, not a bare tail
|
|
21
|
+
# Control arm for the whole file: PG_SCRIPT=<older prepush_guard_check.sh> makes V4/V5 red.
|
|
22
|
+
#
|
|
23
|
+
# Usage: bash scripts/test_prepush_guard_failure_visibility_lanes.sh (exit 0 all pass, 1 otherwise)
|
|
24
|
+
set -uo pipefail
|
|
25
|
+
ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
|
|
26
|
+
PG_SCRIPT="${PG_SCRIPT:-$ROOT/scripts/prepush_guard_check.sh}"
|
|
27
|
+
SELFCHECK="${SELFCHECK:-$ROOT/scripts/selfcheck.sh}"
|
|
28
|
+
PASS=0; FAIL=0
|
|
29
|
+
ok() { echo " ✅ $1"; PASS=$((PASS+1)); }
|
|
30
|
+
no() { echo " ❌ $1"; FAIL=$((FAIL+1)); }
|
|
31
|
+
|
|
32
|
+
for f in "$PG_SCRIPT" "$SELFCHECK" "$ROOT/templates/.git-hooks/pre-push" "$ROOT/scripts/psa_scan_lib.sh" \
|
|
33
|
+
"$ROOT/.claude/rules/.public-surface-patterns.defaults"; do
|
|
34
|
+
[ -f "$f" ] || { echo "HARNESS-ERROR: missing $f"; exit 2; }
|
|
35
|
+
done
|
|
36
|
+
|
|
37
|
+
# shellcheck source=fixture_guard_lib.sh
|
|
38
|
+
. "$ROOT/scripts/fixture_guard_lib.sh"
|
|
39
|
+
WORK="$(fh_fixture_root "$(mktemp -d "${TMPDIR:-/tmp}/pg_vis.XXXXXX")")" || exit 2
|
|
40
|
+
: "${WORK:?fixture root unset — refusing to run git in cwd}"
|
|
41
|
+
trap 'rm -rf "$WORK"' EXIT
|
|
42
|
+
|
|
43
|
+
mkfix() { # mkfix <dir> — a repo the check can treat as REPO_ROOT
|
|
44
|
+
local d="$1"
|
|
45
|
+
mkdir -p "$d/scripts" "$d/templates/.git-hooks" "$d/.claude/rules"
|
|
46
|
+
cp "$PG_SCRIPT" "$d/scripts/prepush_guard_check.sh"
|
|
47
|
+
cp "$ROOT/scripts/psa_scan_lib.sh" "$d/scripts/psa_scan_lib.sh"
|
|
48
|
+
cp "$ROOT/templates/.git-hooks/pre-push" "$d/templates/.git-hooks/pre-push"
|
|
49
|
+
cp "$ROOT/.claude/rules/.public-surface-patterns.defaults" "$d/.claude/rules/.public-surface-patterns.defaults"
|
|
50
|
+
( cd "$d" && git init -q -b main && git config user.email t@example.com && git config user.name t \
|
|
51
|
+
&& git add scripts templates .claude && git commit -qm fix >/dev/null ) || return 1
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
CLEAN="$WORK/clean"; PLANT="$WORK/plant"
|
|
55
|
+
mkfix "$CLEAN" || { echo "HARNESS-ERROR: clean fixture"; exit 2; }
|
|
56
|
+
mkfix "$PLANT" || { echo "HARNESS-ERROR: planted fixture"; exit 2; }
|
|
57
|
+
# The plant: rename the warning marker on the line that announces a stacked branch (not the SKIPPED one).
|
|
58
|
+
MARK='[fh-advisory:stacked-branch] %s carries'
|
|
59
|
+
python3 - "$PLANT/templates/.git-hooks/pre-push" "$MARK" <<'PY'
|
|
60
|
+
import sys
|
|
61
|
+
p, m = sys.argv[1], sys.argv[2]
|
|
62
|
+
s = open(p, encoding="utf-8").read()
|
|
63
|
+
open(p, "w", encoding="utf-8").write(s.replace(m, "[fh-advisory:planted-off] %s carries"))
|
|
64
|
+
PY
|
|
65
|
+
( cd "$PLANT" && git add templates/.git-hooks/pre-push && git commit -qm plant >/dev/null )
|
|
66
|
+
|
|
67
|
+
# V2 application check
|
|
68
|
+
c_clean=$(grep -cF "$MARK" "$CLEAN/templates/.git-hooks/pre-push")
|
|
69
|
+
c_plant=$(grep -cF "$MARK" "$PLANT/templates/.git-hooks/pre-push")
|
|
70
|
+
if [ "$c_clean" -ge 1 ] && [ "$c_plant" -eq 0 ]; then ok "V2 plant applied (marker clean=$c_clean planted=$c_plant)"
|
|
71
|
+
else no "V2 plant not applied (marker clean=$c_clean planted=$c_plant) — later lanes would read nothing"; fi
|
|
72
|
+
|
|
73
|
+
out_clean="$(cd "$CLEAN" && bash scripts/prepush_guard_check.sh 2>&1)"; rc_clean=$?
|
|
74
|
+
out_plant="$(cd "$PLANT" && bash scripts/prepush_guard_check.sh 2>&1)"; rc_plant=$?
|
|
75
|
+
|
|
76
|
+
# V1
|
|
77
|
+
case "$out_clean" in
|
|
78
|
+
*"BLOCKED"*) no "V1 clean arm printed BLOCKED (rc=$rc_clean)" ;;
|
|
79
|
+
*) if [ "$rc_clean" -eq 0 ]; then ok "V1 clean arm passes (rc=0, no BLOCKED)"
|
|
80
|
+
else no "V1 clean arm rc=$rc_clean"; printf '%s\n' "$out_clean" | tail -8 | sed 's/^/ | /'; fi ;;
|
|
81
|
+
esac
|
|
82
|
+
|
|
83
|
+
# V3
|
|
84
|
+
if [ "$rc_plant" -eq 1 ]; then ok "V3 planted arm exits 1"; else no "V3 planted arm rc=$rc_plant (expected 1)"; fi
|
|
85
|
+
|
|
86
|
+
# Names of the broken pairs, as the per-pair ❌ lines print them (spaces squeezed; the elapsed stamp
|
|
87
|
+
# and everything after the em dash dropped).
|
|
88
|
+
names="$(printf '%s\n' "$out_plant" | python3 -c '
|
|
89
|
+
import re, sys
|
|
90
|
+
for line in sys.stdin:
|
|
91
|
+
m = re.match(r"^\s+❌ (.*?) (?:\[\d+s\] )?— ", line)
|
|
92
|
+
if m: print(re.sub(r" +", " ", m.group(1)).strip())
|
|
93
|
+
')"
|
|
94
|
+
n_names=$(printf '%s\n' "$names" | grep -c . || true)
|
|
95
|
+
tail12="$(printf '%s\n' "$out_plant" | tail -12)"
|
|
96
|
+
|
|
97
|
+
# V4 — each broken pair must appear in the BLOCKED line of the last 12 lines WITH its own
|
|
98
|
+
# «(rc=N, Ns)»: a summary naming every pair but carrying the numbers for only one would be decorative.
|
|
99
|
+
if [ "$n_names" -eq 0 ]; then
|
|
100
|
+
no "V4 planted arm printed no per-pair ❌ line — nothing to look for"
|
|
101
|
+
else
|
|
102
|
+
v4miss="$(TAIL="$tail12" NAMES="$names" python3 -c '
|
|
103
|
+
import os, re
|
|
104
|
+
blk = [l for l in os.environ["TAIL"].splitlines() if "BLOCKED" in l]
|
|
105
|
+
line = re.sub(r" +", " ", blk[-1]) if blk else ""
|
|
106
|
+
for nm in os.environ["NAMES"].splitlines():
|
|
107
|
+
if nm and not re.search(re.escape(nm) + r" \(rc=\d+, \d+s\)", line):
|
|
108
|
+
print(" | " + nm)
|
|
109
|
+
' | tr -d '\n')"
|
|
110
|
+
if [ -z "$v4miss" ]; then ok "V4 last 12 lines name all $n_names broken pair(s), each with (rc=, Ns)"
|
|
111
|
+
else no "V4 BLOCKED line in the last 12 lines lacks name+(rc=, Ns) for:$v4miss"; fi
|
|
112
|
+
fi
|
|
113
|
+
|
|
114
|
+
# V5
|
|
115
|
+
pair_lines=$(printf '%s\n' "$out_plant" | grep -E '^\s+(✅|❌) ' | grep -vE 'BLOCKED' || true)
|
|
116
|
+
n_pair=$(printf '%s\n' "$pair_lines" | grep -c . || true)
|
|
117
|
+
n_stamped=$(printf '%s\n' "$pair_lines" | grep -cE '\[[0-9]+s\]' || true)
|
|
118
|
+
if [ "$n_pair" -ge 10 ] && [ "$n_pair" -eq "$n_stamped" ]; then ok "V5 all $n_pair pair lines carry [Ns]"
|
|
119
|
+
else no "V5 pair lines stamped $n_stamped of $n_pair (want all, at least 10)"; fi
|
|
120
|
+
|
|
121
|
+
# V6 selfcheck's renderer, extracted and run on the planted output
|
|
122
|
+
fn="$(awk '/^_show_failure\(\) \{/{f=1} f{print} f&&/^\}/{exit}' "$SELFCHECK")"
|
|
123
|
+
if [ -z "$fn" ]; then
|
|
124
|
+
no "V6 _show_failure not found in selfcheck.sh"
|
|
125
|
+
else
|
|
126
|
+
shown="$(eval "$fn"; _show_failure "$out_plant" 2>&1)"
|
|
127
|
+
sq="$(printf '%s\n' "$shown" | sed 's/ */ /g')"
|
|
128
|
+
miss6=""
|
|
129
|
+
while IFS= read -r nm; do
|
|
130
|
+
[ -n "$nm" ] || continue
|
|
131
|
+
case "$sq" in *"$nm"*) ;; *) miss6="$miss6 | $nm" ;; esac
|
|
132
|
+
done <<EOF
|
|
133
|
+
$names
|
|
134
|
+
EOF
|
|
135
|
+
if [ "$n_names" -gt 0 ] && [ -z "$miss6" ]; then ok "V6 selfcheck renderer shows all broken pair names"
|
|
136
|
+
else no "V6 selfcheck renderer misses:${miss6:- (no names to check)}"; fi
|
|
137
|
+
fi
|
|
138
|
+
|
|
139
|
+
# V7 the prepush-guard block in selfcheck renders through _show_failure (comment lines ignored, so a
|
|
140
|
+
# commented-out call does not count; any tail -N in live lines is refused, not only tail -12)
|
|
141
|
+
blk="$(awk '/_pg_out="\$\(bash scripts\/prepush_guard_check.sh/{f=1} f{print} f&&/^fi$/{exit}' "$SELFCHECK" \
|
|
142
|
+
| grep -vE '^[[:space:]]*#' || true)"
|
|
143
|
+
if [ -z "$blk" ]; then no "V7 prepush-guard block not found in selfcheck.sh"
|
|
144
|
+
elif ! printf '%s\n' "$blk" | grep -m1 -E '^[[:space:]]*_show_failure "\$_pg_out"' >/dev/null; then
|
|
145
|
+
no "V7 selfcheck prepush block does not call _show_failure"
|
|
146
|
+
elif printf '%s\n' "$blk" | grep -m1 -E 'tail -[0-9]' >/dev/null; then
|
|
147
|
+
no "V7 selfcheck prepush block still truncates with tail -N"
|
|
148
|
+
else ok "V7 selfcheck prepush block renders through _show_failure"; fi
|
|
149
|
+
|
|
150
|
+
echo
|
|
151
|
+
echo "prepush-guard failure visibility: PASS=$PASS FAIL=$FAIL"
|
|
152
|
+
[ "$FAIL" -eq 0 ]
|