@chrono-meta/fh-gate 3.28.0 → 3.30.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-plugin/marketplace.json +4 -4
- package/AGENTS.md +7 -2
- package/CHEATSHEET.md +2 -2
- package/CLAUDE.md +5 -2
- package/docs/REFERENCE.md +4 -1
- package/knowledge/shared/harness-core/claude_md_full_reference.md +2 -0
- package/knowledge/shared/harness-core/claude_md_gate_details.md +8 -1
- package/knowledge/shared/harness-core/dispatch_conditional_prohibition.md +12 -0
- package/knowledge/shared/harness-core/fh_three_layer_canon.md +12 -0
- package/knowledge/shared/harness-core/measurement-integrity-checklist.md +16 -0
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +161 -0
- package/package.json +4 -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 +41 -0
- package/plugins/fh-meta/skills/auto-decorrelation/SKILL.md +17 -0
- package/plugins/fh-meta/skills/phantom-quench/SKILL.md +1 -1
- package/plugins/fh-meta/skills/sim-conductor/SKILL.md +2 -2
- package/plugins/fh-meta/skills/sim-conductor/SKILL_detail.md +3 -3
- package/plugins/fh-meta/skills/steel-quench/SKILL.md +25 -1
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/degrade_direction_scan.sh +43 -0
- package/scripts/dispatch_receipt.py +185 -0
- package/scripts/doc_claim_triad_scan.py +43 -4
- package/scripts/fh-gate.sh +71 -11
- package/scripts/finding_fleet.sh +15 -3
- package/scripts/mapped_tracks.sh +20 -13
- package/scripts/memory_gc_report.py +55 -5
- package/scripts/package_coverage_check.sh +5 -0
- package/scripts/pr_merge_verified.sh +56 -8
- package/scripts/selfcheck.sh +43 -20
- package/scripts/session_checklist.py +158 -14
- package/scripts/session_close_check.sh +1 -1
- package/scripts/sim_isolated_run.sh +62 -0
- package/scripts/stale_ref_scan.py +47 -3
- package/scripts/test_degrade_scan_shell_probes.sh +81 -0
- package/scripts/test_dispatch_receipt_lanes.sh +95 -0
- package/scripts/test_doc_claim_triad_lanes.sh +30 -0
- package/scripts/test_fh_audit_check_lanes.sh +10 -5
- package/scripts/test_fh_gate_regressions.sh +71 -1
- package/scripts/test_finding_pipeline_lanes.sh +83 -0
- package/scripts/test_hook_source_gate_lanes.sh +16 -2
- package/scripts/test_locale_invariance_lanes.sh +19 -0
- package/scripts/test_mapped_tracks_lanes.sh +55 -1
- package/scripts/test_memory_gc_report_lanes.sh +91 -1
- package/scripts/test_mutation_probe_lanes.sh +40 -8
- package/scripts/test_pr_merge_verified_lanes.sh +48 -1
- package/scripts/test_prepush_real_fire_lanes.sh +215 -0
- package/scripts/test_selfcheck_state_lanes.sh +32 -0
- package/scripts/test_session_checklist_lanes.sh +172 -0
- package/scripts/test_sim_isolated_run_lanes.sh +88 -0
- package/scripts/test_stale_ref_scan_lanes.sh +11 -1
- package/templates/.git-hooks/pre-push +82 -1
- package/templates/PRE-PUBLISH-CHECKLIST.md +10 -0
- package/templates/degrade_direction_scan.sh +43 -0
|
@@ -445,6 +445,38 @@ chk $? "CONTROL: the pre-repair substring form accepts both — the fixtures dis
|
|
|
445
445
|
# through _show_failure, whose empty branch prints "(no output captured)" at runtime, so the failure
|
|
446
446
|
# is loud rather than silent. Regression is anchored; evasion is a named residual, not a solved one.
|
|
447
447
|
|
|
448
|
+
# ── Pair-suite exit-code verdict (2026-10-19) ──────────────────────────────────
|
|
449
|
+
# fh_signal_2026-10-18_selfcheck-timeout-unlabelled: a suite killed by the 300 s lane timeout
|
|
450
|
+
# (rc=124) fell into a bare `*) fail=1` and the whole run said FAIL with no line naming anything.
|
|
451
|
+
# Lift the REAL function out of selfcheck.sh and call it — a re-spelled copy would stay green
|
|
452
|
+
# while the subject regressed. Every non-zero rc must print a line containing the suite label;
|
|
453
|
+
# rc 0 must print nothing and return 0 (the negative control that keeps "prints a line" from
|
|
454
|
+
# passing a function that prints on every call).
|
|
455
|
+
echo ""
|
|
456
|
+
echo "── pair-suite rc verdict (_pair_rc_verdict) ──"
|
|
457
|
+
_FN=$(sed -n '/^_pair_rc_verdict() {/,/^}/p' "$SELFCHECK")
|
|
458
|
+
if [ -z "$_FN" ]; then
|
|
459
|
+
chk 1 "_pair_rc_verdict found in selfcheck.sh (lane would test nothing)"
|
|
460
|
+
else
|
|
461
|
+
eval "$_FN"
|
|
462
|
+
_o=$(_pair_rc_verdict lane_x.sh subj_x 0); _r=$?
|
|
463
|
+
[ "$_r" -eq 0 ] && [ -z "$_o" ]; chk $? "rc=0 → pass, silent (control)"
|
|
464
|
+
for _c in 124 1 3 137; do
|
|
465
|
+
_o=$(_pair_rc_verdict lane_x.sh subj_x "$_c"); _r=$?
|
|
466
|
+
[ "$_r" -ne 0 ] && printf '%s' "$_o" | grep -q 'lane_x.sh'; chk $? "rc=$_c → failure AND a line naming the suite"
|
|
467
|
+
done
|
|
468
|
+
_o=$(_pair_rc_verdict lane_x.sh subj_x 124)
|
|
469
|
+
printf '%s' "$_o" | grep -q '^TIMEOUT '; chk $? "rc=124 → labelled TIMEOUT (not a generic FAIL)"
|
|
470
|
+
for _c in 10 2 126 127; do
|
|
471
|
+
_o=$(_pair_rc_verdict lane_x.sh subj_x "$_c"); _r=$?
|
|
472
|
+
[ "$_r" -ne 0 ] && printf '%s' "$_o" | grep -q '^HARNESS ERROR '; chk $? "rc=$_c → failure AND HARNESS ERROR"
|
|
473
|
+
done
|
|
474
|
+
# The loop must route through the function — a lifted function with no caller is decoration.
|
|
475
|
+
# Uncommented line only (codex review 2026-10-19: a commented-out call passed the first form).
|
|
476
|
+
# Still a text check — it cannot prove the line is reached; that residual is named, not closed.
|
|
477
|
+
grep -qE '^[[:space:]]+_pair_rc_verdict "\$_lbl" "\$_subj" "\$_rc" \|\| fail=1' "$SELFCHECK"; chk $? "pair loop calls _pair_rc_verdict (uncommented) and sets fail on it"
|
|
478
|
+
fi
|
|
479
|
+
|
|
448
480
|
echo ""
|
|
449
481
|
if [ "$FAILED" -ne 0 ]; then
|
|
450
482
|
echo "SELFCHECK STATE LANES: FAIL — a discriminator would mis-route"
|
|
@@ -767,6 +767,178 @@ else
|
|
|
767
767
|
fail "L40 rc=$L40A_RC/$RC plain=$L40_PLAIN (see $L40)"
|
|
768
768
|
fi
|
|
769
769
|
|
|
770
|
+
# ---------------------------------------------------------------------------
|
|
771
|
+
# L41-L45 — the hook record as a second channel (merge with the transcript, tag source, never a silent zero)
|
|
772
|
+
# transcript: alpha 09:00Z · beta 09:10Z · gamma 09:20Z; hook: alpha · delta (09:05Z, hook only) · beta (+20s); hook ts is local-naive
|
|
773
|
+
# ---------------------------------------------------------------------------
|
|
774
|
+
python3 - "$TMPDIR_ROOT" <<'PYEOF'
|
|
775
|
+
import json, sys, datetime
|
|
776
|
+
d = sys.argv[1]
|
|
777
|
+
def loc(z): # UTC «…Z» -> local naive, as the hook writes it
|
|
778
|
+
t = datetime.datetime.strptime(z, "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=datetime.timezone.utc).astimezone()
|
|
779
|
+
return t.strftime("%Y-%m-%dT%H:%M:%S")
|
|
780
|
+
tr = [("2026-10-01T09:00:00Z", "alpha request about the status bar"),
|
|
781
|
+
("2026-10-01T09:10:00Z", "beta request about the export button"),
|
|
782
|
+
("2026-10-01T09:20:00Z", "gamma request only the transcript saw")]
|
|
783
|
+
with open(d + "/l41_tr.jsonl", "w", encoding="utf-8") as f:
|
|
784
|
+
for z, t in tr:
|
|
785
|
+
f.write(json.dumps({"type": "user", "timestamp": z, "message": {"role": "user", "content": t}}) + "\n")
|
|
786
|
+
hk = [("2026-10-01T09:00:00Z", "alpha request about the status bar"),
|
|
787
|
+
("2026-10-01T09:05:00Z", "delta request sent while a tool was running"),
|
|
788
|
+
("2026-10-01T09:10:20Z", "beta request about the export button")]
|
|
789
|
+
with open(d + "/l41_hook.jsonl", "w", encoding="utf-8") as f:
|
|
790
|
+
for n, (z, t) in enumerate(hk, 1):
|
|
791
|
+
f.write(json.dumps({"ts": loc(z), "n": n, "text": t}) + "\n")
|
|
792
|
+
with open(d + "/l44_hook.jsonl", "w", encoding="utf-8") as f: # one good row, one torn line, one row without text
|
|
793
|
+
f.write(json.dumps({"ts": loc("2026-10-01T09:05:00Z"), "n": 1, "text": "delta request sent while a tool was running"}) + "\n")
|
|
794
|
+
f.write('{"ts": "2026-10-01T09:06:00", "n": 2, "text": "torn li\n')
|
|
795
|
+
f.write(json.dumps({"ts": loc("2026-10-01T09:07:00Z"), "n": 3}) + "\n")
|
|
796
|
+
with open(d + "/l42_tr.jsonl", "w", encoding="utf-8") as f:
|
|
797
|
+
f.write(json.dumps({"type": "user", "timestamp": "2026-10-01T09:00:00Z", "message": {"role": "user", "content": "please continue with the next step"}}) + "\n")
|
|
798
|
+
with open(d + "/l42_hook.jsonl", "w", encoding="utf-8") as f:
|
|
799
|
+
for z in ("2026-10-01T09:00:00Z", "2026-10-01T13:00:00Z"):
|
|
800
|
+
f.write(json.dumps({"ts": loc(z), "n": 1, "text": "please continue with the next step"}) + "\n")
|
|
801
|
+
PYEOF
|
|
802
|
+
run "$TMPDIR_ROOT/l41.out" extract --transcript "$TMPDIR_ROOT/l41_tr.jsonl" --utterances "$TMPDIR_ROOT/l41_hook.jsonl"
|
|
803
|
+
L41_RC=$RC
|
|
804
|
+
L41_ROWS=$(grep -cE '^\| [0-9HS]+ \|' "$TMPDIR_ROOT/l41.out")
|
|
805
|
+
if [ "$L41_RC" -eq 0 ] && [ "$L41_ROWS" -eq 4 ] \
|
|
806
|
+
&& [ "$(grep -c 'alpha request' "$TMPDIR_ROOT/l41.out")" -eq 1 ] \
|
|
807
|
+
&& [ "$(grep -c 'beta request' "$TMPDIR_ROOT/l41.out")" -eq 1 ] \
|
|
808
|
+
&& grep -q '^| 3 | .*gamma request' "$TMPDIR_ROOT/l41.out" \
|
|
809
|
+
&& grep -q '^| H1 | 10-01 09:05 | delta request' "$TMPDIR_ROOT/l41.out" \
|
|
810
|
+
&& grep -q '훅 기록 채널 읽음 — 3건 · 전사와 일치 2건 · 훅 전용 1건' "$TMPDIR_ROOT/l41.out"; then
|
|
811
|
+
pass "L41 hook+transcript: a message in both is ONE row (no dup), hook-only is an H row with its time, transcript-only keeps its number, header counts 3/2/1"
|
|
812
|
+
else
|
|
813
|
+
fail "L41 rc=$L41_RC rows=$L41_ROWS (see $TMPDIR_ROOT/l41.out)"
|
|
814
|
+
fi
|
|
815
|
+
|
|
816
|
+
# L42 — the same words far apart in time are a distinct message, not folded into the first
|
|
817
|
+
run "$TMPDIR_ROOT/l42.out" extract --transcript "$TMPDIR_ROOT/l42_tr.jsonl" --utterances "$TMPDIR_ROOT/l42_hook.jsonl"
|
|
818
|
+
if [ "$RC" -eq 0 ] && [ "$(grep -c 'please continue' "$TMPDIR_ROOT/l42.out")" -eq 2 ] && grep -q '^| H1 | 10-01 13:00 |' "$TMPDIR_ROOT/l42.out"; then
|
|
819
|
+
pass "L42 the same words 4h later are a second message (H row); the pair inside the window is one"
|
|
820
|
+
else
|
|
821
|
+
fail "L42 rc=$RC (see $TMPDIR_ROOT/l42.out)"
|
|
822
|
+
fi
|
|
823
|
+
|
|
824
|
+
# L43 — hook file absent: the header says NOT READ (never zero), rc stays 0, transcript rows print
|
|
825
|
+
run "$TMPDIR_ROOT/l43.out" extract --transcript "$TMPDIR_ROOT/l41_tr.jsonl" --utterances "$TMPDIR_ROOT/no_such_hook.jsonl"
|
|
826
|
+
if [ "$RC" -eq 0 ] && grep -q '훅 기록 채널 안 읽음 — 파일 없음' "$TMPDIR_ROOT/l43.out" \
|
|
827
|
+
&& grep -q '0건이 아니라 미열람' "$TMPDIR_ROOT/l43.out" \
|
|
828
|
+
&& [ "$(grep -cE '^\| [0-9]+ \|' "$TMPDIR_ROOT/l43.out")" -eq 3 ]; then
|
|
829
|
+
pass "L43 hook record absent: header says not read (not zero), the transcript's 3 rows intact, rc=0"
|
|
830
|
+
else
|
|
831
|
+
fail "L43 rc=$RC (see $TMPDIR_ROOT/l43.out)"
|
|
832
|
+
fi
|
|
833
|
+
|
|
834
|
+
# L44 — malformed hook lines: loud in the header, rc=2, transcript rows and the readable hook row survive
|
|
835
|
+
run "$TMPDIR_ROOT/l44.out" extract --transcript "$TMPDIR_ROOT/l41_tr.jsonl" --utterances "$TMPDIR_ROOT/l44_hook.jsonl"
|
|
836
|
+
if [ "$RC" -eq 2 ] && grep -q '훅 기록 2줄 해석 실패' "$TMPDIR_ROOT/l44.out" \
|
|
837
|
+
&& [ "$(grep -cE '^\| [0-9]+ \|' "$TMPDIR_ROOT/l44.out")" -eq 3 ] \
|
|
838
|
+
&& grep -q '^| H1 | .*delta request' "$TMPDIR_ROOT/l44.out"; then
|
|
839
|
+
pass "L44 malformed hook lines: header names 2 bad lines, rc=2, transcript rows and the readable hook row kept"
|
|
840
|
+
else
|
|
841
|
+
fail "L44 rc=$RC (see $TMPDIR_ROOT/l44.out)"
|
|
842
|
+
fi
|
|
843
|
+
|
|
844
|
+
# L45 — hook path unreadable as a record (a directory): channel error in the header, rc=2, no crash, transcript rows kept
|
|
845
|
+
mkdir -p "$TMPDIR_ROOT/l45_dir"
|
|
846
|
+
run "$TMPDIR_ROOT/l45.out" extract --transcript "$TMPDIR_ROOT/l41_tr.jsonl" --utterances "$TMPDIR_ROOT/l45_dir"
|
|
847
|
+
if [ "$RC" -eq 2 ] && grep -q '훅 기록 채널 오류' "$TMPDIR_ROOT/l45.out" \
|
|
848
|
+
&& [ "$(grep -cE '^\| [0-9]+ \|' "$TMPDIR_ROOT/l45.out")" -eq 3 ]; then
|
|
849
|
+
pass "L45 hook path unreadable: channel error in the header, rc=2, transcript rows kept"
|
|
850
|
+
else
|
|
851
|
+
fail "L45 rc=$RC (see $TMPDIR_ROOT/l45.out)"
|
|
852
|
+
fi
|
|
853
|
+
|
|
854
|
+
# ---------------------------------------------------------------------------
|
|
855
|
+
# L46-L51 — merge edge cases a cross-family read reproduced (codex 2026-10-19). Each calls the REAL functions.
|
|
856
|
+
# L46 repeated short text: two «yes» pairs stay two rows (nearest-first greedy made three)
|
|
857
|
+
# L47 truncated hook row cannot steal the row a full hook row needs
|
|
858
|
+
# L48 hook row without a usable ts is a parse failure, not a text-only match
|
|
859
|
+
# L49 invalid UTF-8 in a hook line is a parse failure, not a replaced-character H row
|
|
860
|
+
# L50 DST fall-back hour: the nearer of the two instants is used (America/New_York)
|
|
861
|
+
# L51 carry_forward keeps BOTH judgments of two rows with the same minute and words
|
|
862
|
+
# ---------------------------------------------------------------------------
|
|
863
|
+
L46_OUT=$(python3 - "$SUBJ" "$TMPDIR_ROOT" <<'PYEOF'
|
|
864
|
+
import importlib.util, json, os, sys, datetime, time
|
|
865
|
+
spec = importlib.util.spec_from_file_location("sck", sys.argv[1]); m = importlib.util.module_from_spec(spec); spec.loader.exec_module(m)
|
|
866
|
+
d = sys.argv[2]
|
|
867
|
+
def loc(z):
|
|
868
|
+
t = datetime.datetime.strptime(z, "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=datetime.timezone.utc).astimezone()
|
|
869
|
+
return t.strftime("%Y-%m-%dT%H:%M:%S")
|
|
870
|
+
res = {}
|
|
871
|
+
raw = [{"ts": "2026-10-01T09:00:00Z", "text": "yes"}, {"ts": "2026-10-01T09:20:00Z", "text": "yes"}]
|
|
872
|
+
hk = [{"ts": loc("2026-10-01T09:11:00Z"), "text": "yes", "truncated": False}, {"ts": loc("2026-10-01T09:40:00Z"), "text": "yes", "truncated": False}]
|
|
873
|
+
only, n = m.merge_hook_rows(raw, hk); res["L46"] = (len(only), n) == (0, 2)
|
|
874
|
+
raw = [{"ts": "2026-10-01T09:00:00Z", "text": "prefix B"}, {"ts": "2026-10-01T09:01:00Z", "text": "prefix A"}]
|
|
875
|
+
hk = [{"ts": loc("2026-10-01T09:00:00Z"), "text": "prefix", "truncated": True}, {"ts": loc("2026-10-01T09:00:01Z"), "text": "prefix B", "truncated": False}]
|
|
876
|
+
only, n = m.merge_hook_rows(raw, hk); res["L47"] = (len(only), n) == (0, 2)
|
|
877
|
+
with open(d + "/l48.jsonl", "w") as f:
|
|
878
|
+
f.write(json.dumps({"n": 1, "text": "yes"}) + "\n"); f.write(json.dumps({"ts": "bad", "n": 2, "text": "yes"}) + "\n")
|
|
879
|
+
st, rows, bad, _ = m.read_hook_channel(d + "/l48.jsonl"); res["L48"] = (st, len(rows), bad) == ("read", 0, 2)
|
|
880
|
+
with open(d + "/l49.jsonl", "wb") as f:
|
|
881
|
+
f.write(b'{"ts": "2026-10-01T09:00:00", "n": 1, "text": "y\xffs"}\n')
|
|
882
|
+
st, rows, bad, _ = m.read_hook_channel(d + "/l49.jsonl"); res["L49"] = (len(rows), bad) == (0, 1)
|
|
883
|
+
raw = [{"ts": "2026-10-01T09:00:00Z", "text": "prefix A"}, {"ts": "2026-10-01T09:01:00Z", "text": "prefix B"}]
|
|
884
|
+
hk = [{"ts": loc("2026-10-01T09:00:00Z"), "text": "prefix", "truncated": True}, {"ts": loc("2026-10-01T09:01:00Z"), "text": "prefix A", "truncated": True}]
|
|
885
|
+
only, n = m.merge_hook_rows(raw, hk); res["L47b"] = (len(only), n) == (0, 2)
|
|
886
|
+
res["L48b"] = m.parse_ts_candidates("2026-10-01T09:00:00garbage") == [] and m.parse_ts_candidates("2026-10-01T09:00:00.123Z") != []
|
|
887
|
+
os.environ["TZ"] = "America/New_York"; time.tzset()
|
|
888
|
+
raw = [{"ts": "2026-11-01T06:30:00Z", "text": "second half hour"}]
|
|
889
|
+
hk = [{"ts": "2026-11-01T01:30:00", "text": "second half hour", "truncated": False}]
|
|
890
|
+
only, n = m.merge_hook_rows(raw, hk); res["L50"] = (len(only), n) == (0, 1)
|
|
891
|
+
out = d + "/l51.md"
|
|
892
|
+
row = "| %s | 10-01 09:00 | yes | %s | | | |"
|
|
893
|
+
with open(out, "w") as f:
|
|
894
|
+
f.write("\n".join(["# t", "", "x", "", "| # | 시각 | 발화(요지) | 상태 | 증거 | 사유 / 남은 것 | 제안(이번 세션 vs 이월) |", "|---|---|---|---|---|---|---|", row % ("H1", "✅"), row % ("H2", "❌")]) + "\n")
|
|
895
|
+
new = ["# t", "", "x", "", "| # | 시각 | 발화(요지) | 상태 | 증거 | 사유 / 남은 것 | 제안(이번 세션 vs 이월) |", "|---|---|---|---|---|---|---|", row % ("H1", ""), row % ("H2", "")]
|
|
896
|
+
got = m.carry_forward(new, out)
|
|
897
|
+
res["L51"] = any(l.startswith("| H1 |") and "✅" in l for l in got) and any(l.startswith("| H2 |") and "❌" in l for l in got)
|
|
898
|
+
print(" ".join("%s=%s" % (k, int(v)) for k, v in sorted(res.items())))
|
|
899
|
+
PYEOF
|
|
900
|
+
)
|
|
901
|
+
for L in L46 L47 L47b L48 L48b L49 L50 L51; do
|
|
902
|
+
case " $L46_OUT " in
|
|
903
|
+
*" $L=1 "*) pass "$L merge edge case (codex 2026-10-19 repro) holds" ;;
|
|
904
|
+
*) fail "$L merge edge case — got: ${L46_OUT:-<no output: the python block crashed>}" ;;
|
|
905
|
+
esac
|
|
906
|
+
done
|
|
907
|
+
|
|
908
|
+
# L52 — `unblocked` on a sheet with an empty 상태 cell must not crash (TypeError: None in keys, 2026-10-23)
|
|
909
|
+
L52_FILE="$TMPDIR_ROOT/l52.md"
|
|
910
|
+
{
|
|
911
|
+
echo "| # | 시각 | 발화(요지) | 상태 | 증거 | 사유 / 남은 것 | 제안 |"
|
|
912
|
+
echo "|---|---|---|---|---|---|---|"
|
|
913
|
+
echo "| A1 | 10-01 09:00 | first | ✅DONE | e | - | - |"
|
|
914
|
+
echo "| A2 | 10-01 09:01 | second, blocked on A1 | ⏳IN-PROGRESS | e | A1 선행 | next |"
|
|
915
|
+
echo "| A3 | 10-01 09:02 | never filled | | | | |"
|
|
916
|
+
} >"$L52_FILE"
|
|
917
|
+
run "$TMPDIR_ROOT/l52.out" unblocked --file "$L52_FILE"
|
|
918
|
+
if [ "$RC" -eq 1 ] && grep -q "A2 is still open, but its blocker A1 reads DONE" "$TMPDIR_ROOT/l52.out" \
|
|
919
|
+
&& ! grep -q "Traceback" "$TMPDIR_ROOT/l52.out"; then
|
|
920
|
+
pass "L52 unblocked survives an empty 상태 cell and still reports the real finding"
|
|
921
|
+
else
|
|
922
|
+
fail "L52 unblocked rc=$RC (want 1, finding A2/A1, no Traceback) — $(tail -2 "$TMPDIR_ROOT/l52.out" | tr '\n' ' ')"
|
|
923
|
+
fi
|
|
924
|
+
|
|
925
|
+
# L52b — an N/A row whose blocker reads DONE is closed, not «still open» (the key is "N/A"; a "n/a" compare never matched)
|
|
926
|
+
L52B_FILE="$TMPDIR_ROOT/l52b.md"
|
|
927
|
+
{
|
|
928
|
+
echo "| # | 시각 | 발화(요지) | 상태 | 증거 | 사유 / 남은 것 | 제안 |"
|
|
929
|
+
echo "|---|---|---|---|---|---|---|"
|
|
930
|
+
echo "| A1 | 10-01 09:00 | first | ✅DONE | e | - | - |"
|
|
931
|
+
echo "| A2 | 10-01 09:01 | second, blocked on A1 | ⏳IN-PROGRESS | e | A1 선행 | next |"
|
|
932
|
+
echo "| A3 | 10-01 09:02 | dropped, blocked on A1 | N/A | e | A1 선행 — 범위 밖 | - |"
|
|
933
|
+
} >"$L52B_FILE"
|
|
934
|
+
run "$TMPDIR_ROOT/l52b.out" unblocked --file "$L52B_FILE"
|
|
935
|
+
if [ "$RC" -eq 1 ] && grep -q "A2 is still open, but its blocker A1 reads DONE" "$TMPDIR_ROOT/l52b.out" \
|
|
936
|
+
&& ! grep -q "A3 is still open" "$TMPDIR_ROOT/l52b.out"; then
|
|
937
|
+
pass "L52b unblocked treats an N/A row as closed (A2 reported, A3 not)"
|
|
938
|
+
else
|
|
939
|
+
fail "L52b unblocked rc=$RC (want 1, A2 reported, A3 silent) — $(tail -3 "$TMPDIR_ROOT/l52b.out" | tr '\n' ' ')"
|
|
940
|
+
fi
|
|
941
|
+
|
|
770
942
|
echo "── $PASS_COUNT passed, $FAIL_COUNT failed ──"
|
|
771
943
|
|
|
772
944
|
if [ "$FAIL_COUNT" -gt 0 ]; then
|
|
@@ -574,5 +574,93 @@ printf 'rc\t0\nended_at_cap\tno\n' > "$WORKROOT/o_b29f/a_r1.meta.tsv"
|
|
|
574
574
|
&& ok "L29f clone failure on a reused --out leaves no stale ended_at_cap=no behind" \
|
|
575
575
|
|| no "L29f stale meta survived (clone-fail seen: $(grep -c 'BASE CLONE FAILED' "$WORKROOT/o_b29f.log"))"
|
|
576
576
|
|
|
577
|
+
# L30 (2026-10-23) — an --out under instruction files refuses BEFORE any arm runs; the logged override proceeds.
|
|
578
|
+
# Known pair: same runner, same stub, the only difference is a CLAUDE.md in an ancestor of --out.
|
|
579
|
+
INH="$WORKROOT/inherit_parent"; mkdir -p "$INH"; printf '# parent instructions\n' > "$INH/CLAUDE.md"
|
|
580
|
+
LOG30="$WORKROOT/argv30.log"; : > "$LOG30"
|
|
581
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG30" \
|
|
582
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$INH/o30" ) >"$WORKROOT/o30.log" 2>&1; RC30=$?
|
|
583
|
+
{ [ "$RC30" = 2 ] && grep -q "REFUSED: --out" "$WORKROOT/o30.log" && grep -q "inherit_parent/CLAUDE.md" "$WORKROOT/o30.log" && [ ! -s "$LOG30" ]; } \
|
|
584
|
+
&& ok "L30a --out under a CLAUDE.md ancestor → rc 2 · REFUSED names the file · no arm invoked" \
|
|
585
|
+
|| no "L30a inherited instructions not refused (rc=$RC30 · argv lines=$(wc -l < "$LOG30" | tr -d ' '))"
|
|
586
|
+
LOG30b="$WORKROOT/argv30b.log"; : > "$LOG30b"
|
|
587
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG30b" FH_SIM_ALLOW_INHERIT=1 \
|
|
588
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$INH/o30b" ) >"$WORKROOT/o30b.log" 2>&1
|
|
589
|
+
{ grep -q "FH_SIM_ALLOW_INHERIT=1 — arms WILL inherit" "$WORKROOT/o30b.log" && [ -s "$LOG30b" ]; } \
|
|
590
|
+
&& ok "L30b FH_SIM_ALLOW_INHERIT=1 → printed warning, the arm runs" \
|
|
591
|
+
|| no "L30b override did not proceed visibly (argv lines=$(wc -l < "$LOG30b" | tr -d ' '))"
|
|
592
|
+
rm -rf "$INH"
|
|
593
|
+
# L30c known-NEGATIVE — a parent with only a bare .git (no instruction file) is NOT refused (codex R1: over-block)
|
|
594
|
+
mkdir -p "$WORKROOT/bare_git_parent/.git"; LOG30c="$WORKROOT/argv30c.log"; : > "$LOG30c"
|
|
595
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG30c" \
|
|
596
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$WORKROOT/bare_git_parent/o" ) >"$WORKROOT/o30c.log" 2>&1
|
|
597
|
+
{ ! grep -q "REFUSED" "$WORKROOT/o30c.log" && [ -s "$LOG30c" ]; } \
|
|
598
|
+
&& ok "L30c bare .git parent, no instruction file → not refused, the arm runs" \
|
|
599
|
+
|| no "L30c a bare .git parent was refused or the arm did not run"
|
|
600
|
+
# L30d ancestor .claude/rules/*.md counts as an instruction source (codex R1)
|
|
601
|
+
mkdir -p "$WORKROOT/rules_parent/.claude/rules"; printf 'x\n' > "$WORKROOT/rules_parent/.claude/rules/r.md"
|
|
602
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say \
|
|
603
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$WORKROOT/rules_parent/o" ) >"$WORKROOT/o30d.log" 2>&1; RC30d=$?
|
|
604
|
+
{ [ "$RC30d" = 2 ] && grep -q "rules_parent/.claude/rules/" "$WORKROOT/o30d.log"; } \
|
|
605
|
+
&& ok "L30d ancestor .claude/rules/*.md → refused (rc 2, names the rules dir)" \
|
|
606
|
+
|| no "L30d ancestor rules not refused (rc=$RC30d)"
|
|
607
|
+
# L30e a reused --out whose rep wrapper already holds a CLAUDE.md → refused at the rep (codex R1)
|
|
608
|
+
mkdir -p "$WORKROOT/o30e/w_a_r1"; printf 'x\n' > "$WORKROOT/o30e/w_a_r1/CLAUDE.md"; LOG30e="$WORKROOT/argv30e.log"; : > "$LOG30e"
|
|
609
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG30e" \
|
|
610
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$WORKROOT/o30e" ) >"$WORKROOT/o30e.log" 2>&1; RC30e=$?
|
|
611
|
+
{ [ "$RC30e" = 2 ] && grep -q "REFUSED: rep wrapper" "$WORKROOT/o30e.log" && [ ! -s "$LOG30e" ]; } \
|
|
612
|
+
&& ok "L30e pre-existing w_a_r1/CLAUDE.md → refused at the rep, no arm invoked" \
|
|
613
|
+
|| no "L30e pre-existing wrapper instructions slipped through (rc=$RC30e · argv lines=$(wc -l < "$LOG30e" | tr -d ' '))"
|
|
614
|
+
# L30f an unresolvable --out stops at once (Gemini R1: empty path looped on dirname "")
|
|
615
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say \
|
|
616
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "/dev/null/x" ) >"$WORKROOT/o30f.log" 2>&1; RC30f=$?
|
|
617
|
+
[ "$RC30f" = 2 ] && ok "L30f unresolvable --out → rc 2, no hang" || no "L30f unresolvable --out rc=$RC30f"
|
|
618
|
+
rm -rf "$WORKROOT/bare_git_parent" "$WORKROOT/rules_parent" "$WORKROOT/o30e"
|
|
619
|
+
# L30g symlinked rules dir in an ancestor still counts (codex R2) · L30h GEMINI.md alone is not a Claude source (codex R2)
|
|
620
|
+
mkdir -p "$WORKROOT/sym_parent/.claude/rules" "$WORKROOT/sym_parent/shared-rules"; printf 'x\n' > "$WORKROOT/sym_parent/shared-rules/policy.md"
|
|
621
|
+
ln -s ../../shared-rules "$WORKROOT/sym_parent/.claude/rules/shared"
|
|
622
|
+
LOG30g="$WORKROOT/argv30g.log"; : > "$LOG30g"
|
|
623
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG30g" \
|
|
624
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$WORKROOT/sym_parent/o" ) >"$WORKROOT/o30g.log" 2>&1; RC30g=$?
|
|
625
|
+
{ [ "$RC30g" = 2 ] && grep -q "sym_parent/.claude/rules/" "$WORKROOT/o30g.log" && [ ! -s "$LOG30g" ]; } \
|
|
626
|
+
&& ok "L30g symlinked ancestor rules dir → refused (rc 2, names the rules dir, no arm invoked)" \
|
|
627
|
+
|| no "L30g symlinked rules slipped through (rc=$RC30g · argv lines=$(wc -l < "$LOG30g" | tr -d ' '))"
|
|
628
|
+
mkdir -p "$WORKROOT/gem_parent"; printf 'x\n' > "$WORKROOT/gem_parent/GEMINI.md"; LOG30h="$WORKROOT/argv30h.log"; : > "$LOG30h"
|
|
629
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG30h" \
|
|
630
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$WORKROOT/gem_parent/o" ) >"$WORKROOT/o30h.log" 2>&1
|
|
631
|
+
{ ! grep -q REFUSED "$WORKROOT/o30h.log" && [ -s "$LOG30h" ]; } && ok "L30h GEMINI.md-only parent → not refused, the arm runs" || no "L30h GEMINI.md over-blocked"
|
|
632
|
+
rm -rf "$WORKROOT/sym_parent" "$WORKROOT/gem_parent"
|
|
633
|
+
# L30i an ancestor with only .claude/AGENTS.md is an instruction source (Gemini R3)
|
|
634
|
+
mkdir -p "$WORKROOT/cagents_parent/.claude"; printf 'x\n' > "$WORKROOT/cagents_parent/.claude/AGENTS.md"; LOG30i="$WORKROOT/argv30i.log"; : > "$LOG30i"
|
|
635
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG30i" \
|
|
636
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$WORKROOT/cagents_parent/o" ) >"$WORKROOT/o30i.log" 2>&1; RC30i=$?
|
|
637
|
+
{ [ "$RC30i" = 2 ] && grep -q "cagents_parent/.claude/AGENTS.md" "$WORKROOT/o30i.log" && [ ! -s "$LOG30i" ]; } \
|
|
638
|
+
&& ok "L30i ancestor .claude/AGENTS.md only → refused (rc 2, names it, no arm invoked)" \
|
|
639
|
+
|| no "L30i .claude/AGENTS.md not refused (rc=$RC30i · argv lines=$(wc -l < "$LOG30i" | tr -d ' '))"
|
|
640
|
+
rm -rf "$WORKROOT/cagents_parent"
|
|
641
|
+
# L30j the user config dir is not an ancestor hit: HOME with ~/.claude/CLAUDE.md + --out under HOME → not refused,
|
|
642
|
+
# the informational user-level line prints once (CLAUDE_CONFIG_DIR unset). L30k known-positive: a plain ~/CLAUDE.md still refuses.
|
|
643
|
+
mkdir -p "$FAKEHOME/.claude" "$FAKEHOME/clean"; printf 'user\n' > "$FAKEHOME/.claude/CLAUDE.md"; LOG30j="$WORKROOT/argv30j.log"; : > "$LOG30j"
|
|
644
|
+
( cd "$SRC" && env -u CLAUDE_CONFIG_DIR PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG30j" \
|
|
645
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$FAKEHOME/clean/o" ) >"$WORKROOT/o30j.log" 2>&1
|
|
646
|
+
{ ! grep -q REFUSED "$WORKROOT/o30j.log" && [ -s "$LOG30j" ] && [ "$(grep -c 'user-level instructions load' "$WORKROOT/o30j.log")" = 1 ]; } \
|
|
647
|
+
&& ok "L30j HOME/.claude/CLAUDE.md + --out under HOME → not refused, arm runs, user-level line printed once" \
|
|
648
|
+
|| no "L30j user config dir over-blocked or info line wrong (argv lines=$(wc -l < "$LOG30j" | tr -d ' ') · info=$(grep -c 'user-level instructions load' "$WORKROOT/o30j.log"))"
|
|
649
|
+
printf 'plain\n' > "$FAKEHOME/CLAUDE.md"; LOG30k="$WORKROOT/argv30k.log"; : > "$LOG30k"
|
|
650
|
+
( cd "$SRC" && env -u CLAUDE_CONFIG_DIR PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG30k" \
|
|
651
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$FAKEHOME/clean/o2" ) >"$WORKROOT/o30k.log" 2>&1; RC30k=$?
|
|
652
|
+
{ [ "$RC30k" = 2 ] && grep -q "home/CLAUDE.md" "$WORKROOT/o30k.log" && [ ! -s "$LOG30k" ]; } \
|
|
653
|
+
&& ok "L30k plain HOME/CLAUDE.md → refused (rc 2, names it, no arm invoked)" \
|
|
654
|
+
|| no "L30k plain HOME CLAUDE.md slipped through (rc=$RC30k · argv lines=$(wc -l < "$LOG30k" | tr -d ' '))"
|
|
655
|
+
rm -rf "$FAKEHOME/CLAUDE.md" "$FAKEHOME/.claude" "$FAKEHOME/clean"
|
|
656
|
+
# L30l override with --reps 2: the inherit warning prints once, not per rep
|
|
657
|
+
mkdir -p "$WORKROOT/inh2"; printf 'x\n' > "$WORKROOT/inh2/CLAUDE.md"
|
|
658
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_SIM_ALLOW_INHERIT=1 \
|
|
659
|
+
bash "$SUT" --arm a --reps 2 --prompt p --out "$WORKROOT/inh2/o" ) >"$WORKROOT/o30l.log" 2>&1
|
|
660
|
+
[ "$(grep -c 'arms WILL inherit' "$WORKROOT/o30l.log")" = 1 ] \
|
|
661
|
+
&& ok "L30l FH_SIM_ALLOW_INHERIT=1 --reps 2 → inherit warning exactly once" \
|
|
662
|
+
|| no "L30l inherit warning count=$(grep -c 'arms WILL inherit' "$WORKROOT/o30l.log")"
|
|
663
|
+
rm -rf "$WORKROOT/inh2"
|
|
664
|
+
|
|
577
665
|
echo "sim_isolated_run lanes: $pass passed, $fail failed"
|
|
578
666
|
[ "$fail" -eq 0 ] || exit 1
|
|
@@ -62,7 +62,7 @@ run () { python3 scripts/stale_ref_scan.py --offline-fixture "$TMP/fx.json" --bo
|
|
|
62
62
|
# ── L1 자기검사가 실제로 돈다 ─────────────────────────────────────────────────
|
|
63
63
|
python3 scripts/stale_ref_scan.py --self-check > "$TMP/sc" 2>&1; rc=$?
|
|
64
64
|
n_pass=$(/usr/bin/grep -c '^ PASS' "$TMP/sc" || true)
|
|
65
|
-
if [ "$rc" = "0" ] && [ "$n_pass" -ge
|
|
65
|
+
if [ "$rc" = "0" ] && [ "$n_pass" -ge 25 ]; then ok "L1 --self-check rc=0 · PASS 레인 $n_pass (>=25)"
|
|
66
66
|
else ng "L1 --self-check rc=$rc · PASS $n_pass"; fi
|
|
67
67
|
|
|
68
68
|
# ── L2 known-POSITIVE: <wbr> 분할 DOI 가 SUPERSEDED 로 잡힌다 ─────────────────
|
|
@@ -92,6 +92,13 @@ rc=$(run "$TMP/d.html")
|
|
|
92
92
|
if [ "$rc" = "0" ] && /usr/bin/grep -q 'CHANGELOG-EXCLUDED=1' "$TMP/out"; then ok "L5 pin 마커 → rc=0"
|
|
93
93
|
else ng "L5 rc=$rc — pin 이 안 먹는다"; fi
|
|
94
94
|
|
|
95
|
+
# ── L5b 줄 pin — 그 줄만 제외, 같은 파일의 다른 낡은 인용은 그대로 잡힌다 ─────────────
|
|
96
|
+
printf 'v1 paper 10.5281/zenodo.20397566 old name <!-- stale-ref: pinned-line=20397566 -->\nlater cite 10.5281/zenodo.20397566 again\n' > "$TMP/d2.md"
|
|
97
|
+
rc=$(run "$TMP/d2.md")
|
|
98
|
+
if [ "$rc" = "1" ] && /usr/bin/grep -q 'SUPERSEDED=1' "$TMP/out" && /usr/bin/grep -q 'CHANGELOG-EXCLUDED=1' "$TMP/out"; then
|
|
99
|
+
ok "L5b 줄 pin → 같은 id 의 고정 줄은 제외 · 고정 안 된 줄은 SUPERSEDED 1 rc=1 (main 의 id 묶음 통과)"
|
|
100
|
+
else ng "L5b rc=$rc · $(/usr/bin/grep -o 'SUPERSEDED=[0-9]* .*CHANGELOG-EXCLUDED=[0-9]*' "$TMP/out" | head -1)"; fi
|
|
101
|
+
|
|
95
102
|
# ── L6 🟥 못 읽은 입력은 UNSCANNABLE + rc=10 (적대검증 S-1) ───────────────────
|
|
96
103
|
printf '%%PDF-1.4\000\000binary\n' > "$TMP/e.pdf"
|
|
97
104
|
rc=$(run "$TMP/e.pdf")
|
|
@@ -123,6 +130,9 @@ PYX
|
|
|
123
130
|
}
|
|
124
131
|
probe "L8 scan_body 죽이기" " return sites" " return []"
|
|
125
132
|
probe "L9 rc 지배 제거" " if unresolved or unscannable:" " if False:"
|
|
133
|
+
probe "L10b 줄 pin 제거" "in_changelog or m.group(1) in line_pinned))" "in_changelog))"
|
|
134
|
+
probe "L10d 줄 pin 이 id 를 안 가림" "in_changelog or m.group(1) in line_pinned))" "in_changelog or bool(line_pinned)))"
|
|
135
|
+
probe "L10c 파일 pin 접두 일치" 'pinned(?=\s|-->)", re.IGNORECASE)' 'pinned", re.IGNORECASE)'
|
|
126
136
|
probe "L10 바이너리 검사 제거" ' if b"\x00" in raw:' " if False:"
|
|
127
137
|
|
|
128
138
|
# 원본 불변 확인 — 프로브가 대상을 건드리지 않았나
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
# • tag / notes ref deletion (git push origin :refs/tags/vX)
|
|
9
9
|
# • FORCE / non-fast-forward push (history rewrite — git push -f)
|
|
10
10
|
# • implicit deletes from git push --mirror / --prune
|
|
11
|
+
# (--prune: git lists the deletes on stdin. --mirror: git does NOT — measured 2026-10-24, git 2.50.1 — so the
|
|
12
|
+
# hook detects a mirror push and computes the deletes from `git ls-remote`; see the mirror block below.)
|
|
13
|
+
# Each line above is measured by a REAL push in scripts/test_prepush_real_fire_lanes.sh (hook fired · stdin line ·
|
|
14
|
+
# remote unchanged), not only by synthetic stdin in test_prepush_destructive_lanes.sh.
|
|
11
15
|
#
|
|
12
16
|
# What it is and is NOT (honest scope):
|
|
13
17
|
# • It closes the **honest-weak-model** gap: an agent that simply *forgot* the prose
|
|
@@ -333,6 +337,75 @@ while read -r local_ref local_sha remote_ref remote_sha; do
|
|
|
333
337
|
# remote_sha == ZERO → creating a new branch (not destructive) → ignore
|
|
334
338
|
done
|
|
335
339
|
|
|
340
|
+
# ── `git push --mirror` deletes refs WITHOUT telling this hook (2026-10-24, sibling-harness report) ──────────────
|
|
341
|
+
# Measured with git 2.50.1 (scripts/test_prepush_real_fire_lanes.sh L8): a mirror push deleted an unmerged remote
|
|
342
|
+
# branch and the stdin above carried NO `(delete)` line for it — only the refs the push creates. The header's claim
|
|
343
|
+
# «covers implicit deletes from --mirror» was a statement about git that no lane had run, and it was false.
|
|
344
|
+
# So when the push is a mirror push, compute the deletions here: every remote ref that does not exist locally is
|
|
345
|
+
# deleted by it. They join the same lists the verdict below already judges (merged branch = SAFE, unique work =
|
|
346
|
+
# held, tags/notes = held). Cannot read the remote's refs → cannot classify → block (irreversible surface).
|
|
347
|
+
# Mirror detection: `remote.<name>.mirror` config, or `--mirror` on the `git push` command line of an ancestor
|
|
348
|
+
# process (the hook may sit behind a wrapper, so walk up to 4 levels). Named residual: with `ps` unavailable and no
|
|
349
|
+
# mirror config, a mirror push is not detected — server-side branch protection stays the hard floor (header).
|
|
350
|
+
# Second named residual (cross-family R1): `ls-remote` reads the upload-pack advertisement; a server that hides refs
|
|
351
|
+
# from upload-pack (uploadpack.hideRefs) but not from receive-pack can omit a ref the mirror deletes. Same hard floor.
|
|
352
|
+
MIRROR_UNREADABLE=""
|
|
353
|
+
_fh_cfg=0
|
|
354
|
+
[ "$(git config --bool "remote.${PUSH_REMOTE}.mirror" 2>/dev/null)" = true ] && _fh_cfg=1
|
|
355
|
+
# A mirror config makes the push a mirror push (git refuses `--no-mirror <refspec>` against it — measured: «--mirror
|
|
356
|
+
# can't be combined with refspecs» — so the config is not overridden here; fail-closed). The command line is read from the
|
|
357
|
+
# nearest ancestor whose EXECUTABLE is git (the hook may sit behind a wrapper; an unrelated shell whose text merely
|
|
358
|
+
# contains «push --mirror» is not git and is skipped — cross-family R1). argv is split without globbing (read -a).
|
|
359
|
+
# git accepts unambiguous abbreviations, so every prefix of --mirror down to --mi counts (cross-family R1: `--mir`).
|
|
360
|
+
_fh_cli=""
|
|
361
|
+
_fh_pid=$PPID
|
|
362
|
+
for _fh_i in 1 2 3 4 5; do
|
|
363
|
+
case "${_fh_pid:-}" in ''|0|1) break ;; esac
|
|
364
|
+
_fh_comm=$(ps -o comm= -p "$_fh_pid" 2>/dev/null) || break
|
|
365
|
+
case "${_fh_comm##*/}" in
|
|
366
|
+
git|git-push)
|
|
367
|
+
_fh_args=$(ps -o args= -p "$_fh_pid" 2>/dev/null) || break
|
|
368
|
+
read -r -a _fh_av <<< "$_fh_args"
|
|
369
|
+
for _fh_w in "${_fh_av[@]}"; do
|
|
370
|
+
case "$_fh_w" in
|
|
371
|
+
--mi|--mir|--mirr|--mirro|--mirror|--mirror=*) _fh_cli=mirror ;;
|
|
372
|
+
esac
|
|
373
|
+
done
|
|
374
|
+
break ;;
|
|
375
|
+
esac
|
|
376
|
+
_fh_pid=$(ps -o ppid= -p "$_fh_pid" 2>/dev/null | tr -d ' ')
|
|
377
|
+
done
|
|
378
|
+
case "$_fh_cli" in mirror) _fh_mirror=1 ;; *) _fh_mirror=$_fh_cfg ;; esac
|
|
379
|
+
if [ "$_fh_mirror" = 1 ]; then
|
|
380
|
+
# bounded and non-interactive (cross-family R1): a stalled transport or an auth prompt must end as «unreadable» → block
|
|
381
|
+
# The deadline covers the whole transport process group (cross-family R2: `alarm; exec` killed git but an ssh/helper
|
|
382
|
+
# child holding stdout kept a $(...) waiting past it). Output goes to a file, not a command substitution.
|
|
383
|
+
_fh_lr_out=$(mktemp "${TMPDIR:-/tmp}/fh-mirror-lsr.XXXXXX") || _fh_lr_out=""
|
|
384
|
+
if [ -n "$_fh_lr_out" ]; then
|
|
385
|
+
GIT_TERMINAL_PROMPT=0 GIT_ASKPASS=/usr/bin/false perl -e '
|
|
386
|
+
my $p = fork; die "fork" unless defined $p;
|
|
387
|
+
if (!$p) { setpgrp(0, 0); exec @ARGV; exit 127 }
|
|
388
|
+
$SIG{ALRM} = sub { kill "KILL", -$p; exit 124 };
|
|
389
|
+
alarm 30; waitpid($p, 0); exit($? >> 8)' git ls-remote "${2:-$PUSH_REMOTE}" >"$_fh_lr_out" 2>/dev/null; _fh_rc=$?
|
|
390
|
+
_fh_remote_refs=$(cat "$_fh_lr_out" 2>/dev/null); rm -f "$_fh_lr_out"
|
|
391
|
+
else
|
|
392
|
+
_fh_rc=1
|
|
393
|
+
fi
|
|
394
|
+
if [ "$_fh_rc" -ne 0 ]; then
|
|
395
|
+
MIRROR_UNREADABLE="${2:-$PUSH_REMOTE}"
|
|
396
|
+
else
|
|
397
|
+
while read -r _fh_sha _fh_ref; do
|
|
398
|
+
case "$_fh_ref" in ''|HEAD|*'^{}') continue ;; esac
|
|
399
|
+
git show-ref --verify -q "$_fh_ref" 2>/dev/null && continue # exists locally → the mirror keeps it
|
|
400
|
+
case " $DEL_BRANCHES $DEL_OTHER " in *"|${_fh_ref} "*|*" ${_fh_ref} "*) continue ;; esac # stdin already named it
|
|
401
|
+
case "$_fh_ref" in
|
|
402
|
+
refs/heads/*) DEL_BRANCHES="$DEL_BRANCHES ${_fh_sha}|${_fh_ref}" ;;
|
|
403
|
+
*) DEL_OTHER="$DEL_OTHER $_fh_ref" ;;
|
|
404
|
+
esac
|
|
405
|
+
done <<< "$_fh_remote_refs"
|
|
406
|
+
fi
|
|
407
|
+
fi
|
|
408
|
+
|
|
336
409
|
# ── Confidentiality at the PUBLISH boundary — instrument completeness + content ───
|
|
337
410
|
# Pattern loading and matching come from scripts/psa_scan_lib.sh, the single implementation shared
|
|
338
411
|
# with pre-commit and the publish scanner. Every confidentiality defect found in the 2026-07-26
|
|
@@ -663,7 +736,7 @@ fi
|
|
|
663
736
|
# push. Running AFTER classification removes the hazard structurally (the refs are already read
|
|
664
737
|
# into variables); the `< /dev/null` guard is kept as defense in depth, not as the fix.
|
|
665
738
|
# Nothing destructive and nothing unclassifiable → ordinary ff push / new branch → allow.
|
|
666
|
-
if [ -z "$DEL_BRANCHES$DEL_OTHER$FORCED_REFS$UNCLASSIFIED" ]; then
|
|
739
|
+
if [ -z "$DEL_BRANCHES$DEL_OTHER$FORCED_REFS$UNCLASSIFIED$MIRROR_UNREADABLE" ]; then
|
|
667
740
|
exit 0
|
|
668
741
|
fi
|
|
669
742
|
|
|
@@ -695,6 +768,14 @@ for r in $FORCED_REFS; do
|
|
|
695
768
|
BLOCK=1
|
|
696
769
|
done
|
|
697
770
|
|
|
771
|
+
# ── Mirror push whose remote refs could not be read: the deletions are unknown → fail-closed ──
|
|
772
|
+
if [ -n "$MIRROR_UNREADABLE" ]; then
|
|
773
|
+
echo " CANNOT CLASSIFY (mirror push, remote refs unreadable): $MIRROR_UNREADABLE"
|
|
774
|
+
echo " → a --mirror push deletes every remote ref missing locally; git does not list those deletes for this hook."
|
|
775
|
+
echo " Make the remote readable (git ls-remote) and re-push, or push explicit refspecs instead of --mirror."
|
|
776
|
+
BLOCK=1
|
|
777
|
+
fi
|
|
778
|
+
|
|
698
779
|
# ── Unclassifiable (remote tip not fetched): fail-closed, accurate message ──
|
|
699
780
|
for r in $UNCLASSIFIED; do
|
|
700
781
|
echo " CANNOT CLASSIFY (remote tip not fetched): $r"
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
|
|
20
20
|
## When it applies
|
|
21
21
|
|
|
22
|
+
The leak gates (Steps 0–3) apply to any first-time public action below. The last item of
|
|
23
|
+
**§Read it as a reader** (Area B) applies to every minor/major release and every public announcement
|
|
24
|
+
of the harness itself, not only the first one.
|
|
25
|
+
|
|
22
26
|
Any first-time public action:
|
|
23
27
|
- `gh repo create --public` / `gh repo create ... --public`
|
|
24
28
|
- `gh repo edit --visibility public` (private → public flip)
|
|
@@ -128,6 +132,12 @@ opens and look at what they see:
|
|
|
128
132
|
|
|
129
133
|
A lens already exists — `/sim-conductor` A-1 (`beginner` cold-read) — or just render it and read it.
|
|
130
134
|
|
|
135
|
+
- [ ] **Minor/major release or public announcement of the harness itself**: run `/sim-conductor` Area B
|
|
136
|
+
(whole-set internal audit: outside-reader briefing · naming/structure gaps · challenger) unless one
|
|
137
|
+
already ran since the previous minor release. This replaced a 30-day terminal reminder on
|
|
138
|
+
2026-10-19 (operator decision): Area B's distinct value is an outsider's view of the whole set,
|
|
139
|
+
and that view pays at publication, not on a clock.
|
|
140
|
+
|
|
131
141
|
🟥 **Why this is a human step and not a scan**: a static check catches what is ABSENT, never what is
|
|
132
142
|
UNREADABLE. Two independent measurements arrived here the same day (2026-08-17): one harness axis
|
|
133
143
|
found 12 readability defects with **0** caught by static scanners; a third-harness review
|
|
@@ -588,6 +588,49 @@ for f in "${FILES[@]}"; do
|
|
|
588
588
|
| grep -vE '^[0-9]+:[[:space:]]*#' \
|
|
589
589
|
| grep -vE '#[[:space:]]*noqa[:[:space:]]*degrade')
|
|
590
590
|
fi
|
|
591
|
+
|
|
592
|
+
# S7 — `set -e` under a declared exit contract that has its OWN error code, with no ERR trap.
|
|
593
|
+
# Under `set -e` a command that fails where nobody expected it ends the script with THAT
|
|
594
|
+
# command's status — usually 1. If the contract reserves a separate code for "the tool itself
|
|
595
|
+
# broke" (10 HARNESS_ERROR and the like), the low codes are verdicts, so a crash leaks out as
|
|
596
|
+
# one of them. Measured 2026-10-20 on fh-gate.sh: a failing `mktemp` exited 1 = PENDING
|
|
597
|
+
# ("proceed with awareness"); reported from outside, fixed in #927. The cure is an ERR trap
|
|
598
|
+
# that exits the error code, plus an exit-time check that 0..N only leave through the verdict
|
|
599
|
+
# sites (`set -u` and a failing EXIT-trap function end with 1 WITHOUT firing ERR).
|
|
600
|
+
# SCOPE, so this stays quiet: all three must hold — `set -…e…` · a comment header naming exit
|
|
601
|
+
# codes · a contract line naming an error code (harness/internal/tool error). A contract of
|
|
602
|
+
# just "0 = pass, 1 = fail" is excluded: there an unexpected 1 already points the safe way.
|
|
603
|
+
# Census 2026-10-20 over this repo's tracked shell: 1 file matched the shape (fh-gate.sh).
|
|
604
|
+
# FILE-level probe: it reports the `set -e` line once.
|
|
605
|
+
# Round-1 cross-family review (codex) widened three things: `set -o errexit` and `cmd; set -e`
|
|
606
|
+
# activate it; an `EXIT_*ERROR=10`-style constant counts as a contract; and a trap only counts
|
|
607
|
+
# when it EXITS — `trap cleanup ERR` (no exit) and a commented-out trap do not protect anything.
|
|
608
|
+
# A grep that ERRORS (rc>1) is reported as S7-UNMEASURED, never read as "no hit" — the same
|
|
609
|
+
# default-toward-clean shape this probe exists to find.
|
|
610
|
+
_s7_rc() { grep "$@" "$f" >/dev/null 2>&1; echo $?; }
|
|
611
|
+
_s7_lines=$(grep -nE '(^|[;{&|])[[:space:]]*set[[:space:]]+(-[A-Za-z]*e[A-Za-z]*|-o[[:space:]]+errexit)([[:space:];]|$)' "$f" 2>/dev/null); _s7_r1=$?
|
|
612
|
+
_s7_set=$(printf '%s\n' "$_s7_lines" | grep -vE '^[0-9]+:[[:space:]]*#' | grep -vE '#[[:space:]]*noqa[:[:space:]]*degrade' | sed -n 1p)
|
|
613
|
+
_s7_r2=$(_s7_rc -qE '^[[:space:]]*#.*\b[Ee]xit([[:space:]]+codes?|[[:space:]]+status(es)?)?[[:space:]]*:')
|
|
614
|
+
_s7_r3=$(_s7_rc -qiE '^[[:space:]]*#.*\b[0-9]+([[:space:]]*(—|–|-|=|:|\))[[:space:]]*.{0,40}|[[:space:]]+)(harness|internal|tool)[ _-]?error')
|
|
615
|
+
# ^ a CONTRACT ENTRY (`10 — Harness error`, `10 harness error`), not prose that happens to hold a
|
|
616
|
+
# number and the word (an old test file's comment «the count is 0 … HARNESS_ERROR» was flagged).
|
|
617
|
+
_s7_r4=$(_s7_rc -qE '^[[:space:]]*[A-Z_]*(HARNESS|INTERNAL|TOOL)_?ERR(OR)?[A-Z_]*=[0-9]+')
|
|
618
|
+
# protecting trap: an ACTIVE (non-comment) `trap … ERR` line that exits, or that names a handler
|
|
619
|
+
# function whose body (next 12 lines) exits.
|
|
620
|
+
_s7_traps=$(grep -nE "^[^#]*\btrap[[:space:]].*[[:space:]'\"]ERR(['\"]|[[:space:];]|$)" "$f" 2>/dev/null); _s7_r5=$?
|
|
621
|
+
_s7_guard=""
|
|
622
|
+
if [ -n "$_s7_traps" ]; then
|
|
623
|
+
if printf '%s\n' "$_s7_traps" | grep -qE '\bexit\b'; then _s7_guard=1
|
|
624
|
+
else
|
|
625
|
+
_s7_h=$(printf '%s\n' "$_s7_traps" | sed -nE "s/.*trap[[:space:]]+['\"]?([A-Za-z_][A-Za-z0-9_]*)['\"]?[[:space:]].*/\\1/p" | sed -n 1p)
|
|
626
|
+
[ -n "$_s7_h" ] && grep -A12 -E "^[[:space:]]*(function[[:space:]]+)?${_s7_h}[[:space:]]*\(\)" "$f" 2>/dev/null | grep -qE '\bexit\b' && _s7_guard=1
|
|
627
|
+
fi
|
|
628
|
+
fi
|
|
629
|
+
if [ "$_s7_r1" -gt 1 ] || [ "$_s7_r2" -gt 1 ] || [ "$_s7_r3" -gt 1 ] || [ "$_s7_r4" -gt 1 ] || [ "$_s7_r5" -gt 1 ]; then
|
|
630
|
+
emit "$f" 1 "S7-UNMEASURED(sh)" "could not read this file for the set -e / exit-contract check (grep error) — NOT checked, not clean"
|
|
631
|
+
elif [ -n "$_s7_set" ] && { { [ "$_s7_r2" -eq 0 ] && [ "$_s7_r3" -eq 0 ]; } || [ "$_s7_r4" -eq 0 ]; } && [ -z "$_s7_guard" ]; then
|
|
632
|
+
emit "$f" "${_s7_set%%:*}" "S7:set-e-leaks-verdict(sh)" "\`set -e\` under an exit contract that has its own error code, but no ERR trap that exits — an unexpected failure exits with the failing command's status (usually 1), which the contract reads as a verdict; add \`trap '…; exit <error-code>' ERR\` and an EXIT check that 0..N only leave through the verdict sites (set -u and EXIT-trap failures do not fire ERR). Do NOT add set -E without checking \`\$( ) || rc=\$?\` captures"
|
|
633
|
+
fi
|
|
591
634
|
fi
|
|
592
635
|
|
|
593
636
|
# Probe A — except/else/finally block returning a permissive value within 2 lines.
|