@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.
- package/.claude-plugin/marketplace.json +2 -2
- package/README.ja.md +58 -28
- package/README.ko.md +201 -184
- package/README.md +59 -43
- package/README.zh.md +74 -47
- package/docs/USER_GUIDE.md +6 -6
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +179 -0
- package/package.json +2 -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 +32 -0
- package/plugins/fh-meta/skills/phantom-quench/SKILL.md +8 -0
- package/plugins/fh-meta/skills/phantom-quench/SKILL_detail.md +1 -0
- package/plugins/fh-meta/skills/salience-splitter/SKILL.md +26 -0
- package/plugins/fh-meta/skills/steel-quench/SKILL.md +10 -0
- package/scripts/degrade_direction_scan.sh +118 -0
- package/scripts/fh-goal.sh +22 -2
- package/scripts/fh_session_load.sh +14 -1
- package/scripts/package_coverage_check.sh +7 -4
- package/scripts/selfcheck.sh +3 -1
- package/scripts/session_close_check.sh +124 -3
- package/scripts/test_card_drift_probe.sh +27 -0
- package/scripts/test_degrade_scan_shell_probes.sh +130 -1
- package/scripts/test_dispatch_log_lanes.sh +54 -2
- package/scripts/test_fh_goal_change_detection_lanes.sh +89 -0
- package/scripts/test_session_close_chain_lanes.sh +27 -0
- package/scripts/test_session_close_lanes.sh +128 -1
- package/templates/.git-hooks/pre-commit +19 -3
- package/templates/degrade_direction_scan.sh +118 -0
|
@@ -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 (
|
|
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
|
-
|
|
1940
|
-
|
|
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
|
-
|
|
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'."
|