@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.
@@ -26,6 +26,17 @@
26
26
 
27
27
  set -uo pipefail
28
28
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
29
+ # πŸŸ₯ ENVIRONMENT ISOLATION (2026-08-27) β€” the suite inherited FH_COMPANION_STORE from the
30
+ # operator's shell. `CLAUDE.local.md` INSTRUCTS the operator to export it, so this suite went red
31
+ # on exactly the setup it is written for, and stayed green in CI where the variable is unset β€”
32
+ # environment dependence in the inverse of the usual direction, which is why it survived.
33
+ # The leak: β‘€-C reads the prior card from that store, so an unguarded lane compared its FIXTURE
34
+ # card against the operator's REAL companion history and reported a carry-over loss that belongs
35
+ # to neither. Measured A/B: exported β†’ rc 1, 2 failures Β· unset β†’ rc 0, 0 failures.
36
+ # Default it to a path that cannot exist; the three lanes that genuinely exercise β‘€-C set their
37
+ # own fixture store inline and still win, because they set it on the invocation.
38
+ unset FH_COMPANION_STORE
39
+ export FH_COMPANION_STORE=""
29
40
  CHECK="$SCRIPT_DIR/session_close_check.sh"
30
41
  TODAY=$(date +%Y-%m-%d)
31
42
  FAILED=0
@@ -256,9 +267,124 @@ else
256
267
  fi
257
268
  rm -rf "$T"
258
269
 
270
+
271
+ # ─────────────────────────────────────────────────────────────────────────────
272
+ # β‘€-C CARRY-OVER lanes β€” μΉ΄λ“œ μž¬μž‘μ„±μ΄ «아직 μ•ˆ 온 κΈ°ν•œΒ» 을 λ‚ λ ΈλŠ”κ°€.
273
+ #
274
+ # WHY (2026-08-24, μ‹€μΈ‘ 손싀 1건 β€” 이 레인이 κ·Έ κ²°ν•¨μ˜ νšŒκ·€ 액컀닀): β‘€ μž¬μž‘μ„±μ΄ delta update κ°€
275
+ # μ•„λ‹ˆλΌ μƒˆλ‘œ μ“°κΈ°κ°€ λ˜μ–΄ λ―Έμ™„Β·μ‹œκ°λ°•νžŒ ν•­λͺ©μ΄ ν†΅μ§Έλ‘œ μ‚¬λΌμ‘Œλ‹€(κ·Έλ‚  저녁 κ²Œμ‹œ, λ‹€μŒλ‚  GeekNews,
276
+ # 14일 referrer μΈ‘μ •, 08-26 λ―ΈνŒ…). μ„Έμ…˜μ€ "BEFORE 172 β†’ AFTER 101" μ΄λΌλŠ” diff λ₯Ό 내고도
277
+ # Β«μ€„μ—ˆλ‹€Β» 만 λ§ν•˜κ³  «무엇이 λΉ μ‘Œλ‚˜Β» λŠ” 보지 μ•Šμ•˜λ‹€. μš΄μ˜μžκ°€ λ¬Όμ–΄μ„œ 발견 β€” 자λ ₯ μ•„λ‹ˆλ‹€.
278
+ # πŸŸ₯ tier λ¬Έμ œκ°€ μ•„λ‹ˆλΌ WIRING λ¬Έμ œμ˜€λ‹€: μΉ΄λ“œ κ·œμœ¨μ€ γ€Œμ™„λ£Œ ν•­λͺ©μ΄ λ‚¨λŠ” 게 버그」라고 ν•œ λ°©ν–₯만
279
+ # 적고, κ·Έ μ—­λ°©ν–₯은 검사가 0μ€„μ΄μ—ˆλ‹€. base op 이 μ‚΄λ¦¬μ–ΈμŠ€μ—λ§Œ μ–Ήν˜€ μžˆμ—ˆμœΌλ―€λ‘œ
280
+ # sonnet_floor_doctrine Β§tier-gated base op = defect.
281
+ #
282
+ # Lanes (각각 κ²Œμ΄νŠΈκ°€ 옳게 νŒμ •ν•΄μ•Ό ν•˜λŠ” 결정이지 슀λͺ¨ν¬κ°€ μ•„λ‹ˆλ‹€):
283
+ # β‘€-C-N 이전 μΉ΄λ“œμ˜ 미래 κΈ°ν•œμ΄ 였늘 μΉ΄λ“œμ— μ—†μŒ β†’ ❌ MUST fire (μœ μ‹€ μ§€λͺ©)
284
+ # β‘€-C-P κ·Έ κΈ°ν•œμ΄ 였늘 μΉ΄λ“œμ— μ‚΄μ•„ 있음 β†’ βœ… must NOT fire (μ˜€νƒ μ—†μŒ)
285
+ # β‘€-C-L μΉ΄λ“œμ—” μ—†μ§€λ§Œ 였늘 fh_completed 에 있음 β†’ βœ… μ™„λ£Œ 처리 경둜둜 톡과
286
+ # (γ€Œμ΄ ν•­λͺ©μ„ μ§€μ›Œλ„ λ˜λ‚˜γ€λ₯Ό νŒμ •ν•˜μ§€ μ•ŠλŠ”λ‹€ β€” 채널 검사지 κ²°λ‘  검사가 μ•„λ‹ˆλ‹€)
287
+ # β‘€-C-S companion store λΆ€μž¬ β†’ ⬜ SKIPPED, **초둝 μ•„λ‹˜**
288
+ # (not-found β‰  0. 미츑정을 PASS 둜 μ ‘μœΌλ©΄ 이 ν”„λ‘œλΈŒ 전체가 μž₯식이 λœλ‹€)
289
+ #
290
+ # πŸŸ₯ ν”½μŠ€μ²˜λŠ” Β«λš«λ¦¬λŠ” ν‘œκΈ°Β» 둜 κ³ λ₯Έλ‹€: 미래 λ‚ μ§œλ₯Ό **MM-DD μΆ•μ•½ν˜•** 으둜 λ‘”λ‹€. YYYY-MM-DD 만
291
+ # μž‘λŠ” 반μͺ½ κ΅¬ν˜„μ€ β‘€-C-N μ—μ„œ 톡과해버린닀 β€” μ‹€μ œ μΉ΄λ“œκ°€ γ€Œ08-26 λ―ΈνŒ…γ€μ²˜λŸΌ μΆ•μ•½ν˜•μ„ μ“΄λ‹€.
292
+ _carry_fixture() { # $1=μ˜€λŠ˜μΉ΄λ“œ λ³Έλ¬Έ $2=fh_completed λ³Έλ¬Έ(빈 λ¬Έμžμ—΄=파일 μ—†μŒ) β†’ "REPO|STORE"
293
+ local card_body="$1" done_body="$2" T S FUT
294
+ T=$(mktemp -d); S=$(mktemp -d)
295
+ ( cd "$T" && git init -q . && git config user.email a@l && git config user.name a \
296
+ && echo x > unrelated.txt && git add -A && git commit -qm fixture ) >/dev/null 2>&1
297
+ mkdir -p "$T/tracks/_meta"
298
+ printf '%s\n' "$card_body" > "$T/tracks/_meta/reference_next_session_starter.md"
299
+ [ -n "$done_body" ] && printf '%s\n' "$done_body" > "$T/tracks/_meta/fh_completed_${TODAY}.md"
300
+ # companion store: μ–΄μ œ λ‚ μ§œλ‘œ μ»€λ°‹λœ «이전 μΉ΄λ“œΒ» 미러 ν•˜λ‚˜
301
+ FUT=$(date -v+2d '+%m-%d' 2>/dev/null || date -d '+2 days' '+%m-%d')
302
+ ( cd "$S" && git init -q . && git config user.email a@l && git config user.name a \
303
+ && mkdir -p tracks-meta \
304
+ && printf 'κΈ°ν•œ %s λ―ΈνŒ… μ•ˆκ±΄ [B]\n' "$FUT" > tracks-meta/reference_next_session_starter.md \
305
+ && git add -A \
306
+ && GIT_AUTHOR_DATE='2020-01-01T00:00:00' GIT_COMMITTER_DATE='2020-01-01T00:00:00' \
307
+ git commit -qm prior ) >/dev/null 2>&1
308
+ printf '%s|%s' "$T" "$S"
309
+ }
310
+ _carry_future() { date -v+2d '+%m-%d' 2>/dev/null || date -d '+2 days' '+%m-%d'; }
311
+
312
+ _carry_lane() { # $1=name $2=pattern $3=expect $4="REPO|STORE" $5=extra-env(μ˜΅μ…˜)
313
+ local name="$1" pat="$2" expect="$3" pair="$4" env5="${5:-}" T S out hit
314
+ T="${pair%%|*}"; S="${pair##*|}"
315
+ if [ ! -d "$T/tracks/_meta" ] || [ ! -d "$S/.git" ]; then
316
+ echo "❌ $name β€” FIXTURE ERROR: ν”½μŠ€μ²˜κ°€ μ•ˆ λ§Œλ“€μ–΄μ‘Œλ‹€"
317
+ PREMISE_FAILED=1; rm -rf "$T" "$S"; return
318
+ fi
319
+ if [ -n "$env5" ]; then
320
+ out=$(env "$env5" FH_COMPANION_STORE="$S" bash "$CHECK" "$T" 2>/dev/null)
321
+ else
322
+ out=$(FH_COMPANION_STORE="$S" bash "$CHECK" "$T" 2>/dev/null)
323
+ fi
324
+ hit=0; printf '%s\n' "$out" | grep -q "$pat" && hit=1
325
+ rm -rf "$T" "$S"
326
+ if [ "$hit" = "$expect" ]; then
327
+ echo "βœ… $name (hit=$hit, expected=$expect)"
328
+ else
329
+ echo "❌ $name β€” hit=$hit, expected=$expect"
330
+ printf '%s\n' "$out" | grep 'β‘€-C' | sed 's/^/ /'
331
+ FAILED=1
332
+ fi
333
+ }
334
+
335
+ _CF=$(_carry_future)
336
+ _carry_lane "β‘€-C-N 미래 κΈ°ν•œ μœ μ‹€ β†’ μ§€λͺ©ν•œλ‹€" "❌ β‘€-C carry-over μœ μ‹€" 1 \
337
+ "$(_carry_fixture '# card' '')"
338
+ _carry_lane "β‘€-C-P κΈ°ν•œμ΄ μΉ΄λ“œμ— μ‚΄μ•„μžˆμŒ β†’ 쑰용" "❌ β‘€-C carry-over μœ μ‹€" 0 \
339
+ "$(_carry_fixture "# card
340
+ 이월: $_CF λ―ΈνŒ… μ•ˆκ±΄ [B]" '')"
341
+ _carry_lane "β‘€-C-L μ™„λ£Œλ‘œκ·Έμ— 있음 β†’ 톡과" "❌ β‘€-C carry-over μœ μ‹€" 0 \
342
+ "$(_carry_fixture '# card' "- βœ… $_CF λ―ΈνŒ… β€” μ·¨μ†Œ ν™•μ •")"
343
+
344
+ # β‘€-C-S: companion store λΆ€μž¬λŠ” SKIPPED μ—¬μ•Ό ν•˜κ³  **βœ… μ—¬μ„œλŠ” μ•ˆ λœλ‹€**.
345
+ _T4=$(mktemp -d)
346
+ ( cd "$_T4" && git init -q . && git config user.email a@l && git config user.name a \
347
+ && echo x > u.txt && git add -A && git commit -qm f ) >/dev/null 2>&1
348
+ mkdir -p "$_T4/tracks/_meta"; printf '# card\n' > "$_T4/tracks/_meta/reference_next_session_starter.md"
349
+ _out4=$(FH_COMPANION_STORE=/tmp/__no_such_store__ bash "$CHECK" "$_T4" 2>/dev/null)
350
+ if printf '%s\n' "$_out4" | grep -q '⬜ β‘€-C SKIPPED (not PASS)'; then
351
+ if printf '%s\n' "$_out4" | grep -q 'βœ… β‘€-C'; then
352
+ echo "❌ β‘€-C-S SKIPPED 인데 βœ… 도 같이 μ°μ—ˆλ‹€ β€” 미츑정을 초둝으둜 μ ‘κ³  μžˆλ‹€"; FAILED=1
353
+ else
354
+ echo "βœ… β‘€-C-S companion store λΆ€μž¬ β†’ SKIPPED(not PASS), 초둝 μ•„λ‹˜"
355
+ fi
356
+ else
357
+ echo "❌ β‘€-C-S store λΆ€μž¬λ₯Ό SKIPPED 둜 ν‘œκΈ°ν•˜μ§€ μ•Šμ•˜λ‹€ β€” not-found λ₯Ό 0 으둜 λ Œλ”ν•œλ‹€"
358
+ printf '%s\n' "$_out4" | grep 'β‘€-C' | sed 's/^/ /'
359
+ FAILED=1
360
+ fi
361
+ rm -rf "$_T4"
362
+
259
363
  # Premise failure is reported FIRST and with its own exit code: it says "this run's verdicts are
260
364
  # meaningless", which is a different instruction to the reader than "the gate is broken". Collapsing
261
365
  # them into one red X is what made the original CI flake unreadable.
366
+ # ── ENV-ISO β€” an inherited FH_COMPANION_STORE must not reach an unguarded $CHECK call ─────────
367
+ # known-pair: a hostile store that WOULD trigger β‘€-C (its prior card carries a future date the
368
+ # fixture card lacks) must produce SKIPPED, not a carry-over FAIL. POS arm first: prove the
369
+ # hostile store really is hostile by feeding it to $CHECK ON PURPOSE.
370
+ _ei=$(mktemp -d)
371
+ mkdir -p "$_ei/store/tracks-meta" "$_ei/work/tracks/_meta"
372
+ ( cd "$_ei/store" && git init -q . && git config user.email l@l && git config user.name l
373
+ printf 'prior card\n- 2099-12-31 κΈ°ν•œ\n' > tracks-meta/reference_next_session_starter.md
374
+ git add -A >/dev/null 2>&1 && GIT_AUTHOR_DATE="2020-01-01T00:00:00" GIT_COMMITTER_DATE="2020-01-01T00:00:00" git commit -qm seed ) >/dev/null 2>&1
375
+ printf 'today card, no future date\n' > "$_ei/work/tracks/_meta/reference_next_session_starter.md"
376
+ ( cd "$_ei/work" && git init -q . ) >/dev/null 2>&1
377
+ _ei_pos=$(FH_COMPANION_STORE="$_ei/store" bash "$CHECK" "$_ei/work" 2>/dev/null | grep -c "β‘€-C carry-over μœ μ‹€")
378
+ _ei_neg=$(FH_COMPANION_STORE="$_ei/store" env FH_COMPANION_STORE="$_ei/store" sh -c 'unset FH_COMPANION_STORE; export FH_COMPANION_STORE=""; bash "$0" "$1" 2>/dev/null' "$CHECK" "$_ei/work" | grep -c "β‘€-C SKIPPED")
379
+ if [ "$_ei_pos" -ge 1 ]; then
380
+ echo "βœ… ENV-ISO POS: the hostile store DOES trigger β‘€-C when handed in ($_ei_pos) β€” the arm is potent"
381
+ if [ "$_ei_neg" -ge 1 ]; then echo "βœ… ENV-ISO: with the suite's guard applied, β‘€-C SKIPs instead of comparing a foreign card"
382
+ else { echo "❌ ENV-ISO: guard did not hold β€” an inherited store still reached \$CHECK"; FAILED=1; }; fi
383
+ else
384
+ { echo "❌ ENV-ISO POS arm inert (hostile store triggered nothing) β€” the negative result below is UNINTERPRETABLE"; FAILED=1; }
385
+ fi
386
+ rm -rf "$_ei"
387
+
262
388
  if [ "$PREMISE_FAILED" -ne 0 ]; then
263
389
  echo "SESSION-CLOSE LANES: FIXTURE ERROR β€” a lane's input state was never created; this run's β‘€ verdicts prove nothing (exit 3 β‰  gate failure)"
264
390
  exit 3
@@ -267,5 +393,6 @@ if [ "$FAILED" -ne 0 ]; then
267
393
  echo "SESSION-CLOSE LANES: FAIL β€” the gate's instrument is miscalibrated"
268
394
  exit 1
269
395
  fi
270
- echo "SESSION-CLOSE LANES: PASS (8/8)"
396
+ echo "SESSION-CLOSE LANES: PASS (12 core + ENV-ISO 2)"
271
397
  exit 0
398
+
@@ -1936,14 +1936,30 @@ if [ -n "$LOADBEARING" ]; then
1936
1936
  done <<< "$LOADBEARING"
1937
1937
  # The grep filter is KEPT even though the scan is now scoped: the scanner emits summary lines
1938
1938
  # ("degrade-scan: N smell(s) …") that name no file, and those must not read as findings.
1939
- _dd=$(bash "$DDSCAN" "${_dd_targets[@]}" 2>/dev/null \
1940
- | grep -Ff <(printf '%s\n' "$LOADBEARING") 2>/dev/null | head -5 || true)
1939
+ # πŸŸ₯ 2026-08-26 fail-open fix (Β§λ―Έμ •-λ‘˜ ⓐ): the old one-liner (`… 2>/dev/null | grep … || true`)
1940
+ # collapsed "scanner errored / left files unmeasured" (rc≠0, incl. its own
1941
+ # `exit "${_FORCE_NONCLEAN:-0}"` = μ•ˆ μŸ€λ‹€ β‰  κΉ¨λ—ν•˜λ‹€) into an empty string, and the else-branch
1942
+ # printed "βœ… no smell" β€” the scanner's own defect class, committed by its caller. Capture rc
1943
+ # first; rc≠0 still shows any partial findings but never prints the clean checkmark.
1944
+ # rc alone cannot separate the states: the scanner exits 2 BOTH for "smells found" (a normal
1945
+ # advisory result, :542) and for "files could not be measured" (_FORCE_NONCLEAN=2, :548) β€”
1946
+ # codex cross-family catch on the first draft of this fix, which printed "DID NOT complete"
1947
+ # for a completed scan that merely found smells. Discriminate by the output markers.
1948
+ _dd_raw=$(bash "$DDSCAN" "${_dd_targets[@]}" 2>/dev/null); _dd_rc=$?
1949
+ _dd=$(printf '%s\n' "$_dd_raw" | grep -Ff <(printf '%s\n' "$LOADBEARING") 2>/dev/null | head -5 || true)
1950
+ _dd_unm=$(printf '%s\n' "$_dd_raw" | grep -c "COULD NOT BE MEASURED" || true); _dd_unm=${_dd_unm:-0}
1951
+ if [ "$_dd_unm" -gt 0 ]; then
1952
+ echo " ⚠️ degrade lint: some file(s) COULD NOT BE MEASURED β€” NOT-SCANNED is not clean. Advisory: does not block."
1953
+ fi
1941
1954
  if [ -n "$_dd" ]; then
1942
1955
  echo " ⚠️ degrade-direction smell(s) in the staged load-bearing files (advisory):"
1943
1956
  printf '%s\n' "$_dd" | sed 's/^/ /'
1944
1957
  echo " Each = 'prove this is not default-toward-PASS'. Advisory: does not block."
1945
- else
1958
+ elif [ "$_dd_rc" -eq 0 ]; then
1946
1959
  echo " βœ… degrade lint: no smell in the staged load-bearing files"
1960
+ elif [ "$_dd_unm" -eq 0 ]; then
1961
+ echo " ⚠️ degrade lint rc=${_dd_rc} with no staged-file finding β€” scanner error, or findings outside"
1962
+ echo " the staged set. NOT a clean pass. Advisory: does not block."
1947
1963
  fi
1948
1964
  else
1949
1965
  echo " ⚠️ degrade lint unavailable (scripts/degrade_direction_scan.sh missing) β€” advisory leg skipped"
@@ -83,6 +83,13 @@ if ! command -v find >/dev/null 2>&1; then
83
83
  echo "This is not 'clean' and not 'no targets'; nothing was measured. Fix PATH and re-run."
84
84
  exit 2
85
85
  fi
86
+ # `awk` is the S1b probe's only engine (line-continuation joining + bounded lookahead are not
87
+ # expressible in a line-oriented grep). Its absence must not render as clean β€” the same rule the
88
+ # `find` gate above states. Guarded rather than hard-exit: unlike `find`, a missing awk blinds ONE
89
+ # probe, not the whole discovery pass, so the honest degrade is "S1b NOT MEASURED" + non-clean rc.
90
+ _S1B_OK=1
91
+ command -v awk >/dev/null 2>&1 || { _S1B_OK=0; _FORCE_NONCLEAN=2; }
92
+
86
93
  # cksum 도 λ―Έμ„ μ–Έ μ˜μ‘΄μ„±μ΄λ‹€ β€” 첫 μˆ˜λ¦¬λŠ” python3 만 κ°€λ“œν•˜κ³  cksum 은 rc λ―Έκ²€μ‚¬λ‘œ λ„μž…ν–ˆλ‹€.
87
94
  # λΆ€μž¬ μ‹œ μœ μΌμ„± 토큰이 **빈 λ¬Έμžμ—΄**이 돼 shadow 이름 좩돌(A-1)이 κ·ΈλŒ€λ‘œ λΆ€ν™œν•œλ‹€(싀증).
88
95
  # mktemp μ‹€νŒ¨ μ‹œ 예츑 κ°€λŠ₯ν•œ 경둜(/tmp/degradescan.$$)둜 ν΄λ°±ν•˜λ˜ 것을 μ œκ±°ν–ˆλ‹€: κ·Έ 경둜λ₯Ό mkdir
@@ -318,6 +325,116 @@ for f in "${FILES[@]}"; do
318
325
  | grep -vE '^[0-9]+:[[:space:]]*(if[[:space:]]+)?\[\[?[[:space:]]*(-[dznN][[:space:]]|[^]]*=~)' \
319
326
  | grep -E '(\$\(|`|\[[[:space:]]*-[fx][[:space:]]|\b(scan|check|verify|validate|audit|grep|gate|assert|lint|test_)[A-Za-z_]*[[:space:](])')
320
327
 
328
+ # S1b β€” `|| true` INSIDE a command substitution: `V=$(git … 2>/dev/null | … || true)`.
329
+ # S1 above cannot see this shape at all: its regex closes on `(#|;|$)` after the permissive
330
+ # value, and here the next character is `)`. Measured 2026-08-26 by a full hand-census of the
331
+ # 132 `|| true)` sites in this repo (tracks/_meta/s1_true_paren_census_2026-08-26.md): 11 sit
332
+ # on a verdict path, and S1 saw 0 of them.
333
+ #
334
+ # WHY THIS SHAPE IS DIFFERENT FROM `|| true` AT END OF LINE. `|| true` on its own is NOT the
335
+ # defect β€” under `set -e` it is the prescribed way to let a legitimately-empty result through,
336
+ # and flagging it would push an author to delete the remedy (the same trap S3 and S5 already
337
+ # name). The measured defect is the CONJUNCTION the census isolated: the command's stderr is
338
+ # discarded (`2>/dev/null`) AND its non-zero exit is swallowed (`|| true`), so "git failed"
339
+ # and "git ran and matched nothing" arrive at the consumer as the same empty string. Every
340
+ # downstream `[ -n "$V" ]` then reads a broken repo as "nothing to check" and the gate skips
341
+ # itself in silence. Both halves are required by the rule below; either alone is not a smell.
342
+ #
343
+ # SCOPE β€” ORIGIN sites only, deliberately. The census's dominant pattern is that ONE git read
344
+ # feeds a dozen derived filters (`HEAVY=$(echo "$STAGED" | grep … || true)`). The derived
345
+ # filters inherit the origin's risk and add none of their own: their only failure mode is
346
+ # grep-no-match, which is what `|| true` is there for. Flagging them would turn 11 findings
347
+ # into 122 and bury the origin β€” this file already paid that price once (S5 shipped at 9/9 FP)
348
+ # and its own rule is that a probe which is mostly noise trains authors to dismiss it. So the
349
+ # substitution's LEADING command must be a real state read, never `echo`/`printf` on a value
350
+ # that is already in a shell variable.
351
+ #
352
+ # TWO RULES, because the two A-shapes have different tells:
353
+ # (1) git index/worktree read β€” `$(git … diff|log|ls-files|status|show …)`. Restricted to
354
+ # those five subcommands on purpose: `rev-parse`/`config`/`describe`/`merge-base` read
355
+ # identity or configuration, and in this corpus they are either fail-closed on the next
356
+ # line or feed a display string.
357
+ # (2) a substitution that FEEDS A LOOP β€” `done < <(cmd … || true)`, `done <<< "$(cmd …)"`.
358
+ # There is no variable to test here, so no `[ -z ]` can ever exist: an errored command
359
+ # yields zero iterations and the detector reports "found nothing". Any leading command
360
+ # counts except `echo`/`printf` (see SCOPE above).
361
+ #
362
+ # COUNTER DECONFLICTION: a pipeline ending in `grep -c` / `wc` is NOT flagged here β€” a counter
363
+ # always emits ("0") and exits 1 on no-match, so `|| true` there is the no-match idiom, and
364
+ # πŸŸ₯ RETRACTED 2026-08-26 β€” the sentence below said counters "belong to S5". MEASURED FALSE:
365
+ # S5's regex requires `|| echo 0` literally; `session_close_check.sh:395`/`:411` use
366
+ # `|| true`, so S5 never sees them. They are not "another probe's business" β€” they fall
367
+ # BETWEEN the two probes. Found by cross-family review (codex), confirmed by reading S5's
368
+ # own pattern at the S5 block below. The exclusion here stays (a counter genuinely is not
369
+ # S1b's shape and flagging it re-noises this probe to 74%); what changes is the CLAIM about
370
+ # where they land. Open, named, not silently carried: see Β§S5-COUNTER-GAP below.
371
+ # that class belongs to S5 (`|| echo 0` pipefail-fallback). Not flagging it twice is why S5's
372
+ # narrowing survives. Named cost: census A#10/A#11 (session_close_check.sh β‘£-e DISPATCHED /
373
+ # LOGGED) are counter-shaped and therefore NOT covered by S1b. They are not silently dropped β€”
374
+ # they are named here.
375
+ #
376
+ # SUPPRESSION (fail-closed handler): if the assigned variable is tested with `[ -z ]` within
377
+ # 14 lines and that branch exits non-zero / sets FAIL / reports ERROR|UNMEASURED, the emptiness
378
+ # IS distinguished and the site is clean. Note the direction matters: `[ -n "$V" ] && run the
379
+ # check` is NOT suppression β€” that is precisely the "empty β‡’ skip in silence" shape (census
380
+ # A#5, pre-commit SKILL_CHANGE), and it stays flagged.
381
+ #
382
+ # MEASURED PRECISION on this repo, hand-checked against the census, 2026-08-26: 11 hits,
383
+ # 9 true (census A), 2 false (scripts/fh-goal.sh:209,214 β€” a three-stage TARGET_FILES fallback
384
+ # whose terminal empty branch is `exit 0` "skipping fh-gate", which the census read as C).
385
+ # RECALL 9/11 of the census A set; the two misses are the counter-shaped pair named above.
386
+ # awk is the only new dependency and it is GUARDED (_S1B_OK) β€” a missing awk makes this probe
387
+ # blind, and blind must not render as clean (same rule as the `find` gate at the top).
388
+ if [ "${_S1B_OK:-1}" = 1 ]; then
389
+ while IFS= read -r ln; do
390
+ [ -n "$ln" ] || continue
391
+ emit "$f" "$ln" "S1b:||true-in-\$()" "a state-reading command has BOTH its stderr discarded (2>/dev/null) and its failure swallowed (|| true) inside a command substitution β€” 'the command failed' and 'the command matched nothing' become the same empty value, and the gate downstream skips itself in silence. Capture the status separately (out=\$(cmd 2>&1); rc=\$?) and branch on rc, or make the empty case fail closed"
392
+ done < <(awk '
393
+ { raw[NR]=$0 }
394
+ END{
395
+ n=NR
396
+ for(i=1;i<=n;i++){
397
+ if(i<=skipto) continue
398
+ L=raw[i]; last=i
399
+ while(L ~ /\\[ \t]*$/ && last<n){ sub(/\\[ \t]*$/,"",L); last++; L=L " " raw[last] }
400
+ skipto=last # a continuation line is not its own finding
401
+ if(L ~ /^[ \t]*#/) continue
402
+ if(L ~ /#[ \t]*noqa[: \t]*degrade/) continue
403
+ if(L !~ /\|\|[ \t]*true[ \t]*\)/) continue
404
+ if(L !~ /2>\/dev\/null/) continue # stderr must actually be discarded
405
+ if(L ~ /\|[ \t]*(grep[ \t]+-[A-Za-z]*c|grep[ \t]+--count|wc[ \t])/) continue # counter: see Β§S5-COUNTER-GAP
406
+ r1 = (L ~ /[$<]\([ \t]*git[ \t]+(-[^ \t]+[ \t]+([^ \t]+[ \t]+)?)*(diff|log|ls-files|status|show)[ \t]/)
407
+ r2 = ((L ~ /<[ \t]*<\(/ || L ~ /<<<[ \t]*"?\$\(/) && L !~ /[$<]\([ \t]*(echo|printf)[ \t]/)
408
+ if(!r1 && !r2) continue
409
+ v=""
410
+ if(match(L,/^[ \t]*(local[ \t]+)?[A-Za-z_][A-Za-z0-9_]*=/)){
411
+ v=substr(L,RSTART,RLENGTH); sub(/^[ \t]*(local[ \t]+)?/,"",v); sub(/=$/,"",v)
412
+ }
413
+ supp=0
414
+ if(v!=""){
415
+ for(j=last+1;j<=last+14 && j<=n;j++){
416
+ if(raw[j] ~ ("-z[ \t]*\"?\\$\\{?" v "[\"}]")){
417
+ # πŸŸ₯ 2026-08-26 (cross-family/codex): proximity alone suppressed on a COMMENT
418
+ # or on an unrelated later branch that merely sat within 6 lines. That is a
419
+ # false NEGATIVE β€” it hides a real fail-open β€” which is strictly worse than the
420
+ # distance constant being unmeasured. Two guards: comments are not remedies,
421
+ # and the search stops at the end of the `-z` branch.
422
+ for(k=j;k<=j+6 && k<=n;k++){
423
+ C=raw[k]
424
+ if(C ~ /^[ \t]*#/) continue
425
+ sub(/[ \t]#.*$/,"",C) # trailing comment is not code
426
+ if(k>j && C ~ /^[ \t]*(fi|else|elif|esac|;;|})([ \t]|$)/) break
427
+ if(C ~ /exit[ \t]+[1-9]|return[ \t]+[1-9]|FAIL|UNMEASURED|ERROR|die /){ supp=1; break }
428
+ }
429
+ }
430
+ if(supp) break
431
+ }
432
+ }
433
+ if(!supp) print i
434
+ }
435
+ }' "$f" 2>/dev/null)
436
+ fi
437
+
321
438
  # S2 β€” `else` fall-through to a permissive exit/return within 2 lines (unenumerated case β†’ allow).
322
439
  while IFS= read -r ln; do
323
440
  emit "$f" "$ln" "S2:elseβ†’PASS(sh)" "else/fall-through branch exits permissively β€” the unenumerated case should fail closed"
@@ -535,6 +652,7 @@ for f in "${FILES[@]}"; do
535
652
  done
536
653
 
537
654
  echo "----"
655
+ [ "${_S1B_OK:-1}" = 1 ] || echo "note: probe S1b NOT MEASURED (awk unavailable) β€” this run is not clean on that axis."
538
656
  [ ${#UNSCANNABLE[@]} -gt 0 ] && printf 'note: %s changed file(s) outside py/sh β€” NOT covered by this scan (send to cross-family directly).\n' "${#UNSCANNABLE[@]}"
539
657
  if [ "$hits" -gt 0 ]; then
540
658
  echo "degrade-scan: $hits smell(s) β€” ADVISORY. Each = 'prove this is not default-toward-PASS'."