@chrono-meta/fh-gate 3.44.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.
Files changed (89) hide show
  1. package/.claude/rules/fh_4axis_gate.md +50 -608
  2. package/.claude-plugin/marketplace.json +4 -4
  3. package/CATALOG.md +21 -0
  4. package/CHEATSHEET.md +7 -1
  5. package/docs/codex-compat.md +1 -1
  6. package/knowledge/shared/harness-core/fh_4axis_gate_detail.md +679 -0
  7. package/knowledge/shared/harness-core/fh_integration_contract.md +1 -1
  8. package/knowledge/shared/harness-core/fh_module_contract.md +106 -3
  9. package/knowledge/shared/harness-core/heavy_skill_to_cartridge.md +185 -0
  10. package/knowledge/shared/learnings/subagent_invocations_log.yaml +209 -0
  11. package/package.json +17 -1
  12. package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
  13. package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +9 -8
  14. package/plugins/fh-commons/skills/ko-tech-writer/SKILL_detail.md +20 -0
  15. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  16. package/plugins/fh-meta/CHANGELOG.md +95 -0
  17. package/plugins/fh-meta/skills/auto-decorrelation/SKILL.md +13 -0
  18. package/plugins/fh-meta/skills/install-wizard/SKILL_detail.md +4 -0
  19. package/plugins/fh-meta/skills/steel-quench/SKILL_detail.md +2 -1
  20. package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
  21. package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
  22. package/scripts/agy_launch_guard.sh +117 -1
  23. package/scripts/below_floor_scan.sh +30 -0
  24. package/scripts/codex_launch_guard.sh +38 -2
  25. package/scripts/correction_moments.py +23 -2
  26. package/scripts/fh-gate.sh +612 -14
  27. package/scripts/fh-goal.sh +56 -12
  28. package/scripts/fh-run.sh +1 -1
  29. package/scripts/fh_gate_exec.sh +272 -0
  30. package/scripts/fh_session_load.sh +17 -0
  31. package/scripts/finding_fleet.sh +2 -1
  32. package/scripts/finding_verifier.sh +2 -1
  33. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/README.md +16 -0
  34. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/scripts/check_refs.py +12 -0
  35. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/scripts/test_check_refs.py +24 -0
  36. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/skills/tidy-notes/SKILL.md +16 -0
  37. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/skills/tidy-notes/fh-module.yaml +20 -0
  38. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/SKILL.md +25 -0
  39. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/hooks/hooks.json +7 -0
  40. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/check_links.py +25 -0
  41. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/publish.sh +9 -0
  42. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/publish_guard.py +6 -0
  43. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/setup.sh +5 -0
  44. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/SKILL.md +25 -0
  45. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/hooks/hooks.json +10 -0
  46. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/check_refs.py +12 -0
  47. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/guard_push.py +9 -0
  48. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/install.sh +6 -0
  49. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/ship.sh +9 -0
  50. package/scripts/heavy_skill_smell.py +311 -0
  51. package/scripts/job_heartbeat.py +186 -0
  52. package/scripts/live_eval_matrix.py +128 -0
  53. package/scripts/live_eval_trace.py +176 -1
  54. package/scripts/package_coverage_check.sh +18 -0
  55. package/scripts/prepush_guard_check.sh +8 -0
  56. package/scripts/probe_live_eval.sh +32 -0
  57. package/scripts/probe_live_eval_lib.py +8 -2
  58. package/scripts/selfcheck.sh +111 -0
  59. package/scripts/selfcheck_shard_weights.txt +2 -0
  60. package/scripts/sidecar_calibrate.sh +7 -5
  61. package/scripts/sim_isolated_run.sh +20 -0
  62. package/scripts/test_agy_launch_guard_lanes.sh +120 -0
  63. package/scripts/test_below_floor_scan_lanes.sh +85 -0
  64. package/scripts/test_codex_launch_guard_lanes.sh +45 -0
  65. package/scripts/test_correction_moments_lanes.sh +37 -0
  66. package/scripts/test_fh_gate_absorb_lanes.sh +255 -0
  67. package/scripts/test_fh_gate_defaults_lanes.sh +169 -0
  68. package/scripts/test_fh_gate_exec_lanes.sh +244 -0
  69. package/scripts/test_fh_gate_fusion_lanes.sh +202 -0
  70. package/scripts/test_fh_gate_regressions.sh +92 -1
  71. package/scripts/test_fh_goal_change_detection_lanes.sh +103 -3
  72. package/scripts/test_finding_pipeline_lanes.sh +35 -1
  73. package/scripts/test_guard_anchor_override_env_lanes.sh +84 -0
  74. package/scripts/test_heavy_skill_smell_lanes.sh +160 -0
  75. package/scripts/test_job_heartbeat_lanes.sh +96 -0
  76. package/scripts/test_live_eval_construct_lanes.sh +29 -6
  77. package/scripts/test_live_eval_matrix_lanes.sh +53 -0
  78. package/scripts/test_live_eval_trace_lanes.sh +112 -5
  79. package/scripts/test_name_boundary_locale_lanes.sh +36 -5
  80. package/scripts/test_prepush_marker_lookup_lanes.sh +143 -0
  81. package/scripts/test_probe_live_eval_lanes.sh +43 -0
  82. package/scripts/test_regression_guard_sibling_lanes.sh +52 -1
  83. package/scripts/test_sidecar_calibrate_lanes.sh +1 -1
  84. package/scripts/test_sim_isolated_run_lanes.sh +43 -0
  85. package/scripts/universal_guard_check.sh +8 -0
  86. package/templates/.claude/rules/mcp_tool_gating.md +27 -0
  87. package/templates/.git-hooks/pre-push +60 -3
  88. package/templates/regression_guard.sh +8 -4
  89. 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 ]
@@ -18,10 +18,13 @@
18
18
  # TR16 same plugin, different version → INVALID-COMPARISON (an auto-update moved a version mid-run)
19
19
  # TR17 one arm's init carries a plugin list (or an empty one), the other's none → INVALID-COMPARISON (UNKNOWN ≠ «no plugins»)
20
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
21
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
22
25
  HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
23
26
  LIB="${LIVE_EVAL_LIB_DIR:-$HERE}"
24
- 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"; }
25
28
  T="$(mktemp -d)"; trap 'rm -rf "$T"' EXIT
26
29
 
27
30
  python3 "$HERE/live_eval_trace.py" extract /dev/null /dev/null /dev/null >/dev/null 2>&1; [ $? -eq 3 ] \
@@ -155,8 +158,29 @@ hf=$(score "$T/half" P 'read=CATALOG\.md')
155
158
 
156
159
  # TR13 the direct `claude -p` measurement path (not via sim_isolated_run) pins MCP in all three arms.
157
160
  # 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"
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
160
184
 
161
185
  # ── plugins (2026-11-15): the nightly's G-GREET-01 / G-TRIG-05 had tools and MCP equal in every arm and
162
186
  # one rep (primary_r1) with one extra builtin plugin; the scorer reported «1 distinct». Names below are
@@ -187,5 +211,88 @@ if grep -q "trace.get('plugins') is None" "$T/mut2/live_eval_trace.py"; then bad
187
211
  else mp=$(LIB="$T/mut2" score "$T/plg" P 'read=CATALOG\.md')
188
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
189
213
 
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 ]
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
- sh_files=$(git ls-files '*.sh') || bad "B3 git ls-files '*.sh' failed — file list incomplete"
40
- all_files=$(git ls-files) || bad "B3 git ls-files failed — file list incomplete"
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
- out=$(printf '%s\n' "$files" | tr '\n' '\0' | xargs -0 bash "$SCAN" --nonascii-only); rc=$?
45
- { [ "$rc" -eq 0 ] && [ "$n" -gt 100 ]; } && ok "B3 $n tracked shell files → 0 code-line hits" \
46
- || bad "B3 files=$n rc=$rc — brace them as \${NAME}:"$'\n'"$(printf '%s' "$out" | grep '🟥' | head -20)"
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
@@ -0,0 +1,143 @@
1
+ #!/usr/bin/env bash
2
+ # test_prepush_marker_lookup_lanes.sh — the pre-push Load-Bearing gate must find THIS branch's marker where the
3
+ # pre-commit hook writes it (the main checkout's tracks/_meta, i.e. EVIDENCE_ROOT), and nothing else.
4
+ #
5
+ # Why (2026-11-15, found pushing FH #1118 from a worktree): the gate read `$REPO_ROOT/tracks/_meta` — the worktree's
6
+ # own folder — and took the newest marker of ANY branch. Two wrong answers followed from one line:
7
+ # W1 a worktree push was BLOCKED although its branch's marker existed in the main checkout;
8
+ # M1 a main-checkout push PASSED on another branch's marker.
9
+ # Lanes (each in a throwaway clone of this checkout with a bare origin; nothing here touches the real repo):
10
+ # W1 worktree, marker for the pushed branch in the main checkout only → push passes
11
+ # M1 main checkout, only a FOREIGN branch's marker (newer) → push blocked
12
+ # M2 control: main checkout, the pushed branch's own marker → push passes
13
+ # M3 control: main checkout, no marker at all → push blocked
14
+ # M4 only a longer branch's marker (lane/m4_extra for lane/m4 — glob prefix) → push blocked
15
+ # M5 two local branches share one marker name (lane/m5 · lane_m5) → push blocked
16
+ # M6 same as M5 plus a tag of that name (the short refname would hide the collision) → push blocked
17
+ # M7 <sha>:refs/heads/lane/m7 while standing on a branch that has a marker → push blocked
18
+ # M8 <sha>:refs/heads/lane/m8, no local lane/m8, a local lane_m8 with a marker → push blocked
19
+ # W1/M2 «gate-pass» = rc 0 AND the gate printed its ✅ line (proves the hook ran, not just that the push worked)
20
+ # N1 control: a push that carries no load-bearing file, no marker → push passes (gate not involved)
21
+ # N2 an outside contributor's clone (no tracks/_meta), load-bearing file, no marker → push passes (FH-dev scope)
22
+ # Exit 0 all lanes pass · 1 a lane failed · 2 harness error.
23
+ set -uo pipefail
24
+ . "$(dirname "${BASH_SOURCE[0]}")/fixture_guard_lib.sh" # scrub inherited GIT_* env first (#1088)
25
+ SRC=$(cd "$(dirname "$0")/.." 2>/dev/null && pwd) || { echo "HARNESS-ERROR: cannot resolve the repo root"; exit 2; }
26
+ [ -f "$SRC/templates/.git-hooks/pre-push" ] || { echo "HARNESS-ERROR: no pre-push hook in $SRC"; exit 2; }
27
+ W=$(mktemp -d "${TMPDIR:-/tmp}/prepush-marker.XXXX") || { echo "HARNESS-ERROR: mktemp"; exit 2; }
28
+ trap 'rm -rf "$W"' EXIT
29
+ unset PUBLIC_SURFACE_OK DESTRUCTIVE_OP_OK MAIN_PUSH_OK PUSH_ZONE_OK TAG_VERSION_OK FH_SESSION_CLOSE 2>/dev/null || true
30
+ G() { git -c user.name=lane -c user.email=lane@localhost -c commit.gpgsign=false "$@"; }
31
+ TODAY=$(date +%Y-%m-%d)
32
+ pass=0; fail=0
33
+
34
+ # one fixture = a clone of this checkout (committed HEAD + this working tree's hook, so the hook under test is the
35
+ # one on disk), a bare origin, hooks wired by absolute path like the operator's setup.
36
+ fixture() { # $1 = dir
37
+ local d="$1"
38
+ G clone -q --no-hardlinks "$SRC" "$d/main" < /dev/null || return 1
39
+ cp "$SRC/templates/.git-hooks/pre-push" "$d/main/templates/.git-hooks/pre-push" || return 1
40
+ G init -q --bare "$d/origin.git" < /dev/null || return 1
41
+ G -C "$d/main" remote set-url origin "$d/origin.git" || return 1
42
+ G -C "$d/main" push -q --no-verify origin HEAD:refs/heads/main < /dev/null || return 1
43
+ G -C "$d/main" fetch -q origin < /dev/null || return 1
44
+ G -C "$d/main" config core.hooksPath "$d/main/templates/.git-hooks" || return 1 # checked (codex R2)
45
+ mkdir -p "$d/main/tracks/_meta" || return 1
46
+ }
47
+ lb_commit() { # $1 = repo dir · $2 = branch — a commit touching a load-bearing path
48
+ G -C "$1" switch -q -c "$2" origin/main < /dev/null || return 1
49
+ lb_change "$1" "$2"
50
+ }
51
+ lb_change() { # $1 = repo dir · $2 = label — the change itself, every step checked (codex R1: an unchecked failure
52
+ # left the branch at origin/main, so the push carried nothing load-bearing and «passed» without exercising the gate)
53
+ printf '\n# lane %s\n' "$2" >> "$1/scripts/predelete_check.sh" || return 1
54
+ G -C "$1" add scripts/predelete_check.sh || return 1
55
+ G -C "$1" commit -q --no-verify -m "lane $2" < /dev/null || return 1
56
+ [ -n "$(G -C "$1" log --format=%h origin/main..HEAD -- scripts/predelete_check.sh)" ] || return 1
57
+ }
58
+ plain_commit() { # $1 = repo dir · $2 = branch — a commit touching no load-bearing path
59
+ G -C "$1" switch -q -c "$2" origin/main < /dev/null || return 1
60
+ printf 'lane\n' > "$1/lane_note_${2//\//_}.txt"; G -C "$1" add "lane_note_${2//\//_}.txt"
61
+ G -C "$1" commit -q --no-verify -m "lane $2" < /dev/null
62
+ }
63
+ marker() { # $1 = evidence dir · $2 = branch
64
+ printf 'crossfamily: panel(codex) — residency=CLEAN(files=1) · evidence=SHARED(lane) · R1 no S/A\n' \
65
+ > "$1/tracks/_meta/.axes_23_passed_${2//\//_}_${TODAY}.marker"
66
+ }
67
+ push() { # $1 = repo dir · $2 = branch → prints rc
68
+ G -C "$1" push origin "$2" > "$W/last_push.log" 2>&1 < /dev/null; echo $?
69
+ }
70
+ lane() { # $1 id · $2 want (pass | gate-pass = pass AND the gate printed its ✅ line | block) · $3 rc
71
+ if { [ "$2" = pass ] && [ "$3" -eq 0 ]; } \
72
+ || { [ "$2" = gate-pass ] && [ "$3" -eq 0 ] && grep -q '✅ FH Load-Bearing Change Gate' "$W/last_push.log"; } \
73
+ || { [ "$2" = block ] && [ "$3" -ne 0 ] && grep -q 'no cross-family leg recorded' "$W/last_push.log"; }; then
74
+ pass=$((pass+1)); echo " ✅ $1 (want $2, rc=$3)"
75
+ else
76
+ fail=$((fail+1)); echo " ❌ $1 — want $2, got rc=$3"; awk '/⛔|❌|error/ && n < 4 { n++; print " " $0 }' "$W/last_push.log"
77
+ fi
78
+ }
79
+ echo "pre-push marker lookup lanes"
80
+
81
+ # W1 — worktree push, marker only in the main checkout
82
+ D="$W/w1"; mkdir -p "$D"; fixture "$D" || { echo "HARNESS-ERROR: fixture W1"; exit 2; }
83
+ G -C "$D/main" worktree add -q "$D/wt" -b lane/w1 origin/main < /dev/null || { echo "HARNESS-ERROR: worktree"; exit 2; }
84
+ mkdir -p "$D/wt/tracks/_meta" # the real worktrees have this folder too (it is gitignored, created by tools)
85
+ lb_change "$D/wt" w1 || { echo "HARNESS-ERROR: commit W1"; exit 2; }
86
+ marker "$D/main" lane/w1
87
+ lane W1 gate-pass "$(push "$D/wt" lane/w1)"
88
+
89
+ # M1 — main checkout, only a foreign (newer) marker
90
+ D="$W/m1"; mkdir -p "$D"; fixture "$D" || { echo "HARNESS-ERROR: fixture M1"; exit 2; }
91
+ lb_commit "$D/main" lane/m1 || { echo "HARNESS-ERROR: commit M1"; exit 2; }
92
+ marker "$D/main" lane/someone-else
93
+ lane M1 block "$(push "$D/main" lane/m1)"
94
+
95
+ # M2 — main checkout, own marker
96
+ marker "$D/main" lane/m1
97
+ lane M2 gate-pass "$(push "$D/main" lane/m1)"
98
+
99
+ # M4 — prefix collision: only a LONGER branch's marker (lane/m1 already pushed; lane_m4_extra is not lane/m4's)
100
+ G -C "$D/main" switch -q -c lane/m4 origin/main < /dev/null && lb_change "$D/main" m4 || { echo "HARNESS-ERROR: commit M4"; exit 2; }
101
+ marker "$D/main" lane/m4_extra
102
+ lane M4 block "$(push "$D/main" lane/m4)"
103
+
104
+ # M5 — slug collision: lane/m5 and lane_m5 both exist locally; the one marker cannot be attributed to either
105
+ G -C "$D/main" branch -q lane_m5 origin/main < /dev/null || { echo "HARNESS-ERROR: branch M5"; exit 2; }
106
+ G -C "$D/main" switch -q -c lane/m5 origin/main < /dev/null && lb_change "$D/main" m5 || { echo "HARNESS-ERROR: commit M5"; exit 2; }
107
+ marker "$D/main" lane/m5
108
+ lane M5 block "$(push "$D/main" lane/m5)"
109
+
110
+ # M6 — tag ambiguity: lane/m6 and lane_m6 both exist AND a tag lane_m6 (refname:short would print heads/lane_m6)
111
+ G -C "$D/main" branch -q lane_m6 origin/main < /dev/null && G -C "$D/main" tag lane_m6 origin/main < /dev/null || { echo "HARNESS-ERROR: refs M6"; exit 2; }
112
+ G -C "$D/main" switch -q -c lane/m6 origin/main < /dev/null && lb_change "$D/main" m6 || { echo "HARNESS-ERROR: commit M6"; exit 2; }
113
+ marker "$D/main" lane/m6
114
+ lane M6 block "$(push "$D/main" lane/m6)"
115
+
116
+ # M7 — commit-expression refspec: standing on lane/m1 (its marker exists), push an unreviewed load-bearing commit to a
117
+ # NEW branch name with <sha>:refs/heads/lane/m7 — it must need lane/m7's marker, not borrow lane/m1's
118
+ G -C "$D/main" switch -q -c lane/m7-src origin/main < /dev/null && lb_change "$D/main" m7 || { echo "HARNESS-ERROR: commit M7"; exit 2; }
119
+ M7SHA=$(G -C "$D/main" rev-parse HEAD); G -C "$D/main" switch -q lane/m1 < /dev/null || { echo "HARNESS-ERROR: switch M7"; exit 2; }
120
+ G -C "$D/main" push origin "$M7SHA:refs/heads/lane/m7" > "$W/last_push.log" 2>&1 < /dev/null; lane M7 block "$?"
121
+
122
+ # M8 — <sha>:refs/heads/lane/m8 where lane/m8 does not exist locally but lane_m8 does, with a marker → blocked
123
+ G -C "$D/main" branch -q lane_m8 origin/main < /dev/null || { echo "HARNESS-ERROR: branch M8"; exit 2; }
124
+ marker "$D/main" lane_m8
125
+ G -C "$D/main" push origin "$M7SHA:refs/heads/lane/m8" > "$W/last_push.log" 2>&1 < /dev/null; lane M8 block "$?"
126
+
127
+ # M3 — main checkout, no marker
128
+ D="$W/m3"; mkdir -p "$D"; fixture "$D" || { echo "HARNESS-ERROR: fixture M3"; exit 2; }
129
+ lb_commit "$D/main" lane/m3 || { echo "HARNESS-ERROR: commit M3"; exit 2; }
130
+ lane M3 block "$(push "$D/main" lane/m3)"
131
+
132
+ # N1 — no load-bearing file, no marker
133
+ plain_commit "$D/main" lane/n1 || { echo "HARNESS-ERROR: commit N1"; exit 2; }
134
+ lane N1 pass "$(push "$D/main" lane/n1)"
135
+
136
+ # N2 — an outside contributor's clone (no tracks/_meta anywhere), load-bearing file, no marker → not blocked by this gate
137
+ D="$W/n2"; mkdir -p "$D"; fixture "$D" || { echo "HARNESS-ERROR: fixture N2"; exit 2; }
138
+ rm -rf "$D/main/tracks/_meta"
139
+ lb_commit "$D/main" lane/n2 || { echo "HARNESS-ERROR: commit N2"; exit 2; }
140
+ lane N2 pass "$(push "$D/main" lane/n2)"
141
+
142
+ echo "pre-push marker lookup lanes: $pass passed, $fail failed"
143
+ [ "$fail" -eq 0 ]
@@ -878,6 +878,49 @@ fi
878
878
  _lane SF3 state-fp "verdict row identical across runs whose end states differ" "yes" \
879
879
  "$([ -n "$(grep -E '^\| G-GREET-01 ' "$T/sf_a.md")" ] && [ "$(grep -E '^\| G-GREET-01 ' "$T/sf_a.md")" = "$(grep -E '^\| G-GREET-01 ' "$T/sf_b.md")" ] && echo yes || echo no)"
880
880
 
881
+ # BP1-BP4 behaviour profile (2026-11-17): one record-only line per rep, appended after the verdict.
882
+ # BP1 the budget stub writes no stream → MISSING for both arms (not measured ≠ 0).
883
+ _lane BP1 behave-prof "stub without stream: report carries 'trace=MISSING' for both arms" "2" \
884
+ "$(grep -cE '^behaviour-profile: G-GREET-01 (primary|control) r1 trace=MISSING$' "$T/bud_report.md")"
885
+ # BP2 a stub that writes a stream: primary explores + runs a test, control only explores.
886
+ cat > "$BSTUB/fake_sim_trace.sh" <<'FAKETRACE'
887
+ #!/usr/bin/env bash
888
+ arm=""; out=""
889
+ while [ $# -gt 0 ]; do case "$1" in --arm) arm="$2"; shift 2 ;; --out) out="$2"; shift 2 ;; *) shift ;; esac; done
890
+ mkdir -p "$out"
891
+ printf 'stub body %s\n' "$arm" > "$out/${arm}_r1.txt"
892
+ printf 'rc\t0\ntimeout_s\t900\nmax_turns\tunset\ntoken_cap\tunset\nended_at_cap\tno\n' > "$out/${arm}_r1.meta.tsv"
893
+ if [ "$arm" = primary ]; then cmd='bash scripts/test_x_lanes.sh'; else cmd='ls tracks'; fi
894
+ { printf '{"type":"system","subtype":"init","tools":["Read","Bash"],"mcp_servers":[]}\n'
895
+ printf '{"type":"assistant","message":{"content":[{"type":"tool_use","id":"a","name":"Read","input":{"file_path":"CATALOG.md"}}]}}\n'
896
+ printf '{"type":"assistant","message":{"content":[{"type":"tool_use","id":"b","name":"Bash","input":{"command":"%s"}}]}}\n' "$cmd"
897
+ printf '{"type":"result","subtype":"success","result":"stub body"}\n'; } > "$out/${arm}_r1.stream.jsonl"
898
+ [ "$arm" = control ] && [ "${FH_TRACE_STUB_BAD:-no}" = yes ] && printf 'not json\x00' > "$out/${arm}_r1.stream.jsonl" && chmod 000 "$out/${arm}_r1.stream.jsonl"
899
+ echo "RESULT: CLEAN"; exit 0
900
+ FAKETRACE
901
+ chmod +x "$BSTUB/fake_sim_trace.sh"
902
+ ( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$BSTUB/fake_sim_trace.sh" \
903
+ bash "$RUNNER" --ids "G-GREET-01" --no-evidence --report-out "$T/bp.md" ) >"$T/bp.log" 2>&1
904
+ _lane BP2 behave-prof "stream present: per-arm counts (primary runs a test, control only explores)" "yes" \
905
+ "$(grep -qxF 'behaviour-profile: G-GREET-01 primary r1 explore=1 edit=0 test-run=1 other=0 total=2' "$T/bp.md" \
906
+ && grep -qxF 'behaviour-profile: G-GREET-01 control r1 explore=2 edit=0 test-run=0 other=0 total=2' "$T/bp.md" && echo yes || echo no)"
907
+ # BP3 FH_LIVE_TRACE=0 keeps no stream → one «not recorded» line, not a MISSING line per rep
908
+ ( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$BSTUB/fake_sim_trace.sh" FH_LIVE_TRACE=0 \
909
+ bash "$RUNNER" --ids "G-GREET-01" --no-evidence --report-out "$T/bp0.md" ) >"$T/bp0.log" 2>&1
910
+ _lane BP3 behave-prof "FH_LIVE_TRACE=0 → one 'not recorded' line, no per-rep lines" "1 0" \
911
+ "$(grep -c '^behaviour-profile: not recorded — FH_LIVE_TRACE=0' "$T/bp0.md") $(grep -c '^behaviour-profile: G-GREET-01' "$T/bp0.md")"
912
+ # BP4 an unreadable stream says UNREADABLE (skipped as root: root reads mode 000)
913
+ if [ "$(id -u)" != 0 ]; then
914
+ ( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$BSTUB/fake_sim_trace.sh" FH_TRACE_STUB_BAD=yes \
915
+ bash "$RUNNER" --ids "G-GREET-01" --no-evidence --report-out "$T/bpu.md" ) >"$T/bpu.log" 2>&1
916
+ _lane BP4 behave-prof "unreadable stream → trace=UNREADABLE, not counts of 0" "1" \
917
+ "$(grep -cxF 'behaviour-profile: G-GREET-01 control r1 trace=UNREADABLE' "$T/bpu.md")"
918
+ chmod -R u+rwx "$T" 2>/dev/null
919
+ fi
920
+ # BP5 the profile never moves a verdict: the G-GREET-01 row is identical with and without streams.
921
+ _lane BP5 behave-prof "verdict row identical with stream (BP2) and without (FH_LIVE_TRACE=0)" "yes" \
922
+ "$([ -n "$(grep -E '^\| G-GREET-01 ' "$T/bp.md")" ] && [ "$(grep -E '^\| G-GREET-01 ' "$T/bp.md")" = "$(grep -E '^\| G-GREET-01 ' "$T/bp0.md")" ] && echo yes || echo no)"
923
+
881
924
  # TG3 default output unchanged: no --target -> no split section anywhere.
882
925
  _lane TG3 target "default (no --target): report has no 'Target split' section" \
883
926
  "no" "$(grep -q 'Target split' "$T/bud_report.md" && echo yes || echo no)"
@@ -8,7 +8,8 @@
8
8
  # SKILL pair — so these lanes cover both pairs and both directions:
9
9
  # moved into the sibling -> no M-tier (exit != 2)
10
10
  # dropped from both -> M-tier block (exit 2) <- the lookup must not become a free pass
11
- # plus a REVERT PROBE: the CLAUDE.md case is deleted from a copy of the guard and lane S1 must turn red.
11
+ # plus REVERT PROBES: each pair arm is deleted from a copy of the guard and its lane must turn red.
12
+ # 2026-11-19: third pair, .claude/rules/fh_4axis_gate.md <-> fh_4axis_gate_detail.md (S11-S13, R4-R5).
12
13
  #
13
14
  # Usage: bash scripts/test_regression_guard_sibling_lanes.sh Exit: 0 = all behave; 1 = regression.
14
15
 
@@ -188,6 +189,56 @@ else
188
189
  else echo " ✅ R3 revert probe: without the reverse arm the reference side no longer sees a move"; fi
189
190
  fi
190
191
 
192
+ # S11 (2026-11-19): the 4-axis rule became a thin resident layer; its body moved verbatim to
193
+ # knowledge/shared/harness-core/fh_4axis_gate_detail.md. Same pair shape, so the same lookup.
194
+ RULE=.claude/rules/fh_4axis_gate.md; RDET=knowledge/shared/harness-core/fh_4axis_gate_detail.md
195
+ mkrule() { local d=$1; mkrepo "$d"; mkdir -p "$d/.claude/rules"; printf '# gate\n%s' "$BODY" > "$d/$RULE"; git -C "$d" add -A && git -C "$d" commit -q -m rule; }
196
+ d=$T/s11; mkrule "$d"
197
+ printf '# gate\nthin layer only.\n' > "$d/$RULE"; printf '# gate detail\n%s' "$BODY" > "$d/$RDET"
198
+ git -C "$d" add -A
199
+ run_lane "S11 4-axis rule -> detail move" "$d" "$GUARD" pass
200
+
201
+ # S12: rule slimmed, detail file absent -> real loss still blocks
202
+ d=$T/s12; mkrule "$d"
203
+ printf '# gate\nthin layer only.\n' > "$d/$RULE"; git -C "$d" add -A
204
+ run_lane "S12 4-axis rule loss, detail absent" "$d" "$GUARD" block
205
+
206
+ # R4: revert probe — delete the rule arm from a copy of the guard; S11 must now block
207
+ G5=$T/guard_norule.sh
208
+ grep -v '^ .claude/rules/fh_4axis_gate.md) ' "$GUARD" > "$G5"
209
+ if cmp -s "$GUARD" "$G5"; then echo " ❌ R4 revert probe: the mutation did not apply (pattern drift) — HARNESS-ERROR"; FAIL=1
210
+ else
211
+ d=$T/r4; mkrule "$d"
212
+ printf '# gate\nthin layer only.\n' > "$d/$RULE"; printf '# gate detail\n%s' "$BODY" > "$d/$RDET"
213
+ git -C "$d" add -A
214
+ run_lane "R4 revert probe: without the rule pair, S11 blocks" "$d" "$G5" block
215
+ fi
216
+
217
+ # S13: reverse — detail content moved back into the rule -> move recognised on the detail side
218
+ d=$T/s13; mkrule "$d"
219
+ printf '# gate\nthin layer only.\n' > "$d/$RULE"; printf '# gate detail\n%s' "$BODY" > "$d/$RDET"
220
+ git -C "$d" add -A; git -C "$d" commit -q -m split
221
+ printf '# gate\n%s' "$BODY" > "$d/$RULE"; printf '# gate detail\nmoved back.\n' > "$d/$RDET"; git -C "$d" add -A
222
+ out=$(cd "$d" && bash "$GUARD" --staged 2>&1)
223
+ sec=$(grep -A60 "fh_4axis_gate_detail.md ===" <<<"$out"); if [[ "$sec" == *"moved to"* ]] && [[ "$sec" != *"M-TIER"* ]]; then
224
+ echo " ✅ S13 detail -> rule reverse move recognised"
225
+ else echo " ❌ S13 reverse move not recognised on the detail side"; FAIL=1; fi
226
+
227
+ # R5: revert probe — drop the detail-side arm; S13 must fail
228
+ G6=$T/guard_nodetailarm.sh
229
+ grep -v 'fh_4axis_gate_detail.md) sib=".claude/rules/fh_4axis_gate.md"' "$GUARD" > "$G6"
230
+ if cmp -s "$GUARD" "$G6"; then echo " ❌ R5 revert probe: the mutation did not apply (pattern drift) — HARNESS-ERROR"; FAIL=1
231
+ else
232
+ d=$T/r5; mkrule "$d"
233
+ printf '# gate\nthin layer only.\n' > "$d/$RULE"; printf '# gate detail\n%s' "$BODY" > "$d/$RDET"
234
+ git -C "$d" add -A; git -C "$d" commit -q -m split
235
+ printf '# gate\n%s' "$BODY" > "$d/$RULE"; printf '# gate detail\nmoved back.\n' > "$d/$RDET"; git -C "$d" add -A
236
+ rc=0; out=$(cd "$d" && bash "$G6" --staged 2>&1) || rc=$?
237
+ if [ "$rc" -gt 2 ] || ! grep -q "fh_4axis_gate_detail.md ===" <<<"$out"; then echo " ❌ R5 revert probe: mutated guard did not run or never examined the detail file (rc=$rc) — HARNESS-ERROR"; FAIL=1
238
+ elif sec=$(grep -A60 "fh_4axis_gate_detail.md ===" <<<"$out"); [[ "$sec" == *"moved to"* ]]; then echo " ❌ R5 revert probe: reverse move still recognised without the detail-side arm"; FAIL=1
239
+ else echo " ✅ R5 revert probe: without the detail-side arm the detail file no longer sees a move"; fi
240
+ fi
241
+
191
242
  echo
192
243
  if [ "$FAIL" -eq 0 ]; then echo "ALL regression_guard sibling lanes behave."; exit 0; fi
193
244
  echo "regression_guard sibling lanes: FAIL"; exit 1
@@ -101,7 +101,7 @@ STUB
101
101
  # not: "absent" is simulated by NOT creating a stub, so the real codex/agy further down $PATH were
102
102
  # found instead and the lanes fired REAL, billed API calls (measured: a lane run hung past 120s
103
103
  # against live runtimes). A test that can reach production is not a test.
104
- run_cal() { PATH="$TMP/bin:/usr/bin:/bin:/usr/sbin:/sbin" bash "$CAL" --stub-model "stub-pro-3.1" "$@" 2>&1; }
104
+ run_cal() { PATH="$TMP/bin:/usr/bin:/bin:/usr/sbin:/sbin" bash "$CAL" --stub-model "stub-pro-3.1" "$@" 2>&1 < /dev/null; }
105
105
 
106
106
  echo "── sidecar-calibrate lanes ──"
107
107
 
@@ -730,5 +730,48 @@ run_sut --arm a --reps 1 --prompt p --setting-sources 'project local' --out "$WO
730
730
  run_sut --arm a --reps 1 --prompt p --setting-sources ',,,' --out "$WORKROOT/o31k2"; _rk2=$RC
731
731
  { [ "$_rk1" = 2 ] && [ "$_rk2" = 2 ]; } && ok "L31k 'project local' and ',,,' → rc 2" || no "L31k malformed source list accepted (rc=$_rk1/$_rk2)"
732
732
 
733
+ # ── L32 run-level tally (2026-11-19, AQ-20261108-6) — a run where NO rep produced output is
734
+ # FAILED-TO-RUN, never a quiet «RESULT: CLEAN» that a scorer folds to 0/N. Known-positive: every
735
+ # rep dies (rc 7, 0 bytes). Known-negative: every rep answers. Exit code stays 0 in both (L9).
736
+ OUTDIR="$WORKROOT/o32a"
737
+ OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=die \
738
+ bash "$SUT" --arm a --reps 2 --prompt p --out "$OUTDIR" 2>&1 ); RC=$?
739
+ { [ "$RC" = 0 ] && printf '%s' "$OUT" | grep -q "^RUN: FAILED-TO-RUN" \
740
+ && printf '%s' "$OUT" | grep -q "^REPS: captured=0 empty=0 unmeasured=2 not_launched=0 of 2$"; } \
741
+ && ok "L32a every rep dead → RUN: FAILED-TO-RUN + tally unmeasured=2 of 2 (exit 0 kept)" \
742
+ || no "L32a all-dead run not named FAILED-TO-RUN (rc=$RC): $(printf '%s' "$OUT" | grep -E '^(REPS|RUN):' | tr '\n' ' ')"
743
+ OUTDIR="$WORKROOT/o32b"
744
+ OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say \
745
+ bash "$SUT" --arm a --reps 2 --prompt p --out "$OUTDIR" 2>&1 )
746
+ { ! printf '%s' "$OUT" | grep -q "FAILED-TO-RUN" \
747
+ && printf '%s' "$OUT" | grep -q "^REPS: captured=2 empty=0 unmeasured=0 not_launched=0 of 2$"; } \
748
+ && ok "L32b CONTROL — healthy run carries no FAILED-TO-RUN, tally captured=2 of 2" \
749
+ || no "L32b CONTROL — FAILED-TO-RUN fired on a healthy run, or the tally is wrong"
750
+ OUTDIR="$WORKROOT/o32c"
751
+ OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=silent \
752
+ bash "$SUT" --arm a --reps 2 --prompt p --out "$OUTDIR" 2>&1 )
753
+ { ! printf '%s' "$OUT" | grep -q "FAILED-TO-RUN" \
754
+ && printf '%s' "$OUT" | grep -q "^REPS: captured=0 empty=2 unmeasured=0 not_launched=0 of 2$"; } \
755
+ && ok "L32c all-EMPTY (rc 0) is not FAILED-TO-RUN — it ran and said nothing; tally empty=2" \
756
+ || no "L32c EMPTY reps folded into FAILED-TO-RUN, or tally wrong"
757
+
758
+ # L32d/e — the two routes the challenger review (2026-11-19) found around L32a: a multi-turn rep
759
+ # whose every turn died (turn headers make bytes>0) and reps that never launched (clone failure).
760
+ printf 't1\nt2\n' > "$WORKROOT/t32.txt"
761
+ OUTDIR="$WORKROOT/o32d"
762
+ OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=die \
763
+ bash "$SUT" --arm a --reps 2 --turns "$WORKROOT/t32.txt" --out "$OUTDIR" 2>&1 )
764
+ { printf '%s' "$OUT" | grep -q "^RUN: FAILED-TO-RUN" \
765
+ && printf '%s' "$OUT" | grep -q "^REPS: captured=0 empty=0 unmeasured=2 not_launched=0 of 2$"; } \
766
+ && ok "L32d --turns with every turn dead → unmeasured=2 + FAILED-TO-RUN (turn headers are not output)" \
767
+ || no "L32d multi-turn all-dead run counted as captured: $(printf '%s' "$OUT" | grep -E '^(REPS|RUN):' | tr '\n' ' ')"
768
+ OUTDIR="$WORKROOT/o32e"
769
+ OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say \
770
+ bash "$SUT" --arm a --reps 2 --prompt p --base-ref no-such-ref-32e --base-sha deadbeef --out "$OUTDIR" 2>&1 )
771
+ { printf '%s' "$OUT" | grep -q "^RUN: FAILED-TO-RUN" \
772
+ && printf '%s' "$OUT" | grep -q "^REPS: captured=0 empty=0 unmeasured=0 not_launched=2 of 2$"; } \
773
+ && ok "L32e every clone failed → not_launched=2 + FAILED-TO-RUN (not a quiet CLEAN)" \
774
+ || no "L32e never-launched reps not counted: $(printf '%s' "$OUT" | grep -E '^(REPS|RUN):' | tr '\n' ' ')"
775
+
733
776
  echo "sim_isolated_run lanes: $pass passed, $fail failed"
734
777
  [ "$fail" -eq 0 ] || exit 1
@@ -24,6 +24,14 @@
24
24
  set -uo pipefail
25
25
 
26
26
  unset GIT_INDEX_FILE GIT_DIR GIT_WORK_TREE GIT_COMMON_DIR 2>/dev/null || true
27
+ # The anchor measures the hook as it behaves by DEFAULT. A caller that exported an override (a commit made with
28
+ # PUBLIC_SURFACE_OK=1 that stages the hook) used to pass it into the sandboxed hook, which then let its own
29
+ # planted leaks through and broke the known pairs (rc=1 for a reason unrelated to the change — pmh-dev #91 ②,
30
+ # 2026-11-15). Lane: scripts/test_guard_anchor_override_env_lanes.sh.
31
+ unset PUBLIC_SURFACE_OK DESTRUCTIVE_OP_OK FH_NOVELTY_OK MAIN_PUSH_OK PUSH_ZONE_OK TAG_VERSION_OK TRACKS_GITLINK_OK TRACKS_PUBLIC_OK 2>/dev/null || true
32
+ # Every PSA_* input too (codex R2: PSA_ALLOWLIST suppressed a planted positive) — by prefix, so a new PSA_ input
33
+ # cannot slip past a hand-written list. The scan library sets the ones it needs itself.
34
+ for _v in $(compgen -v | grep '^PSA_'); do unset "$_v"; done; unset _v
27
35
 
28
36
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
29
37
  HOOK="$REPO_ROOT/templates/.git-hooks/pre-commit"