@chrono-meta/fh-gate 3.43.0 → 3.45.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/rules/fh_4axis_gate.md +50 -608
- package/.claude-plugin/marketplace.json +4 -4
- package/AGENTS.md +5 -1
- package/CATALOG.md +21 -0
- package/CHEATSHEET.md +7 -1
- package/docs/USER_GUIDE.md +95 -0
- package/docs/codex-compat.md +1 -1
- package/knowledge/shared/harness-core/fh_4axis_gate_detail.md +679 -0
- package/knowledge/shared/harness-core/fh_integration_contract.md +1 -1
- package/knowledge/shared/harness-core/fh_module_contract.md +106 -3
- package/knowledge/shared/harness-core/governance_engineering_definition.md +16 -0
- package/knowledge/shared/harness-core/heavy_skill_to_cartridge.md +185 -0
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +221 -0
- package/knowledge/shared/plugin-catalog/recommended_plugins.md +53 -9
- package/package.json +24 -1
- package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +50 -14
- package/plugins/fh-commons/skills/ko-tech-writer/SKILL_detail.md +80 -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 +118 -0
- package/plugins/fh-meta/skills/auto-decorrelation/SKILL.md +58 -1
- package/plugins/fh-meta/skills/install-wizard/SKILL_detail.md +4 -0
- package/plugins/fh-meta/skills/sim-conductor/SKILL_detail.md +3 -3
- package/plugins/fh-meta/skills/steel-quench/SKILL_detail.md +9 -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 +165 -0
- package/scripts/agy_remote_run.sh +187 -0
- package/scripts/below_floor_scan.sh +30 -0
- package/scripts/codex_launch_guard.sh +123 -0
- package/scripts/correction_moments.py +23 -2
- package/scripts/fh-gate.sh +612 -14
- package/scripts/fh-goal.sh +56 -12
- package/scripts/fh-run.sh +1 -1
- package/scripts/fh_gate_exec.sh +272 -0
- package/scripts/fh_session_load.sh +17 -0
- package/scripts/finding_fleet.sh +36 -2
- package/scripts/finding_verifier.sh +7 -2
- package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/README.md +16 -0
- package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/scripts/check_refs.py +12 -0
- package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/scripts/test_check_refs.py +24 -0
- package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/skills/tidy-notes/SKILL.md +16 -0
- package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/skills/tidy-notes/fh-module.yaml +20 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/SKILL.md +25 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/hooks/hooks.json +7 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/check_links.py +25 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/publish.sh +9 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/publish_guard.py +6 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/setup.sh +5 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/SKILL.md +25 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/hooks/hooks.json +10 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/check_refs.py +12 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/guard_push.py +9 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/install.sh +6 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/ship.sh +9 -0
- package/scripts/heavy_skill_smell.py +311 -0
- package/scripts/job_heartbeat.py +186 -0
- package/scripts/ko_tech_writer_calibrate.py +88 -1
- package/scripts/live_eval_matrix.py +128 -0
- package/scripts/live_eval_trace.py +199 -5
- package/scripts/package_coverage_check.sh +18 -0
- package/scripts/prepush_guard_check.sh +41 -20
- package/scripts/probe_live_eval.sh +33 -1
- package/scripts/probe_live_eval_lib.py +14 -6
- package/scripts/selfcheck.sh +162 -2
- package/scripts/selfcheck_shard_weights.txt +2 -0
- package/scripts/session_checklist.py +109 -5
- package/scripts/sidecar_calibrate.sh +15 -5
- package/scripts/sidecar_wait.sh +21 -1
- package/scripts/sim_isolated_run.sh +20 -0
- package/scripts/test_agy_launch_guard_lanes.sh +347 -0
- package/scripts/test_agy_remote_run_lanes.sh +228 -0
- package/scripts/test_below_floor_scan_lanes.sh +85 -0
- package/scripts/test_codex_launch_guard_lanes.sh +183 -0
- package/scripts/test_correction_moments_lanes.sh +37 -0
- package/scripts/test_fh_gate_absorb_lanes.sh +255 -0
- package/scripts/test_fh_gate_defaults_lanes.sh +169 -0
- package/scripts/test_fh_gate_exec_lanes.sh +244 -0
- package/scripts/test_fh_gate_fusion_lanes.sh +202 -0
- package/scripts/test_fh_gate_regressions.sh +92 -1
- package/scripts/test_fh_goal_change_detection_lanes.sh +103 -3
- package/scripts/test_finding_pipeline_lanes.sh +41 -3
- package/scripts/test_guard_anchor_override_env_lanes.sh +84 -0
- package/scripts/test_heavy_skill_smell_lanes.sh +160 -0
- package/scripts/test_job_heartbeat_lanes.sh +96 -0
- package/scripts/test_live_eval_construct_lanes.sh +29 -6
- package/scripts/test_live_eval_matrix_lanes.sh +53 -0
- package/scripts/test_live_eval_trace_lanes.sh +165 -12
- package/scripts/test_name_boundary_locale_lanes.sh +36 -5
- package/scripts/test_preprep_speech_coach_lanes.sh +18 -2
- package/scripts/test_prepush_guard_failure_visibility_lanes.sh +152 -0
- package/scripts/test_prepush_marker_lookup_lanes.sh +143 -0
- package/scripts/test_probe_live_eval_lanes.sh +43 -0
- package/scripts/test_regression_guard_sibling_lanes.sh +52 -1
- package/scripts/test_session_checklist_lanes.sh +205 -0
- package/scripts/test_sidecar_calibrate_lanes.sh +5 -1
- package/scripts/test_sidecar_wait_stdin.sh +18 -0
- package/scripts/test_sim_isolated_run_lanes.sh +43 -0
- package/scripts/universal_guard_check.sh +8 -0
- package/templates/.claude/rules/mcp_tool_gating.md +27 -0
- package/templates/.git-hooks/pre-push +60 -3
- package/templates/regression_guard.sh +8 -4
- package/templates/settings.LaneGap.snippet.json +27 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Lanes for scripts/live_eval_matrix.py (per-probe verdicts across nightly reports, record only).
|
|
3
|
+
# Known pair: a probe that never passed must land in never-pass; one that always passed in always-pass.
|
|
4
|
+
# Shapes that must NOT read as a bin: a probe that did not run (UNCALIBRATED / FAILED-TO-RUN) is not a FAIL,
|
|
5
|
+
# a probe with fewer than 2 scored reports is too-few, a file without a run table is named unreadable.
|
|
6
|
+
set -u
|
|
7
|
+
FH="$(cd "$(dirname "$0")/.." && pwd)"
|
|
8
|
+
S="$FH/scripts/live_eval_matrix.py"
|
|
9
|
+
T=$(mktemp -d); trap 'rm -rf "$T"' EXIT
|
|
10
|
+
pass=0; fail=0
|
|
11
|
+
ok() { if eval "$2"; then pass=$((pass+1)); else fail=$((fail+1)); echo "FAIL $1"; fi; }
|
|
12
|
+
|
|
13
|
+
rep() { # rep <date> <id:verdict>...
|
|
14
|
+
local f="$T/r/live_eval_$1.md"; shift
|
|
15
|
+
{ echo "# live eval"; echo; echo "| id | verdict | note |"; echo "|---|---|---|"
|
|
16
|
+
for kv in "$@"; do echo "| ${kv%%:*} | ${kv#*:} | x |"; done; } > "$f"
|
|
17
|
+
}
|
|
18
|
+
mkdir -p "$T/r"
|
|
19
|
+
rep 2026-11-01 G-ALW:PASS G-NEV:FAIL G-MIX:PASS G-RUN:FAIL G-ONE:PASS
|
|
20
|
+
rep 2026-11-02 G-ALW:PASS G-NEV:FAIL G-MIX:FAIL G-RUN:FAILED-TO-RUN
|
|
21
|
+
rep 2026-11-03 G-ALW:PASS G-NEV:FAIL G-MIX:PASS G-RUN:UNCALIBRATED "G-ONE:NOT-LIVE-MEASURABLE (no tool)"
|
|
22
|
+
printf '# live eval\n\nno table here\n' > "$T/r/live_eval_2026-11-04.md"
|
|
23
|
+
printf '| G-ALW | FAIL | x |\n' > "$T/r/live_eval_stratify_RESULT_2026-11-05.md" # not a nightly report name
|
|
24
|
+
|
|
25
|
+
out=$(python3 "$S" --dir "$T/r"); rc=$?
|
|
26
|
+
ok M1-rc0 '[ $rc -eq 0 ]'
|
|
27
|
+
ok M2-never-pass 'grep -qx "never-pass: 1 — G-NEV" <<<"$out"'
|
|
28
|
+
ok M3-always-pass 'grep -qx "always-pass: 1 — G-ALW" <<<"$out"'
|
|
29
|
+
ok M4-mixed 'grep -qx "mixed: 1 — G-MIX" <<<"$out"'
|
|
30
|
+
# G-RUN: one FAIL + two not-run reports → too-few, never never-pass
|
|
31
|
+
ok M5-notrun-not-fail 'grep -qx "too-few: 2 — G-ONE, G-RUN" <<<"$out"'
|
|
32
|
+
ok M6-row-cells 'grep -Eq "^G-RUN +FRU +pass=0 fail=1 not-scored=2 absent=0 +too-few$" <<<"$out"'
|
|
33
|
+
# G-ONE: absent on 11-02 (.), present with an out-of-enum verdict on 11-03 (N) — not absent
|
|
34
|
+
ok M7-absent-vs-oos 'grep -Eq "^G-ONE +P\.N +pass=1 fail=0 not-scored=1 absent=1 +too-few$" <<<"$out"'
|
|
35
|
+
ok M8-unreadable 'grep -q "reports unreadable or without a run table: 1 — live_eval_2026-11-04.md" <<<"$out"'
|
|
36
|
+
ok M9-name-filter 'grep -q "reports read: 3 (2026-11-01 .. 2026-11-03)" <<<"$out"'
|
|
37
|
+
|
|
38
|
+
mkdir -p "$T/empty"
|
|
39
|
+
out=$(python3 "$S" --dir "$T/empty"); rc=$?
|
|
40
|
+
ok M10-empty-not-zero '[ $rc -eq 0 ] && grep -q "not measured, not zero" <<<"$out" && ! grep -q "^never-pass" <<<"$out"'
|
|
41
|
+
|
|
42
|
+
python3 "$S" --dir "$T/nope" >/dev/null 2>&1; rc=$?
|
|
43
|
+
ok M11-missing-dir '[ $rc -eq 10 ]'
|
|
44
|
+
python3 "$S" --bogus >/dev/null 2>&1; rc=$?
|
|
45
|
+
ok M12-bad-arg '[ $rc -eq 10 ]'
|
|
46
|
+
|
|
47
|
+
# exit code ignores bins: a folder that is all never-pass still exits 0
|
|
48
|
+
mkdir -p "$T/bad"; cp "$T/r/live_eval_2026-11-01.md" "$T/bad/"; cp "$T/r/live_eval_2026-11-02.md" "$T/bad/"
|
|
49
|
+
python3 "$S" --dir "$T/bad" >/dev/null; rc=$?
|
|
50
|
+
ok M13-no-verdict-rc '[ $rc -eq 0 ]'
|
|
51
|
+
|
|
52
|
+
echo "live_eval_matrix lanes: pass=$pass fail=$fail"
|
|
53
|
+
[ $fail -eq 0 ]
|
|
@@ -13,17 +13,26 @@
|
|
|
13
13
|
# TR8 the runner refuses --trace with --turns (rc 2), never ignores it
|
|
14
14
|
# TR13 ablation_calibrate.sh (direct claude -p measurement path) pins MCP in every arm
|
|
15
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
|
+
# TR23 the INVALID reason names the elements not in every arm (mcp · plugin · two versions), full lists kept; TR15 has none
|
|
22
|
+
# TR24 revert probe: surface_diff → '' drops the named plugin → TR23 would be red
|
|
16
23
|
set -u
|
|
24
|
+
. "$(dirname "${BASH_SOURCE[0]}")/fixture_guard_lib.sh" # scrub inherited GIT_* env first (#1088); TR19's fixture names `git status` as data
|
|
17
25
|
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
18
26
|
LIB="${LIVE_EVAL_LIB_DIR:-$HERE}"
|
|
19
|
-
pass=0; fail=0; ok(){ pass=$((pass+1)); echo " ✅ $1"; }; bad(){ fail=$((fail+1)); echo " ❌ $1"; }
|
|
27
|
+
pass=0; fail=0; skipped=0; ok(){ pass=$((pass+1)); echo " ✅ $1"; }; bad(){ fail=$((fail+1)); echo " ❌ $1"; }
|
|
20
28
|
T="$(mktemp -d)"; trap 'rm -rf "$T"' EXIT
|
|
21
29
|
|
|
22
30
|
python3 "$HERE/live_eval_trace.py" extract /dev/null /dev/null /dev/null >/dev/null 2>&1; [ $? -eq 3 ] \
|
|
23
31
|
&& ok "TR0 the shipped file runs by its own path (empty stream → rc 3)" || bad "TR0 direct run"
|
|
24
32
|
if [ -n "${LIVE_TRACE_REAL:-}" ]; then
|
|
25
33
|
r=$(python3 "$HERE/live_eval_trace.py" extract "$LIVE_TRACE_REAL" "$T/real.txt" "$T/real.tools" ; echo "rc=$?")
|
|
26
|
-
grep -q '^tools=.*Read' "$T/real.tools" && [ -s "$T/real.txt" ] &&
|
|
34
|
+
grep -q '^tools=.*Read' "$T/real.tools" && [ -s "$T/real.txt" ] && grep -q '| plugins=\[' "$T/real.tools" \
|
|
35
|
+
&& echo " ℹ️ TR0b real stream shape read, plugin list included ($r)" \
|
|
27
36
|
|| echo " ⚠️ TR0b real stream NOT read ($r) — fixtures may not match the real shape"
|
|
28
37
|
else
|
|
29
38
|
echo " ℹ️ TR0b real-shape re-check UNMEASURED this run (LIVE_TRACE_REAL unset) — not a pass"
|
|
@@ -33,10 +42,19 @@ fi
|
|
|
33
42
|
cat > "$T/mk.py" <<'PY'
|
|
34
43
|
import json, sys
|
|
35
44
|
f, tools, mcp, res = sys.argv[1:5]
|
|
45
|
+
import os
|
|
36
46
|
ev = [{"type": "system", "subtype": "hook_started", "hook_name": "SessionStart"}]
|
|
37
47
|
if tools != "NOINIT":
|
|
38
|
-
|
|
39
|
-
|
|
48
|
+
init = {"type": "system", "subtype": "init", "tools": [t for t in tools.split(",") if t],
|
|
49
|
+
"mcp_servers": [{"name": m.split(":")[0], "status": (m.split(":") + ["connected"])[1]} for m in mcp.split(",") if m]}
|
|
50
|
+
# MK_PLUGINS: unset/empty = no plugins key (older shape); "-" = empty list; else csv of
|
|
51
|
+
# source[=version] — the real init carries {name, path, source, version?} per plugin.
|
|
52
|
+
pl = os.environ.get("MK_PLUGINS", "")
|
|
53
|
+
if pl:
|
|
54
|
+
init["plugins"] = [] if pl == "-" else [
|
|
55
|
+
dict({"name": x.split("=")[0].split("@")[0], "path": "/fixture", "source": x.split("=")[0]},
|
|
56
|
+
**({"version": x.split("=")[1]} if "=" in x else {})) for x in pl.split(",")]
|
|
57
|
+
ev.append(init)
|
|
40
58
|
# call forms: Read=path · ERR:Read=path (tool_result is_error) · SUB:Read=path (inside a subagent)
|
|
41
59
|
for n, c in enumerate(sys.argv[5:]):
|
|
42
60
|
flag = ""
|
|
@@ -58,7 +76,7 @@ mk "$T/a.jsonl" "Read,Grep,Glob" "" "CATALOG says x" Read=CATALOG.md
|
|
|
58
76
|
python3 "$HERE/live_eval_trace.py" extract "$T/a.jsonl" "$T/a.txt" "$T/a.tools"; xrc=$?
|
|
59
77
|
printf '%s\n' '{"type":"system","subtype":"init","tools":["Read"]}' > "$T/nores.jsonl"
|
|
60
78
|
python3 "$HERE/live_eval_trace.py" extract "$T/nores.jsonl" "$T/n.txt" "$T/n.tools"; nrc=$?
|
|
61
|
-
[ $xrc -eq 0 ] && [ "$(cat "$T/a.txt")" = "CATALOG says x" ] && grep -qx 'tools=Glob,Grep,Read | mcp=' "$T/a.tools" \
|
|
79
|
+
[ $xrc -eq 0 ] && [ "$(cat "$T/a.txt")" = "CATALOG says x" ] && grep -qx 'tools=Glob,Grep,Read | mcp= | plugins=UNKNOWN' "$T/a.tools" \
|
|
62
80
|
&& [ $nrc -eq 3 ] && [ ! -s "$T/n.txt" ] \
|
|
63
81
|
&& ok "TR1 extract writes result + inventory; no result event → rc 3, empty text" \
|
|
64
82
|
|| bad "TR1 xrc=$xrc nrc=$nrc txt=$(cat "$T/a.txt") tools=$(cat "$T/a.tools")"
|
|
@@ -69,9 +87,11 @@ build(){ local root="$1" pid="$2" reps="$3" ps="$4" cs="$5" i arm spec
|
|
|
69
87
|
for i in $(seq 1 "$reps"); do
|
|
70
88
|
for arm in primary control; do
|
|
71
89
|
[ $arm = primary ] && spec="$ps" || spec="$cs"
|
|
72
|
-
IFS='|' read -r tl mc tx calls <<<"$spec"
|
|
90
|
+
IFS='|' read -r tl mc tx calls pl <<<"$spec"
|
|
91
|
+
# 5th field = plugins for rep 1 only when it starts with «r1:» (a set that changed in one rep)
|
|
92
|
+
case "$pl" in r1:*) if [ "$i" -eq 1 ]; then pl="${pl#r1:}"; else pl="${PL_BASE:-}"; fi ;; esac
|
|
73
93
|
printf '%s' "$tx" > "$root/$pid/${arm}_r$i.txt"
|
|
74
|
-
if [ "$tl" != "-" ]; then set -f; mk "$root/$pid/${arm}_r$i.stream.jsonl" "$tl" "$mc" "$tx" $calls; set +f; fi
|
|
94
|
+
if [ "$tl" != "-" ]; then set -f; MK_PLUGINS="$pl" mk "$root/$pid/${arm}_r$i.stream.jsonl" "$tl" "$mc" "$tx" $calls; set +f; fi
|
|
75
95
|
done
|
|
76
96
|
done; }
|
|
77
97
|
score(){ python3 - "$LIB" "$1" "$2" "$3" "${4:-}" <<'PY'
|
|
@@ -106,7 +126,7 @@ m=$(score "$T/old" P 'read=CATALOG\.md'); m0=$(score "$T/old" P '')
|
|
|
106
126
|
|
|
107
127
|
build "$T/inv" P 3 "Read,Grep,Glob|drive,wiki|CATALOG has it|Read=CATALOG.md" "$RT||오늘 맑아|"
|
|
108
128
|
v=$(score "$T/inv" P 'read=CATALOG\.md')
|
|
109
|
-
[[ "$v" == "INVALID-COMPARISON MENTION-ONLY INVALID-COMPARISON None "* || "$v" == "INVALID-COMPARISON BEHAVIOUR INVALID-COMPARISON None "* ]] && [[ "$v" == *"different tool/MCP lists"* ]] \
|
|
129
|
+
[[ "$v" == "INVALID-COMPARISON MENTION-ONLY INVALID-COMPARISON None "* || "$v" == "INVALID-COMPARISON BEHAVIOUR INVALID-COMPARISON None "* ]] && [[ "$v" == *"different tool/MCP/plugin lists"* ]] \
|
|
110
130
|
&& ok "TR6 arms with different tool/MCP lists → INVALID-COMPARISON, no pass_rate" || bad "TR6 [$v]"
|
|
111
131
|
|
|
112
132
|
b=$(score "$T/did" P 'reads=CATALOG')
|
|
@@ -138,8 +158,141 @@ hf=$(score "$T/half" P 'read=CATALOG\.md')
|
|
|
138
158
|
|
|
139
159
|
# TR13 the direct `claude -p` measurement path (not via sim_isolated_run) pins MCP in all three arms.
|
|
140
160
|
# Static check of the argv only — a pin is not proof; the recorded tool list (TR6/TR11) is the defence.
|
|
141
|
-
|
|
142
|
-
|
|
161
|
+
# 🟥 The subject is hub-only: `ablation_calibrate.sh` is not in package.json's files[] and
|
|
162
|
+
# package_coverage_check.sh carries it as an accepted absence, while THIS suite ships. Measured
|
|
163
|
+
# 2026-11-16 in the extracted npm pack (clean-room audit round 9): the grep hit a missing file, npin
|
|
164
|
+
# came back empty, and the lane printed `TR13 pinned arms=/3` — a red about a subject that is not in
|
|
165
|
+
# the tree, plus `lane count 18 != 19`, in a tree whose owner did nothing wrong. Two arms now: inside
|
|
166
|
+
# a checkout the subject MUST be there, so its absence stays red (the subject is gone, not unshipped);
|
|
167
|
+
# outside a checkout it is a named SKIP, which is not a pass and is counted as its own thing.
|
|
168
|
+
if [ -f "$HERE/ablation_calibrate.sh" ]; then
|
|
169
|
+
npin=$(grep -cE '^ (allowlist|denylist|baseline)\) +FLAGS=\(.*--strict-mcp-config' "$HERE/ablation_calibrate.sh")
|
|
170
|
+
[ "$npin" -eq 3 ] && ok "TR13 ablation_calibrate.sh pins MCP (--strict-mcp-config) in all 3 arms" || bad "TR13 pinned arms=$npin/3"
|
|
171
|
+
# 🟥 The checkout test here is `.git` presence, NOT a git call — and that asymmetry with
|
|
172
|
+
# test_name_boundary_locale_lanes.sh (which does call `git ls-files`, and sources fixture_guard_lib.sh
|
|
173
|
+
# for it) is deliberate. This suite called no git at all before, and `test_fixture_guard_coverage_lanes.sh`
|
|
174
|
+
# L-live requires every git-calling lane to source that guard first (#1088); a `git rev-parse` added
|
|
175
|
+
# here made this file UNGUARDED and turned that lane red — caught by the full local selfcheck run
|
|
176
|
+
# before the push, not by CI. `.git` present also answers the only question this lane has (is this
|
|
177
|
+
# tree a checkout of itself, or an unpacked package), without inheriting GIT_* from the caller.
|
|
178
|
+
elif [ -e "$HERE/../.git" ]; then
|
|
179
|
+
bad "TR13 ablation_calibrate.sh is missing from this CHECKOUT — the subject is gone, not merely unshipped"
|
|
180
|
+
else
|
|
181
|
+
skipped=$((skipped+1))
|
|
182
|
+
echo " ⏭️ SKIP TR13 — ablation_calibrate.sh is hub-only (not in files[]) and this tree is not a checkout, so the argv it pins cannot be read here. Not a pass"
|
|
183
|
+
fi
|
|
143
184
|
|
|
144
|
-
|
|
145
|
-
|
|
185
|
+
# ── plugins (2026-11-15): the nightly's G-GREET-01 / G-TRIG-05 had tools and MCP equal in every arm and
|
|
186
|
+
# one rep (primary_r1) with one extra builtin plugin; the scorer reported «1 distinct». Names below are
|
|
187
|
+
# synthetic — the shape (source@version, builtin with no version) is the real init's.
|
|
188
|
+
PB='fx-core@hub=3.42.0,fx-lsp@official=1.0.0,fx-telemetry@builtin'
|
|
189
|
+
PL_BASE="$PB" build "$T/plg" P 3 "$RT||CATALOG has it|Read=CATALOG.md|r1:$PB,fx-chart@builtin" "$RT||오늘 맑아||$PB"
|
|
190
|
+
pg=$(score "$T/plg" P 'read=CATALOG\.md')
|
|
191
|
+
[[ "$pg" == INVALID-COMPARISON* ]] && [[ "$pg" == *"saw 2 different"*"plugin lists"* ]] && [[ "$pg" != *UNKNOWN* ]] \
|
|
192
|
+
&& ok "TR14 one rep with an extra plugin (tools/MCP equal) → INVALID-COMPARISON" || bad "TR14 [$pg]"
|
|
193
|
+
build "$T/plq" P 3 "$RT||CATALOG has it|Read=CATALOG.md|$PB" "$RT||오늘 맑아||$PB"
|
|
194
|
+
pq=$(score "$T/plq" P 'read=CATALOG\.md')
|
|
195
|
+
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
|
|
196
|
+
build "$T/plr" P 3 "$RT||CATALOG has it|Read=CATALOG.md|$PB" "$RT||오늘 맑아||$PR"
|
|
197
|
+
pr=$(score "$T/plr" P 'read=CATALOG\.md')
|
|
198
|
+
[[ "$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]"
|
|
199
|
+
build "$T/plv" P 3 "$RT||CATALOG has it|Read=CATALOG.md|${PB/3.42.0/3.43.0}" "$RT||오늘 맑아||$PB"
|
|
200
|
+
pv=$(score "$T/plv" P 'read=CATALOG\.md')
|
|
201
|
+
[[ "$pv" == INVALID-COMPARISON* ]] && [[ "$pv" == *"saw 2 different"* ]] && [[ "$pv" != *UNKNOWN* ]] && ok "TR16 same plugin, different version → INVALID-COMPARISON" || bad "TR16 [$pv]"
|
|
202
|
+
build "$T/plu" P 3 "$RT||CATALOG has it|Read=CATALOG.md|$PB" "$RT||오늘 맑아|"
|
|
203
|
+
pu=$(score "$T/plu" P 'read=CATALOG\.md')
|
|
204
|
+
build "$T/ple" P 3 "$RT||CATALOG has it|Read=CATALOG.md|-" "$RT||오늘 맑아|"
|
|
205
|
+
pe=$(score "$T/ple" P 'read=CATALOG\.md')
|
|
206
|
+
[[ "$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]"
|
|
207
|
+
mkdir -p "$T/mut2"; cp "$LIB/probe_live_eval_lib.py" "$T/mut2/"
|
|
208
|
+
sed "s/^\( *\)plug = 'UNKNOWN' if trace.get('plugins') is None else ','.join(trace\['plugins'\])$/\1plug = ''/" \
|
|
209
|
+
"$LIB/live_eval_trace.py" > "$T/mut2/live_eval_trace.py"
|
|
210
|
+
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)"
|
|
211
|
+
else mp=$(LIB="$T/mut2" score "$T/plg" P 'read=CATALOG\.md')
|
|
212
|
+
[[ "$mp" == "PASS "* ]] && ok "TR18 revert probe: inventory without plugins → TR14's pair scores PASS (TR14 would be red)" || bad "TR18 mutant still [$mp]"; fi
|
|
213
|
+
|
|
214
|
+
# ── behaviour profile (2026-11-17, record only): top-level calls in explore · edit · test-run · other.
|
|
215
|
+
# mk2 <file> <json list of [name, input, flag]> [noresult] — flag "SUB" = inside a subagent
|
|
216
|
+
cat > "$T/mk2.py" <<'PY'
|
|
217
|
+
import json, sys
|
|
218
|
+
f, calls = sys.argv[1], json.loads(sys.argv[2])
|
|
219
|
+
ev = [{"type": "system", "subtype": "init", "tools": ["Read", "Bash"], "mcp_servers": []}]
|
|
220
|
+
for n, (name, inp, flag) in enumerate(calls):
|
|
221
|
+
a = {"type": "assistant", "message": {"content": [{"type": "tool_use", "id": "b%d" % n, "name": name, "input": inp}]}}
|
|
222
|
+
if flag == "SUB":
|
|
223
|
+
a["parent_tool_use_id"] = "task0"
|
|
224
|
+
ev.append(a)
|
|
225
|
+
ev.append({"type": "user", "message": {"content": [{"type": "tool_result", "tool_use_id": "b%d" % n}]}})
|
|
226
|
+
if len(sys.argv) < 4:
|
|
227
|
+
ev.append({"type": "result", "subtype": "success", "result": "done"})
|
|
228
|
+
open(f, "w").write("".join(json.dumps(e) + "\n" for e in ev))
|
|
229
|
+
PY
|
|
230
|
+
B='[["Read",{"file_path":"a.md"},""],["Edit",{"file_path":"a.md"},""],["Write",{"file_path":"b.md"},""],
|
|
231
|
+
["Bash",{"command":"pytest -q tests/"},""],["Bash",{"command":"bash scripts/test_x_lanes.sh"},""],
|
|
232
|
+
["Bash",{"command":"echo hi > out.txt"},""],["Bash",{"command":"sed -i s/a/b/ f.txt"},""],
|
|
233
|
+
["Bash",{"command":"cd /x && git status --short"},""],["Bash",{"command":"ls tracks 2>/dev/null"},""],
|
|
234
|
+
["Bash",{"command":"cat f 2>&1 | head -3"},""],["Bash",{"command":"python3 build.py"},""],["Agent",{"prompt":"x"},""],
|
|
235
|
+
["Edit",{"file_path":"c.md"},"SUB"],["Bash",{"command":"pytest"},"SUB"]]'
|
|
236
|
+
python3 "$T/mk2.py" "$T/bp.jsonl" "$B"
|
|
237
|
+
bp=$(python3 "$HERE/live_eval_trace.py" profile "$T/bp.jsonl"; echo "rc=$?")
|
|
238
|
+
[ "$bp" = "explore=4 edit=4 test-run=2 other=2 total=12
|
|
239
|
+
rc=0" ] && ok "TR19 profile bins: one known call per rule; redirects to /dev/null and 2>&1 stay explore; subagent calls not counted" \
|
|
240
|
+
|| bad "TR19 [$bp]"
|
|
241
|
+
python3 "$T/mk2.py" "$T/bpn.jsonl" '[["Read",{"file_path":"a.md"},""]]' noresult
|
|
242
|
+
bn=$(python3 "$HERE/live_eval_trace.py" profile "$T/bpn.jsonl"); bu=$(python3 "$HERE/live_eval_trace.py" profile "$T/absent.jsonl"; echo "rc=$?")
|
|
243
|
+
[ "$bn" = "explore=1 edit=0 test-run=0 other=0 total=1 result=MISSING (counts are a lower bound)" ] \
|
|
244
|
+
&& [ "$bu" = "trace=UNREADABLE
|
|
245
|
+
rc=3" ] && ok "TR20 no result event → counts marked a lower bound; unreadable stream → trace=UNREADABLE rc 3, never 0" \
|
|
246
|
+
|| bad "TR20 noresult=[$bn] absent=[$bu]"
|
|
247
|
+
# TR21 revert probe. Three conditions, each its own failure: the original carries the exclusion, the
|
|
248
|
+
# mutation removed it, and the mutant RAN (rc 0) — so «counts changed» cannot come from a crash or a no-op.
|
|
249
|
+
mkdir -p "$T/mut3"; sed 's|(?!/dev/null\\b)||' "$LIB/live_eval_trace.py" > "$T/mut3/live_eval_trace.py"
|
|
250
|
+
if ! grep -q '(?!/dev/null' "$LIB/live_eval_trace.py"; then bad "TR21 the original has no /dev/null exclusion to revert"
|
|
251
|
+
elif grep -q '(?!/dev/null' "$T/mut3/live_eval_trace.py"; then bad "TR21 mutation did not apply (instrument error, not a pass)"
|
|
252
|
+
else mb=$(python3 "$T/mut3/live_eval_trace.py" profile "$T/bp.jsonl"); mrc=$?
|
|
253
|
+
[ $mrc -eq 0 ] && [ "$mb" = "explore=3 edit=5 test-run=2 other=2 total=12" ] \
|
|
254
|
+
&& ok "TR21 revert probe: without the /dev/null exclusion, 2>/dev/null reads as an edit → TR19 would be red" \
|
|
255
|
+
|| bad "TR21 mutant rc=$mrc [$mb]"; fi
|
|
256
|
+
# TR22 (codex R1): naming a test file as data is not a test run; sed -Ei / --in-place are edits;
|
|
257
|
+
# a wrapper (timeout N / env) does not hide the runner.
|
|
258
|
+
B2='[["Bash",{"command":"cat tests/test_example.py"},""],["Bash",{"command":"grep -n x scripts/test_y_lanes.sh"},""],
|
|
259
|
+
["Bash",{"command":"sed -Ei s/a/b/ f"},""],["Bash",{"command":"sed --in-place s/a/b/ f"},""],["Bash",{"command":"sed -n 1p f"},""],
|
|
260
|
+
["Bash",{"command":"timeout 60 bash scripts/selfcheck.sh"},""],["Bash",{"command":"env A=1 python3 -m pytest -q"},""],
|
|
261
|
+
["Bash",{"command":"./scripts/test_z.sh"},""],["Bash",{"command":"npm run test"},""]]'
|
|
262
|
+
python3 "$T/mk2.py" "$T/bp2.jsonl" "$B2"
|
|
263
|
+
b2=$(python3 "$HERE/live_eval_trace.py" profile "$T/bp2.jsonl")
|
|
264
|
+
[ "$b2" = "explore=3 edit=2 test-run=4 other=0 total=9" ] \
|
|
265
|
+
&& ok "TR22 reading a test file stays explore; sed -Ei/--in-place are edits; timeout/env wrappers keep the runner visible" \
|
|
266
|
+
|| bad "TR22 [$b2]"
|
|
267
|
+
|
|
268
|
+
# the count has to add the named skips, or a lane that correctly declined would read as a lane that
|
|
269
|
+
# silently did not run — which is the thing this counter exists to catch.
|
|
270
|
+
# ── TR23 (2026-11-20 weekly audit): the INVALID reason names what differs. The nightly printed two
|
|
271
|
+
# 840-character plugin lists side by side and left the diff to a human — INVALID rose 0→3 of 12 over
|
|
272
|
+
# 11-17..11-20 and nobody had named the plugin (real 11-20 streams: cc-plugin-easel@builtin in some arms). The reason must carry the elements that are not in
|
|
273
|
+
# every arm, before the full lists (which stay — nothing hidden or shortened).
|
|
274
|
+
# TR6 shape : MCP drive,wiki in one arm only → «not in every arm: mcp=drive:connected,wiki:connected»
|
|
275
|
+
# TR14 shape : one extra builtin plugin in one rep → «plugins=fx-chart@builtin»
|
|
276
|
+
# TR16 shape : same plugin, two versions → both versions named
|
|
277
|
+
# control : TR15 (same set) carries no such clause
|
|
278
|
+
if [[ "$v" == *"not in every arm: "*"mcp=drive:connected,wiki:connected — tools="* ]] && [[ "$pg" == *"not in every arm: plugins=fx-chart@builtin — "* ]] \
|
|
279
|
+
&& [[ "$pv" == *"not in every arm: plugins=fx-core@hub=3.42.0,fx-core@hub=3.43.0 — "* ]] \
|
|
280
|
+
&& [[ "$pg" == *"plugins="*" ≠ tools="* ]] \
|
|
281
|
+
&& [[ "$pq" != *"not in every arm"* ]] && [[ "$pr" != *"not in every arm"* ]]; then
|
|
282
|
+
ok "TR23 INVALID-COMPARISON names the elements not in every arm (TR6 mcp · TR14 plugin · TR16 versions); TR15 control has none"
|
|
283
|
+
else bad "TR23 v=[${v#*|}] pg=[${pg#*|}] pv=[${pv#*|}]"; fi
|
|
284
|
+
|
|
285
|
+
# TR24 revert probe for TR23: surface_diff returning '' must turn TR14's reason back into a bare list pair
|
|
286
|
+
mkdir -p "$T/mut3"; cp "$LIB/probe_live_eval_lib.py" "$T/mut3/"
|
|
287
|
+
sed "s/^\( *\)return '; '.join(out) # SURFACE_DIFF_RETURN.*/\1return ''/" "$LIB/live_eval_trace.py" > "$T/mut3/live_eval_trace.py"
|
|
288
|
+
if grep -q 'SURFACE_DIFF_RETURN' "$T/mut3/live_eval_trace.py"; then bad "TR24 mutation did not apply (instrument error, not a pass)"
|
|
289
|
+
else m3=$(LIB="$T/mut3" score "$T/plg" P 'read=CATALOG\.md')
|
|
290
|
+
[[ "$m3" != *"plugins=fx-chart@builtin — "* ]] && [[ "$m3" == INVALID-COMPARISON* ]] && ok "TR24 revert probe: surface_diff → '' drops the named plugin (TR23 would be red), verdict unchanged" || bad "TR24 mutant still [$m3]"; fi
|
|
291
|
+
|
|
292
|
+
[ $((pass + fail + skipped)) -eq 25 ] || bad "lane count $pass passed + $fail failed + $skipped skipped != 25 — a case did not run"
|
|
293
|
+
if [ "$skipped" -gt 0 ]; then
|
|
294
|
+
echo "live_eval_trace lanes: $pass passed, $fail failed, $skipped skipped (named, not a pass)"
|
|
295
|
+
else
|
|
296
|
+
echo "live_eval_trace lanes: $pass passed, $fail failed"
|
|
297
|
+
fi
|
|
298
|
+
[ $fail -eq 0 ]
|
|
@@ -36,14 +36,45 @@ out=$(bash "$SCAN" --nonascii-only "$T/hash.sh"); rc=$?
|
|
|
36
36
|
out=$(bash "$SCAN" --nonascii-only 2>&1); rc=$?
|
|
37
37
|
[ "$rc" -eq 2 ] && ok "B2e the mode flag with no files → rc 2, never «0 hits»" || bad "B2e rc=$rc out=$out"
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
# B3's corpus: `git ls-files` in a checkout, `find` where there is no checkout. This suite SHIPS, and
|
|
40
|
+
# the tree an npm consumer receives has no .git — measured 2026-11-16 in the extracted npm pack
|
|
41
|
+
# (clean-room audit round 9), where the two `git ls-files` calls printed a fatal each and the lane
|
|
42
|
+
# then read `files=0 rc=123` and went red THREE times about a scanner that is sound. The real corpus
|
|
43
|
+
# is the whole point of B3 (the header says so: the static lane is what keeps this fixed on Linux),
|
|
44
|
+
# so it falls back to a file walk rather than folding to a pass or skipping the lane.
|
|
45
|
+
# 🟥 `--is-inside-work-tree` is the WRONG test here and a blind reader of this change caught it: an
|
|
46
|
+
# extracted tarball under someone's node_modules is inside THEIR work tree, so `git ls-files` would
|
|
47
|
+
# answer with their repo's files and B3 would scan a corpus that is not this package's. The test is
|
|
48
|
+
# therefore "this directory IS the top of a checkout".
|
|
49
|
+
if [ "$(git rev-parse --show-toplevel 2>/dev/null)" = "$PWD" ]; then
|
|
50
|
+
corpus=checkout
|
|
51
|
+
sh_files=$(git ls-files '*.sh'); gl1=$?
|
|
52
|
+
all_files=$(git ls-files); gl2=$?
|
|
53
|
+
if [ "$gl1" -ne 0 ] || [ "$gl2" -ne 0 ]; then
|
|
54
|
+
corpus=BROKEN
|
|
55
|
+
bad "B3 git ls-files failed inside a checkout (rc $gl1/$gl2) — file list incomplete, so B3 measured nothing"
|
|
56
|
+
fi
|
|
57
|
+
else
|
|
58
|
+
corpus=walk
|
|
59
|
+
# no .git: list the tree itself. Prune the directories a packed install carries that are not this
|
|
60
|
+
# repo's own shell code, so the count means the same thing it means in a checkout.
|
|
61
|
+
sh_files=$(find . -type d \( -name node_modules -o -name .git \) -prune -o -type f -name '*.sh' -print | sed 's|^\./||')
|
|
62
|
+
all_files=$(find . -type d \( -name node_modules -o -name .git \) -prune -o -type f -print | sed 's|^\./||')
|
|
63
|
+
fi
|
|
64
|
+
if [ "$corpus" != BROKEN ]; then
|
|
41
65
|
files=$(printf '%s\n' "$sh_files"; printf '%s\n' "$all_files" | grep -v '\.sh$' | while IFS= read -r f; do
|
|
42
66
|
[ -f "$f" ] && head -1 "$f" | grep -qE '^#!.*(bash|/sh)( |$)' && printf '%s\n' "$f"; done)
|
|
43
67
|
n=$(printf '%s\n' "$files" | grep -c .)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
68
|
+
if [ "$n" -le 100 ]; then
|
|
69
|
+
# a working file list that is this short is not this repo's shell set, so the lane has no corpus to
|
|
70
|
+
# judge — named, and not a pass.
|
|
71
|
+
skip "B3 — only $n shell files found via $corpus; too few to be this repo's shell set, so nothing was scanned"
|
|
72
|
+
else
|
|
73
|
+
out=$(printf '%s\n' "$files" | tr '\n' '\0' | xargs -0 bash "$SCAN" --nonascii-only); rc=$?
|
|
74
|
+
[ "$rc" -eq 0 ] && ok "B3 $n shell files ($corpus) → 0 code-line hits" \
|
|
75
|
+
|| bad "B3 files=$n rc=$rc ($corpus) — brace them as \${NAME}:"$'\n'"$(printf '%s' "$out" | grep '🟥' | head -20)"
|
|
76
|
+
fi
|
|
77
|
+
fi
|
|
47
78
|
|
|
48
79
|
LOCALES=$(locale -a 2>/dev/null) # captured first: grep -q under pipefail would SIGPIPE locale -a into a false SKIP
|
|
49
80
|
if [ -x /bin/bash ] && printf "%s\n" "$LOCALES" | grep -iE '^ko_KR\.utf-?8$' >/dev/null; then
|
|
@@ -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 ]
|