@chrono-meta/fh-gate 3.44.0 → 3.46.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 (101) 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 +13 -3
  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_detail_protocols.md +1 -0
  8. package/knowledge/shared/harness-core/fh_integration_contract.md +1 -1
  9. package/knowledge/shared/harness-core/fh_module_contract.md +106 -3
  10. package/knowledge/shared/harness-core/heavy_skill_to_cartridge.md +185 -0
  11. package/knowledge/shared/learnings/subagent_invocations_log.yaml +209 -0
  12. package/package.json +19 -1
  13. package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
  14. package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +9 -8
  15. package/plugins/fh-commons/skills/ko-tech-writer/SKILL_detail.md +20 -0
  16. package/plugins/fh-commons/skills/mcp-circuit-breaker/SKILL.md +12 -6
  17. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  18. package/plugins/fh-meta/CHANGELOG.md +122 -0
  19. package/plugins/fh-meta/skills/auto-decorrelation/SKILL.md +13 -0
  20. package/plugins/fh-meta/skills/context-doctor/SKILL.md +1 -0
  21. package/plugins/fh-meta/skills/deep-clarify/SKILL.md +76 -22
  22. package/plugins/fh-meta/skills/harvest-loop/SKILL.md +2 -2
  23. package/plugins/fh-meta/skills/install-wizard/SKILL_detail.md +4 -0
  24. package/plugins/fh-meta/skills/memory-hygiene/SKILL.md +6 -0
  25. package/plugins/fh-meta/skills/steel-quench/SKILL_detail.md +2 -1
  26. package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
  27. package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
  28. package/scripts/agy_launch_guard.sh +117 -1
  29. package/scripts/below_floor_scan.sh +30 -0
  30. package/scripts/codex_launch_guard.sh +38 -2
  31. package/scripts/correction_moments.py +23 -2
  32. package/scripts/fh-gate.sh +612 -14
  33. package/scripts/fh-goal.sh +56 -12
  34. package/scripts/fh-run.sh +1 -1
  35. package/scripts/fh_gate_exec.sh +272 -0
  36. package/scripts/fh_session_load.sh +17 -0
  37. package/scripts/finding_fleet.sh +2 -1
  38. package/scripts/finding_verifier.sh +2 -1
  39. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/README.md +16 -0
  40. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/scripts/check_refs.py +12 -0
  41. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/scripts/test_check_refs.py +24 -0
  42. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/skills/tidy-notes/SKILL.md +16 -0
  43. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/skills/tidy-notes/fh-module.yaml +20 -0
  44. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/SKILL.md +25 -0
  45. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/hooks/hooks.json +7 -0
  46. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/check_links.py +25 -0
  47. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/publish.sh +9 -0
  48. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/publish_guard.py +6 -0
  49. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/setup.sh +5 -0
  50. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/SKILL.md +25 -0
  51. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/hooks/hooks.json +10 -0
  52. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/check_refs.py +12 -0
  53. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/guard_push.py +9 -0
  54. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/install.sh +6 -0
  55. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/ship.sh +9 -0
  56. package/scripts/heavy_skill_smell.py +311 -0
  57. package/scripts/job_heartbeat.py +186 -0
  58. package/scripts/live_eval_matrix.py +128 -0
  59. package/scripts/live_eval_trace.py +197 -4
  60. package/scripts/package_coverage_check.sh +18 -0
  61. package/scripts/pr_merge_verified.sh +14 -4
  62. package/scripts/prepush_guard_check.sh +8 -0
  63. package/scripts/probe_live_eval.sh +32 -0
  64. package/scripts/probe_live_eval_lib.py +8 -2
  65. package/scripts/selfcheck.sh +113 -0
  66. package/scripts/selfcheck_shard_weights.txt +2 -0
  67. package/scripts/sidecar_calibrate.sh +7 -5
  68. package/scripts/sim_isolated_run.sh +20 -0
  69. package/scripts/test_agy_launch_guard_lanes.sh +120 -0
  70. package/scripts/test_below_floor_scan_lanes.sh +85 -0
  71. package/scripts/test_codex_launch_guard_lanes.sh +45 -0
  72. package/scripts/test_correction_moments_lanes.sh +37 -0
  73. package/scripts/test_deep_clarify_interview_lanes.sh +108 -0
  74. package/scripts/test_deep_clarify_spec_path_lanes.sh +91 -0
  75. package/scripts/test_fh_gate_absorb_lanes.sh +255 -0
  76. package/scripts/test_fh_gate_defaults_lanes.sh +188 -0
  77. package/scripts/test_fh_gate_exec_lanes.sh +244 -0
  78. package/scripts/test_fh_gate_fusion_lanes.sh +202 -0
  79. package/scripts/test_fh_gate_regressions.sh +92 -1
  80. package/scripts/test_fh_goal_change_detection_lanes.sh +103 -3
  81. package/scripts/test_finding_pipeline_lanes.sh +35 -1
  82. package/scripts/test_guard_anchor_override_env_lanes.sh +84 -0
  83. package/scripts/test_heavy_skill_smell_lanes.sh +160 -0
  84. package/scripts/test_job_heartbeat_lanes.sh +96 -0
  85. package/scripts/test_live_eval_construct_lanes.sh +29 -6
  86. package/scripts/test_live_eval_matrix_lanes.sh +53 -0
  87. package/scripts/test_live_eval_trace_lanes.sh +132 -5
  88. package/scripts/test_name_boundary_locale_lanes.sh +36 -5
  89. package/scripts/test_pr_merge_verified_lanes.sh +15 -2
  90. package/scripts/test_prepush_marker_lookup_lanes.sh +143 -0
  91. package/scripts/test_probe_live_eval_lanes.sh +44 -0
  92. package/scripts/test_regression_guard_sibling_lanes.sh +52 -1
  93. package/scripts/test_sidecar_calibrate_lanes.sh +1 -1
  94. package/scripts/test_sim_isolated_run_lanes.sh +43 -0
  95. package/scripts/universal_guard_check.sh +8 -0
  96. package/scripts/worktree_reclaim.sh +1 -1
  97. package/templates/.claude/rules/mcp_tool_gating.md +27 -0
  98. package/templates/.git-hooks/pre-push +60 -3
  99. package/templates/PRE-PUBLISH-CHECKLIST.md +22 -0
  100. package/templates/regression_guard.sh +8 -4
  101. package/templates/settings.LaneGap.snippet.json +27 -0
@@ -0,0 +1,160 @@
1
+ #!/usr/bin/env bash
2
+ # test_heavy_skill_smell_lanes.sh — known-pair lanes for scripts/heavy_skill_smell.py (advisory checker).
3
+ #
4
+ # Known positive: scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro — an invented «heavy skill» that
5
+ # carries its own harness (permission hook, settings write, own confirm before push, restated floor rules,
6
+ # «our verdict is final»). Every smell class must fire at least once, on the file it was planted in.
7
+ # Known negative: scripts/fixtures/heavy_skill_smell/clean/tidy-notes — the same craft after the refactor
8
+ # (passes scripts/fh_module_check.py check). Zero smells.
9
+ # Optional real cartridge: HEAVY_SMELL_REAL_CLEAN=<dir of a real cartridge> (e.g. a cart-ocr checkout). Absent =
10
+ # printed SKIP and counted as skipped, never as PASS.
11
+ #
12
+ # The checker is advisory: rc 0 = read (smells or not), rc 2 = could not read. Lanes H7/H8 hold that line —
13
+ # a «heavy» input must still exit 0, because the checker never blocks.
14
+ set -u
15
+ . "$(dirname "${BASH_SOURCE[0]}")/fixture_guard_lib.sh" # scrub inherited GIT_* env first (#1088)
16
+ HERE="$(cd "$(dirname "$0")" && pwd)"
17
+ CHK="$HERE/heavy_skill_smell.py"
18
+ FX="$HERE/fixtures/heavy_skill_smell"
19
+ HEAVY="$FX/heavy/release-notes-pro"
20
+ CLEAN="$FX/clean/tidy-notes"
21
+ pass=0; fail=0; skip=0
22
+ ok() { pass=$((pass+1)); echo "PASS $1"; }
23
+ bad() { fail=$((fail+1)); echo "FAIL $1"; }
24
+
25
+ if [ ! -f "$CHK" ]; then echo "FAIL H0 checker missing: $CHK"; echo "RESULT: 0 passed, 1 failed"; exit 1; fi
26
+
27
+ out_h="$(python3 "$CHK" "$HEAVY" --json 2>&1)"; rc_h=$?
28
+ out_c="$(python3 "$CHK" "$CLEAN" --json 2>&1)"; rc_c=$?
29
+
30
+ # count of one class, optionally restricted to a file suffix — read from the JSON, not from the text report
31
+ count() { # $1=json $2=class $3=file-suffix(optional)
32
+ printf '%s' "$1" | python3 -c '
33
+ import json, sys
34
+ d = json.load(sys.stdin); cls, suf = sys.argv[1], sys.argv[2]
35
+ print(sum(1 for s in d.get("smells", []) if s["class"] == cls and s["file"].endswith(suf)))' "$2" "${3:-}" 2>/dev/null || echo ERR
36
+ }
37
+
38
+ # H1–H7: each class fires on the file it was planted in (known positive)
39
+ for spec in "P1:scripts/guard_push.py" "P2:hooks/hooks.json" "P3:scripts/install.sh" "P4:scripts/ship.sh" \
40
+ "P5:SKILL.md" "P6:SKILL.md" "P7:SKILL.md"; do
41
+ cls="${spec%%:*}"; f="${spec#*:}"; n="$(count "$out_h" "$cls" "$f")"
42
+ case "$n" in ''|ERR|*[!0-9]*) bad "H-$cls unreadable count «${n}»";;
43
+ *) [ "$n" -ge 1 ] && ok "H-$cls fires on $f ($n)" || bad "H-$cls did not fire on $f";; esac
44
+ done
45
+ # H8: the known negative carries zero smells (and the control value is printed next to it)
46
+ nc="$(printf '%s' "$out_c" | python3 -c 'import json,sys; print(len(json.load(sys.stdin)["smells"]))' 2>/dev/null || echo ERR)"
47
+ nh="$(printf '%s' "$out_h" | python3 -c 'import json,sys; print(len(json.load(sys.stdin)["smells"]))' 2>/dev/null || echo ERR)"
48
+ [ "$nc" = "0" ] && ok "H8 clean example: 0 smells (heavy control in the same run: $nh)" || bad "H8 clean example: «${nc}» smells"
49
+ # H9/H10: advisory — rc 0 on both, whatever was found
50
+ [ "$rc_h" = 0 ] && ok "H9 heavy input exits 0 (advisory, never blocks)" || bad "H9 heavy input rc=$rc_h"
51
+ [ "$rc_c" = 0 ] && ok "H10 clean input exits 0" || bad "H10 clean input rc=$rc_c"
52
+ # H11/H12: unreadable is rc 2, never a «0 smells» reading
53
+ o="$(python3 "$CHK" "$FX/does-not-exist" 2>&1)"; r=$?
54
+ [ "$r" = 2 ] && printf '%s' "$o" | grep -q UNMEASURED && ! printf '%s' "$o" | grep -q SUMMARY \
55
+ && ok "H11 missing folder = rc 2, says UNMEASURED, no SUMMARY" || bad "H11 missing folder rc=$r out=«${o}»"
56
+ empty="$(mktemp -d)"; o="$(python3 "$CHK" "$empty" 2>&1)"; r=$?; rmdir "$empty"
57
+ [ "$r" = 2 ] && printf '%s' "$o" | grep -q UNMEASURED && ! printf '%s' "$o" | grep -q SUMMARY \
58
+ && ok "H12 folder with no readable files = rc 2, says UNMEASURED, no SUMMARY" || bad "H12 empty folder rc=$r out=«${o}»"
59
+ # H13: the text report says the zero is scoped to its patterns, never «clean»
60
+ txt="$(python3 "$CHK" "$CLEAN" 2>&1)"
61
+ printf '%s' "$txt" | grep -q "NOT-DETECTED" && ok "H13 zero is reported as NOT-DETECTED by named patterns" || bad "H13 zero reported without scope"
62
+ # H14: a proposed split is printed for the heavy skill (craft / checks / floor)
63
+ txt_h="$(python3 "$CHK" "$HEAVY" 2>&1)"
64
+ for part in craft checks floor; do
65
+ printf '%s' "$txt_h" | grep -q "^ $part:" || { bad "H14 split part «${part}» missing"; continue; }
66
+ done
67
+ printf '%s' "$txt_h" | grep -q "^ floor:" && ok "H14 split proposed (craft/checks/floor)"
68
+ # H16: shape (a) — a markdown line telling the session to run the command is ROUTED by a valid manifest pair; the
69
+ # same command inside a cartridge script stays P4 (the core gate cannot see inside it); a mismatched pair
70
+ # (publish → destructive-op) routes nothing.
71
+ mk_a() { # $1=dir $2=core_route
72
+ mkdir -p "$1/skills/s" "$1/scripts"
73
+ printf '%s\n' "id: s" "touches_irreversible: publish" "core_route: $2" > "$1/skills/s/fh-module.yaml"
74
+ printf '%s\n' "# s" "When the check passes, run npm publish --access public in the session." > "$1/skills/s/SKILL.md"
75
+ printf '%s\n' "#!/usr/bin/env bash" "npm publish --access public" > "$1/scripts/ship.sh"
76
+ }
77
+ a1="$(mktemp -d)"; mk_a "$a1" pre-publish
78
+ a2="$(mktemp -d)"; mk_a "$a2" destructive-op
79
+ r16="$(python3 "$CHK" "$a1" --json 2>/dev/null | python3 -c 'import json,sys; d=json.load(sys.stdin); print(len(d["routed"]), sum(1 for s in d["smells"] if s["class"]=="P4" and s["file"].endswith("ship.sh")))' 2>/dev/null || echo "ERR ERR")"
80
+ r16b="$(python3 "$CHK" "$a2" --json 2>/dev/null | python3 -c 'import json,sys; d=json.load(sys.stdin); print(len(d["routed"]), d["counts"]["P4"])' 2>/dev/null || echo "ERR ERR")"
81
+ rm -rf "$a1" "$a2"
82
+ [ "$r16" = "1 1" ] && ok "H16 shape (a): SKILL.md line ROUTED, same command in a script still P4" || bad "H16 shape (a) routed/script-P4 = «${r16}» (expected «1 1»)"
83
+ [ "$r16b" = "0 2" ] && ok "H16b mismatched pair (publish → destructive-op) routes nothing (P4=2)" || bad "H16b mismatched pair routed/P4 = «${r16b}» (expected «0 2»)"
84
+ # H17: a second invented heavy skill (written after the patterns were tuned — it caught the «before …, confirm with
85
+ # the user» word order P5 had missed). Every class fires; P5 on that SKILL.md line specifically.
86
+ HEAVY2="$FX/heavy/docs-publisher-pro"
87
+ out_h2="$(python3 "$CHK" "$HEAVY2" --json 2>&1)"
88
+ miss=""
89
+ for cls in P1 P2 P3 P4 P5 P6 P7; do n="$(count "$out_h2" "$cls" "")"; case "$n" in ''|ERR|*[!0-9]*|0) miss="$miss $cls";; esac; done
90
+ n5="$(count "$out_h2" P5 SKILL.md)"
91
+ [ -z "$miss" ] && [ "$n5" = "1" ] && ok "H17 second heavy fixture: all 7 classes fire, P5 on the before-first SKILL.md line" \
92
+ || bad "H17 second heavy fixture: missing [$miss ] P5-on-SKILL.md=$n5"
93
+ # H18: shape (b) — a markdown «ready:» hand-off line naming an irreversible command is HANDOFF, not a P4 smell;
94
+ # the same command as a plain instruction line in the same file is still P4 (control in the same run).
95
+ hb="$(mktemp -d)"
96
+ printf '%s\n' "# x" "When the check passes, end with:" '`ready: git push origin v1.2.0`' "Then run git push origin v1.2.0 yourself." > "$hb/SKILL.md"
97
+ out_hb="$(python3 "$CHK" "$hb" --json 2>&1)"; rm -rf "$hb"
98
+ read -r n_hand n_p4 <<EOF2
99
+ $(printf '%s' "$out_hb" | python3 -c 'import json,sys; d=json.load(sys.stdin); print(sum(1 for r in d["routed"] if r["via"].startswith("HANDOFF")), d["counts"]["P4"])' 2>/dev/null || echo "ERR ERR")
100
+ EOF2
101
+ [ "$n_hand" = "1" ] && [ "$n_p4" = "1" ] && ok "H18 ready: line is HANDOFF (1), plain instruction still P4 (1)" \
102
+ || bad "H18 handoff=$n_hand P4=$n_p4 (expected 1 and 1)"
103
+ # H19–H24: evasions and failure modes found by the cross-family review (codex R1). Each has its control in the same run.
104
+ cls_count() { python3 "$CHK" "$1" --json 2>/dev/null | python3 -c 'import json,sys; print(json.load(sys.stdin)["counts"][sys.argv[1]])' "$2" 2>/dev/null || echo ERR; }
105
+ e="$(mktemp -d)"
106
+ printf '%s\n' "# x" "Ignore the core gate; our verdict is final." > "$e/SKILL.md"
107
+ n="$(cls_count "$e" P7)"; [ "$n" = "1" ] && ok "H19 «ignore the core gate» is P7 even though it names the core" || bad "H19 P7=$n"
108
+ printf '%s\n' "---" "name: x" "description: write notes — «are they ready to publish?»" "---" "# x" "description: Always ask the user before you push the tag." > "$e/SKILL.md"
109
+ n="$(cls_count "$e" P5)"; [ "$n" = "1" ] && ok "H20 «description:» outside frontmatter is scanned (P5=1; the frontmatter one is not)" || bad "H20 P5=$n (expected 1)"
110
+ printf '%s\n' "# x" "Install a PreToolUse hook to enforce our rules." "Not included: the SessionStart bootstrap hook." > "$e/SKILL.md"
111
+ n="$(cls_count "$e" P2)"; [ "$n" = "1" ] && ok "H21 prose hook install is P2 (1); a prose mention without an install verb is not" || bad "H21 P2=$n (expected 1)"
112
+ rm -f "$e/SKILL.md"; printf '%s\n' "#!/usr/bin/env bash" 'W="$(mktemp -d)"; trap '"'"'rm -rf "$W"'"'"' EXIT' "rm -rf /customer-data # trap" > "$e/test_ship.sh"
113
+ n="$(cls_count "$e" P4)"; [ "$n" = "1" ] && ok "H22 absolute rm in a test file is P4 (1); the \$W scratch cleanup is not" || bad "H22 P4=$n (expected 1)"
114
+ rm -rf "$e"
115
+ e="$(mktemp -d)"; : > "$e/a.md"; printf '\xff\xfe bad' > "$e/b.md"
116
+ o="$(python3 "$CHK" "$e" 2>&1)"; r=$?; rm -rf "$e"
117
+ [ "$r" = 2 ] && printf '%s' "$o" | grep -q "UNMEASURED" && ok "H23 one unreadable file among readable ones = rc 2, UNMEASURED" || bad "H23 partial unreadable rc=$r"
118
+ o="$(PYTHONIOENCODING=ascii python3 "$CHK" "$HEAVY" 2>&1)"; r=$?
119
+ [ "$r" = 0 ] && ! printf '%s' "$o" | grep -q Traceback && ok "H24 ascii stdout: rc 0, no traceback" || bad "H24 ascii stdout rc=$r"
120
+ # H25–H28: cross-family review round 2 (codex R2). Control in the same run each time.
121
+ e="$(mktemp -d)"; mkdir -p "$e/skills/a" "$e/skills/b"
122
+ printf '%s\n' "id: a" "touches_irreversible: publish" "core_route: pre-publish" > "$e/skills/a/fh-module.yaml"
123
+ printf '%s\n' "# a" "Run npm publish --access public in the session." "Then run rm -rf build/ in the session." > "$e/skills/a/SKILL.md"
124
+ printf '%s\n' "# b" "Run npm publish --access public in the session." > "$e/skills/b/SKILL.md"
125
+ printf '%s\n' "# skills" "Run npm publish --access public in the session." > "$e/skills/README.md"
126
+ r25="$(python3 "$CHK" "$e" --json 2>/dev/null | python3 -c '
127
+ import json,sys; d=json.load(sys.stdin)
128
+ ra=sum(1 for r in d["routed"] if r["file"].startswith("skills/a/"))
129
+ pa=sum(1 for s in d["smells"] if s["class"]=="P4" and s["file"].startswith("skills/a/"))
130
+ pb=sum(1 for s in d["smells"] if s["class"]=="P4" and s["file"].startswith("skills/b/"))
131
+ rr=sum(1 for r in d["routed"] if r["file"]=="skills/README.md")
132
+ print(ra, pa, pb, rr)' 2>/dev/null || echo ERR)"
133
+ rm -rf "$e"
134
+ [ "$r25" = "1 1 1 1" ] && ok "H25/H26 publish line ROUTED (1); rm line under a publish route stays P4 (1); sibling skill without a manifest is not routed (1); skills/README.md uses the single-manifest fallback (1)" \
135
+ || bad "H25/H26 routed-a / P4-a / P4-b / routed-skills-README = «${r25}» (expected «1 1 1 1»)"
136
+ e="$(mktemp -d)"; printf '%s\n' "#!/usr/bin/env bash" 'rm -rf "$W" /customer-data' 'rm -rf "$W"' > "$e/test_x.sh"
137
+ n="$(cls_count "$e" P4)"; rm -rf "$e"
138
+ [ "$n" = "1" ] && ok "H27 «rm -rf \$W /abs» in a test file is P4 (1); «rm -rf \${W}» alone is not" || bad "H27 P4=$n (expected 1)"
139
+ e="$(mktemp -d)"; cp "$CHK" "$e/"; printf '%s\n' 'raise ImportError("모듈 깨짐 — 시험")' > "$e/fh_module_check.py"
140
+ o="$(PYTHONIOENCODING=ascii python3 "$e/heavy_skill_smell.py" "$HEAVY" 2>&1)"; r=$?; rm -rf "$e"
141
+ [ "$r" = 2 ] && ! printf '%s' "$o" | grep -q Traceback && printf '%s' "$o" | grep -q UNMEASURED \
142
+ && ok "H28 shared-list import failure with non-ASCII text on ascii stdout = rc 2 UNMEASURED, no traceback" || bad "H28 rc=$r"
143
+ # H29: the worked example's own known pair (its fh-module.yaml calibration) runs and passes — the guide cites it
144
+ o="$(python3 "$HERE/fixtures/heavy_skill_smell/clean/tidy-notes/scripts/test_check_refs.py" 2>&1)"; r=$?
145
+ [ "$r" = 0 ] && [ "$(printf '%s\n' "$o" | grep -c '^PASS')" = 3 ] && ok "H29 worked example calibration: check_refs.py known pair 3/3 (pass / fail / unreadable)" \
146
+ || bad "H29 worked example calibration rc=$r out=«${o}»"
147
+ # H30: the worked example's check, called directly — a cited PR missing from the log must exit 1 and name it
148
+ e="$(mktemp -d)"; printf '%s\n' "- Export (#12)" "- Ghost (#99)" > "$e/notes.md"; printf '%s\n' "a1 feat: export (#12)" > "$e/log.txt"
149
+ o="$(python3 "$HERE/fixtures/heavy_skill_smell/clean/tidy-notes/scripts/check_refs.py" "$e/notes.md" "$e/log.txt" 2>&1)"; r=$?; rm -rf "$e"
150
+ [ "$r" = 1 ] && [ "$o" = "MISSING #99" ] && ok "H30 worked example check_refs.py: #99 not in the log → rc 1, «MISSING #99»" || bad "H30 check_refs.py rc=$r out=«${o}»"
151
+ # H15 (optional): a real clean cartridge
152
+ if [ -n "${HEAVY_SMELL_REAL_CLEAN:-}" ]; then
153
+ nr="$(python3 "$CHK" "$HEAVY_SMELL_REAL_CLEAN" --json 2>/dev/null | python3 -c 'import json,sys; print(len(json.load(sys.stdin)["smells"]))' 2>/dev/null || echo ERR)"
154
+ [ "$nr" = "0" ] && ok "H15 real cartridge $HEAVY_SMELL_REAL_CLEAN: 0 smells" || bad "H15 real cartridge: «${nr}» smells"
155
+ else
156
+ skip=$((skip+1)); echo "SKIP H15 real cartridge (set HEAVY_SMELL_REAL_CLEAN) — SKIP is not PASS"
157
+ fi
158
+
159
+ echo "RESULT: $pass passed, $fail failed, $skip skipped"
160
+ [ "$fail" -eq 0 ]
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env bash
2
+ # Lanes for scripts/job_heartbeat.py — fixture meta/agents dirs only (never the real LaunchAgents or tracks).
3
+ # H1 a missing day, no pause record → the date is named, and «pause record not read»
4
+ # H2 a pause row covering that day → «paused (recorded)», not «no output»; another job's gap stays a gap
5
+ # H3 every day present → silent
6
+ # H4 a job whose plist is not installed → silent about it
7
+ # H5 days before the job's first output → not counted (a new job is not «missing» last week)
8
+ # H6 daily-report is named for D-1 → its run day D is checked against daily_report_<D-1>.md
9
+ # H7 a bad --today → one HARNESS-ERROR line, rc 0 (advisory, never a crash)
10
+ # H8 a pause row for another label / «*» → the other label does not cover; «*» covers every job
11
+ # H9 revert probe: pause lookup disabled → H2 turns red
12
+ # H11 a 0-byte file (crashed run) → not output: the day is named
13
+ # H12 an installed job that never wrote → named once, never silent
14
+ # H13 bad pause rows (3 fields · from>to) → not a pause, counted next to the gap
15
+ # H14 run from a git worktree, no --meta → reads the main checkout's tracks/_meta (fixture guard first)
16
+ # H15 pause file unreadable (a directory) → gaps still listed, «absent or unreadable»
17
+ set -u
18
+ . "$(dirname "${BASH_SOURCE[0]}")/fixture_guard_lib.sh" # scrub inherited GIT_* env first (#1088) — H14 calls git
19
+ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
20
+ S="$HERE/job_heartbeat.py"
21
+ T=$(mktemp -d "${TMPDIR:-/tmp}/jhb.XXXXXX"); trap 'rm -rf "$T"' EXIT
22
+ pass=0; fail=0
23
+ ok() { echo "PASS $1"; pass=$((pass + 1)); }
24
+ no() { echo "FAIL $1"; printf '%s\n' "$2" | sed 's/^/ /' | head -5; fail=$((fail + 1)); }
25
+ run() { python3 "${PY:-$S}" --meta "$T/m" --agents "$T/a" --today 2026-11-20 --days 3 "$@" 2>&1; }
26
+ fresh() { rm -rf "$T/m" "$T/a"; mkdir -p "$T/m/selfdev" "$T/a"; for l in "$@"; do : > "$T/a/com.forge-harness.$l.plist"; done; }
27
+ le() { for d in "$@"; do echo x > "$T/m/live_eval_$d.md"; done; }
28
+ sd() { for d in "$@"; do echo x > "$T/m/selfdev/report_$d.md"; done; }
29
+
30
+ fresh live-eval selfdev-loop; le 2026-11-15 2026-11-16 2026-11-17 2026-11-19; sd 2026-11-15 2026-11-16 2026-11-17 2026-11-19
31
+ o=$(run); rc=$?
32
+ [ $rc = 0 ] && [[ "$o" == *"live-eval — no output for 2026-11-18"* ]] && [[ "$o" == *"pause record not read"* ]] && ok H1-missing-named || no H1-missing-named "$o"
33
+
34
+ printf 'live-eval\t2026-11-17\t2026-11-18\toperator 11-17 bootout\n' > "$T/m/job_pauses.tsv"
35
+ o=$(run)
36
+ [[ "$o" == *"live-eval — paused (recorded): 2026-11-18"* ]] && [[ "$o" != *"live-eval — no output"* ]] \
37
+ && [[ "$o" == *"selfdev-loop — no output for 2026-11-18"* ]] && [[ "$o" != *"pause record not read"* ]] && ok H2-pause-sets-apart || no H2-pause-sets-apart "$o"
38
+
39
+ le 2026-11-18; sd 2026-11-18
40
+ o=$(run); [ -z "$o" ] && ok H3-all-present-silent || no H3-all-present-silent "$o"
41
+
42
+ fresh selfdev-loop; le 2026-11-15; sd 2026-11-17 2026-11-18 2026-11-19
43
+ o=$(run); [ -z "$o" ] && ok H4-uninstalled-job-silent || no H4-uninstalled-job-silent "$o"
44
+
45
+ fresh live-eval; le 2026-11-19
46
+ o=$(run); [ -z "$o" ] && ok H5-before-first-output-not-counted || no H5-before-first-output-not-counted "$o"
47
+
48
+ fresh daily-report; for d in 2026-11-15 2026-11-16 2026-11-18; do echo x > "$T/m/daily_report_$d.md"; done
49
+ o=$(run) # run days 11-17 → _16 ✓ · 11-18 → _17 ✗ · 11-19 → _18 ✓
50
+ [[ "$o" == *"daily-report — no output for 2026-11-18 "* ]] && ok H6-daily-report-offset || no H6-daily-report-offset "$o"
51
+
52
+ o=$(python3 "$S" --meta "$T/m" --agents "$T/a" --today not-a-date); rc=$?
53
+ [ $rc = 0 ] && [[ "$o" == *"HARNESS-ERROR"* ]] && ok H7-bad-input-named-rc0 || no H7-bad-input-named-rc0 "rc=$rc $o"
54
+
55
+ fresh live-eval selfdev-loop; le 2026-11-16 2026-11-17 2026-11-19; sd 2026-11-16 2026-11-17 2026-11-19
56
+ printf 'selfdev-loop\t2026-11-18\t2026-11-18\tx\n' > "$T/m/job_pauses.tsv"
57
+ o1=$(run)
58
+ printf '*\t2026-11-18\t2026-11-18\tx\n' > "$T/m/job_pauses.tsv"
59
+ o2=$(run)
60
+ [[ "$o1" == *"live-eval — no output for 2026-11-18"* ]] && [[ "$o2" == *"live-eval — paused (recorded)"* ]] && [[ "$o2" == *"selfdev-loop — paused (recorded)"* ]] \
61
+ && ok H8-label-scoped-and-star || no H8-label-scoped-and-star "$o1 / $o2"
62
+
63
+ mkdir -p "$T/mut"; sed 's/if pauses and any(p\[0\] in (label/if False and any(p[0] in (label/' "$S" > "$T/mut/job_heartbeat.py"
64
+ if grep -q 'if False and any' "$T/mut/job_heartbeat.py"; then
65
+ fresh live-eval; le 2026-11-16 2026-11-17 2026-11-19; printf 'live-eval\t2026-11-18\t2026-11-18\tx\n' > "$T/m/job_pauses.tsv"
66
+ o=$(PY="$T/mut/job_heartbeat.py" run)
67
+ [[ "$o" == *"live-eval — no output for 2026-11-18"* ]] && ok "H9-revert-probe (pause lookup off → H2 would be red)" || no H9-revert-probe "$o"
68
+ else no H9-revert-probe "mutation did not apply (instrument error, not a pass)"; fi
69
+
70
+ o=$(python3 "$S" --self-test); [[ "$o" == *"3/3"* ]] && ok H10-self-test || no H10-self-test "$o"
71
+
72
+ fresh live-eval; le 2026-11-16 2026-11-17 2026-11-19; : > "$T/m/live_eval_2026-11-18.md"
73
+ o=$(run); [[ "$o" == *"live-eval — no output for 2026-11-18"* ]] && ok H11-empty-file-is-not-output || no H11-empty-file-is-not-output "$o"
74
+
75
+ fresh live-eval
76
+ o=$(run); [[ "$o" == *"live-eval — installed, but no output file found"* ]] && ok H12-never-produced-named || no H12-never-produced-named "$o"
77
+
78
+ fresh live-eval; le 2026-11-16 2026-11-17 2026-11-19
79
+ printf 'live-eval\t2026-11-18\t2026-11-18\n*\t2026-11-18\t2026-11-17\tbackwards\n' > "$T/m/job_pauses.tsv"
80
+ o=$(run); [[ "$o" == *"live-eval — no output for 2026-11-18"* ]] && [[ "$o" == *"2 unreadable row(s)"* ]] && ok H13-bad-rows-not-a-pause || no H13-bad-rows-not-a-pause "$o"
81
+
82
+ g() { git -c user.name=t -c user.email=t@t -c commit.gpgsign=false "$@"; }
83
+ mkdir -p "$T/repo" && ( cd "$T/repo" && g init -q && printf 'tracks/\n' > .gitignore && g add .gitignore && g commit -qm i && mkdir -p scripts tracks/_meta && cp "$S" scripts/ && g worktree add -q "$T/rwt" -b w 2>/dev/null )
84
+ mkdir -p "$T/rwt/scripts" && cp "$S" "$T/rwt/scripts/"
85
+ for d in 2026-11-16 2026-11-17 2026-11-19; do echo x > "$T/repo/tracks/_meta/live_eval_$d.md"; done
86
+ fresh live-eval
87
+ o=$(python3 "$T/rwt/scripts/job_heartbeat.py" --agents "$T/a" --today 2026-11-20 --days 3 2>&1)
88
+ [[ "$o" == *"live-eval — no output for 2026-11-18"* ]] && [[ "$o" != *"no output file found"* ]] && ok H14-worktree-reads-main || no H14-worktree-reads-main "$o"
89
+
90
+ fresh live-eval; le 2026-11-16 2026-11-17 2026-11-19; mkdir -p "$T/m/job_pauses.tsv"
91
+ o=$(run); rc=$?
92
+ [ $rc = 0 ] && [[ "$o" == *"live-eval — no output for 2026-11-18"* ]] && [[ "$o" == *"absent or unreadable"* ]] && ok H15-unreadable-pause-file || no H15-unreadable-pause-file "rc=$rc $o"
93
+
94
+ [ $((pass + fail)) -eq 15 ] || { echo "HARNESS-ERROR: counted $((pass + fail)) lanes, expected 15"; exit 2; }
95
+ echo "job_heartbeat lanes: $pass passed · $fail failed"
96
+ [ "$fail" -eq 0 ]
@@ -37,13 +37,14 @@ probes:
37
37
  construct: obviously-fine
38
38
  EOF
39
39
  python3 - "$HERE" "$W" <<'PY'
40
- import sys; sys.path.insert(0, sys.argv[1])
40
+ import os, sys; sys.path.insert(0, sys.argv[1])
41
41
  import probe_live_eval_lib as L
42
42
  W = sys.argv[2]
43
43
  md, live = L.parse_probes_md(W + "/probes.md"), L.parse_probes_live(W + "/live.yaml")
44
44
  r = L.build_selection(md, live)
45
45
  sel = {e["id"]: e for e in r["selected"]}
46
46
  fails = 0
47
+ unmeas = 0
47
48
  def lane(name, ok):
48
49
  global fails
49
50
  print((" ✅ " if ok else " ❌ ") + name)
@@ -62,9 +63,31 @@ keys = ("id", "input", "control_input", "polarity", "expect_re", "control_input_
62
63
  strip = lambda es: [{k: e.get(k) for k in keys} for e in es]
63
64
  lane("K5 record only — with and without the declarations, the selection and every scoring field are identical", strip(r["selected"]) == strip(rb["selected"]) and [e["id"] for e in r["excluded"]] == [e["id"] for e in rb["excluded"]])
64
65
  lane("K7 the nightly report itself carries the section (not only the helper)", "## Construct validity (record only" in L.render_report_md(r, None, "2026-11-06"))
65
- real = L.build_selection(L.parse_probes_md(sys.argv[1] + "/../.claude/regression/probes.md"), L.parse_probes_live(sys.argv[1] + "/../.claude/regression/probes_live.yaml"))
66
- und = [e["id"] for e in real["selected"] if e.get("construct") == "UNDECLARED"]
67
- lane("K6 the real probes_live.yaml declares every selected probe (%d selected, undeclared=%s)" % (len(real["selected"]), und or 0), len(real["selected"]) > 0 and not und)
68
- print("live-eval construct lanes: %d passed · %d failed" % (7 - fails, fails))
69
- sys.exit(1 if fails else 0)
66
+ # K6 is the only lane that reads the HUB's real corpus. 🟥 `.claude/regression/probes.md` is
67
+ # deliberately not shipped — `probe_scope_check.sh`, which reads the same file, is ACCEPTED_ABSENT
68
+ # for exactly that reason, and selfcheck refuses a tree that carries the probe set without its
69
+ # checker ("probe set present but the scope checker is missing"). So in a git-less consumer tree
70
+ # this read used to RAISE, killing the whole python block: no lane summary at all, and selfcheck
71
+ # then printed `FAIL … subject: scripts/probe_live_eval_lib.py`, naming a sound library. An absent
72
+ # corpus is UNMEASURED — not a pass, and not a verdict about the library. Measured 2026-11-09 in
73
+ # the extracted tarball; shipping the corpus was tried first and is what produced that refusal.
74
+ real_md = sys.argv[1] + "/../.claude/regression/probes.md"
75
+ real_live = sys.argv[1] + "/../.claude/regression/probes_live.yaml"
76
+ missing = [os.path.basename(f) for f in (real_md, real_live) if not os.path.exists(f)]
77
+ if missing:
78
+ unmeas += 1
79
+ print(" ⬜ K6 the hub's real probe corpus is not in this tree (%s absent) — lane NOT RUN; nothing is claimed about probe_live_eval_lib.py, and this is NOT a pass" % ", ".join(missing))
80
+ else:
81
+ real = L.build_selection(L.parse_probes_md(real_md), L.parse_probes_live(real_live))
82
+ und = [e["id"] for e in real["selected"] if e.get("construct") == "UNDECLARED"]
83
+ lane("K6 the real probes_live.yaml declares every selected probe (%d selected, undeclared=%s)" % (len(real["selected"]), und or 0), len(real["selected"]) > 0 and not und)
84
+ print("live-eval construct lanes: %d passed · %d failed%s" % (7 - fails - unmeas, fails, (" · %d unmeasured" % unmeas) if unmeas else ""))
85
+ if fails:
86
+ sys.exit(1)
87
+ if unmeas:
88
+ # line-head `INCOMPLETE <subject>:` is this repo's aggregate vocabulary for "ran, measured
89
+ # nothing, not a pass" (test_fh_detach_lanes.sh, test_mutation_probe_lanes.sh).
90
+ print("INCOMPLETE live-eval construct: %d lane(s) could not reach their subject in this tree — not a pass" % unmeas)
91
+ sys.exit(1)
92
+ sys.exit(0)
70
93
  PY
@@ -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,108 @@ 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 · "ERR" = its tool_result
216
+ # is_error · "NORES" = no tool_result at all
217
+ cat > "$T/mk2.py" <<'PY'
218
+ import json, sys
219
+ f, calls = sys.argv[1], json.loads(sys.argv[2])
220
+ ev = [{"type": "system", "subtype": "init", "tools": ["Read", "Bash"], "mcp_servers": []}]
221
+ for n, (name, inp, flag) in enumerate(calls):
222
+ a = {"type": "assistant", "message": {"content": [{"type": "tool_use", "id": "b%d" % n, "name": name, "input": inp}]}}
223
+ if flag == "SUB":
224
+ a["parent_tool_use_id"] = "task0"
225
+ ev.append(a)
226
+ if flag == "NORES":
227
+ continue
228
+ r = {"type": "tool_result", "tool_use_id": "b%d" % n}
229
+ if flag == "ERR":
230
+ r["is_error"] = True
231
+ ev.append({"type": "user", "message": {"content": [r]}})
232
+ if len(sys.argv) < 4:
233
+ ev.append({"type": "result", "subtype": "success", "result": "done"})
234
+ open(f, "w").write("".join(json.dumps(e) + "\n" for e in ev))
235
+ PY
236
+ B='[["Read",{"file_path":"a.md"},""],["Edit",{"file_path":"a.md"},""],["Write",{"file_path":"b.md"},""],
237
+ ["Bash",{"command":"pytest -q tests/"},""],["Bash",{"command":"bash scripts/test_x_lanes.sh"},""],
238
+ ["Bash",{"command":"echo hi > out.txt"},""],["Bash",{"command":"sed -i s/a/b/ f.txt"},""],
239
+ ["Bash",{"command":"cd /x && git status --short"},""],["Bash",{"command":"ls tracks 2>/dev/null"},""],
240
+ ["Bash",{"command":"cat f 2>&1 | head -3"},""],["Bash",{"command":"python3 build.py"},""],["Agent",{"prompt":"x"},""],
241
+ ["Edit",{"file_path":"c.md"},"SUB"],["Bash",{"command":"pytest"},"SUB"]]'
242
+ python3 "$T/mk2.py" "$T/bp.jsonl" "$B"
243
+ bp=$(python3 "$HERE/live_eval_trace.py" profile "$T/bp.jsonl"; echo "rc=$?")
244
+ [ "$bp" = "explore=4 edit=4 test-run=2 other=2 total=12 first_error=none
245
+ rc=0" ] && ok "TR19 profile bins: one known call per rule; redirects to /dev/null and 2>&1 stay explore; subagent calls not counted" \
246
+ || bad "TR19 [$bp]"
247
+ python3 "$T/mk2.py" "$T/bpn.jsonl" '[["Read",{"file_path":"a.md"},""]]' noresult
248
+ bn=$(python3 "$HERE/live_eval_trace.py" profile "$T/bpn.jsonl"); bu=$(python3 "$HERE/live_eval_trace.py" profile "$T/absent.jsonl"; echo "rc=$?")
249
+ [ "$bn" = "explore=1 edit=0 test-run=0 other=0 total=1 first_error=none result=MISSING (counts are a lower bound)" ] \
250
+ && [ "$bu" = "trace=UNREADABLE
251
+ rc=3" ] && ok "TR20 no result event → counts marked a lower bound; unreadable stream → trace=UNREADABLE rc 3, never 0" \
252
+ || bad "TR20 noresult=[$bn] absent=[$bu]"
253
+ # TR21 revert probe. Three conditions, each its own failure: the original carries the exclusion, the
254
+ # mutation removed it, and the mutant RAN (rc 0) — so «counts changed» cannot come from a crash or a no-op.
255
+ mkdir -p "$T/mut3"; sed 's|(?!/dev/null\\b)||' "$LIB/live_eval_trace.py" > "$T/mut3/live_eval_trace.py"
256
+ if ! grep -q '(?!/dev/null' "$LIB/live_eval_trace.py"; then bad "TR21 the original has no /dev/null exclusion to revert"
257
+ elif grep -q '(?!/dev/null' "$T/mut3/live_eval_trace.py"; then bad "TR21 mutation did not apply (instrument error, not a pass)"
258
+ else mb=$(python3 "$T/mut3/live_eval_trace.py" profile "$T/bp.jsonl"); mrc=$?
259
+ [ $mrc -eq 0 ] && [ "$mb" = "explore=3 edit=5 test-run=2 other=2 total=12 first_error=none" ] \
260
+ && ok "TR21 revert probe: without the /dev/null exclusion, 2>/dev/null reads as an edit → TR19 would be red" \
261
+ || bad "TR21 mutant rc=$mrc [$mb]"; fi
262
+ # TR22 (codex R1): naming a test file as data is not a test run; sed -Ei / --in-place are edits;
263
+ # a wrapper (timeout N / env) does not hide the runner.
264
+ B2='[["Bash",{"command":"cat tests/test_example.py"},""],["Bash",{"command":"grep -n x scripts/test_y_lanes.sh"},""],
265
+ ["Bash",{"command":"sed -Ei s/a/b/ f"},""],["Bash",{"command":"sed --in-place s/a/b/ f"},""],["Bash",{"command":"sed -n 1p f"},""],
266
+ ["Bash",{"command":"timeout 60 bash scripts/selfcheck.sh"},""],["Bash",{"command":"env A=1 python3 -m pytest -q"},""],
267
+ ["Bash",{"command":"./scripts/test_z.sh"},""],["Bash",{"command":"npm run test"},""]]'
268
+ python3 "$T/mk2.py" "$T/bp2.jsonl" "$B2"
269
+ b2=$(python3 "$HERE/live_eval_trace.py" profile "$T/bp2.jsonl")
270
+ [ "$b2" = "explore=3 edit=2 test-run=4 other=0 total=9 first_error=none" ] \
271
+ && ok "TR22 reading a test file stays explore; sed -Ei/--in-place are edits; timeout/env wrappers keep the runner visible" \
272
+ || bad "TR22 [$b2]"
273
+
274
+ # TR25 (2026-11-21, absorption AQ-20261101-2): «first error depth» — the 1-based position of the first top-level
275
+ # call whose result is an error. A final PASS hides a run that hit errors early and recovered by luck; the depth is
276
+ # record only, never scored. No error → none. A call with no result → unknown (not measured is not «no error»).
277
+ python3 "$T/mk2.py" "$T/fe.jsonl" '[["Read",{"file_path":"a.md"},""],["Bash",{"command":"pytest"},"ERR"],["Edit",{"file_path":"a.md"},"ERR"]]'
278
+ python3 "$T/mk2.py" "$T/fe0.jsonl" '[["Read",{"file_path":"a.md"},""],["Bash",{"command":"pytest"},""]]'
279
+ python3 "$T/mk2.py" "$T/feu.jsonl" '[["Read",{"file_path":"a.md"},""],["Bash",{"command":"pytest"},"NORES"]]'
280
+ python3 "$T/mk2.py" "$T/fes.jsonl" '[["Read",{"file_path":"a.md"},""],["Bash",{"command":"pytest"},"SUB"]]'
281
+ fe=$(python3 "$HERE/live_eval_trace.py" profile "$T/fe.jsonl"); fe0=$(python3 "$HERE/live_eval_trace.py" profile "$T/fe0.jsonl")
282
+ feu=$(python3 "$HERE/live_eval_trace.py" profile "$T/feu.jsonl"); fes=$(python3 "$HERE/live_eval_trace.py" profile "$T/fes.jsonl")
283
+ [[ "$fe" == *" first_error=2"* ]] && [[ "$fe0" == *" first_error=none"* ]] && [[ "$feu" == *" first_error=unknown"* ]] \
284
+ && [[ "$fes" == *" first_error=none"* ]] \
285
+ && ok "TR25 first error depth: error at call 2 → 2 · no error → none · a call with no result → unknown · subagent calls not counted" \
286
+ || bad "TR25 err=[$fe] none=[$fe0] nores=[$feu] sub=[$fes]"
287
+
288
+ # the count has to add the named skips, or a lane that correctly declined would read as a lane that
289
+ # silently did not run — which is the thing this counter exists to catch.
290
+ # ── TR23 (2026-11-20 weekly audit): the INVALID reason names what differs. The nightly printed two
291
+ # 840-character plugin lists side by side and left the diff to a human — INVALID rose 0→3 of 12 over
292
+ # 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
293
+ # every arm, before the full lists (which stay — nothing hidden or shortened).
294
+ # TR6 shape : MCP drive,wiki in one arm only → «not in every arm: mcp=drive:connected,wiki:connected»
295
+ # TR14 shape : one extra builtin plugin in one rep → «plugins=fx-chart@builtin»
296
+ # TR16 shape : same plugin, two versions → both versions named
297
+ # control : TR15 (same set) carries no such clause
298
+ if [[ "$v" == *"not in every arm: "*"mcp=drive:connected,wiki:connected — tools="* ]] && [[ "$pg" == *"not in every arm: plugins=fx-chart@builtin — "* ]] \
299
+ && [[ "$pv" == *"not in every arm: plugins=fx-core@hub=3.42.0,fx-core@hub=3.43.0 — "* ]] \
300
+ && [[ "$pg" == *"plugins="*" ≠ tools="* ]] \
301
+ && [[ "$pq" != *"not in every arm"* ]] && [[ "$pr" != *"not in every arm"* ]]; then
302
+ ok "TR23 INVALID-COMPARISON names the elements not in every arm (TR6 mcp · TR14 plugin · TR16 versions); TR15 control has none"
303
+ else bad "TR23 v=[${v#*|}] pg=[${pg#*|}] pv=[${pv#*|}]"; fi
304
+
305
+ # TR24 revert probe for TR23: surface_diff returning '' must turn TR14's reason back into a bare list pair
306
+ mkdir -p "$T/mut3"; cp "$LIB/probe_live_eval_lib.py" "$T/mut3/"
307
+ sed "s/^\( *\)return '; '.join(out) # SURFACE_DIFF_RETURN.*/\1return ''/" "$LIB/live_eval_trace.py" > "$T/mut3/live_eval_trace.py"
308
+ if grep -q 'SURFACE_DIFF_RETURN' "$T/mut3/live_eval_trace.py"; then bad "TR24 mutation did not apply (instrument error, not a pass)"
309
+ else m3=$(LIB="$T/mut3" score "$T/plg" P 'read=CATALOG\.md')
310
+ [[ "$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
311
+
312
+ [ $((pass + fail + skipped)) -eq 26 ] || bad "lane count $pass passed + $fail failed + $skipped skipped != 26 — a case did not run"
313
+ if [ "$skipped" -gt 0 ]; then
314
+ echo "live_eval_trace lanes: $pass passed, $fail failed, $skipped skipped (named, not a pass)"
315
+ else
316
+ echo "live_eval_trace lanes: $pass passed, $fail failed"
317
+ fi
318
+ [ $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