@chrono-meta/fh-gate 2.10.0 β†’ 2.12.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.
@@ -392,7 +392,31 @@ fi
392
392
  # Fix = no `|| echo`, plus integer sanitation. This is the documented prescription for this class
393
393
  # ([[feedback_pipefail_fallback_disarms_guard]]) applied to the checker that cited it.
394
394
  _int() { case "${1:-}" in (''|*[!0-9]*) echo 0 ;; (*) echo "$1" ;; esac; }
395
- DISPATCHED=$(_int "$(grep -c "^$TODAY$" "$TALLY" 2>/dev/null | tr -d ' ' || true)")
395
+ # πŸŸ₯ 2026-08-26 (cross-family/codex) β€” the fix above closed the `0\n0` half and left the OTHER
396
+ # half open: `|| true` + `_int` folded a READ FAILURE into the same 0 as a genuine no-match, so an
397
+ # unreadable tally rendered as "βœ… no sub-agent dispatches tallied today" β€” a green nobody measured.
398
+ # `grep -c` separates the three cleanly: rc 0 = matched, rc 1 = no match (a REAL zero), rc >= 2 =
399
+ # grep itself failed. Only the first two are counts; the third is UNMEASURED and must not be 0.
400
+ # ([[feedback_not_found_is_not_zero_family]] β€” `not found` != `0`, applied to this checker.)
401
+ # πŸŸ₯ Kept as a HELPER + a ONE-LINE assignment on purpose: test_dispatch_log_lanes.sh lifts the
402
+ # subject's own `^DISPATCHED=` / `^LOGGED=` line and evaluates it, precisely so the lane cannot go
403
+ # green on a needle that no longer matches real behaviour. A multi-line if/else defeats that lift.
404
+ _cnt() { # $1 = a path that must EXIST (or "" to skip that test); rest = the reader command.
405
+ # Three states, not two β€” the lane below pins all three:
406
+ # path absent -> 0 a tally that was never written IS zero dispatches;
407
+ # calling that UNMEASURED false-blocks every clean
408
+ # close on a fresh install, and an over-blocking close
409
+ # gate trains the --no-verify reflex that disarms the
410
+ # Destructive-Op gate sharing that hook.
411
+ # reader rc 0 or 1 -> the count (rc 1 = grep's honest "no match")
412
+ # reader rc >= 2 -> UNMEASURED the reader ITSELF failed; folding that into 0 printed
413
+ # "no dispatches tallied today" on something nobody read.
414
+ _c_f="$1"; shift
415
+ if [ -n "$_c_f" ] && [ ! -e "$_c_f" ]; then echo 0; return; fi
416
+ _c_out=$("$@" 2>/dev/null); _c_rc=$?
417
+ if [ "$_c_rc" -ge 2 ]; then echo UNMEASURED; else _int "$(printf '%s' "$_c_out" | tr -d ' ')"; fi
418
+ }
419
+ DISPATCHED=$(_cnt "$TALLY" grep -c "^$TODAY$" "$TALLY")
396
420
  # Both quotings, because the file carries both: hand-written entries use `- date: 2026-08-02`
397
421
  # while anything appended via yaml.dump renders `- date: '"'"'2026-08-02'"'"'`. Matching one form counted
398
422
  # half the entries as absent β€” a divergent-normalizer miss inside the check that exists to catch
@@ -408,8 +432,17 @@ LOGDIR="$FH/knowledge/shared/learnings/subagent_invocations"
408
432
  _cat_logs() { # 닀쀑 νŒŒμΌμ— grep -c λ₯Ό 직접 κ±Έλ©΄ νŒŒμΌλ³„ `경둜:개수` λ₯Ό 찍어 합산이 κΉ¨μ§„λ‹€(μ‹€μΈ‘).
409
433
  { [ -f "$LOG" ] && cat "$LOG"; [ -d "$LOGDIR" ] && cat "$LOGDIR"/*.yaml; } 2>/dev/null
410
434
  }
411
- LOGGED=$(_int "$(_cat_logs | grep -cE "^- date: *'?$TODAY'?" | tr -d ' ' || true)")
412
- if [ "${DISPATCHED:-0}" -gt 0 ] && [ "${LOGGED:-0}" -eq 0 ]; then
435
+ _log_grep() { # πŸŸ₯ MUST stay multi-line: the lane lifts defs with /^_name\(\) \{/,/^\}/ and a
436
+ # one-liner has no `}` at column 0, so the range never closes and the extraction
437
+ # silently swallows the rest of the file (measured 2026-08-26).
438
+ _cat_logs | grep -cE "^- date: *'?$TODAY'?"
439
+ }
440
+ LOGGED=$(_cnt "" _log_grep) # _cat_logs already renders absence as empty, not as an error
441
+ if [ "$DISPATCHED" = UNMEASURED ] || [ "$LOGGED" = UNMEASURED ]; then
442
+ echo "❌ β‘£-e dispatch log: COULD NOT MEASURE (tally=$DISPATCHED, log=$LOGGED) β€” a read error is"
443
+ echo " not a count of zero. Fix the read before closing; do not treat this as 'no dispatches'."
444
+ FAIL=1
445
+ elif [ "${DISPATCHED:-0}" -gt 0 ] && [ "${LOGGED:-0}" -eq 0 ]; then
413
446
  echo "❌ β‘£-e $DISPATCHED sub-agent dispatch(es) today and ZERO invocation-log entries β€” the 60/40"
414
447
  echo " promotion gate and the UAP loop both read that file; an unlogged session is invisible to"
415
448
  echo " them. Append to knowledge/shared/learnings/subagent_invocations_log.yaml (consolidated"
@@ -566,5 +599,93 @@ CARD_LINE_EOF
566
599
  [ "$DRIFT_HITS" -eq 0 ] && echo "βœ… β‘€-b no card absence-claim contradicted by on-disk artifacts"
567
600
  fi
568
601
 
602
+ # β‘€-C CARRY-OVER probe β€” μΉ΄λ“œ μž¬μž‘μ„±μ΄ «아직 μ•ˆ 온 κΈ°ν•œΒ» 을 λ‚ λ ΈλŠ”κ°€.
603
+ # WHY (2026-08-24, μ‹€μΈ‘ 손싀 1건): β‘€ μž¬μž‘μ„±μ΄ delta update κ°€ μ•„λ‹ˆλΌ μƒˆλ‘œ μ“°κΈ°κ°€ λ˜μ–΄ λ―Έμ™„Β·
604
+ # μ‹œκ°λ°•νžŒ ν•­λͺ©μ΄ ν†΅μ§Έλ‘œ μ‚¬λΌμ‘Œλ‹€ β€” κ·Έλ‚  저녁 19:00 κ²Œμ‹œ, λ‹€μŒλ‚  GeekNews, 14일 referrer μΈ‘μ •,
605
+ # 08-26 λ―ΈνŒ…. μ„Έμ…˜μ€ "BEFORE 172 β†’ AFTER 101" μ΄λΌλŠ” diff λ₯Ό 좜λ ₯ν•˜κ³ λ„ Β«μ€„μ—ˆλ‹€Β» 만 λ§ν•˜κ³ 
606
+ # «무엇이 λΉ μ‘Œλ‚˜Β» λŠ” 보지 μ•Šμ•˜λ‹€. μš΄μ˜μžκ°€ λ¬Όμ–΄μ„œ 발견 β€” 자λ ₯ μ•„λ‹ˆλ‹€.
607
+ # πŸŸ₯ 이것은 tier λ¬Έμ œκ°€ μ•„λ‹ˆλΌ WIRING λ¬Έμ œλ‹€. μΉ΄λ“œ 규율(Β§Session Wrap-up)은 γ€Œμ™„λ£Œ ν•­λͺ©μ΄
608
+ # λ‚¨λŠ” 게 버그」라고 ν•œ λ°©ν–₯만 적고 있고, κ·Έ μ—­λ°©ν–₯(미완이 μ‚¬λΌμ§€λŠ” 것)은 검사가 0μ€„μ΄μ—ˆλ‹€.
609
+ # 규율이 ν•œ λ°©ν–₯만 μ ν˜€ 있으면 κ·Έ λ°˜λŒ€λŠ” μ•ˆ 보인닀. base op 이 μ‚΄λ¦¬μ–ΈμŠ€μ—λ§Œ μ–Ήν˜€ μžˆμ—ˆμœΌλ―€λ‘œ
610
+ # sonnet_floor_doctrine Β§tier-gated base op = defect 에 ν•΄λ‹Ήν•œλ‹€ β€” N 을 μ„ΈκΈ° 전에 λ‹«λŠ”λ‹€.
611
+ #
612
+ # WHAT IT ASSERTS (채널이지 결둠이 μ•„λ‹ˆλ‹€ β€” CLAUDE.md Β§Mechanization Boundary):
613
+ # γ€Œμ΄μ „ μΉ΄λ“œμ— 있던 **미래 λ‚ μ§œ**κ°€ 였늘 μΉ΄λ“œλ‚˜ 였늘 fh_completed 에 μ—¬μ „νžˆ λ‚˜νƒ€λ‚˜λŠ”κ°€γ€
614
+ # = 기둝의 μ„±μ§ˆ(μ‘΄μž¬Β·κ·€μ†). γ€Œμ΄ ν•­λͺ©μ„ μ§€μ›Œλ„ λ˜λŠ”κ°€γ€λŠ” **νŒμ •ν•˜μ§€ μ•ŠλŠ”λ‹€** β€” 그건 νŒλ‹¨μ΄κ³ 
615
+ # 얼리면 였늘의 νŒλ‹¨μ΄ λ‚΄μΌμ˜ 천μž₯이 λœλ‹€. μ™„λ£Œ μ²˜λ¦¬ν–ˆμœΌλ©΄ fh_completed 에 λ‚ μ§œκ°€ λ‚¨μœΌλ―€λ‘œ
616
+ # κ·Έ 경둜둜 ν†΅κ³Όν•œλ‹€.
617
+ #
618
+ # HONEST SCOPE:
619
+ # Β· νŒλ³„μžλŠ” `YYYY-MM-DD` / `MM-DD` 토큰뿐이닀. λ‚ μ§œ 없이 적힌 λ―Έμ™„(Β«4090 λΆ€νŒ… UNKNOWNΒ»)은
620
+ # ꡬ쑰적으둜 λͺ» μž‘λŠ”λ‹€ β€” 액컀지 floor κ°€ μ•„λ‹ˆλ‹€.
621
+ # Β· 이전 μΉ΄λ“œλŠ” companion store 의 git 이λ ₯μ—μ„œ μ˜¨λ‹€. 그게 μ—†λŠ” install(λŒ€λΆ€λΆ„μ˜ μ†ŒλΉ„μž)μ—μ„œλŠ”
622
+ # **SKIP 이고 PASS κ°€ μ•„λ‹ˆλ‹€** β€” 미츑정을 초둝으둜 μ ‘μ§€ μ•ŠλŠ”λ‹€.
623
+ # Β· ASCII 클래슀만 μ“΄λ‹€. λ‹€κ΅­μ–΄ RANGE λ₯Ό bracket μ•ˆμ— λ„£μœΌλ©΄ C λ‘œμΌ€μΌ GNU grep 이
624
+ # `Invalid collation character` 둜 exit 2 ν•˜κ³  **아무것도 μ•ˆ λ±‰λŠ”λ‹€** β†’ no-match 와 ꡬ뢄 λΆˆκ°€
625
+ # (β‘€-b κ°€ 2026-07-31 에 μ •ν™•νžˆ κ·Έλ ‡κ²Œ 무음 ν†΅κ³Όν–ˆλ‹€).
626
+ # DEGRADE: 이전 μΉ΄λ“œ λͺ» ꡬ함 β†’ SKIP(λ―ΈμΈ‘μ • ν‘œκΈ°) Β· κ΅¬ν–ˆλŠ”λ° λ―Έλž˜λ‚ μ§œ μœ μ‹€ β†’ FAIL=1.
627
+ # FAIL 은 FH_SESSION_CLOSE=1 인 close push 만 막고 일반 push λŠ” surface ν•œλ‹€(κ°€μ—­ ν‘œλ©΄ 규율).
628
+ # 과차단 μ‹œ override: FH_CARRYOVER_OK=1 (무엇을 μš°νšŒν–ˆλŠ”μ§€ 좜λ ₯에 λ‚¨λŠ”λ‹€).
629
+ # 기본값을 두지 μ•ŠλŠ”λ‹€ β€” companion store 의 이름은 install λ§ˆλ‹€ λ‹€λ₯΄κ³ , νŠΉμ • 이름을 곡개
630
+ # νŒŒμΌμ— λ°•μœΌλ©΄ κ·Έ μžμ²΄κ°€ operator-private 토큰이닀(이 쀄은 μ‹€μ œλ‘œ κ·Έλ ‡κ²Œ ν•œ 번 차단됐닀).
631
+ # 섀정은 각자의 둜컬 λ°”μΈλ”©μ—μ„œ FH_COMPANION_STORE 둜 μ€€λ‹€.
632
+ _CARRY_STORE="${FH_COMPANION_STORE:-}"
633
+ _CARRY_MIRROR="tracks-meta/reference_next_session_starter.md"
634
+ if [ ! -f "$CARD" ]; then
635
+ : # β‘€ κ°€ 이미 μΉ΄λ“œ λΆ€μž¬λ₯Ό FAIL 둜 λ³΄κ³ ν–ˆλ‹€ β€” μ—¬κΈ°μ„œ 쀑볡 λ³΄κ³ ν•˜μ§€ μ•ŠλŠ”λ‹€
636
+ elif [ "${FH_CARRYOVER_OK:-0}" = "1" ]; then
637
+ echo "⚠️ β‘€-C SKIPPED by FH_CARRYOVER_OK=1 β€” 이전 μΉ΄λ“œμ˜ 미래-λ‚ μ§œ μœ μ‹€ 검사λ₯Ό μš°νšŒν–ˆλ‹€"
638
+ elif [ -z "$_CARRY_STORE" ] || [ ! -d "$_CARRY_STORE/.git" ]; then
639
+ echo "⬜ β‘€-C SKIPPED (not PASS) β€” companion store λ―Έμ„€μ •/λΆ€μž¬ (FH_COMPANION_STORE). 이전 μΉ΄λ“œλ₯Ό λͺ» ꡬ해 UNMEASURED"
640
+ else
641
+ _TODAY_YMD=$(date +%Y-%m-%d)
642
+ # 였늘 이전에 기둝된 λ§ˆμ§€λ§‰ μΉ΄λ“œ 버전. 였늘자 sync 컀밋듀은 이미 μž¬μž‘μ„±λ³Έμ΄λΌ μ œμ™Έν•œλ‹€.
643
+ _PRIOR_SHA=$(git -C "$_CARRY_STORE" log --before="${_TODAY_YMD}T00:00:00" -1 --format=%H -- "$_CARRY_MIRROR" 2>/dev/null || true)
644
+ if [ -z "$_PRIOR_SHA" ]; then
645
+ echo "⬜ β‘€-C SKIPPED (not PASS) β€” 였늘 이전 μΉ΄λ“œ 버전이 이λ ₯에 μ—†λ‹€ (첫 μ„Έμ…˜?) β€” UNMEASURED"
646
+ else
647
+ _PRIOR_CARD=$(git -C "$_CARRY_STORE" show "$_PRIOR_SHA:$_CARRY_MIRROR" 2>/dev/null || true)
648
+ if [ -z "$_PRIOR_CARD" ]; then
649
+ echo "⬜ β‘€-C SKIPPED (not PASS) β€” 이전 μΉ΄λ“œλ₯Ό 읽지 λͺ»ν–ˆλ‹€ ($_PRIOR_SHA) β€” UNMEASURED"
650
+ else
651
+ # 이전 μΉ΄λ“œμ˜ λ‚ μ§œ 토큰 쀑 «였늘 이상» 인 κ²ƒλ§Œ. YYYY-MM-DD 와 MM-DD λ‘˜ λ‹€ λ³Έλ‹€.
652
+ _TODAY_MD=$(date +%m-%d)
653
+ _FUTURE_DATES=$(printf '%s\n' "$_PRIOR_CARD" \
654
+ | grep -oE '20[0-9]{2}-[0-9]{2}-[0-9]{2}|(^|[^0-9])[01][0-9]-[0-3][0-9]([^0-9]|$)' 2>/dev/null \
655
+ | grep -oE '20[0-9]{2}-[0-9]{2}-[0-9]{2}|[01][0-9]-[0-3][0-9]' 2>/dev/null \
656
+ | sort -u | while IFS= read -r d; do
657
+ # bash 3.2(macOS)λŠ” $( ) μ•ˆμ˜ case νŒ¨ν„΄ ')' λ₯Ό μ˜€νŒŒμ‹±ν•œλ‹€ β€” 길이둜 κ°€λ₯Έλ‹€
658
+ _ref="$_TODAY_MD"
659
+ if [ ${#d} -eq 10 ]; then _ref="$_TODAY_YMD"; fi
660
+ if [ "$d" = "$_ref" ]; then printf '%s\n' "$d"
661
+ elif [ "$d" \> "$_ref" ]; then printf '%s\n' "$d"
662
+ fi
663
+ done)
664
+ _LOST=0
665
+ if [ -n "$_FUTURE_DATES" ]; then
666
+ _TODAY_LOG="$FH/tracks/_meta/fh_completed_${_TODAY_YMD}.md"
667
+ while IFS= read -r d; do
668
+ [ -z "$d" ] && continue
669
+ if grep -qF "$d" "$CARD" 2>/dev/null; then continue; fi
670
+ if [ -f "$_TODAY_LOG" ] && grep -qF "$d" "$_TODAY_LOG" 2>/dev/null; then continue; fi
671
+ _CTX=$(printf '%s\n' "$_PRIOR_CARD" | grep -F "$d" | head -1 | cut -c1-90)
672
+ echo "❌ β‘€-C carry-over μœ μ‹€: 이전 μΉ΄λ“œμ˜ 미래 κΈ°ν•œ '$d' κ°€ 였늘 μΉ΄λ“œμ—λ„ fh_completed 에도 μ—†λ‹€"
673
+ echo " 이전 μΉ΄λ“œ 원문: $_CTX"
674
+ _LOST=$((_LOST+1))
675
+ done <<CARRY_EOF
676
+ $_FUTURE_DATES
677
+ CARRY_EOF
678
+ fi
679
+ if [ "$_LOST" -gt 0 ]; then
680
+ echo " β‡’ β‘€ λŠ” delta update λ‹€. μ™„λ£Œλ©΄ fh_completed 에 적고, 이월이면 μΉ΄λ“œμ— 남겨라."
681
+ echo " μ •λ‹Ήν•˜κ²Œ μ·¨μ†Œλœ ν•­λͺ©μ΄λ©΄: FH_CARRYOVER_OK=1 FH_SESSION_CLOSE=1 git push"
682
+ FAIL=1
683
+ else
684
+ echo "βœ… β‘€-C 이전 μΉ΄λ“œμ˜ 미래 κΈ°ν•œμ΄ μ „λΆ€ μΉ΄λ“œ/μ™„λ£Œλ‘œκ·Έμ— μ‚΄μ•„ μžˆλ‹€ (prior=${_PRIOR_SHA%%??????????????????????????????????})"
685
+ fi
686
+ fi
687
+ fi
688
+ fi
689
+
569
690
  echo "── close check: $([ "$FAIL" -eq 0 ] && echo CONSISTENT || echo VIOLATIONS) ──"
570
691
  exit "$FAIL"
@@ -16,6 +16,33 @@
16
16
 
17
17
  set -uo pipefail
18
18
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
19
+ # πŸŸ₯ ENVIRONMENT ISOLATION (2026-08-27). `CLAUDE.local.md` INSTRUCTS this operator to export
20
+ # FH_COMPANION_STORE, so the suite inherited a REAL companion store and β‘€-C compared each FIXTURE
21
+ # card against the operator's actual prior card β€” reporting a carry-over loss that belongs to
22
+ # neither. Measured A/B on this file: exported β†’ rc 1 with 6 exit-code lanes red Β· unset β†’ rc 0.
23
+ # The verdict CONTENT was right every time (every `_line` assertion passed); only the exit code
24
+ # moved, which is what made it read like an over-blocking script rather than an ambient leak.
25
+ # πŸŸ₯ THIS IS THE SECOND FILE WITH THIS LEAK. The sibling test_session_close_lanes.sh was fixed
26
+ # earlier the same day and this one was not β€” a half-fix propagation boundary created by the same
27
+ # author who had just named that class. Fixed together now; the sweep that found it is
28
+ # grep -l session_close_check scripts/test_*.sh β†’ check each for an FH_COMPANION_STORE guard.
29
+ # Lanes that genuinely exercise β‘€-C set their own fixture store ON the invocation and still win.
30
+ # πŸŸ₯ CLASS, NOT INSTANCE. The first draft of this guard unset FH_COMPANION_STORE alone β€” the one
31
+ # variable that had actually bitten. That is the same shape as the half-fix that put this guard in
32
+ # only ONE of two sibling lane files hours earlier. Every operator-settable override the subject
33
+ # reads is the same window, so all of them are closed here rather than one at a time:
34
+ # FH_COMPANION_STORE β‘€-C reads a REAL prior card and reports a carry-over loss on a fixture
35
+ # FH_SESSION_CLOSE flips advisory into blocking β€” every `expect exit 0` lane would go red
36
+ # FH_CARRYOVER_OK SKIPs β‘€-C β€” a lane asserting β‘€-C FIRES would go green for the wrong reason
37
+ # (note the direction: this one fails OPEN, which is the worse half)
38
+ # FH_PEER_SCAN_FORCE forces the β‘ -c peer scan on regardless of session shape
39
+ # FH_PEER_SOCK_DIR / FH_REPO_ID repoint peer discovery at the ambient machine
40
+ # CLAUDE_CODE_AGENT / CLAUDE_CODE_CHILD_SESSION are deliberately NOT in this list: the subject uses
41
+ # them to detect session shape and the lanes that care unset them per-case on purpose (see the
42
+ # subject's own "NEGATIVE ARM UNVERIFIED" note). Blanket-clearing them here would silently change
43
+ # which branch those lanes exercise.
44
+ unset FH_COMPANION_STORE FH_SESSION_CLOSE FH_CARRYOVER_OK FH_PEER_SCAN_FORCE FH_PEER_SOCK_DIR FH_REPO_ID
45
+ export FH_COMPANION_STORE=""
19
46
  CHECK="$SCRIPT_DIR/session_close_check.sh"
20
47
  FAILED=0
21
48
 
@@ -705,6 +705,135 @@ else
705
705
  fi
706
706
  fi
707
707
 
708
+
709
+ # ── S1b known pair β€” `|| true` INSIDE a command substitution ────────────────────────
710
+ # Added 2026-08-26 after a full hand-census of the 132 `|| true)` sites in this repo
711
+ # (tracks/_meta/s1_true_paren_census_2026-08-26.md). 11 sat on a verdict path and S1 saw ZERO of
712
+ # them: its regex closes on `(#|;|$)` after the permissive value, and in this shape the next
713
+ # character is `)`. Both directions are pinned, and so are the two deliberate NON-detections that
714
+ # keep the probe from becoming the 122-hit noise machine the census warned about.
715
+ s1b_hits() { bash "$SCAN" "$@" 2>&1 | grep -cE '\[S1b:'; }
716
+
717
+ # POSITIVE β€” the four census-A shapes, verbatim in structure:
718
+ # origin git read Β· multi-line continuation Β· process substitution feeding a detector loop Β·
719
+ # here-string feeding the npm-publish leak loop.
720
+ cat > "$TMP/s1b_positive.sh" <<'EOF'
721
+ #!/usr/bin/env bash
722
+ STAGED=$(git -c core.quotePath=false diff --cached --name-only -z 2>/dev/null | tr '\0' '\n' || true)
723
+ HEAVY=$(echo "$STAGED" | grep -E 'SKILL\.md' || true)
724
+ SKILL_CHANGE=$(git diff --cached --name-status --diff-filter=ADR 2>/dev/null \
725
+ | grep -E 'skills/[^/]+/SKILL\.md' || true)
726
+ if [ -n "$SKILL_CHANGE" ]; then echo "count check"; fi
727
+ while IFS= read -r p; do _bad=1; done < <(git diff --cached --name-only -z 2>/dev/null || true)
728
+ while IFS= read -r h; do echo "$h"; done <<< "$(grep -aoiE "$re" "$path" 2>/dev/null | sort -u || true)"
729
+ EOF
730
+
731
+ # NEGATIVE β€” the same logic written so that "the command failed" and "the command matched nothing"
732
+ # are different values. Must stay silent or the probe is noise.
733
+ cat > "$TMP/s1b_negative.sh" <<'EOF'
734
+ #!/usr/bin/env bash
735
+ STAGED=$(git -c core.quotePath=false diff --cached --name-only -z 2>&1 | tr '\0' '\n'); _rc=$?
736
+ [ "$_rc" -ne 0 ] && { echo "git diff failed"; exit 1; }
737
+ HEAVY=$(echo "$STAGED" | grep -E 'SKILL\.md' || true)
738
+ _paths=$(git diff --cached --name-only -z 2>/dev/null || true)
739
+ if [ -z "$_paths" ]; then echo "ERROR: no path stream"; exit 1; fi
740
+ while IFS= read -r p; do _bad=1; done <<< "$_paths"
741
+ EOF
742
+
743
+ # NON-DETECTIONS, each pinned for a distinct reason:
744
+ # (a) a DERIVED filter over a value already in a shell variable β€” its only failure mode is
745
+ # grep-no-match, which is what `|| true` is for. The census counted the risk once, at the
746
+ # origin; flagging derivations turns 11 findings into 122 and buries the origin.
747
+ # (b) stderr NOT discarded β€” a real failure is still visible, so the conjunction is incomplete.
748
+ # (c) a COUNTER pipeline β€” `grep -c` always emits and exits 1 on no-match; that class is S5's.
749
+ # (d) `git rev-parse`/`config` β€” identity/config reads, not index/worktree state.
750
+ cat > "$TMP/s1b_nondetect.sh" <<'EOF'
751
+ #!/usr/bin/env bash
752
+ LIGHT=$(echo "$STAGED" | grep -E '^knowledge/' 2>/dev/null || true)
753
+ BODY=$(printf '%s\n' "$body" | grep -E '^\+' 2>/dev/null || true)
754
+ VISIBLE=$(git diff --cached --name-only || true)
755
+ N=$(git -C "$FH" ls-files -v 2>/dev/null | grep -c '^[a-z]' || true)
756
+ ROOT=$(git rev-parse --show-toplevel 2>/dev/null || true)
757
+ EOF
758
+
759
+ n=$(s1b_hits "$TMP/s1b_positive.sh")
760
+ [ "$n" -eq 4 ] && ok "S1b-KP 4/4 census-A shapes detected (origin Β· continuation Β· <(…) Β· <<<)" \
761
+ || bad "S1b-KP expected 4 S1b hits, got $n"
762
+
763
+ n=$(s1b_hits "$TMP/s1b_negative.sh")
764
+ [ "$n" -eq 0 ] && ok "S1b-KN fail-closed spelling stays silent (the probe discriminates)" \
765
+ || bad "S1b-KN expected 0 S1b hits, got $n"
766
+
767
+ n=$(s1b_hits "$TMP/s1b_nondetect.sh")
768
+ [ "$n" -eq 0 ] && ok "S1b-ND derived filters / visible stderr / counters / rev-parse stay silent (5/5)" \
769
+ || bad "S1b-ND expected 0 S1b hits, got $n (the SCOPE narrowing regressed)"
770
+
771
+ # The 2>/dev/null conjunct is LOAD-BEARING, not decoration: removing it from the fixture must flip
772
+ # the verdict. Without this, "the probe fires" could be true for the wrong reason.
773
+ printf '#!/usr/bin/env bash\nS=$(git diff --cached --name-only 2>/dev/null || true)\n' > "$TMP/s1b_conj.sh"
774
+ a=$(s1b_hits "$TMP/s1b_conj.sh")
775
+ printf '#!/usr/bin/env bash\nS=$(git diff --cached --name-only || true)\n' > "$TMP/s1b_conj.sh"
776
+ b=$(s1b_hits "$TMP/s1b_conj.sh")
777
+ if [ "$a" -eq 1 ] && [ "$b" -eq 0 ]; then
778
+ ok "S1b-CONJ the 2>/dev/null half is load-bearing (1 with, 0 without)"
779
+ else
780
+ bad "S1b-CONJ expected 1/0 across the mutant, got $a/$b β€” the conjunct proves nothing"
781
+ fi
782
+
783
+ # The fail-closed suppression must SUPPRESS, and must not suppress the `-n` skip direction.
784
+ printf '#!/usr/bin/env bash\nV=$(git diff --cached --name-only 2>/dev/null || true)\nif [ -z "$V" ]; then echo ERROR; exit 1; fi\n' > "$TMP/s1b_supp.sh"
785
+ a=$(s1b_hits "$TMP/s1b_supp.sh")
786
+ printf '#!/usr/bin/env bash\nV=$(git diff --cached --name-only 2>/dev/null || true)\nif [ -n "$V" ]; then run_the_check; fi\n' > "$TMP/s1b_supp.sh"
787
+ b=$(s1b_hits "$TMP/s1b_supp.sh")
788
+ if [ "$a" -eq 0 ] && [ "$b" -eq 1 ]; then
789
+ ok "S1b-SUPP [-z]β†’exit 1 suppresses; [-n]β†’run-the-check (empty β‡’ silent skip) still fires"
790
+ else
791
+ bad "S1b-SUPP expected 0/1, got $a/$b β€” the suppression lost its direction"
792
+ fi
793
+
708
794
  echo "----"
709
- echo "degrade-scan shell probes: $pass passed, $fail failed"
710
795
  [ "$fail" -eq 0 ] || exit 1
796
+ # ── S1b-SUPP-COMMENT β€” the suppression must not be fooled by a COMMENT (2026-08-26) ──────────
797
+ # Cross-family (codex) finding: the `-z`-branch remedy search was raw proximity, so the word
798
+ # ERROR sitting in a COMMENT (or in an unrelated later branch) within 6 lines suppressed a REAL
799
+ # fail-open. That is a false NEGATIVE β€” strictly worse than the unmeasured distance constant.
800
+ # πŸŸ₯ POS arm is mandatory: without it, "0 firings" cannot be told apart from "S1b is dead".
801
+ _s1bc=$(mktemp -d)
802
+ cat > "$_s1bc/pos.sh" <<'P1'
803
+ #!/usr/bin/env bash
804
+ STAGED=$(git diff --cached --name-only 2>/dev/null | tr '\n' ' ' || true)
805
+ echo "proceeding with $STAGED"
806
+ P1
807
+ cat > "$_s1bc/mut.sh" <<'P2'
808
+ #!/usr/bin/env bash
809
+ STAGED=$(git diff --cached --name-only 2>/dev/null | tr '\n' ' ' || true)
810
+ if [ -z "$STAGED" ]; then
811
+ # ERROR appears only in this comment; nothing is actually blocked
812
+ :
813
+ fi
814
+ echo "proceeding"
815
+ P2
816
+ cat > "$_s1bc/ctl.sh" <<'P3'
817
+ #!/usr/bin/env bash
818
+ STAGED=$(git diff --cached --name-only 2>/dev/null | tr '\n' ' ' || true)
819
+ if [ -z "$STAGED" ]; then
820
+ echo "ERROR: cannot read index" >&2
821
+ exit 1
822
+ fi
823
+ echo "proceeding"
824
+ P3
825
+ _s1bc_n(){ bash "$SCAN" "$1" 2>/dev/null | grep -c 'S1b' || true; }
826
+ _p=$(_s1bc_n "$_s1bc/pos.sh"); _m=$(_s1bc_n "$_s1bc/mut.sh"); _c=$(_s1bc_n "$_s1bc/ctl.sh")
827
+ if [ "$_p" -ge 1 ]; then
828
+ ok "S1b-SUPP-COMMENT POS: probe is ALIVE on a bare origin ($_p hit) β€” 0-results below are readable"
829
+ if [ "$_m" -ge 1 ]; then ok "S1b-SUPP-COMMENT MUT: a comment does not suppress a real fail-open"
830
+ else bad "S1b-SUPP-COMMENT MUT: comment-only ERROR suppressed a real fail-open (false negative)"; fi
831
+ if [ "$_c" -eq 0 ]; then ok "S1b-SUPP-COMMENT CTL: a genuine fail-closed branch is still suppressed"
832
+ else bad "S1b-SUPP-COMMENT CTL: over-blocked a legitimate fail-closed remedy ($_c)"; fi
833
+ else
834
+ bad "S1b-SUPP-COMMENT: POS arm dead (probe fired 0 on a bare origin) β€” MUT/CTL UNINTERPRETABLE"
835
+ fi
836
+ rm -rf "$_s1bc"
837
+
838
+ echo "degrade-scan shell probes: $pass passed, $fail failed"
839
+
@@ -39,10 +39,37 @@ if [ -z "$CATLOGS_DEF" ]; then
39
39
  echo "FAIL subject 에 _cat_logs κ°€ μ—†λ‹€ β€” μ „ν™˜ 섀계(λ ˆκ±°μ‹œ βˆͺ 디렉터리)κ°€ μ‚¬λΌμ‘Œκ±°λ‚˜ 이름이 λ°”λ€Œμ—ˆλ‹€."
40
40
  exit 1
41
41
  fi
42
+ # πŸŸ₯ 2026-08-26 β€” μ£Όμ–΄κ°€ read-error λ₯Ό UNMEASURED 둜 κ°€λ₯΄κΈ° μ‹œμž‘ν–ˆκ³  κ·Έ 둜직이 `_cnt` 에 μ‚°λ‹€.
43
+ # 이걸 μ•ˆ λ“€μ—¬μ˜€λ©΄ λŒ€μž…μ€„ 평가가 Β«command not found β†’ rc 127 β†’ UNMEASUREDΒ» 둜 **ν‹€λ¦° 이유둜**
44
+ # 닡을 λ‚Έλ‹€. 이 파일이 이미 _cat_logs 에 λŒ€ν•΄ κ²½κ³ ν•œ μž₯식-액컀 ν•¨μ •μ˜ 같은 얼꡴이닀.
45
+ CNT_DEF=$(awk '/^_cnt\(\) \{/,/^\}/' "$CHECK")
46
+ LOGGREP_DEF=$(awk '/^_log_grep\(\) \{/,/^\}/' "$CHECK")
47
+ if [ -z "$CNT_DEF" ]; then
48
+ echo "FAIL subject 에 _cnt κ°€ μ—†λ‹€ β€” read-error↔zero 뢄리(UNMEASURED)κ°€ μ‚¬λΌμ‘Œκ±°λ‚˜ 이름이 λ°”λ€Œμ—ˆλ‹€."
49
+ exit 1
50
+ fi
51
+ if [ -z "$LOGGREP_DEF" ]; then
52
+ echo "FAIL subject 에 _log_grep κ°€ μ—†λ‹€ β€” LOGGED 의 리더가 μ‚¬λΌμ‘Œκ±°λ‚˜ 이름이 λ°”λ€Œμ—ˆλ‹€."
53
+ exit 1
54
+ fi
42
55
  echo "── matcher located in the subject"
43
56
  echo "── _cat_logs lifted from the subject ($(printf '%s' "$CATLOGS_DEF" | grep -c '') lines)"
44
57
 
45
58
  T=$(mktemp -d); trap 'rm -rf "$T"' EXIT
59
+ # πŸŸ₯ μ •μ˜λ₯Ό `bash -c "..."` μ•ˆμ— μΈλΌμΈν•˜λ©΄ **λ°”κΉ₯ 셸이 λ¨Όμ € ν™•μž₯**ν•œλ‹€ β€” `_cnt` 본문의 `"$@"` κ°€
60
+ # 빈 λ¬Έμžμ—΄λ‘œ μΉ˜ν™˜λΌ 리더가 쑰용히 μ£½κ³ , λ ˆμΈμ€ Β«ν‹€λ¦° 이유둜» νŒμ •μ„ λ‚Έλ‹€(2026-08-26 μ‹€μΈ‘).
61
+ # 파일둜 λ–¨κΆˆ source ν•˜λ©΄ κ·Έ 창이 μ•„μ˜ˆ μ—†λ‹€.
62
+ SUBJ_DEFS="$T/subject_defs.sh"
63
+ printf '%s\n%s\n%s\n' "$CATLOGS_DEF" "$CNT_DEF" "$LOGGREP_DEF" > "$SUBJ_DEFS"
64
+ bash -n "$SUBJ_DEFS" || { echo "FAIL subject μ •μ˜ 3쒅을 λ“€μ–΄μ™”μœΌλ‚˜ ꡬ문이 κΉ¨μ§„λ‹€"; exit 1; }
65
+ # πŸŸ₯ 크기 κ°€λ“œ β€” awk λ²”μœ„κ°€ μ•ˆ λ‹«νžˆλ©΄(ν•œ 쀄 ν•¨μˆ˜λΌ `}` κ°€ column 0 에 μ—†μœΌλ©΄) 파일 λ‚˜λ¨Έμ§€λ₯Ό
66
+ # ν†΅μ§Έλ‘œ 끌고 였고, κ·Έλž˜λ„ `bash -n` 은 ν†΅κ³Όν•œλ‹€. 그러면 μ •μ˜κ°€ μ•„λ‹ˆλΌ 슀크립트λ₯Ό source ν•˜κ²Œ
67
+ # λ˜μ–΄ Β«unbound variableΒ» 같은 μ—‰λš±ν•œ 이유둜 νŒμ •μ΄ λ‚œλ‹€(2026-08-26 μ‹€μΈ‘).
68
+ _SD_LINES=$(grep -c '' "$SUBJ_DEFS")
69
+ if [ "$_SD_LINES" -gt 40 ]; then
70
+ echo "FAIL λ“€μ–΄μ˜¨ μ •μ˜κ°€ ${_SD_LINES}쀄 β€” awk λ²”μœ„κ°€ μ•ˆ λ‹«ν˜”λ‹€(ν•œ 쀄 ν•¨μˆ˜?). μ •μ˜λ§Œ 와야 ν•œλ‹€."
71
+ exit 1
72
+ fi
46
73
  D=2026-08-02
47
74
 
48
75
  echo "── date-spelling lanes (the shipped miscount) ──"
@@ -132,7 +159,7 @@ _eval_subject_assign() { # $1 = variable name; echoes what the SUBJECT computes
132
159
  _int() { case \"\${1:-}\" in (''|*[!0-9]*) echo 0 ;; (*) echo \"\$1\" ;; esac; }
133
160
  # β˜… LOGGED λŠ” μ£Όμ–΄μ˜ _cat_logs 에 μ˜μ‘΄ν•œλ‹€. 이걸 μ•ˆ λ“€μ—¬μ˜€λ©΄ Β«ν•¨μˆ˜ μ—†μŒ β†’ 빈 μž…λ ₯ β†’ 0Β»
134
161
  # 으둜 **ν‹€λ¦° 이유둜 톡과**ν•œλ‹€ β€” 이 파일이 κ²½κ³ ν•˜λŠ” μž₯식 액컀 κ·Έ μžμ²΄λ‹€.
135
- $CATLOGS_DEF
162
+ . '$SUBJ_DEFS'
136
163
  TODAY=NOSUCHDATE; TALLY='$CHECK'; LOG='$CHECK'; LOGDIR='$CHECK.nodir'
137
164
  $line
138
165
  printf %s \"\$$var\"" 2>/dev/null
@@ -150,7 +177,7 @@ LOGGED_LINE=$(grep -E "^LOGGED=" "$CHECK" | head -1)
150
177
  _count_in() { # $1=LOG 경둜(μ—†μœΌλ©΄ 빈문자) $2=LOGDIR 경둜(μ—†μœΌλ©΄ 빈문자)
151
178
  bash -c "set -uo pipefail
152
179
  _int() { case \"\${1:-}\" in (''|*[!0-9]*) echo 0 ;; (*) echo \"\$1\" ;; esac; }
153
- $CATLOGS_DEF
180
+ . '$SUBJ_DEFS'
154
181
  TODAY='$D'; LOG='$1'; LOGDIR='$2'
155
182
  $LOGGED_LINE
156
183
  printf %s \"\$LOGGED\"" 2>/dev/null
@@ -167,6 +194,31 @@ printf -- "- date: %s\n" "$D" > "$LT/dir/b.yaml" # 1건
167
194
  _naive=$(grep -cE "^- date: *'?$D'?" "$LT/dir"/*.yaml 2>/dev/null | tr -d ' \n')
168
195
  [ "$_naive" != 3 ] ; chk $? "컨트둀: naive grep -c λ‹€μ€‘νŒŒμΌμ€ 3을 λͺ» λ‚Έλ‹€ (μ‹€μ œ='$_naive' β€” 경둜:개수 ν˜•νƒœ)"
169
196
 
197
+ echo ""
198
+ echo "── read-error β‰  zero 레인 (2026-08-26, cross-family/codex) ──"
199
+ # μ£Όμ–΄κ°€ Β«0건» κ³Ό Β«λͺ» μ½μ—ˆλ‹€Β» λ₯Ό κ°€λ₯΄λŠ”κ°€. κ°€λ₯΄κΈ° μ „μ—λŠ” 읽기 μ‹€νŒ¨κ°€ 0 으둜 μ ‘ν˜€
200
+ # "βœ… β‘£-e no sub-agent dispatches tallied today" λΌλŠ” **μ•ˆ 잰 초둝**이 λ‚˜κ°”λ‹€.
201
+ DISP_LINE=$(grep -E "^DISPATCHED=" "$CHECK" | head -1)
202
+ _disp_with() { # $1 = TALLY 둜 μ“Έ 경둜
203
+ bash -c "set -uo pipefail
204
+ _int() { case \"\${1:-}\" in (''|*[!0-9]*) echo 0 ;; (*) echo \"\$1\" ;; esac; }
205
+ . '$SUBJ_DEFS'
206
+ TODAY='$D'; TALLY='$1'
207
+ $DISP_LINE
208
+ printf %s \"\$DISPATCHED\"" 2>/dev/null
209
+ }
210
+ RE="$T/readerr"; mkdir -p "$RE/as_dir"
211
+ printf '%s\n' "$D" > "$RE/real_hit" # 였늘 1건
212
+ : > "$RE/real_zero" # μ§„μ§œ 0건
213
+ _p=$(_disp_with "$RE/real_hit")
214
+ [ "$_p" = "1" ] ; chk $? "POS 계기 생쑴: 정상 tally 1건 β†’ '$_p' (1 이어야 μ•„λž˜ νŒμ •μ΄ μ½νžŒλ‹€)"
215
+ _z=$(_disp_with "$RE/real_zero")
216
+ [ "$_z" = "0" ] ; chk $? "μ§„μ§œ 0건 β†’ '$_z' (UNMEASURED μ•„λ‹˜ β€” λΆ€μž¬κ°€ μ•„λ‹ˆλΌ μ‹€μΈ‘λœ 0)"
217
+ _u=$(_disp_with "$RE/as_dir")
218
+ [ "$_u" = "UNMEASURED" ] ; chk $? "읽기 μ‹€νŒ¨(디렉터리) β†’ '$_u' (0 으둜 μ ‘νžˆλ©΄ μ•ˆ 잰 초둝이 λ‚˜κ°„λ‹€)"
219
+ _n=$(_disp_with "$RE/nosuchfile")
220
+ [ "$_n" = "0" ] ; chk $? "파일 λΆ€μž¬ β†’ '$_n' β€” μ„Έ 번째 μƒνƒœλ‹€. μ•ˆ 쓰인 tally λŠ” Β«0 λ””μŠ€νŒ¨μΉ˜Β»μ΄μ§€ Β«λͺ» 읽음»이 μ•„λ‹ˆλ‹€. UNMEASURED 둜 두면 μƒˆ install 의 κΉ¨λ—ν•œ λ§ˆκ°μ„ μ „λΆ€ false-block ν•˜κ³ , 과차단 close κ²Œμ΄νŠΈλŠ” 같은 ν›…μ˜ Destructive-Op κ²Œμ΄νŠΈκΉŒμ§€ 무μž₯ν•΄μ œμ‹œν‚€λŠ” --no-verify λ°˜μ‚¬λ₯Ό ν›ˆλ ¨μ‹œν‚¨λ‹€"
221
+
170
222
  echo ""
171
223
  if [ "$FAILED" -ne 0 ]; then echo "DISPATCH-LOG LANES: FAIL"; exit 1; fi
172
224
  echo "DISPATCH-LOG LANES: PASS ($PASS/$PASS)"
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env bash
2
+ # Known-pair lane for fh-goal's change detection.
3
+ #
4
+ # πŸŸ₯ WHAT THIS EXISTS TO STOP (2026-08-26, cross-family/codex finding):
5
+ # `git` present + a real repo does NOT mean `diff`/`status` SUCCEEDS. Before this lane,
6
+ # a FAILING `git status` produced an empty TARGET_FILES, which the skip-branch could not
7
+ # tell apart from "nothing changed" β†’ `exit 0` β†’ **fh-gate never ran, caller read it as a
8
+ # clean run**. fh-goal.sh already named that exact class in a comment and had closed it for
9
+ # the "no git at all" branch only.
10
+ #
11
+ # The pair:
12
+ # ARM A (known-positive) git status FAILS β†’ MUST exit 10 ← red before the fix
13
+ # ARM B (known-negative) git status OK, no output β†’ MUST exit 0 (genuinely nothing changed)
14
+ # ARM C (control) git status OK, one file β†’ MUST reach fh-gate (proves A/B are not
15
+ # just "everything exits early")
16
+ # Without ARM C, A and B both pass on a script that never gets to the gate at all.
17
+ set -uo pipefail
18
+ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
19
+ TARGET="${FH_GOAL_UNDER_TEST:-$ROOT/scripts/fh-goal.sh}"
20
+ PASS=0; FAIL=0
21
+ ok(){ printf ' βœ… %s\n' "$1"; PASS=$((PASS+1)); }
22
+ no(){ printf ' ❌ %s\n' "$1"; FAIL=$((FAIL+1)); }
23
+
24
+ FIX=$(mktemp -d); trap 'rm -rf "$FIX"' EXIT
25
+ mkdir -p "$FIX/bin" "$FIX/work"
26
+
27
+ # --- git shim: real enough to pass the GIT_OK probe, scriptable for diff/status -------------
28
+ cat > "$FIX/bin/git" <<'GIT'
29
+ #!/usr/bin/env bash
30
+ # args may be prefixed with -C <dir>
31
+ while [[ "${1:-}" == "-C" ]]; do shift 2; done
32
+ case "${1:-}" in
33
+ rev-parse)
34
+ case "${2:-}" in
35
+ --git-dir) echo ".git"; exit 0 ;;
36
+ HEAD) echo "0000000000000000000000000000000000000000"; exit 0 ;;
37
+ esac
38
+ exit 0 ;;
39
+ diff) exit "${FAKE_GIT_DIFF_RC:-0}" ;;
40
+ status)
41
+ if [[ "${FAKE_GIT_STATUS_RC:-0}" -ne 0 ]]; then exit "${FAKE_GIT_STATUS_RC}"; fi
42
+ [[ -n "${FAKE_GIT_STATUS_OUT:-}" ]] && printf '%s\n' "$FAKE_GIT_STATUS_OUT"
43
+ exit 0 ;;
44
+ esac
45
+ exit 0
46
+ GIT
47
+ chmod +x "$FIX/bin/git"
48
+
49
+ # --- backend stub: fh-goal requires the CLI on PATH and pipes a prompt into it --------------
50
+ printf '#!/usr/bin/env bash\ncat >/dev/null\necho "stub backend output"\nexit 0\n' > "$FIX/bin/codex"
51
+ chmod +x "$FIX/bin/codex"
52
+
53
+ run_arm() { # $1=label $2..=env assignments ; prints rc
54
+ env PATH="$FIX/bin:$PATH" FH_BACKEND=codex FH_TIMEOUT=20 "${@:2}" \
55
+ bash "$TARGET" --prompt "noop" --root "$FIX/work" >"$FIX/out" 2>"$FIX/err"
56
+ echo $?
57
+ }
58
+
59
+ echo "fh-goal change-detection known-pair (target: $TARGET)"
60
+
61
+ # ARM A β€” the defect
62
+ RC=$(run_arm A FAKE_GIT_STATUS_RC=128 FAKE_GIT_DIFF_RC=128)
63
+ if [[ "$RC" == "10" ]] && grep -q "cannot detect changed files" "$FIX/err"; then
64
+ ok "ARM A known-positive: git failure β†’ exit 10, fail-closed"
65
+ else
66
+ no "ARM A known-positive: expected rc=10 + 'cannot detect changed files', got rc=$RC"
67
+ sed -n 1,6p "$FIX/err" | sed 's/^/ /'
68
+ fi
69
+
70
+ # ARM B β€” genuinely clean
71
+ RC=$(run_arm B FAKE_GIT_STATUS_RC=0 FAKE_GIT_STATUS_OUT=)
72
+ if [[ "$RC" == "0" ]] && grep -q "no changed files detected" "$FIX/err"; then
73
+ ok "ARM B known-negative: clean tree β†’ exit 0 (skip is legitimate here)"
74
+ else
75
+ no "ARM B known-negative: expected rc=0 + 'no changed files detected', got rc=$RC"
76
+ sed -n 1,6p "$FIX/err" | sed 's/^/ /'
77
+ fi
78
+
79
+ # ARM C β€” control: proves the script can actually REACH the gate
80
+ RC=$(run_arm C FAKE_GIT_STATUS_RC=0 FAKE_GIT_STATUS_OUT=" M probe_file.txt")
81
+ if grep -q "running fh-gate on" "$FIX/err"; then
82
+ ok "ARM C control: changed file β†’ reaches fh-gate (instrument is alive)"
83
+ else
84
+ no "ARM C control: never reached fh-gate β€” ARM A/B results are UNINTERPRETABLE (rc=$RC)"
85
+ sed -n 1,6p "$FIX/err" | sed 's/^/ /'
86
+ fi
87
+
88
+ echo "fh-goal change-detection: $PASS passed, $FAIL failed"
89
+ [[ "$FAIL" -eq 0 ]] || exit 1
@@ -26,6 +26,33 @@
26
26
  set -uo pipefail
27
27
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
28
28
  ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
29
+ # πŸŸ₯ ENVIRONMENT ISOLATION (2026-08-27). `CLAUDE.local.md` INSTRUCTS this operator to export
30
+ # FH_COMPANION_STORE, so the suite inherited a REAL companion store and β‘€-C compared each FIXTURE
31
+ # card against the operator's actual prior card β€” reporting a carry-over loss that belongs to
32
+ # neither. Measured A/B on this file: exported β†’ rc 1 with 6 exit-code lanes red Β· unset β†’ rc 0.
33
+ # The verdict CONTENT was right every time (every `_line` assertion passed); only the exit code
34
+ # moved, which is what made it read like an over-blocking script rather than an ambient leak.
35
+ # πŸŸ₯ THIS IS THE SECOND FILE WITH THIS LEAK. The sibling test_session_close_lanes.sh was fixed
36
+ # earlier the same day and this one was not β€” a half-fix propagation boundary created by the same
37
+ # author who had just named that class. Fixed together now; the sweep that found it is
38
+ # grep -l session_close_check scripts/test_*.sh β†’ check each for an FH_COMPANION_STORE guard.
39
+ # Lanes that genuinely exercise β‘€-C set their own fixture store ON the invocation and still win.
40
+ # πŸŸ₯ CLASS, NOT INSTANCE. The first draft of this guard unset FH_COMPANION_STORE alone β€” the one
41
+ # variable that had actually bitten. That is the same shape as the half-fix that put this guard in
42
+ # only ONE of two sibling lane files hours earlier. Every operator-settable override the subject
43
+ # reads is the same window, so all of them are closed here rather than one at a time:
44
+ # FH_COMPANION_STORE β‘€-C reads a REAL prior card and reports a carry-over loss on a fixture
45
+ # FH_SESSION_CLOSE flips advisory into blocking β€” every `expect exit 0` lane would go red
46
+ # FH_CARRYOVER_OK SKIPs β‘€-C β€” a lane asserting β‘€-C FIRES would go green for the wrong reason
47
+ # (note the direction: this one fails OPEN, which is the worse half)
48
+ # FH_PEER_SCAN_FORCE forces the β‘ -c peer scan on regardless of session shape
49
+ # FH_PEER_SOCK_DIR / FH_REPO_ID repoint peer discovery at the ambient machine
50
+ # CLAUDE_CODE_AGENT / CLAUDE_CODE_CHILD_SESSION are deliberately NOT in this list: the subject uses
51
+ # them to detect session shape and the lanes that care unset them per-case on purpose (see the
52
+ # subject's own "NEGATIVE ARM UNVERIFIED" note). Blanket-clearing them here would silently change
53
+ # which branch those lanes exercise.
54
+ unset FH_COMPANION_STORE FH_SESSION_CLOSE FH_CARRYOVER_OK FH_PEER_SCAN_FORCE FH_PEER_SOCK_DIR FH_REPO_ID
55
+ export FH_COMPANION_STORE=""
29
56
  CHECK="$SCRIPT_DIR/session_close_check.sh"
30
57
  HOOK="$ROOT/templates/.git-hooks/pre-push"
31
58
  TODAY=$(date +%Y-%m-%d)