@chrono-meta/fh-gate 3.8.0 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/regression/probes_live.yaml +108 -6
- package/.claude-plugin/marketplace.json +4 -4
- package/docs/OUTPUT_EVIDENCE.md +2 -1
- package/knowledge/shared/harness-core/governance_engineering_definition.md +7 -3
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +211 -0
- package/package.json +3 -1
- package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/CHANGELOG.md +84 -0
- package/plugins/fh-meta/skills/frontier-digest/SKILL.md +1 -1
- package/plugins/fh-meta/skills/frontier-digest/SKILL_detail.md +18 -1
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-preprep/skills/preprep/SKILL.md +7 -1
- package/plugins/fh-preprep/skills/preprep/fixtures/font_revert_probe.py +6 -4
- package/plugins/fh-preprep/skills/preprep/lane_font.py +105 -16
- package/plugins/fh-preprep/skills/preprep/test_lane_font.py +170 -21
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/com.forge-harness.live-eval.plist +5 -2
- package/scripts/probe_live_eval.sh +117 -3
- package/scripts/probe_live_eval_lib.py +178 -5
- package/scripts/selfcheck.sh +23 -0
- package/scripts/test_precommit_gitlink_lanes.sh +142 -0
- package/scripts/test_probe_live_eval_lanes.sh +271 -10
- package/scripts/test_temper_check_lanes.sh +307 -0
- package/scripts/test_utterance_intake_lanes.sh +131 -0
- package/scripts/utterance_intake.sh +115 -4
- package/templates/.git-hooks/pre-commit +47 -0
|
@@ -26,10 +26,16 @@
|
|
|
26
26
|
# hand-curated CLI-event filter) and scripts/probe_live_eval_lib.py for the implementation. Run
|
|
27
27
|
# `--dry-run` to see the full 33-row breakdown: which probes are selected, which are excluded and
|
|
28
28
|
# why, and which pass the mechanical rule but have no authored expect/control yet
|
|
29
|
-
# (NOT-YET-AUTHORED — an honest gap, not a silent drop
|
|
30
|
-
#
|
|
29
|
+
# (NOT-YET-AUTHORED — an honest gap, not a silent drop). As of 2026-09-14 that bucket is EMPTY:
|
|
30
|
+
# G-LINT-01, its long-standing occupant, moved to ARM_CAPABILITY_EXCLUDE because the real blocker
|
|
31
|
+
# is that its route needs the Skill layer the arm does not have — an unauthored spec was never the
|
|
32
|
+
# reason. See probe_live_eval_lib.py for the three named exclude sets and what each one does and
|
|
33
|
+
# does not claim.
|
|
31
34
|
#
|
|
32
|
-
# COST. Each selected probe costs TWO live `claude -p` calls (primary + control)
|
|
35
|
+
# COST. Each selected probe costs TWO live `claude -p` calls (primary + control) — THREE if it
|
|
36
|
+
# declares `control_input_b`, a second known-negative (only G-TRIG-07 does, as of 2026-09-14).
|
|
37
|
+
# At the current 13-probe selection that is 27 arm-calls per rep; the nightly plist passes
|
|
38
|
+
# `--reps 3`, so a full night is 81 live calls. Do not run the
|
|
33
39
|
# full selected set casually — use --subset N or --ids P1,P2 for a spot-check, and read
|
|
34
40
|
# sim_isolated_run.sh's own header before running unattended (isolation guarantees, what "observe"
|
|
35
41
|
# mode does and does not prevent, the three-valued rc/bytes verdict for a timeout vs an empty
|
|
@@ -85,6 +91,30 @@ SIM_RUNNER="${FH_SIM_RUNNER_BIN:-$REPO_ROOT/scripts/sim_isolated_run.sh}"
|
|
|
85
91
|
# ── file-header constant — the "문턱" the design brief calls for. Change here, not per-invocation. ──
|
|
86
92
|
THRESHOLD="0.8"
|
|
87
93
|
|
|
94
|
+
# ── EVIDENCE PRESERVATION (2026-09-14) ────────────────────────────────────────────────────────
|
|
95
|
+
# 🟥 WHY. Until today every run's response bodies were written into a `mktemp -d` and destroyed
|
|
96
|
+
# with it, and the launchd log carries only the runner's console tail — no answer text. So when
|
|
97
|
+
# 09-12 came back at pass_rate 0.18 and 09-13 came back 0/3 on EVERY probe, there was no way to
|
|
98
|
+
# tell a model-availability blip from a rate limit from a clone failure from a real regression.
|
|
99
|
+
# Both nights are now PERMANENTLY UNATTRIBUTABLE. That is the cost this block exists to stop
|
|
100
|
+
# paying: a nightly instrument that throws away its own evidence can report a number but can
|
|
101
|
+
# never explain one.
|
|
102
|
+
#
|
|
103
|
+
# WHAT IS KEPT, AND WHAT IS NOT. Only the FLAT artifacts each arm dir holds — the response `.txt`,
|
|
104
|
+
# its `.stderr.txt`, the `.prompt.txt`, the `.meta.tsv` (corpus_head_date / model / cutoff) and the
|
|
105
|
+
# runner console log. 🟥 NOT the clones: sim_isolated_run.sh puts each rep's full
|
|
106
|
+
# `git clone --local --no-hardlinks` under `<out>/w_<arm>_r<n>/repo`, and this repo's tracked tree
|
|
107
|
+
# is ~260MB, so preserving `--out` wholesale would deposit tens of GB per night. `find -maxdepth 1
|
|
108
|
+
# -type f` is what draws that line: the clone trees live at depth 2+ and are never copied.
|
|
109
|
+
#
|
|
110
|
+
# WHERE. tracks/_meta/live_eval_runs/<date>/ — gitignored via `.gitignore:45 tracks/**` (verified
|
|
111
|
+
# with `git check-ignore -v`), same zone as the report the run already writes.
|
|
112
|
+
EVIDENCE_ROOT_DEFAULT="tracks/_meta/live_eval_runs"
|
|
113
|
+
# Retention: a nightly full set is ~66 small text files (a few hundred KB). 14 days is chosen to
|
|
114
|
+
# span the weekly cadence with a margin, so a Monday session can still read the previous week's
|
|
115
|
+
# incident. Override with FH_LIVE_EVAL_KEEP_DAYS; 0 disables pruning entirely (never auto-deletes).
|
|
116
|
+
KEEP_DAYS="${FH_LIVE_EVAL_KEEP_DAYS:-14}"
|
|
117
|
+
|
|
88
118
|
MODEL="sonnet"
|
|
89
119
|
# ── reps — 프로브당 반복 횟수. 기본 1(종전 행동 그대로), 무인 런은 plist 에서 3 을 준다. ──
|
|
90
120
|
# 🟥 왜 1 이 기본이면서 야간은 3 인가 (2026-09-06 실측): 유효 런 3 개를 재채점하니 12 프로브 중
|
|
@@ -99,6 +129,7 @@ SUBSET=""
|
|
|
99
129
|
IDS=""
|
|
100
130
|
OUTDIR=""
|
|
101
131
|
REPORT_OUT="" # --report-out: where the markdown report lands (default: tracks/_meta/live_eval_<date>.md)
|
|
132
|
+
NO_EVIDENCE=0 # --no-evidence: skip the preserved-artifact copy (lanes / throwaway spot-checks)
|
|
102
133
|
while [ $# -gt 0 ]; do
|
|
103
134
|
case "$1" in
|
|
104
135
|
--subset) SUBSET="${2:-}"; shift 2 ;;
|
|
@@ -108,6 +139,7 @@ while [ $# -gt 0 ]; do
|
|
|
108
139
|
--dry-run) DRYRUN=1; shift ;;
|
|
109
140
|
--out) OUTDIR="${2:-}"; shift 2 ;;
|
|
110
141
|
--report-out) REPORT_OUT="${2:-}"; shift 2 ;; # lanes/spot-checks MUST pass this — never the live path
|
|
142
|
+
--no-evidence) NO_EVIDENCE=1; shift ;;
|
|
111
143
|
*) echo "unknown flag: $1" >&2; exit 2 ;;
|
|
112
144
|
esac
|
|
113
145
|
done
|
|
@@ -168,6 +200,54 @@ RUN_DATE="$(date +%Y-%m-%d)"
|
|
|
168
200
|
OUTDIR="${OUTDIR:-$WORKDIR/run}"
|
|
169
201
|
mkdir -p "$OUTDIR"
|
|
170
202
|
|
|
203
|
+
# ── evidence dir + retention prune ────────────────────────────────────────────────────────────
|
|
204
|
+
EVIDENCE_DIR=""
|
|
205
|
+
if [ "$NO_EVIDENCE" -eq 0 ]; then
|
|
206
|
+
# Overridable for the lanes ONLY — a lane that wrote into the live evidence path would be the
|
|
207
|
+
# same class of defect as the 2026-09-05 incident where a lane overwrote that night's report
|
|
208
|
+
# ([[feedback_sim_with_write_tools_is_a_fleet]]). Note the prune guard below deliberately
|
|
209
|
+
# REFUSES to prune an overridden root, so this flag can never be used to point the delete at
|
|
210
|
+
# something else.
|
|
211
|
+
EVIDENCE_ROOT="${FH_LIVE_EVAL_EVIDENCE_ROOT:-$REPO_ROOT/$EVIDENCE_ROOT_DEFAULT}"
|
|
212
|
+
mkdir -p "$EVIDENCE_ROOT"
|
|
213
|
+
EVIDENCE_DIR="$EVIDENCE_ROOT/$RUN_DATE"
|
|
214
|
+
# A second run on the same day gets its own dir rather than overwriting the first. The report
|
|
215
|
+
# path already learned this lesson the hard way (2026-09-05 10:18, a lane overwrote the 02:30
|
|
216
|
+
# record); evidence is the artifact you go back to *because* the record looked wrong, so losing
|
|
217
|
+
# the earlier one is worse here, not better.
|
|
218
|
+
[ -d "$EVIDENCE_DIR" ] && EVIDENCE_DIR="$EVIDENCE_ROOT/${RUN_DATE}_$(date +%H%M%S)"
|
|
219
|
+
mkdir -p "$EVIDENCE_DIR"
|
|
220
|
+
|
|
221
|
+
# Prune. Guarded three ways, because this is the one line in this script that deletes anything:
|
|
222
|
+
# (a) the root must be the literal path built above, under $REPO_ROOT/tracks/_meta
|
|
223
|
+
# (b) only DIRECTORIES exactly one level down whose name is date-shaped
|
|
224
|
+
# (c) only older than KEEP_DAYS; KEEP_DAYS=0 disables pruning outright
|
|
225
|
+
# `-mtime +N` is portable across BSD (macOS) and GNU find; `-mindepth/-maxdepth 1` pins depth so
|
|
226
|
+
# a nested path can never be reached.
|
|
227
|
+
case "$EVIDENCE_ROOT" in
|
|
228
|
+
"$REPO_ROOT/tracks/_meta/"*)
|
|
229
|
+
if [ "$KEEP_DAYS" -gt 0 ] 2>/dev/null; then
|
|
230
|
+
while IFS= read -r _old; do
|
|
231
|
+
[ -n "$_old" ] || continue
|
|
232
|
+
echo " 🧹 pruning evidence older than ${KEEP_DAYS}d: $_old"
|
|
233
|
+
rm -rf "$_old"
|
|
234
|
+
done < <(find "$EVIDENCE_ROOT" -mindepth 1 -maxdepth 1 -type d \
|
|
235
|
+
-name '20[0-9][0-9]-[0-9][0-9]-[0-9][0-9]*' -mtime "+$KEEP_DAYS" 2>/dev/null)
|
|
236
|
+
fi
|
|
237
|
+
;;
|
|
238
|
+
*) echo " ⚠️ evidence root outside tracks/_meta — refusing to prune: $EVIDENCE_ROOT" >&2 ;;
|
|
239
|
+
esac
|
|
240
|
+
fi
|
|
241
|
+
|
|
242
|
+
# Copy ONLY the flat per-arm artifacts out of a probe dir. The full clone trees live at
|
|
243
|
+
# <probe_out>/w_<arm>_r<n>/repo/** — `-maxdepth 1 -type f` is what keeps them out (see the header
|
|
244
|
+
# block: preserving them wholesale would be tens of GB a night).
|
|
245
|
+
preserve_probe_evidence() { # $1 = probe_out dir, $2 = probe id
|
|
246
|
+
[ -n "$EVIDENCE_DIR" ] || return 0
|
|
247
|
+
mkdir -p "$EVIDENCE_DIR/$2" || return 0
|
|
248
|
+
find "$1" -maxdepth 1 -type f -exec cp {} "$EVIDENCE_DIR/$2/" \; 2>/dev/null || true
|
|
249
|
+
}
|
|
250
|
+
|
|
171
251
|
echo ""
|
|
172
252
|
echo "── live run: $SELECTED_COUNT probe(s), model=$MODEL, out=$OUTDIR ──────────────────────"
|
|
173
253
|
|
|
@@ -214,6 +294,30 @@ while IFS= read -r id; do
|
|
|
214
294
|
echo " Partial run artifacts kept at: $OUTDIR" >&2
|
|
215
295
|
exit 2
|
|
216
296
|
fi
|
|
297
|
+
|
|
298
|
+
# OPTIONAL second known-negative — a THIRD live call per rep, spent only where one control has
|
|
299
|
+
# been measured to under-discriminate. Keyed off the spec file's existence, which the selector
|
|
300
|
+
# writes only when `control_input_b` is declared (so "file absent" can only mean "not declared",
|
|
301
|
+
# never "declared but empty").
|
|
302
|
+
if [ -f "$SPEC_DIR/$id.control_b.txt" ]; then
|
|
303
|
+
control_b_text="$(cat "$SPEC_DIR/$id.control_b.txt")"
|
|
304
|
+
echo "▶ $id — control_b"
|
|
305
|
+
bash "$SIM_RUNNER" --arm control_b --reps "$REPS" --prompt "$control_b_text" \
|
|
306
|
+
--mode observe --model "$MODEL" --out "$probe_out" \
|
|
307
|
+
> "$probe_out/_runner_control_b.log" 2>&1
|
|
308
|
+
runner_rc=$?
|
|
309
|
+
tail -n 6 "$probe_out/_runner_control_b.log"
|
|
310
|
+
if [ "$runner_rc" -eq 2 ]; then
|
|
311
|
+
echo "" >&2
|
|
312
|
+
echo "❌ $id control_b runner call exited 2 (preflight failure, before \`claude\` ran)." >&2
|
|
313
|
+
echo " Aborting the whole run rather than burning the remaining clones." >&2
|
|
314
|
+
echo " Runner log: $probe_out/_runner_control_b.log" >&2
|
|
315
|
+
echo " Partial run artifacts kept at: $OUTDIR" >&2
|
|
316
|
+
exit 2
|
|
317
|
+
fi
|
|
318
|
+
fi
|
|
319
|
+
|
|
320
|
+
preserve_probe_evidence "$probe_out" "$id"
|
|
217
321
|
done < "$SPEC_DIR/selected_ids.txt"
|
|
218
322
|
|
|
219
323
|
echo ""
|
|
@@ -233,6 +337,16 @@ python3 "$LIB" score \
|
|
|
233
337
|
--reps "$REPS"
|
|
234
338
|
score_rc=$?
|
|
235
339
|
|
|
340
|
+
if [ -n "$EVIDENCE_DIR" ]; then
|
|
341
|
+
# The report is part of the evidence: a preserved body set with no verdict beside it forces the
|
|
342
|
+
# next reader to re-derive what the run concluded.
|
|
343
|
+
cp "$REPORT_PATH" "$EVIDENCE_DIR/_report.md" 2>/dev/null || true
|
|
344
|
+
_kept=$(find "$EVIDENCE_DIR" -type f 2>/dev/null | wc -l | tr -d ' ')
|
|
345
|
+
_size=$(du -sh "$EVIDENCE_DIR" 2>/dev/null | cut -f1)
|
|
346
|
+
echo ""
|
|
347
|
+
echo "📦 response bodies preserved: $EVIDENCE_DIR ($_kept files, ${_size:-?}; retention ${KEEP_DAYS}d)"
|
|
348
|
+
fi
|
|
349
|
+
|
|
236
350
|
echo ""
|
|
237
351
|
echo "run artifacts kept at: $OUTDIR"
|
|
238
352
|
echo "(temp selection workspace $WORKDIR is NOT auto-deleted when --out was passed explicitly; ok to remove by hand)"
|
|
@@ -45,7 +45,34 @@ CLI_EVENT_EXCLUDE = {"G-CODE-01", "G-CODE-02", "G-CODE-03"}
|
|
|
45
45
|
# arm that can see the skill layer), and building one re-calibrates all 12 probes, so it is not a
|
|
46
46
|
# calibration-week change. Named here so the gap stays greppable instead of dissolving into a
|
|
47
47
|
# permanently-red lane nobody reads.
|
|
48
|
-
|
|
48
|
+
#
|
|
49
|
+
# G-LINT-01 joined this set 2026-09-14, same root cause, different symptom. It had emitted
|
|
50
|
+
# NOT-YET-AUTHORED every night for eight nights — "the rule selects it but nobody wrote a spec" —
|
|
51
|
+
# which reads like a to-do and is not one: its Input Pattern is `/harness-doctor` run in FH cwd, so
|
|
52
|
+
# scoring it requires an arm that can INVOKE a skill, and this arm cannot. Eight identical warnings
|
|
53
|
+
# is how a warning stops being read; the honest close is to name the real blocker, not to author a
|
|
54
|
+
# regex against a route the arm cannot take. Same UNMEASURED note applies: whether harness-doctor's
|
|
55
|
+
# L4 knowledge cross-ref lint fires is not answered by excluding it here.
|
|
56
|
+
ARM_CAPABILITY_EXCLUDE = {"G-TRIG-03", "G-LINT-01"}
|
|
57
|
+
|
|
58
|
+
# The THIRD judgment call, and deliberately a SEPARATE set from the one above — "the arm lacks the
|
|
59
|
+
# TOOL" and "the arm cannot reach the STATE that decides the right answer" are different facts, and
|
|
60
|
+
# collapsing them would render an unreachable fixture as a missing capability (the same
|
|
61
|
+
# separate-values-on-purpose discipline CLAUDE.md applies to the `crossfamily:` degrade triad).
|
|
62
|
+
#
|
|
63
|
+
# G-GREET-03 checks the FIXED 4-DOOR MENU, which renders only on the RETURNING branch. The branch
|
|
64
|
+
# test is mechanical and is `bash scripts/mapped_tracks.sh` — but an observe-mode arm runs with
|
|
65
|
+
# `--tools "Read,Grep,Glob"` and has no Bash, and `tracks/**` is gitignored so the disposable clone
|
|
66
|
+
# carries no session files or mapped-project dirs either. The arm therefore cannot reach the state
|
|
67
|
+
# that decides WHICH door set is correct, and a regex asserting ①②③④ would score a NEW-user 2-door
|
|
68
|
+
# menu — the correct answer for that clone — as a failure.
|
|
69
|
+
#
|
|
70
|
+
# 🟥 THIS IS AN OPEN GAP, NOT AN ANSWER. "Does the fixed 4-door menu render at the floor tier?" is
|
|
71
|
+
# UNMEASURED. Closing it needs an arm with a fixture (a real FILE under tracks/{name}/ — an empty
|
|
72
|
+
# dir is invisible to Glob, measured 2026-08-29 in sim_isolated_run.sh's own header) plus a branch
|
|
73
|
+
# the arm can observe without Bash. Named here so the gap stays greppable instead of dissolving
|
|
74
|
+
# into a decorative always-red probe.
|
|
75
|
+
ARM_STATE_EXCLUDE = {"G-GREET-03"}
|
|
49
76
|
|
|
50
77
|
|
|
51
78
|
def parse_probes_md(path):
|
|
@@ -135,7 +162,14 @@ def classify(id_, input_pat, class_tok):
|
|
|
135
162
|
if id_ in CLI_EVENT_EXCLUDE:
|
|
136
163
|
return 'EXCLUDED', 'NOT-CHAT-UTTERANCE (shell command, not a chat turn)'
|
|
137
164
|
if id_ in ARM_CAPABILITY_EXCLUDE:
|
|
138
|
-
return 'EXCLUDED', 'NOT-LIVE-MEASURABLE (
|
|
165
|
+
return 'EXCLUDED', 'NOT-LIVE-MEASURABLE (needs the Skill layer; the arm has no Skill tool)'
|
|
166
|
+
# Checked BEFORE the utterance-shape rule on purpose: G-GREET-03's cell carries no quoted
|
|
167
|
+
# literal either, so NO-UTTERANCE would win the race and report a true-but-irrelevant reason
|
|
168
|
+
# ("nobody typed it") for a row whose real blocker is that the arm cannot reach the branch
|
|
169
|
+
# state. An honest reason column is the whole point of naming these sets.
|
|
170
|
+
if id_ in ARM_STATE_EXCLUDE:
|
|
171
|
+
return 'EXCLUDED', ('NOT-LIVE-MEASURABLE (branch-state route; the arm has no Bash to run '
|
|
172
|
+
'the branch test and the clone carries no tracks/** fixture)')
|
|
139
173
|
if not UTTERANCE_RE.search(input_pat):
|
|
140
174
|
return 'EXCLUDED', 'NO-UTTERANCE (no quoted/backticked literal a user would type)'
|
|
141
175
|
return 'SELECTABLE', None
|
|
@@ -185,13 +219,25 @@ def build_selection(probes_md_rows, live_rows):
|
|
|
185
219
|
warnings.append("BAD-POLARITY: %s declares polarity=%r (must be present|absent)"
|
|
186
220
|
% (row['id'], spec['polarity']))
|
|
187
221
|
continue
|
|
188
|
-
|
|
222
|
+
entry = {
|
|
189
223
|
'id': row['id'],
|
|
190
224
|
'input': spec['input'],
|
|
191
225
|
'control_input': spec['control_input'],
|
|
192
226
|
'polarity': spec['polarity'],
|
|
193
227
|
'expect_re': spec['expect_re'],
|
|
194
|
-
}
|
|
228
|
+
}
|
|
229
|
+
# Optional, and optional on purpose — a second known-negative costs a THIRD live call per
|
|
230
|
+
# rep, so it is spent only where one control has been shown to under-discriminate. Key name
|
|
231
|
+
# has no digit: parse_probes_live's key regex is `[a-z_]+`, so `control_input_2` would be
|
|
232
|
+
# silently dropped (the leniency class [[feedback_declaration_silently_dropped_by_parse]]).
|
|
233
|
+
if spec.get('control_input_b'):
|
|
234
|
+
entry['control_input_b'] = spec['control_input_b']
|
|
235
|
+
# ADVISORY channel — recorded, never scored. See score_run(): a probe can be widened to
|
|
236
|
+
# measure a BEHAVIOR while a narrower pattern keeps measuring the ROUTE, so that turning the
|
|
237
|
+
# row green does not also erase the residual the widening stopped seeing.
|
|
238
|
+
if spec.get('advisory_re'):
|
|
239
|
+
entry['advisory_re'] = spec['advisory_re']
|
|
240
|
+
selected.append(entry)
|
|
195
241
|
|
|
196
242
|
# Dead-pointer guard: an id in probes_live.yaml that does not exist in probes.md AT ALL.
|
|
197
243
|
for p in live_rows:
|
|
@@ -335,11 +381,42 @@ def score_run(live_rows, run_root, ids_in_order, threshold, model, reps=1):
|
|
|
335
381
|
rows.append({'id': pid, 'verdict': 'UNKNOWN-ID', 'primary_hit': None, 'control_hit': None})
|
|
336
382
|
continue
|
|
337
383
|
base = os.path.join(run_root, pid)
|
|
384
|
+
has_ctrl_b = bool(spec.get('control_input_b'))
|
|
385
|
+
adv_re = spec.get('advisory_re')
|
|
386
|
+
adv_pat = re.compile(adv_re) if adv_re else None
|
|
387
|
+
adv_hits = 0
|
|
388
|
+
ctrl_b_absent = False # rep-1 only, diagnostic: which arm actually produced nothing
|
|
338
389
|
per_rep = [] # [(verdict, phit, chit, primary_text, control_text)]
|
|
339
390
|
for i in range(1, reps + 1):
|
|
340
391
|
pt = _read_text(os.path.join(base, 'primary_r%d.txt' % i))
|
|
341
392
|
ct = _read_text(os.path.join(base, 'control_r%d.txt' % i))
|
|
393
|
+
ct_first_arm_ran = bool(ct)
|
|
394
|
+
if has_ctrl_b:
|
|
395
|
+
# A declared second control that produced nothing did NOT run — and a probe whose
|
|
396
|
+
# calibration arm did not run has not been calibrated. Collapsing that into "the
|
|
397
|
+
# control stayed silent, so the pattern discriminates" is the not-found-is-not-zero
|
|
398
|
+
# defect pointed at the calibration channel instead of the measurement channel.
|
|
399
|
+
ctb = _read_text(os.path.join(base, 'control_b_r%d.txt' % i))
|
|
400
|
+
if not ctb:
|
|
401
|
+
ct = None
|
|
402
|
+
if i == 1 and ct_first_arm_ran:
|
|
403
|
+
# Keep WHICH arm died attributable. Without this the reason column blames
|
|
404
|
+
# `control:` — the arm that ran fine — for the absence of `control_b:`,
|
|
405
|
+
# which is a diagnostic pointing at the wrong file. Caught by lane CB2.
|
|
406
|
+
ctrl_b_absent = True
|
|
407
|
+
elif ct:
|
|
408
|
+
# Concatenated, so a hit in EITHER known-negative sets control_hit. For
|
|
409
|
+
# polarity=present that is the strict direction (more controls can only push a
|
|
410
|
+
# probe toward UNCALIBRATED, never toward PASS).
|
|
411
|
+
# 🟥 For polarity=absent it is the LENIENT direction — the control is a
|
|
412
|
+
# known-POSITIVE there, and concatenation makes "the pattern can fire at all"
|
|
413
|
+
# easier to satisfy. Do not declare control_input_b on an absent-polarity probe
|
|
414
|
+
# without re-deriving this; none currently does.
|
|
415
|
+
ct = ct + '\n----- control_b -----\n' + ctb
|
|
342
416
|
v, ph, ch = score_probe(pt, ct, spec['polarity'], spec['expect_re'])
|
|
417
|
+
if adv_pat is not None and pt:
|
|
418
|
+
if adv_pat.search(pt):
|
|
419
|
+
adv_hits += 1
|
|
343
420
|
per_rep.append((v, ph, ch, pt, ct))
|
|
344
421
|
|
|
345
422
|
ran_reps = [r for r in per_rep if r[0] != FAILED_TO_RUN]
|
|
@@ -356,13 +433,23 @@ def score_run(live_rows, run_root, ids_in_order, threshold, model, reps=1):
|
|
|
356
433
|
# primary_hit/control_hit stay single-valued for backward compatibility with the existing
|
|
357
434
|
# report columns and lanes: they report rep 1, and `reps` carries the spread.
|
|
358
435
|
phit, chit = per_rep[0][1], per_rep[0][2]
|
|
436
|
+
# INSTRUMENT-SILENT: the pattern matched in NEITHER arm, in NO rep that ran. Per probe this
|
|
437
|
+
# is ordinary (a rule that did not fire looks exactly like this). Across a WHOLE run it is
|
|
438
|
+
# the signature of a blind instrument — see the run-level branch below.
|
|
439
|
+
silent = bool(ran_reps) and not any(r[1] or r[2] for r in ran_reps)
|
|
359
440
|
row = {'id': pid, 'verdict': verdict, 'primary_hit': phit, 'control_hit': chit,
|
|
360
441
|
'polarity': spec['polarity'], 'reason': '',
|
|
361
442
|
'reps': '%d/%d' % (len(pass_reps), len(ran_reps)) if ran_reps else '0/0',
|
|
362
443
|
'reps_requested': reps,
|
|
444
|
+
'silent': silent,
|
|
363
445
|
'rep_verdicts': [r[0] for r in per_rep]}
|
|
364
446
|
if len(ran_reps) > 1 and 0 < len(pass_reps) < len(ran_reps):
|
|
365
447
|
row['reason'] = 'FLAKY across reps (%s)' % ','.join(r[0] for r in per_rep)
|
|
448
|
+
if adv_pat is not None:
|
|
449
|
+
row['advisory'] = '%d/%d' % (adv_hits, len(ran_reps) if ran_reps else 0)
|
|
450
|
+
row['advisory_re'] = adv_re
|
|
451
|
+
note = 'advisory[%s] %s' % (adv_re, row['advisory'])
|
|
452
|
+
row['reason'] = (row['reason'] + '; ' + note) if row['reason'] else note
|
|
366
453
|
if verdict == FAILED_TO_RUN:
|
|
367
454
|
# Diagnostic only — score_probe already decided the verdict above from exactly the
|
|
368
455
|
# same texts; this never changes it, only explains it. Reported from rep 1.
|
|
@@ -370,11 +457,57 @@ def score_run(live_rows, run_root, ids_in_order, threshold, model, reps=1):
|
|
|
370
457
|
primary_text, control_text = per_rep[0][3], per_rep[0][4]
|
|
371
458
|
if primary_text is None or primary_text == '':
|
|
372
459
|
reasons.append('primary: %s' % _failure_reason(base, 'primary'))
|
|
373
|
-
if
|
|
460
|
+
if ctrl_b_absent:
|
|
461
|
+
reasons.append('control_b: %s' % _failure_reason(base, 'control_b'))
|
|
462
|
+
elif control_text is None or control_text == '':
|
|
374
463
|
reasons.append('control: %s' % _failure_reason(base, 'control'))
|
|
375
464
|
row['reason'] = '; '.join(reasons)
|
|
376
465
|
rows.append(row)
|
|
377
466
|
|
|
467
|
+
# ── RUN-BLACKOUT / BLACKOUT-SUSPECT (2026-09-14) ──────────────────────────────────────────
|
|
468
|
+
# WHY. On 2026-09-13 every one of 11 probes scored 0/3 — including G-GREET-01, which is 3/3 on
|
|
469
|
+
# every other night in the record, and G-GREET-04, whose polarity=absent control is a
|
|
470
|
+
# known-POSITIVE and also never fired. The report rendered that as ten FAIL rows: "the harness
|
|
471
|
+
# did not fire", when what actually happened is "nothing was measured". That is the
|
|
472
|
+
# not-found-is-not-zero defect (CLAUDE.md §Instrument-Calibration), and the existing
|
|
473
|
+
# UNCALIBRATED value already means exactly the right thing — it was simply never reachable from
|
|
474
|
+
# this shape, because the per-probe rule only fires when a pattern hits a known-negative.
|
|
475
|
+
# This is a CONDITION EXTENSION onto the existing value, not a new verdict.
|
|
476
|
+
#
|
|
477
|
+
# WHERE THE BOUNDARY IS, AND WHY THERE.
|
|
478
|
+
# silent_fraction = (scored probes whose pattern matched in NEITHER arm in ANY rep) / (scored)
|
|
479
|
+
# Measured over the 10 nights on record: 09-05..09-11 and 09-14 sit at 0.00–0.18.
|
|
480
|
+
# 09-12 = 0.73. 09-13 = 1.00.
|
|
481
|
+
# * silent_fraction == 1.00 AND >= 3 scored probes -> RUN-BLACKOUT (verdict UNCALIBRATED)
|
|
482
|
+
# At 1.00 there is literally no evidence any channel worked: N independent patterns, each
|
|
483
|
+
# authored against a different rule, matched nothing anywhere across 2N..6N responses.
|
|
484
|
+
# * 0.50 <= silent_fraction < 1.00 -> BLACKOUT-SUSPECT, ADVISORY ONLY.
|
|
485
|
+
# The verdict is left exactly as computed. This is the deliberate narrow edge: 09-12 lands
|
|
486
|
+
# here (0.73) and stays FAIL, because its greeting anchors were ALIVE — G-GREET-01 3/3 and
|
|
487
|
+
# G-GREET-04 3/3 — so at least two channels demonstrably worked and a genuine broad
|
|
488
|
+
# regression is a live hypothesis that must not be laundered into "nothing was measured".
|
|
489
|
+
# 🟥 This is the failure mode the extension itself must not cause: widen the hard condition
|
|
490
|
+
# below 1.00 and a REAL full regression starts rendering as UNCALIBRATED. The 0.50 line is
|
|
491
|
+
# a majority, chosen for that meaning and not fitted to 0.73; any cut in (0.18, 0.73] would
|
|
492
|
+
# separate the observed classes, which is exactly why it may NOT carry the hard branch.
|
|
493
|
+
# * >= 3 scored probes is required so the guard cannot fire on a one-probe spot-check, where
|
|
494
|
+
# "the single probe did not fire" is the ordinary, informative answer.
|
|
495
|
+
#
|
|
496
|
+
# HONEST SCOPE: n = 10 nights, one instrument, one repo. The 0.50 line is provisional and the
|
|
497
|
+
# distribution that would refine it is exactly what the newly-preserved run artifacts build.
|
|
498
|
+
scored = [r for r in rows if r['verdict'] in (PASS, FAIL, UNCALIBRATED)]
|
|
499
|
+
silent_rows = [r for r in scored if r.get('silent')]
|
|
500
|
+
silent_fraction = (len(silent_rows) / float(len(scored))) if scored else None
|
|
501
|
+
blackout = bool(scored) and len(scored) >= 3 and len(silent_rows) == len(scored)
|
|
502
|
+
blackout_suspect = (not blackout) and silent_fraction is not None and silent_fraction >= 0.5
|
|
503
|
+
|
|
504
|
+
if blackout:
|
|
505
|
+
for r in scored:
|
|
506
|
+
r['verdict'] = UNCALIBRATED
|
|
507
|
+
note = ('RUN-BLACKOUT: no pattern matched in either arm in any rep, across every '
|
|
508
|
+
'probe in this run — the instrument, not the rule, is what failed')
|
|
509
|
+
r['reason'] = (r['reason'] + '; ' + note) if r.get('reason') else note
|
|
510
|
+
|
|
378
511
|
failed_to_run = [r for r in rows if r['verdict'] == FAILED_TO_RUN]
|
|
379
512
|
uncalibrated = [r for r in rows if r['verdict'] == UNCALIBRATED]
|
|
380
513
|
ran = [r for r in rows if r['verdict'] in (PASS, FAIL)]
|
|
@@ -409,6 +542,11 @@ def score_run(live_rows, run_root, ids_in_order, threshold, model, reps=1):
|
|
|
409
542
|
'overall': overall,
|
|
410
543
|
'rc': rc,
|
|
411
544
|
'model': model,
|
|
545
|
+
'silent': len(silent_rows),
|
|
546
|
+
'scored': len(scored),
|
|
547
|
+
'silent_fraction': silent_fraction,
|
|
548
|
+
'blackout': blackout,
|
|
549
|
+
'blackout_suspect': blackout_suspect,
|
|
412
550
|
}
|
|
413
551
|
|
|
414
552
|
|
|
@@ -443,6 +581,25 @@ def render_report_md(select_result, score_result, run_date):
|
|
|
443
581
|
% (score_result['overall'], score_result['ran'], score_result['failed_to_run'],
|
|
444
582
|
score_result['uncalibrated'], score_result['passed'], pr_s))
|
|
445
583
|
lines.append("")
|
|
584
|
+
sf = score_result.get('silent_fraction')
|
|
585
|
+
if sf is not None:
|
|
586
|
+
lines.append("- instrument-silent probes: %d/%d (%.2f) — a probe is *silent* when its "
|
|
587
|
+
"pattern matched in NEITHER arm in ANY rep."
|
|
588
|
+
% (score_result.get('silent', 0), score_result.get('scored', 0), sf))
|
|
589
|
+
if score_result.get('blackout'):
|
|
590
|
+
lines.append("")
|
|
591
|
+
lines.append("🟥 **RUN-BLACKOUT** — every scored probe was instrument-silent. This run "
|
|
592
|
+
"measured NOTHING; it is not evidence that any rule stopped firing. Read "
|
|
593
|
+
"the preserved response bodies under `tracks/_meta/live_eval_runs/` before "
|
|
594
|
+
"attributing this to the harness.")
|
|
595
|
+
elif score_result.get('blackout_suspect'):
|
|
596
|
+
lines.append("")
|
|
597
|
+
lines.append("⚠️ **BLACKOUT-SUSPECT (advisory — the verdict above is unchanged)** — a "
|
|
598
|
+
"majority of probes were instrument-silent while at least one channel "
|
|
599
|
+
"demonstrably worked. Both a broad real regression and a partial "
|
|
600
|
+
"instrument failure produce this shape, and this file cannot tell them "
|
|
601
|
+
"apart; the preserved response bodies can.")
|
|
602
|
+
lines.append("")
|
|
446
603
|
lines.append("## Excluded (from probes.md, 33-row snapshot)")
|
|
447
604
|
lines.append("")
|
|
448
605
|
lines.append("| Probe | Reason |")
|
|
@@ -500,6 +657,11 @@ def _cmd_select(args):
|
|
|
500
657
|
f.write(p['input'])
|
|
501
658
|
with open(os.path.join(args.spec_dir, p['id'] + '.control.txt'), 'w', encoding='utf-8') as f:
|
|
502
659
|
f.write(p['control_input'])
|
|
660
|
+
# Written ONLY when declared — probe_live_eval.sh keys the third live call off this
|
|
661
|
+
# file's existence, so an absent file must mean "no second control", never "empty one".
|
|
662
|
+
if p.get('control_input_b'):
|
|
663
|
+
with open(os.path.join(args.spec_dir, p['id'] + '.control_b.txt'), 'w', encoding='utf-8') as f:
|
|
664
|
+
f.write(p['control_input_b'])
|
|
503
665
|
with open(os.path.join(args.spec_dir, 'selected_ids.txt'), 'w', encoding='utf-8') as f:
|
|
504
666
|
for p in filtered:
|
|
505
667
|
f.write(p['id'] + '\n')
|
|
@@ -532,6 +694,17 @@ def _cmd_score(args):
|
|
|
532
694
|
print("total=%d ran=%d failed_to_run=%d uncalibrated=%d passed=%d pass_rate=%s threshold=%.2f"
|
|
533
695
|
% (score_result['total'], score_result['ran'], score_result['failed_to_run'],
|
|
534
696
|
score_result['uncalibrated'], score_result['passed'], pr_s, score_result['threshold']))
|
|
697
|
+
sf = score_result.get('silent_fraction')
|
|
698
|
+
if sf is not None:
|
|
699
|
+
print("instrument-silent: %d/%d (%.2f)"
|
|
700
|
+
% (score_result.get('silent', 0), score_result.get('scored', 0), sf))
|
|
701
|
+
if score_result.get('blackout'):
|
|
702
|
+
print("🟥 RUN-BLACKOUT — every scored probe was silent in BOTH arms. Nothing was measured;")
|
|
703
|
+
print(" this is not evidence any rule stopped firing. Read the preserved response bodies.")
|
|
704
|
+
elif score_result.get('blackout_suspect'):
|
|
705
|
+
print("⚠️ BLACKOUT-SUSPECT (advisory, verdict unchanged) — majority of probes silent while")
|
|
706
|
+
print(" at least one channel worked. Real broad regression and partial instrument failure")
|
|
707
|
+
print(" look identical here; the preserved response bodies tell them apart.")
|
|
535
708
|
print("OVERALL: %s (rc=%d)" % (score_result['overall'], score_result['rc']))
|
|
536
709
|
|
|
537
710
|
if args.report_out:
|
package/scripts/selfcheck.sh
CHANGED
|
@@ -702,6 +702,7 @@ for _pair in \
|
|
|
702
702
|
"scripts/remote_marker_gate.sh|scripts/test_remote_marker_gate_lanes.sh" \
|
|
703
703
|
".github/workflows/validate.yml|scripts/test_remote_marker_gate_lanes.sh" \
|
|
704
704
|
"templates/.git-hooks/pre-commit|scripts/test_precommit_staged_drift_lanes.sh" \
|
|
705
|
+
"templates/.git-hooks/pre-commit|scripts/test_precommit_gitlink_lanes.sh" \
|
|
705
706
|
"templates/.git-hooks/pre-commit|scripts/test_marker_address_lanes.sh" \
|
|
706
707
|
"templates/.git-hooks/pre-commit|scripts/test_precommit_pointer_index_lanes.sh" \
|
|
707
708
|
"scripts/residency_closure_scan.py|scripts/test_residency_closure_lanes.sh" \
|
|
@@ -1418,6 +1419,28 @@ else
|
|
|
1418
1419
|
fail=1
|
|
1419
1420
|
fi
|
|
1420
1421
|
|
|
1422
|
+
# temper_check lanes — 🟥 `templates/temper_check.sh` 는 게이트체인 7경로 중 **유일하게 실행 레인이
|
|
1423
|
+
# 0** 이었다(2026-09-14 frontier-digest 후보 #1 → 독립 재현으로 참 판정). 참조 6곳이 전부 비실행
|
|
1424
|
+
# 이었고, 그중 하나가 **바로 이 파일의 `bash -n` 목록**이다 — 즉 selfcheck 자신이 «구문 검사» 를
|
|
1425
|
+
# «검증» 으로 세고 있었다. steel-quench SKILL.md 의 T-1 행은 그 사이 그것을 `measured` 로 선언한다.
|
|
1426
|
+
# `bash -n` 은 계기가 아니다([[feedback_gate_verification_must_execute]]) — 아래가 그 자리를 실행으로
|
|
1427
|
+
# 바꾼다. 레인은 격리 픽스처(실물 내용 · 실제 두 커밋 쌍)를 쓰고 네트워크·API 를 안 탄다.
|
|
1428
|
+
#
|
|
1429
|
+
# ⚠️ Subject-absent 는 여기서도 FAIL 이다(SKIP 아님) — `templates/temper_check.sh` 는 package.json
|
|
1430
|
+
# files[] 에 있으므로 부재는 «정당한 미출하» 가 아니라 삭제다. 위 branch_claim 블록과 같은 근거.
|
|
1431
|
+
# rc=2 는 계기 오류(HARNESS-ERROR)라 rc=1 과 같이 fail 로 접는다 — «못 쟀다» 는 «통과» 가 아니다.
|
|
1432
|
+
if [ ! -f templates/temper_check.sh ]; then
|
|
1433
|
+
echo "FAIL templates/temper_check.sh is in package.json files[] but absent — a deleted subject, not a skip"
|
|
1434
|
+
fail=1
|
|
1435
|
+
elif [ -f scripts/test_temper_check_lanes.sh ]; then
|
|
1436
|
+
if ! bash scripts/test_temper_check_lanes.sh; then
|
|
1437
|
+
fail=1
|
|
1438
|
+
fi
|
|
1439
|
+
else
|
|
1440
|
+
echo "FAIL test_temper_check_lanes.sh: temper_check.sh present but its anchor is missing"
|
|
1441
|
+
fail=1
|
|
1442
|
+
fi
|
|
1443
|
+
|
|
1421
1444
|
# listing_watch — 같은 형태. 🟥 이 블록을 «레인을 짓는 같은 커밋에서» 붙인다: 바로 위 주석이
|
|
1422
1445
|
# 기록한 「레인은 지었는데 selfcheck 배선을 안 했다」 재발이 **최소 다섯 번**이고, 그 다섯 다 CI 나
|
|
1423
1446
|
# lane-runner 가 뒤늦게 잡았다. 순서를 바꾸는 것이 유일한 처방이라 여기서 그렇게 한다.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_precommit_gitlink_lanes.sh — known pair for pre-commit's nested-repo gitlink guard.
|
|
3
|
+
#
|
|
4
|
+
# WHAT IT GUARDS. `.gitignore` does not apply to a nested repository. `tracks/**` ignores every
|
|
5
|
+
# FILE under tracks/, but a directory that carries its own `.git` is offered to the index as a
|
|
6
|
+
# mode-160000 entry anyway — so `git add -A` stages it while the author believes the subtree is
|
|
7
|
+
# ignored. Measured 2026-09-16: `tracks/_meta/dominance_bench_B/recovered_2026-09-09/benchB/
|
|
8
|
+
# target_repo_O` (a benchmark's target repo) was staged by `git add -A --dry-run`.
|
|
9
|
+
#
|
|
10
|
+
# 🟥 WHY IT IS SILENT, which is why it needs a gate rather than a habit. A gitlink records a commit
|
|
11
|
+
# SHA in ANOTHER repository. A clone cannot fetch it, so the content is absent while the tree still
|
|
12
|
+
# looks complete — nothing in the commit output says the subtree did not travel.
|
|
13
|
+
#
|
|
14
|
+
# 🟥 SCOPE IS ASYMMETRIC ON PURPOSE, and L4 pins the half that is easy to "unify" away. Under
|
|
15
|
+
# tracks/ a gitlink is provably wrong (local-only lane) → BLOCK. Elsewhere this repo has no
|
|
16
|
+
# submodules today, but calling that a defect would over-block a legitimate future one, and a gate
|
|
17
|
+
# that over-blocks trains `--no-verify` — which disarms the Destructive-Op gate in the SAME hook.
|
|
18
|
+
# So elsewhere it surfaces and proceeds. The absence of a block there is the design, not a gap.
|
|
19
|
+
#
|
|
20
|
+
# HERMETIC: every fixture is a throwaway repo under mktemp. Never reads the real tree or real tracks/.
|
|
21
|
+
#
|
|
22
|
+
# Usage: bash scripts/test_precommit_gitlink_lanes.sh Exit: 0 = all behave · 1 = regression · 10 = own setup broke.
|
|
23
|
+
|
|
24
|
+
set -uo pipefail
|
|
25
|
+
cd "$(dirname "$0")/.." || exit 1
|
|
26
|
+
ROOT="$(pwd -P)"
|
|
27
|
+
HOOK="$ROOT/templates/.git-hooks/pre-commit"
|
|
28
|
+
PASS=0; FAIL=0
|
|
29
|
+
ok() { echo "✅ $1"; PASS=$((PASS+1)); }
|
|
30
|
+
ng() { echo "❌ $1"; FAIL=$((FAIL+1)); }
|
|
31
|
+
|
|
32
|
+
[ -f "$HOOK" ] || { echo "ⓘ subject missing: $HOOK — skipped is NOT passed"; exit 2; }
|
|
33
|
+
|
|
34
|
+
T="$(mktemp -d 2>/dev/null)" || { echo "ⓘ mktemp failed — this suite's own setup broke (NOT a pass)"; exit 10; }
|
|
35
|
+
trap 'rm -rf "$T"' EXIT INT TERM
|
|
36
|
+
|
|
37
|
+
# 🟥 The guard is a block inside a long hook that runs many other gates. Running the whole hook
|
|
38
|
+
# would make this suite measure everything EXCEPT what it claims to. So the block is extracted and
|
|
39
|
+
# run against a fixture repo — the same bytes, isolated. If the anchor ever moves, extraction yields
|
|
40
|
+
# nothing and L0 fails loudly rather than every lane passing vacuously.
|
|
41
|
+
awk '/^echo "\[Privacy\] nested-repo gitlink\.\.\."$/,/^fi$/' "$HOOK" > "$T/block.sh"
|
|
42
|
+
if [ ! -s "$T/block.sh" ] || ! grep -q 'GITLINK_BLOCKED' "$T/block.sh"; then
|
|
43
|
+
ng "L0 setup — could not extract the gitlink block from the hook (anchor moved?)"
|
|
44
|
+
echo "── precommit-gitlink lanes: PASS=$PASS FAIL=$FAIL ──"; exit 1
|
|
45
|
+
fi
|
|
46
|
+
ok "L0 block extracted from the live hook (not a second copy)"
|
|
47
|
+
|
|
48
|
+
# 픽스처 레포 하나 + 그 안에 중첩 레포 하나. 실제 사고와 같은 모양으로 짓는다
|
|
49
|
+
# ([[feedback_fixture_shape_from_artifact_not_mental_model]]) — 손으로 mode 160000 을 써넣지 않고,
|
|
50
|
+
# **진짜 중첩 레포를 만들어** git 이 스스로 gitlink 으로 계상하게 둔다.
|
|
51
|
+
mk_repo() { # $1=경로
|
|
52
|
+
git init -q "$1" 2>/dev/null || return 1
|
|
53
|
+
git -C "$1" config user.email t@t; git -C "$1" config user.name t
|
|
54
|
+
echo x > "$1/f.txt"; git -C "$1" add f.txt; git -C "$1" commit -qm init
|
|
55
|
+
}
|
|
56
|
+
# 🟥 **레인마다 자기 픽스처 레포를 짓는다.** 초판은 하나를 공유했고 앞 레인이 스테이징한
|
|
57
|
+
# gitlink 이 인덱스에 남아 L3(known-negative)·L4 를 오염시켰다 — «막았다» 가 아니라
|
|
58
|
+
# «앞 레인 것을 막고 있었다»였다. 공유 상태는 known-negative 를 구조적으로 무효화한다.
|
|
59
|
+
new_outer() { # $1=이름 → stdout: 경로
|
|
60
|
+
local d="$T/$1"
|
|
61
|
+
mk_repo "$d" >/dev/null 2>&1 || return 1
|
|
62
|
+
printf 'tracks/**\n!tracks/**/\n' > "$d/.gitignore"
|
|
63
|
+
mkdir -p "$d/tracks/_meta/bench"
|
|
64
|
+
printf '%s' "$d"
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
run_block() { # cwd=$1, env 나머지는 호출자가 export
|
|
68
|
+
( cd "$1" && FAILED=0 && . "$T/block.sh" >"$T/out.txt" 2>&1; echo "$FAILED" )
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
# ── L1 known-positive: tracks/ 밑 중첩 레포가 실제로 gitlink 으로 스테이징되고, 가드가 막는다 ──
|
|
72
|
+
# 🟥 이 레인이 증명하는 첫 번째 것은 가드가 아니라 **결함 자체**다: .gitignore 가 `tracks/**` 인데도
|
|
73
|
+
# add 가 그 디렉터리를 집는다. 그게 성립 안 하면 이 가드는 존재 이유가 없다.
|
|
74
|
+
O1=$(new_outer o1) || { ng "L0b 픽스처 레포 생성 실패"; exit 10; }
|
|
75
|
+
mk_repo "$O1/tracks/_meta/bench/target" >/dev/null 2>&1 || { ng "L0c 중첩 레포 생성 실패"; exit 10; }
|
|
76
|
+
( cd "$O1" && git add -A 2>/dev/null )
|
|
77
|
+
STAGED_MODE=$(cd "$O1" && git diff --cached --raw --no-renames 2>/dev/null | awk -F'\t' '$1 ~ / 160000 /{print $2}')
|
|
78
|
+
if [ "$STAGED_MODE" = "tracks/_meta/bench/target" ]; then
|
|
79
|
+
ok "L1 결함 재현: .gitignore 가 tracks/** 인데도 중첩 레포가 gitlink 으로 스테이징된다"
|
|
80
|
+
else
|
|
81
|
+
ng "L1 결함이 재현 안 됨 — 스테이징된 gitlink: [$STAGED_MODE] (계기 오류: 이 가드의 전제가 성립 안 함)"
|
|
82
|
+
fi
|
|
83
|
+
RC=$(run_block "$O1")
|
|
84
|
+
if [ "$RC" = "1" ] && grep -q "nested repo staged as a gitlink under tracks/" "$T/out.txt"; then
|
|
85
|
+
ok "L2 BLOCK — tracks/ 밑 gitlink 에서 FAILED=1 이고 경로를 이름으로 댄다"
|
|
86
|
+
else
|
|
87
|
+
ng "L2 안 막았다 (FAILED=$RC)"; sed 's/^/ /' "$T/out.txt"
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
# ── L3 known-negative: gitlink 이 없으면 통과. 「아무거나 막는 가드」가 아님을 박는다 ──
|
|
91
|
+
O3=$(new_outer o3) || { ng "L3 setup 실패"; }
|
|
92
|
+
echo y > "$O3/plain.txt"; ( cd "$O3" && git add plain.txt 2>/dev/null )
|
|
93
|
+
RC=$(run_block "$O3")
|
|
94
|
+
if [ "$RC" = "0" ] && grep -q "✅ PASS" "$T/out.txt"; then
|
|
95
|
+
ok "L3 known-negative: 평범한 파일만 스테이징되면 PASS (과차단 없음)"
|
|
96
|
+
else
|
|
97
|
+
ng "L3 gitlink 없는데 막았다 (FAILED=$RC)"; sed 's/^/ /' "$T/out.txt"
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
# ── L4 비대칭 고정: tracks/ **밖** 의 gitlink 은 표면화하되 막지 않는다 ──
|
|
101
|
+
# 🟥 이 레인이 없으면 다음 사람이 「일관성」이라며 repo-wide 차단으로 «통일»하고, 그 순간
|
|
102
|
+
# 정당한 서브모듈이 과차단되어 --no-verify 를 훈련시킨다. 부재가 설계임을 여기서 박는다.
|
|
103
|
+
O4=$(new_outer o4) || { ng "L4 setup 실패"; }
|
|
104
|
+
mkdir -p "$O4/vendor"
|
|
105
|
+
mk_repo "$O4/vendor/dep" >/dev/null 2>&1 || { ng "L4 setup 실패(중첩)"; }
|
|
106
|
+
( cd "$O4" && git add -A 2>/dev/null )
|
|
107
|
+
RC=$(run_block "$O4")
|
|
108
|
+
if [ "$RC" = "0" ] && grep -q "surfaced, not blocked" "$T/out.txt"; then
|
|
109
|
+
ok "L4 비대칭: tracks/ 밖 gitlink 은 표면화만 (차단 아님 — 부재가 설계다)"
|
|
110
|
+
else
|
|
111
|
+
ng "L4 tracks/ 밖 gitlink 처리가 규격과 다르다 (FAILED=$RC)"; sed 's/^/ /' "$T/out.txt"
|
|
112
|
+
fi
|
|
113
|
+
|
|
114
|
+
# ── L5 override 채널 — 검토된 경우에만, 그리고 조용하지 않게 ──
|
|
115
|
+
O5=$(new_outer o5) || { ng "L5 setup 실패"; }
|
|
116
|
+
mk_repo "$O5/tracks/_meta/bench/target2" >/dev/null 2>&1
|
|
117
|
+
( cd "$O5" && git add -A 2>/dev/null )
|
|
118
|
+
RC=$( cd "$O5" && FAILED=0 && TRACKS_GITLINK_OK=1 . "$T/block.sh" >"$T/out.txt" 2>&1; echo "$FAILED" )
|
|
119
|
+
if [ "$RC" = "0" ] && grep -q "TRACKS_GITLINK_OK=1" "$T/out.txt"; then
|
|
120
|
+
ok "L5 override: TRACKS_GITLINK_OK=1 이면 통과하되 그 사실이 출력에 남는다"
|
|
121
|
+
else
|
|
122
|
+
ng "L5 override 채널이 규격과 다르다 (FAILED=$RC)"; sed 's/^/ /' "$T/out.txt"
|
|
123
|
+
fi
|
|
124
|
+
|
|
125
|
+
# ── L6 되돌림 프로브 — 가드를 떼면 L2 가 정확히 빨개진다 ──
|
|
126
|
+
# 🟥 적용 확인은 **의미**로 한다. 텍스트만 보면 무효 뮤턴트가 통과한다(2026-09-16 실측).
|
|
127
|
+
sed 's/GITLINK_BLOCKED=1; FAILED=1/GITLINK_BLOCKED=0/' "$T/block.sh" > "$T/block_neutered.sh"
|
|
128
|
+
if ! grep -q 'GITLINK_BLOCKED=0$' "$T/block_neutered.sh"; then
|
|
129
|
+
ng "L6 뮤턴트가 안 만들어졌다 (계기 오류)"
|
|
130
|
+
else
|
|
131
|
+
RC=$( cd "$O1" && FAILED=0 && . "$T/block_neutered.sh" >"$T/out.txt" 2>&1; echo "$FAILED" )
|
|
132
|
+
if [ "$RC" = "0" ]; then
|
|
133
|
+
ok "L6 되돌림: 차단을 떼면 같은 입력이 통과한다 (앵커 생존)"
|
|
134
|
+
else
|
|
135
|
+
ng "L6 차단을 뗐는데도 FAILED=$RC — 이 레인이 재는 것은 이 가드가 아니다"
|
|
136
|
+
fi
|
|
137
|
+
fi
|
|
138
|
+
|
|
139
|
+
echo
|
|
140
|
+
echo "── precommit-gitlink lanes: PASS=$PASS FAIL=$FAIL ──"
|
|
141
|
+
[ "$FAIL" -eq 0 ] || exit 1
|
|
142
|
+
exit 0
|