@chrono-meta/fh-gate 3.36.1 β 3.38.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/knowledge/shared/harness-core/builtin_capability_map.md +23 -2
- package/knowledge/shared/harness-core/claude_md_full_reference.md +7 -0
- package/knowledge/shared/harness-core/self_evolution_routine.md +22 -0
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +84 -0
- package/package.json +9 -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 +30 -0
- package/plugins/fh-meta/skills/frontier-digest/SKILL.md +2 -0
- package/plugins/fh-meta/skills/frontier-digest/SKILL_detail.md +7 -3
- package/plugins/fh-meta/skills/harness-doctor/SKILL.md +1 -0
- package/plugins/fh-meta/skills/harvest-loop/SKILL.md +1 -0
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/adapters/gstack_content_safety.sh +1 -1
- package/scripts/capability_effect_probe.sh +2 -2
- package/scripts/card_status_tags.sh +47 -0
- package/scripts/chamber_run.sh +2 -2
- package/scripts/compaction_probe.sh +14 -14
- package/scripts/correction_moments.py +116 -0
- package/scripts/destructive_pre_gate.sh +25 -2
- package/scripts/env_layer_fingerprint.sh +44 -3
- package/scripts/fh_session_load.sh +2 -2
- package/scripts/frontier_digest_autopilot.sh +10 -0
- package/scripts/gate_shape_scan.sh +1 -1
- package/scripts/governor_board.sh +2 -2
- package/scripts/outbound_pr_gate.sh +1 -1
- package/scripts/package_coverage_check.sh +10 -0
- package/scripts/pr_merge_verified.sh +8 -1
- package/scripts/probe_live_eval.sh +9 -0
- package/scripts/probe_live_eval_lib.py +89 -2
- package/scripts/residency_admission_check.sh +1 -1
- package/scripts/selfcheck.sh +8 -0
- package/scripts/selfcheck_shard_weights.txt +184 -0
- package/scripts/session_close_check.sh +13 -2
- package/scripts/sim_isolated_run.sh +2 -2
- package/scripts/test_card_status_tags_lanes.sh +58 -0
- package/scripts/test_correction_moments_lanes.sh +42 -0
- package/scripts/test_count_check_decl_lanes.sh +1 -1
- package/scripts/test_degrade_scan_shell_probes.sh +1 -1
- package/scripts/test_destructive_pre_gate_lanes.sh +36 -0
- package/scripts/test_dispatch_log_lanes.sh +3 -3
- package/scripts/test_env_layer_fingerprint_lanes.sh +6 -1
- package/scripts/test_fh_detach_lanes.sh +27 -4
- package/scripts/test_fh_qp_lanes.sh +1 -1
- package/scripts/test_fh_run_resolver_lanes.sh +4 -4
- package/scripts/test_finding_pipeline_lanes.sh +7 -7
- package/scripts/test_gate_two_verdicts_lanes.sh +1 -1
- package/scripts/test_lane_runner_lanes.sh +1 -1
- package/scripts/test_lane_stub_env_lanes.sh +2 -2
- package/scripts/test_live_eval_transitions_lanes.sh +32 -0
- package/scripts/test_map_postprocess_lanes.sh +1 -1
- package/scripts/test_marker_address_lanes.sh +1 -1
- package/scripts/test_marker_defense_lanes.sh +1 -1
- package/scripts/test_marker_oracle_lanes.sh +1 -1
- package/scripts/test_outbound_pr_gate_lanes.sh +1 -1
- package/scripts/test_peer_worktree_detect_lanes.sh +1 -1
- package/scripts/test_pr_merge_verified_lanes.sh +8 -0
- package/scripts/test_precommit_staged_drift_lanes.sh +1 -1
- package/scripts/test_preprep_adjacent_dup_lanes.sh +1 -1
- package/scripts/test_prepush_destructive_lanes.sh +1 -1
- package/scripts/test_probe_live_eval_lanes.sh +68 -1
- package/scripts/test_regression_guard_ci_lanes.sh +8 -8
- package/scripts/test_regression_guard_codecomment_lanes.sh +140 -0
- package/scripts/test_revert_probe_lanes.sh +1 -1
- package/scripts/test_selfcheck_shard_lanes.sh +44 -0
- package/scripts/test_selfcheck_state_lanes.sh +1 -1
- package/scripts/test_stale_ref_close_lanes.sh +1 -1
- package/scripts/test_temper_check_lanes.sh +1 -1
- package/scripts/test_utterance_intake_lanes.sh +9 -9
- package/scripts/test_verdict_watermark_lanes.sh +3 -3
- package/scripts/test_worktree_reclaim_lanes.sh +1 -1
- package/templates/.git-hooks/pre-commit +2 -2
- package/templates/fh_audit_check.zsh +140 -0
- package/templates/regression_guard.sh +32 -2
- package/templates/settings.PreToolUse.snippet.json +2 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_regression_guard_codecomment_lanes.sh β Axis 1 F4 must not count `#` comment lines in code.
|
|
3
|
+
#
|
|
4
|
+
# WHY (2026-11-04): F4 counts operational tokens (PASS, BLOCK, M-tier, ...) and blocks at >=50%
|
|
5
|
+
# loss. In a .py file a `PASS` that sits only in a comment is prose, yet it was counted: a
|
|
6
|
+
# downstream harness's utterance_checklist_hook.py reworded one comment, `PASS` went 1 -> 0, and
|
|
7
|
+
# the guard hard-blocked an otherwise clean port. F4 now drops real Python comments (found by
|
|
8
|
+
# Python's tokenizer) before counting. Shell is not filtered. These lanes pin both directions:
|
|
9
|
+
# C1 .py, token only in a comment, comment reworded -> no M-tier (the fix)
|
|
10
|
+
# C2 .py, token in a string literal, dropped -> M-tier (still guards code)
|
|
11
|
+
# C3 .sh, `# BLOCK` inside a heredoc, changed -> M-tier (shell not filtered)
|
|
12
|
+
# C4 .md, `# PASS ...` heading dropped -> M-tier (md is not code)
|
|
13
|
+
# C5 .py, `# BLOCK` line inside a triple-quoted string -> M-tier (string data, not a comment)
|
|
14
|
+
# C6 .py that does not parse, comment-only token dropped -> M-tier (tokenizer fails -> stricter)
|
|
15
|
+
# C7 .py with a form feed before a string holding PASS -> M-tier (rows must not shift)
|
|
16
|
+
# C8 .py, comment then a lone CR then a string holding PASS -> M-tier (only the comment text goes)
|
|
17
|
+
# C3, C5 (round 1) and C7 (round 2), C8 (round 3) are the cross-family findings against a first draft that matched `^#` lines.
|
|
18
|
+
# REVERT PROBE: the .py case is disabled in a copy of the guard and C1 must turn red.
|
|
19
|
+
#
|
|
20
|
+
# Usage: bash scripts/test_regression_guard_codecomment_lanes.sh Exit: 0 = all behave; 1 = regression.
|
|
21
|
+
|
|
22
|
+
set -uo pipefail
|
|
23
|
+
. "$(dirname "${BASH_SOURCE[0]}")/fixture_guard_lib.sh" # fixtures never write the real repo
|
|
24
|
+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
25
|
+
GUARD="$REPO_ROOT/templates/regression_guard.sh"
|
|
26
|
+
T="$(fh_fixture_root "$(mktemp -d)")"
|
|
27
|
+
: "${T:?fixture root unset β refusing to run git in cwd}"
|
|
28
|
+
trap 'rm -rf "$T"' EXIT
|
|
29
|
+
FAIL=0
|
|
30
|
+
|
|
31
|
+
PY_BEFORE='import sys
|
|
32
|
+
|
|
33
|
+
def main():
|
|
34
|
+
# retry on a busy lock (5x PASS under contention)
|
|
35
|
+
return 0
|
|
36
|
+
'
|
|
37
|
+
PY_AFTER='import sys
|
|
38
|
+
|
|
39
|
+
def main():
|
|
40
|
+
# retry on a busy lock, measured under contention
|
|
41
|
+
return 0
|
|
42
|
+
'
|
|
43
|
+
PYS_BEFORE='def verdict(ok):
|
|
44
|
+
return "PASS" if ok else "FAIL"
|
|
45
|
+
'
|
|
46
|
+
PYS_AFTER='def verdict(ok):
|
|
47
|
+
return "ok" if ok else "FAIL"
|
|
48
|
+
'
|
|
49
|
+
SH_BEFORE='#!/usr/bin/env bash
|
|
50
|
+
cat <<EOF
|
|
51
|
+
# BLOCK
|
|
52
|
+
EOF
|
|
53
|
+
'
|
|
54
|
+
SH_AFTER='#!/usr/bin/env bash
|
|
55
|
+
cat <<EOF
|
|
56
|
+
# allow
|
|
57
|
+
EOF
|
|
58
|
+
'
|
|
59
|
+
PYQ_BEFORE='MSG = """
|
|
60
|
+
# BLOCK
|
|
61
|
+
"""
|
|
62
|
+
print(MSG)
|
|
63
|
+
'
|
|
64
|
+
PYQ_AFTER='MSG = """
|
|
65
|
+
# allow
|
|
66
|
+
"""
|
|
67
|
+
print(MSG)
|
|
68
|
+
'
|
|
69
|
+
PYBAD_BEFORE='def broken(:
|
|
70
|
+
# PASS here
|
|
71
|
+
return 0
|
|
72
|
+
'
|
|
73
|
+
PYBAD_AFTER='def broken(:
|
|
74
|
+
# fine here
|
|
75
|
+
return 0
|
|
76
|
+
'
|
|
77
|
+
PYFF_BEFORE=$(printf 'x=0\f\ns="PASS"\n# note\n')
|
|
78
|
+
PYFF_AFTER=$(printf 'x=0\f\ns="okay"\n# note\n')
|
|
79
|
+
PYCR_BEFORE=$(printf '# note\rs="PASS"\n')
|
|
80
|
+
PYCR_AFTER=$(printf '# note\rs="okay"\n')
|
|
81
|
+
MD_BEFORE='# s
|
|
82
|
+
# PASS criteria
|
|
83
|
+
the run is green.
|
|
84
|
+
'
|
|
85
|
+
MD_AFTER='# s
|
|
86
|
+
the run is green.
|
|
87
|
+
'
|
|
88
|
+
|
|
89
|
+
# $1=dir $2=path $3=before $4=after β base commit with $3, then stage $4
|
|
90
|
+
mkcase() {
|
|
91
|
+
local d=$1 p=$2
|
|
92
|
+
mkdir -p "$d/$(dirname "$p")"
|
|
93
|
+
git -C "$d" init -q && git -C "$d" config user.email t@t && git -C "$d" config user.name t
|
|
94
|
+
printf '%s' "$3" > "$d/$p"
|
|
95
|
+
git -C "$d" add -A && git -C "$d" commit -q -m base
|
|
96
|
+
printf '%s' "$4" > "$d/$p"
|
|
97
|
+
git -C "$d" add -A
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
# $1=id $2=dir $3=guard $4=expect(block|pass)
|
|
101
|
+
run_lane() {
|
|
102
|
+
local id=$1 d=$2 g=$3 want=$4 rc out
|
|
103
|
+
out=$(cd "$d" && bash "$g" --staged 2>&1); rc=$?; [ -n "${SHOW:-}" ] && printf "%s\n" "$out" | grep -E "M-TIER" | sed "s/^/ [$id] /"
|
|
104
|
+
if [ -z "$out" ]; then echo " β $id β guard printed nothing (instrument silence, not a pass)"; FAIL=1; return; fi
|
|
105
|
+
if [ "$rc" -ne 0 ] && [ "$rc" -ne 1 ] && [ "$rc" -ne 2 ]; then
|
|
106
|
+
echo " β $id β guard rc=$rc (could not run)"; printf '%s\n' "$out" | tail -3 | sed 's/^/ /'; FAIL=1; return
|
|
107
|
+
fi
|
|
108
|
+
if ! grep -c "Files changed: 1" <<<"$out" >/dev/null; then
|
|
109
|
+
echo " β $id β the fixture file was not selected (inert pathspec reads as a clean 0)"; FAIL=1; return
|
|
110
|
+
fi
|
|
111
|
+
if [ "$want" = block ] && [ "$rc" -eq 2 ]; then echo " β
$id β M-tier block (rc=2)"
|
|
112
|
+
elif [ "$want" = pass ] && [ "$rc" -ne 2 ]; then echo " β
$id β no M-tier (rc=$rc)"
|
|
113
|
+
else echo " β $id β want $want, got rc=$rc"; printf '%s\n' "$out" | grep -E 'M-TIER|token' | head -3 | sed 's/^/ /'; FAIL=1
|
|
114
|
+
fi
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
echo "regression_guard F4 β code comments are not operational tokens"
|
|
118
|
+
mkcase "$T/c1" scripts/hook.py "$PY_BEFORE" "$PY_AFTER"; run_lane C1 "$T/c1" "$GUARD" pass
|
|
119
|
+
mkcase "$T/c2" scripts/verdict.py "$PYS_BEFORE" "$PYS_AFTER"; run_lane C2 "$T/c2" "$GUARD" block
|
|
120
|
+
mkcase "$T/c3" scripts/gate.sh "$SH_BEFORE" "$SH_AFTER"; run_lane C3 "$T/c3" "$GUARD" block
|
|
121
|
+
mkcase "$T/c4" README.md "$MD_BEFORE" "$MD_AFTER"; run_lane C4 "$T/c4" "$GUARD" block
|
|
122
|
+
mkcase "$T/c5" scripts/msg.py "$PYQ_BEFORE" "$PYQ_AFTER"; run_lane C5 "$T/c5" "$GUARD" block
|
|
123
|
+
mkcase "$T/c6" scripts/bad.py "$PYBAD_BEFORE" "$PYBAD_AFTER"; run_lane C6 "$T/c6" "$GUARD" block
|
|
124
|
+
mkcase "$T/c7" scripts/ff.py "$PYFF_BEFORE" "$PYFF_AFTER"; run_lane C7 "$T/c7" "$GUARD" block
|
|
125
|
+
mkcase "$T/c8" scripts/cr.py "$PYCR_BEFORE" "$PYCR_AFTER"; run_lane C8 "$T/c8" "$GUARD" block
|
|
126
|
+
|
|
127
|
+
echo "revert probe β disable the .py case; C1 must turn red"
|
|
128
|
+
G2="$T/guard_reverted.sh"
|
|
129
|
+
sed 's/^ \*\.py)$/ __never_matches__)/' "$GUARD" > "$G2"
|
|
130
|
+
if cmp -s "$GUARD" "$G2"; then
|
|
131
|
+
echo " β R1 β revert did not apply (pattern not found in guard; probe is dead)"; FAIL=1
|
|
132
|
+
else
|
|
133
|
+
out=$(cd "$T/c1" && bash "$G2" --staged 2>&1); rc=$?
|
|
134
|
+
if [ "$rc" -eq 2 ]; then echo " β
R1 β reverted guard blocks C1 (rc=2): the case is load-bearing"
|
|
135
|
+
else echo " β R1 β reverted guard still passes C1 (rc=$rc): lane C1 is decoration"; FAIL=1
|
|
136
|
+
fi
|
|
137
|
+
fi
|
|
138
|
+
|
|
139
|
+
[ "$FAIL" -eq 0 ] && echo "PASS β 8 lanes + revert probe" || echo "FAIL"
|
|
140
|
+
exit "$FAIL"
|
|
@@ -138,7 +138,7 @@ OUT5e=$(bash "$SUT" "$TARGET" "$REAL_SUITE" --baseline totally-bogus-ref 2>&1);
|
|
|
138
138
|
( cd "$SRC" && git diff --cached --quiet ) \
|
|
139
139
|
&& ok "L6 no staged changes left in the index after any probe run" \
|
|
140
140
|
|| no "L6 the index has staged changes β a checkout-based restore would do this"
|
|
141
|
-
( cd "$SRC" && git status --porcelain ) | grep -
|
|
141
|
+
( cd "$SRC" && git status --porcelain ) | grep -c . >/dev/null \
|
|
142
142
|
&& no "L6b working tree not clean after probes (git status is non-empty)" \
|
|
143
143
|
|| ok "L6b working tree clean after all probes (file content == committed HEAD)"
|
|
144
144
|
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
# answers "run it".
|
|
15
15
|
# S7 every shard owns at least one suite for N in 2..4 (an empty shard is a wasted runner and a
|
|
16
16
|
# sign the plan collapsed).
|
|
17
|
+
# S8 shard 1 ACTUALLY runs the inline checks (the ~39 non-suite decisions it alone owns).
|
|
18
|
+
# S1..S7 are dry runs and `_shard_inline` answers "skip" in dry mode, so none of them can
|
|
19
|
+
# see this axis; breaking it leaves every leg green with those 39 checks run nowhere.
|
|
17
20
|
# The runs are DRY (`--shard-dry`): nothing is executed, the decision is appended to $FH_SHARD_TRACE.
|
|
18
21
|
# So this suite costs seconds, and it cannot recurse into itself (a dry run never runs a suite).
|
|
19
22
|
set -u
|
|
@@ -121,6 +124,47 @@ else
|
|
|
121
124
|
printf '%s' "$res" | grep -qx 'inlineskip=1'; chk $? "S6 without --shard no inline check is skipped"
|
|
122
125
|
fi
|
|
123
126
|
|
|
127
|
+
# ββ S8 shard 1 ACTUALLY runs the inline checks βββββββββββββββββββββββββββββββββββββββββββββββ
|
|
128
|
+
# WHY THIS LANE EXISTS (measured 2026-11-02, weekly clean-room audit). S1..S7 all run with
|
|
129
|
+
# `--shard-dry`, and in dry mode `_shard_inline` returns 1 BY CONSTRUCTION β so every lane above
|
|
130
|
+
# holds the SUITE assignment and none of them can say anything about the inline checks that
|
|
131
|
+
# shard 1 alone owns: the syntax scans, the nine named checkers routed through the `bash` shim
|
|
132
|
+
# (count_check Β· prepush_guard_check Β· gate_anchor_check Β· multibyte_bracket_lint Β·
|
|
133
|
+
# package_coverage_check Β· files_manifest_shipping_check Β· lane_runner_check Β· gate_pathspec_check
|
|
134
|
+
# Β· sync_guard_check) and every `--self-test` entry point β 39 decisions in the dry trace.
|
|
135
|
+
# The hole is silent in the direction this repo calls hollow green: 8 of the 11 `_shard_inline_skip`
|
|
136
|
+
# call sites are `then :`, so a skipped inline check never sets `fail=1`. Measured with the mutant
|
|
137
|
+
# below: with `_shard_inline` answering "skip" always, EVERY leg SHARD-SKIPs all 39, no leg runs
|
|
138
|
+
# them, selfcheck exits 0, and this suite reported 31 passed / 0 failed. Nothing was red anywhere.
|
|
139
|
+
# S6 does not cover it either: S6 asks the no-`--shard` case, which is `npm test`, not a CI leg.
|
|
140
|
+
if [ ! -f "$T/block.sh" ]; then
|
|
141
|
+
chk 1 "S8 the lifted shard block is available (S6 did not produce it β lane would test nothing)"
|
|
142
|
+
else
|
|
143
|
+
# one answer pair from the lifted block, run with the given arguments: "<_shard_inline rc> <_shard_inline_skip rc>"
|
|
144
|
+
inline_answer() { # $1 = block file, $2.. = arguments as selfcheck would receive them
|
|
145
|
+
local _bf="$1"; shift
|
|
146
|
+
( cd "$ROOT" && env -u FH_SELFCHECK_SHARD bash -c '
|
|
147
|
+
f="$1"; shift
|
|
148
|
+
. "$f"
|
|
149
|
+
_shard_inline; a=$?
|
|
150
|
+
_shard_inline_skip LBL >/dev/null 2>&1; b=$?
|
|
151
|
+
echo "$a $b"' _ "$_bf" "$@" 2>/dev/null | tail -1 )
|
|
152
|
+
}
|
|
153
|
+
a_leg1=$(inline_answer "$T/block.sh" --shard 1/4)
|
|
154
|
+
a_leg2=$(inline_answer "$T/block.sh" --shard 2/4)
|
|
155
|
+
a_dry1=$(inline_answer "$T/block.sh" --shard 1/4 --shard-dry)
|
|
156
|
+
[ "$a_leg1" = "0 1" ]; chk $? "S8 --shard 1/4 (not dry): the inline checks RUN here (got '$a_leg1', want '0 1')"
|
|
157
|
+
[ "$a_leg2" = "1 0" ]; chk $? "S8 known-negative: --shard 2/4 skips them, so S8 is not a lane that always passes (got '$a_leg2', want '1 0')"
|
|
158
|
+
[ "$a_dry1" = "1 0" ]; chk $? "S8 control: the DRY form every lane above uses answers 'skip' even for shard 1 (got '$a_dry1') β that is why S1..S7 cannot hold this axis"
|
|
159
|
+
|
|
160
|
+
# KNOWN-NEGATIVE on the detector itself: break inline dispatch with one line. If S8 cannot go
|
|
161
|
+
# red on this, it proves nothing about the subject (same construction as S5).
|
|
162
|
+
sed 's|^ \[ "\$_SHARD_I" = 1 \]$| false|' "$T/block.sh" > "$T/block_mut.sh"
|
|
163
|
+
cmp -s "$T/block.sh" "$T/block_mut.sh"; chk $((1 - $?)) "S8 control: the mutation APPLIED β if this is red the \$_SHARD_I line moved, so S8's known-negative below is VOID, not the subject's fault"
|
|
164
|
+
a_mut=$(inline_answer "$T/block_mut.sh" --shard 1/4)
|
|
165
|
+
[ "$a_mut" != "0 1" ]; chk $? "S8 known-negative: with inline dispatch broken, shard 1 no longer runs them (got '$a_mut') β the detector can fail"
|
|
166
|
+
fi
|
|
167
|
+
|
|
124
168
|
# ββ notes (printed, never a verdict) ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
125
169
|
if [ -f "$ROOT/scripts/selfcheck_shard_weights.txt" ]; then
|
|
126
170
|
awk 'NF >= 2 && $1 ~ /^[0-9.]+$/ && $2 != "@inline" { print $2 }' "$ROOT/scripts/selfcheck_shard_weights.txt" | LC_ALL=C sort -u > "$T/w.names"
|
|
@@ -405,7 +405,7 @@ if [ "$(printf '%s\n' "$DD_ARM" | wc -l)" -gt 15 ]; then
|
|
|
405
405
|
fi
|
|
406
406
|
dd_arm_says() { # $1 = the subject's stdout; echoes PASS or FAIL
|
|
407
407
|
( _out="$1"; fail=0; _show_failure() { :; }
|
|
408
|
-
eval "$DD_ARM" ) | grep -oE '^(PASS|FAIL)' |
|
|
408
|
+
eval "$DD_ARM" ) | grep -oE '^(PASS|FAIL)' | sed -n 1p
|
|
409
409
|
}
|
|
410
410
|
|
|
411
411
|
[ "$(dd_arm_says 'β
calibration passed (28 pairs)')" = PASS ]
|
|
@@ -32,7 +32,7 @@ if [ ! -f "$SUBJECT" ]; then
|
|
|
32
32
|
fi
|
|
33
33
|
|
|
34
34
|
BLOCK=$(awk '/^# ββ β -g STALE REF \(advisory\)/,/^echo "ββ close check:/' "$SUBJECT" | sed '$d')
|
|
35
|
-
if [ -z "$BLOCK" ] || ! printf '%s' "$BLOCK" | grep -
|
|
35
|
+
if [ -z "$BLOCK" ] || ! printf '%s' "$BLOCK" | grep -c '_SR_SCAN' >/dev/null; then
|
|
36
36
|
bad "β -g λΈλ‘μ subject μμ λͺ» μ°Ύμλ€ β λͺ» μ°Ύλ κ²μ κ²μ¦ν μλ μλ€"
|
|
37
37
|
echo "----"; echo "stale-ref close lanes: $pass passed, $fail failed"; exit 1
|
|
38
38
|
fi
|
|
@@ -261,7 +261,7 @@ else
|
|
|
261
261
|
CHANGED="$(git -C "$REPO_ROOT" diff --name-only "$BASEREF" HEAD -- '*.md')"
|
|
262
262
|
# L1 β κ·Έ ꡬκ°μ Β«μ λ³νΒ» μ€λ¬Ό md β 6μ§ν μ λΆ +0
|
|
263
263
|
UNCH=""
|
|
264
|
-
for f in $(git -C "$REPO_ROOT" ls-tree -r --name-only HEAD | grep '\.md$' |
|
|
264
|
+
for f in $(git -C "$REPO_ROOT" ls-tree -r --name-only HEAD | grep '\.md$' | sed -n '1,60p'); do
|
|
265
265
|
printf '%s\n' "$CHANGED" | grep -Fxq "$f" && continue
|
|
266
266
|
git -C "$REPO_ROOT" cat-file -e "$BASEREF:$f" 2>/dev/null || continue
|
|
267
267
|
UNCH="$f"; break
|
|
@@ -186,7 +186,7 @@ grep -qE $'^1\t2026-09-05T01:00:00' <<<"${_L9C_OUT%%$'\n'*}" \
|
|
|
186
186
|
|
|
187
187
|
# ββ L10 seal μΆλ ₯ 골λ β 곡μ©νκ° κΈ°μ‘΄ μμ₯μ λ°κΎΈμ§ μμλ€ βββββββββββββββββ
|
|
188
188
|
bash "$PROBE" seal --transcript "$T/tr.jsonl" --dir "$T/seal" >/dev/null 2>&1
|
|
189
|
-
SF="$(ls "$T/seal"/seal_*.md 2>/dev/null |
|
|
189
|
+
SF="$(ls "$T/seal"/seal_*.md 2>/dev/null | sed -n 1p)"
|
|
190
190
|
if [ -n "$SF" ]; then
|
|
191
191
|
sed -n '/^## μ΄μμ λ°ν/,/^## μ΄ μΈμ
μ΄ κ±΄λλ¦°/p' "$SF" | sed '$d' > "$T/seal_block.txt"
|
|
192
192
|
cat > "$T/seal_expect.txt" <<'GOLD'
|
|
@@ -203,7 +203,7 @@ GOLD
|
|
|
203
203
|
if diff -u "$T/seal_expect.txt" "$T/seal_block.txt" >"$T/seal_diff.txt" 2>&1; then
|
|
204
204
|
ok "L10 seal λ°ν λΈλ‘μ΄ κ³¨λ κ³Ό λ°μ΄νΈ λμΌ"
|
|
205
205
|
else
|
|
206
|
-
ng "L10 seal λ°ν λΈλ‘μ΄ κ³¨λ κ³Ό λ€λ₯΄λ€"; sed 's/^/ /' "$T/seal_diff.txt" |
|
|
206
|
+
ng "L10 seal λ°ν λΈλ‘μ΄ κ³¨λ κ³Ό λ€λ₯΄λ€"; sed 's/^/ /' "$T/seal_diff.txt" | sed -n '1,20p'
|
|
207
207
|
fi
|
|
208
208
|
else
|
|
209
209
|
ng "L10 seal νμΌμ΄ μ μκ²Όλ€"
|
|
@@ -218,7 +218,7 @@ if bash "$PROBE" --self-test >/dev/null 2>&1; then ok "L11 compaction_probe --se
|
|
|
218
218
|
mkdir -p "$T/mirror/scripts"
|
|
219
219
|
cp "$PROBE" "$T/mirror/scripts/compaction_probe.sh"
|
|
220
220
|
bash "$T/mirror/scripts/compaction_probe.sh" seal --transcript "$T/tr.jsonl" --dir "$T/seal_rv" >/dev/null 2>&1
|
|
221
|
-
SFR="$(ls "$T/seal_rv"/seal_*.md 2>/dev/null |
|
|
221
|
+
SFR="$(ls "$T/seal_rv"/seal_*.md 2>/dev/null | sed -n 1p)"
|
|
222
222
|
if [ -n "$SFR" ] && grep -q "μμΌλ‘ λ¬΄μΈ μ‘μ plist" "$SFR"; then
|
|
223
223
|
ng "L12 μΆμΆκΈ°κ° μλλ°λ λ°νκ° μ€λ Έλ€ β seal μ΄ κ·Έ νμΌμ ν΅ν΄ λμ§ μλλ€(λ°°μ μ₯μ)"
|
|
224
224
|
else
|
|
@@ -227,7 +227,7 @@ fi
|
|
|
227
227
|
# known-positive μ§: κ°μ λ―Έλ¬μ μΆμΆκΈ°λ₯Ό λ£μΌλ©΄ μ΄μλλ€
|
|
228
228
|
cp "$EXTRACT" "$T/mirror/scripts/transcript_utterances.py"
|
|
229
229
|
bash "$T/mirror/scripts/compaction_probe.sh" seal --transcript "$T/tr.jsonl" --dir "$T/seal_rv2" >/dev/null 2>&1
|
|
230
|
-
SFR2="$(ls "$T/seal_rv2"/seal_*.md 2>/dev/null |
|
|
230
|
+
SFR2="$(ls "$T/seal_rv2"/seal_*.md 2>/dev/null | sed -n 1p)"
|
|
231
231
|
if [ -n "$SFR2" ] && grep -q "μμΌλ‘ λ¬΄μΈ μ‘μ plist" "$SFR2"; then
|
|
232
232
|
ok "L12b μΆμΆκΈ° 볡μ β λ°νκ° λ€μ μ€λ¦°λ€ (볡μ νμΈ β L12 κ° λ―Έλ¬ μ체μ μ¬λ§μ΄ μλ)"
|
|
233
233
|
else
|
|
@@ -314,9 +314,9 @@ NS_ON=$(python3 "$EXTRACT" "$T/tr_slash.jsonl" --min-chars 20 --strip-system-mar
|
|
|
314
314
|
[ "$NS_OFF" -eq 0 ] && ok "L16 νλκ·Έ μμΌλ©΄ μ
λ€ μ»€λ§¨λλ‘ μ μΈ (μ κ·μΉ = seal κ²½λ‘, 컨νΈλ‘€)" \
|
|
315
315
|
|| ng "L16 νλκ·Έ μμ΄ $NS_OFF 건 λ¨μλ€ (κΈ°λ 0) β seal νλμ΄ λ°λμλ€"
|
|
316
316
|
[ "$NS_ON" -eq 1 ] && ok "L16b νλκ·Έλ₯Ό μ£Όλ©΄ κ²½λ‘ν μ€λ°ν 1 κ±΄λ§ μ΄μλλ€" || ng "L16b νλκ·Έ μΌκ³ $NS_ON 건 (κΈ°λ 1)"
|
|
317
|
-
python3 "$EXTRACT" "$T/tr_slash.jsonl" --min-chars 20 --strip-system-markers 2>/dev/null | grep -
|
|
317
|
+
python3 "$EXTRACT" "$T/tr_slash.jsonl" --min-chars 20 --strip-system-markers 2>/dev/null | grep -c "λ°νμ μ€ν°" >/dev/null \
|
|
318
318
|
&& ok "L16c μ΄μλ κ²μ΄ **κ²½λ‘ν μ€λ°ν** λ€ (known-positive)" || ng "L16c μλ±ν κ²μ΄ μ΄μλ¬λ€"
|
|
319
|
-
python3 "$EXTRACT" "$T/tr_slash.jsonl" --min-chars 20 --strip-system-markers 2>/dev/null | grep -
|
|
319
|
+
python3 "$EXTRACT" "$T/tr_slash.jsonl" --min-chars 20 --strip-system-markers 2>/dev/null | grep -c "install-wizard" >/dev/null \
|
|
320
320
|
&& ng "L16d μ§μ§ μ¬λμ 컀맨λκ° μ΄μλ¨μλ€" || ok "L16d μ§μ§ μ¬λμ 컀맨λλ μ¬μ ν μ μΈ (known-negative)"
|
|
321
321
|
|
|
322
322
|
# ββ L17 μμΆ μ΄μ΄λΆμ ν리μ°λΈ (첫 μ€μ¬μ©μ΄ μ‘μ λ€μ―μ§Έ) ββββββββββββββββββββ
|
|
@@ -329,7 +329,7 @@ NC_ON=$(python3 "$EXTRACT" "$T/tr_cont.jsonl" --min-chars 20 --strip-system-mark
|
|
|
329
329
|
NC_OFF=$(python3 "$EXTRACT" "$T/tr_cont.jsonl" --min-chars 20 2>/dev/null | grep -c .); case "$NC_OFF" in ''|*[!0-9]*) NC_OFF=0 ;; esac
|
|
330
330
|
[ "$NC_ON" -eq 1 ] && ok "L17 μμΆ ν리μ°λΈ μ μΈ Β· μ€λ°ν 1 κ±΄λ§ λ¨λλ€" || ng "L17 νλκ·Έ μΌκ³ $NC_ON 건 (κΈ°λ 1)"
|
|
331
331
|
[ "$NC_OFF" -eq 2 ] && ok "L17b νλκ·Έ μμΌλ©΄ λ λ€ ν΅κ³Ό (컨νΈλ‘€ β seal νλ λΆλ³)" || ng "L17b νλκ·Έ μμ΄ $NC_OFF 건 (κΈ°λ 2)"
|
|
332
|
-
python3 "$EXTRACT" "$T/tr_cont.jsonl" --min-chars 20 --strip-system-markers 2>/dev/null | grep -
|
|
332
|
+
python3 "$EXTRACT" "$T/tr_cont.jsonl" --min-chars 20 --strip-system-markers 2>/dev/null | grep -c "λ±κΈ κΈ°λκ°" >/dev/null \
|
|
333
333
|
&& ok "L17c λ¨μ κ²μ΄ μ€λ°νλ€ (known-positive)" || ng "L17c μ€λ°νκΉμ§ λ²λ Έλ€"
|
|
334
334
|
|
|
335
335
|
# ββ L18 β -f **ν볡 κ²½λ‘** β μ μ¬λ³Έκ³Ό κΈ°λ‘μ΄ λ€ μμ λ μ€μ λ‘ νμ κΉμ§ κ°λ€ ββββ
|
|
@@ -421,8 +421,8 @@ cat > "$T/tr23.jsonl" <<'JSONL'
|
|
|
421
421
|
JSONL
|
|
422
422
|
N23=$(python3 "$EXTRACT" "$T/tr23.jsonl" --min-chars 20 2>/dev/null | grep -c .); case "$N23" in ''|*[!0-9]*) N23=0 ;; esac
|
|
423
423
|
[ "$N23" -eq 1 ] && ok "L23 isMetaΒ·isSidechain λ μ½λ μ μΈ Β· νμ μλ 1 κ±΄λ§ λ¨λλ€" || ng "L23 $N23 건 (κΈ°λ 1)"
|
|
424
|
-
python3 "$EXTRACT" "$T/tr23.jsonl" --min-chars 20 2>/dev/null | grep -
|
|
425
|
-
python3 "$EXTRACT" "$T/tr23.jsonl" --min-chars 20 2>/dev/null | grep -
|
|
424
|
+
python3 "$EXTRACT" "$T/tr23.jsonl" --min-chars 20 2>/dev/null | grep -c "νμκ° μλ" >/dev/null && ok "L23b known-positive: λ¨μ κ²μ΄ νμ μλ λ°νλ€" || ng "L23b νμ μλ λ°νκΉμ§ λ²λ Έλ€"
|
|
425
|
+
python3 "$EXTRACT" "$T/tr23.jsonl" --min-chars 20 2>/dev/null | grep -c "λ©ννμλ μ½λ\|μ¬μ΄λ체μΈ" >/dev/null && ng "L23c νμλ λ μ½λκ° μ΄μλ¨μλ€" || ok "L23c νμλ λ μ½λλ μλ€ (known-negative)"
|
|
426
426
|
|
|
427
427
|
# ββ L24 ν€ μ ν: λ³μΉ + κΈΈμ΄ λμ (2026-09-16) ββββββββββββββββββββββββββββββ
|
|
428
428
|
# WHY. γκ°μ₯ κΈ΄ ν ν° 3 κ°γ ν΄λ¦¬μ€ν±μ΄ **λΆμ¬μ΄ μ **μ ν€λ‘ κ³ λ₯Έλ€ β μ μ μ μμ κ°μ₯ κΈΈκ³
|
|
@@ -379,7 +379,7 @@ rm -rf "$_L25"
|
|
|
379
379
|
if grep -q 'TYPED_N=' "$S"; then
|
|
380
380
|
# π₯ μ΄ν μ κ·μμ `$TYPED_N / $TOTAL_N` μ΄λΌλ **νμμ© κ΅¬λΆμ**λ₯Ό λλμ
μΌλ‘ μ€ννλ€.
|
|
381
381
|
# (μ€λ κ·Έ μΆ: κ³κΈ°κ° Β«ννΒ»λ§ λ³΄κ³ Β«λ¬Έλ§₯Β»μ μ λ΄€λ€.) β μ°μ λ¬Έλ§₯ `$((β¦))` μλ§ λ³Έλ€.
|
|
382
|
-
if grep -oE '\$\(\([^)]*\)\)' "$S" 2>/dev/null | grep -E '(TYPED_N|FALLBACK_N)' | grep -
|
|
382
|
+
if grep -oE '\$\(\([^)]*\)\)' "$S" 2>/dev/null | grep -E '(TYPED_N|FALLBACK_N)' | grep -cE '[*/]' >/dev/null; then
|
|
383
383
|
no "L26a λ μ«μλ₯Ό κ²°ν©νλ μμ΄ μλ€ β κ³±νλ©΄ μ΄λ μͺ½μ΄ λλΉ μ‘λμ§ λͺ» λ³Έλ€"
|
|
384
384
|
else ok "L26a λ μ«μ κ²°ν©μ μμ (κ³±ν κ°μ΄ μμ€μ μλ€)"; fi
|
|
385
385
|
grep -q 'β‘ κ·μ½ μ€μ' "$S" && grep -q 'β ν΄λ°± λλ¬' "$S" \
|
|
@@ -388,7 +388,7 @@ if grep -q 'TYPED_N=' "$S"; then
|
|
|
388
388
|
cp "$S" "$S.l26bak"
|
|
389
389
|
printf '\nBAD_RATIO=$((TYPED_N * 100))\n' >> "$S"
|
|
390
390
|
if grep -q 'TYPED_N \* 100' "$S"; then
|
|
391
|
-
if grep -oE '\$\(\([^)]*\)\)' "$S" 2>/dev/null | grep -E 'TYPED_N' | grep -
|
|
391
|
+
if grep -oE '\$\(\([^)]*\)\)' "$S" 2>/dev/null | grep -E 'TYPED_N' | grep -cE '[*/]' >/dev/null; then ok "L26c [λλλ¦Ό] κ²°ν©μμ λ£μΌλ©΄ κ²μ¬κ° λ¬Έλ€"
|
|
392
392
|
else no "L26c κ²°ν©μμ λ£μλλ° κ²μ¬κ° μ λ¬Έλ€ β L26a λ μ₯μμ΄λ€"; fi
|
|
393
393
|
else no "L26c λλλ¦Ό μ μ© μ€ν¨"; fi
|
|
394
394
|
mv -f "$S.l26bak" "$S"
|
|
@@ -408,7 +408,7 @@ else no "L27 νλ‘λΈ μμ β κ²μ¬ λͺ» ν¨(μ€ν΅ μλ)"; fi
|
|
|
408
408
|
# γdeliver κ° κ·μ½ μ€μλ₯Ό μ£½μΈλ€γλ Β«λ°κ²¬Β» μΌλ‘ λΌ λ»νλ€.
|
|
409
409
|
# π₯ known-pair λ₯Ό Β«ν μΈμμ©Β» λ§ λ리면 μ‘°ν©μ΄ μ¬λ κ²½λ‘λ₯Ό ꡬ쑰μ μΌλ‘ λͺ» λ³Έλ€.
|
|
410
410
|
if grep -q 'DELIVER" = 1 \] && \[ "$arm" = ARM' "$S"; then
|
|
411
|
-
_dl=$(grep -n 'DELIVER" = 1 \] && \[ "$arm" = ARM' "$S" |
|
|
411
|
+
_dl=$(grep -n 'DELIVER" = 1 \] && \[ "$arm" = ARM' "$S" | sed -n 1p | cut -d: -f1)
|
|
412
412
|
_blk=$(sed -n "${_dl},$((_dl+4))p" "$S")
|
|
413
413
|
if printf '%s' "$_blk" | grep -q '^\$question"$'; then
|
|
414
414
|
no "L28 deliver λΆκΈ°κ° \$question μ λ€μ μ½λλ€ β κ·μ½μ΄ λ²λ €μ§λ€"
|
|
@@ -166,7 +166,7 @@ mk_pair "$T/m"; M="$T/m/main"; W="$T/m/wt"; mkdir -p "$W/tracks/_meta" "$W/node_
|
|
|
166
166
|
printf 'tracks/\nnode_modules/\n' > "$W/.gitignore" # π₯ ignored μ¬μΌ SKIP (B-7: untracked λ λ§λλ€)
|
|
167
167
|
echo j > "$W/node_modules/x/p.js"
|
|
168
168
|
OUT="$(bash "$SUT" "$W" 2>&1)"; RC=$?
|
|
169
|
-
L="$(ls -t "$M"/tracks/_meta/dispatch/reclaim_wt_*.txt 2>/dev/null |
|
|
169
|
+
L="$(ls -t "$M"/tracks/_meta/dispatch/reclaim_wt_*.txt 2>/dev/null | sed -n 1p)"
|
|
170
170
|
if [ "$RC" -eq 0 ] && printf '%s' "$OUT" | grep -q "non-blocking: skipped 1" \
|
|
171
171
|
&& [ -n "$L" ] && grep -q "^SKIP node_modules/x/p.js" "$L"; then
|
|
172
172
|
ok "W7e μ μΈλΆμ Β«λ²λ¦¬λΒ» κ² μλλΌ Β«μΈκ³ λͺ©λ‘μ λ¨κΈ΄λ€Β» β κ³Όμμ°¨λ¨ λ°©ν₯μ΄ λλ 무μμ΄ μλλ€"
|
|
@@ -128,7 +128,7 @@ readme_first_screen_touched() { # $1 = staged README path
|
|
|
128
128
|
# π₯ No hunks is NOT "nothing changed above the fold". `git diff -U0` prints no @@ for a
|
|
129
129
|
# binary blob or a pure rename, so returning false here renders UNMEASURED as none β the
|
|
130
130
|
# exact family this repo keeps closing. Measure whether the file is staged at all first.
|
|
131
|
-
git diff --cached --name-only -- "$file" 2>/dev/null | grep -
|
|
131
|
+
git diff --cached --name-only -- "$file" 2>/dev/null | grep -c . >/dev/null || return 1 # genuinely unstaged
|
|
132
132
|
return 0 # staged but unreadable β fail closed
|
|
133
133
|
fi
|
|
134
134
|
while IFS= read -r h; do
|
|
@@ -641,7 +641,7 @@ else
|
|
|
641
641
|
GUARD_RESULT_FILE=$(mktemp "${TMPDIR:-/tmp}/fh_guard_result.XXXXXX")
|
|
642
642
|
GUARD_OUT="$(REGRESSION_GUARD_RESULT_FILE="$GUARD_RESULT_FILE" bash "$GUARD" --staged 2>&1)" || GUARD_EXIT=$?
|
|
643
643
|
printf '%s\n' "$GUARD_OUT"
|
|
644
|
-
GUARD_VERDICT=$(sed -n 's/^result=//p' "$GUARD_RESULT_FILE" 2>/dev/null |
|
|
644
|
+
GUARD_VERDICT=$(sed -n 's/^result=//p' "$GUARD_RESULT_FILE" 2>/dev/null | sed -n 1p)
|
|
645
645
|
rm -f "$GUARD_RESULT_FILE"
|
|
646
646
|
# μΌκ΄μ± κ²μ¬ (challenger C-1): exit μ½λμ typed verdict κ° μ΄κΈλλ©΄ κ²μ΄νΈ κ³κΈ° μ€λ₯λ€ β
|
|
647
647
|
# νΉν μ€λ crash(exit 1, νμΌ λ―Έμμ±)κ° "S-tier κ²½κ³ , μ»€λ° νμ©"μΌλ‘ λ λλλ ꡬλ©.
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
#!/usr/bin/env zsh
|
|
2
|
+
# forge-harness β periodic audit reminder (zshrc hook template)
|
|
3
|
+
#
|
|
4
|
+
# Checks elapsed days for each audit item every time a terminal opens,
|
|
5
|
+
# and prints a warning if the threshold is exceeded.
|
|
6
|
+
#
|
|
7
|
+
# ββ Installation ββββββββββββββββββββββββββββββββββββββββββ
|
|
8
|
+
#
|
|
9
|
+
# 1. Set environment variables in .zshrc:
|
|
10
|
+
#
|
|
11
|
+
# export FH_DIR="$HOME/path/to/forge-harness" # required
|
|
12
|
+
# export CC_HUB_DIR="$HOME/path/to/your-cc-hub" # if you have a CC hub
|
|
13
|
+
# export CC_SENTINELS_DIR="$HOME/.cc_sentinels" # project sentinels (optional)
|
|
14
|
+
#
|
|
15
|
+
# 2. Load the function using one of:
|
|
16
|
+
#
|
|
17
|
+
# a) source "$FH_DIR/templates/fh_audit_check.zsh" # source file directly
|
|
18
|
+
# b) Paste the contents of this file into .zshrc # standalone
|
|
19
|
+
#
|
|
20
|
+
# ββ Auto-run (opt-in) βββββββββββββββββββββββββββββββββββββ
|
|
21
|
+
#
|
|
22
|
+
# Default is manual run (call _fh_audit_check directly).
|
|
23
|
+
# To auto-run on terminal start, add to .zshrc:
|
|
24
|
+
#
|
|
25
|
+
# export FH_AUDIT_AUTO=1
|
|
26
|
+
#
|
|
27
|
+
# ββ Sentinel-based project audits βββββββββββββββββββββββββ
|
|
28
|
+
#
|
|
29
|
+
# Quarterly/monthly project audits are tracked via sentinel files.
|
|
30
|
+
# After completing an audit, touch the sentinel to reset the warning.
|
|
31
|
+
#
|
|
32
|
+
# mkdir -p ~/.cc_sentinels
|
|
33
|
+
# touch ~/.cc_sentinels/my_project_pfd # record audit completion
|
|
34
|
+
# export CC_SENTINEL_MY_PROJECT_PFD_DAYS=90 # set 90-day threshold
|
|
35
|
+
#
|
|
36
|
+
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
37
|
+
|
|
38
|
+
# mtime lookup (macOS / Linux compatible) β **GNU-first, and the order is load-bearing**.
|
|
39
|
+
# This was BSD-first (`stat -f %m || stat -c %Y`) and that is silently wrong on GNU/Linux: `-f`
|
|
40
|
+
# there means `--file-system`, so on a regular file it exits 0 and prints a filesystem report
|
|
41
|
+
# instead of an epoch β the `||` fallback never runs and the caller gets a multi-line blob that
|
|
42
|
+
# compares as garbage. Fixed 2026-08-15 after the identical bug was measured in
|
|
43
|
+
# scripts/digest_landing_check.sh (macOS 10/10 PASS Β· ubuntu 1/10 FAIL). Every other _mtime helper
|
|
44
|
+
# in this repo is already GNU-first (scripts/sync-from-be.sh:116 Β· scripts/fh_session_load.sh:105
|
|
45
|
+
# carry the same warning); this template copy was the straggler, and it ships to field harnesses.
|
|
46
|
+
_fh_mtime() { stat -c %Y "$1" 2>/dev/null || stat -f %m "$1" 2>/dev/null || echo 0; }
|
|
47
|
+
|
|
48
|
+
_fh_audit_check() {
|
|
49
|
+
# The caller's zshrc must not leak options in: under KSH_ARRAYS `${arr[1]}` is the SECOND newest
|
|
50
|
+
# file, so a current audit would read as overdue (cross-family codex, 2026-09-27). Local reset.
|
|
51
|
+
emulate -L zsh
|
|
52
|
+
local -a warns=()
|
|
53
|
+
local now
|
|
54
|
+
now=$(date +%s)
|
|
55
|
+
|
|
56
|
+
# β weekly_audit β 7-day threshold (when CC_HUB_DIR is set)
|
|
57
|
+
# π₯ This used to glob `tracks/_meta/harvest_*.md`, a filename NOTHING writes (harvest-loop's
|
|
58
|
+
# SKILL*.md writes skill_usage.md Β· edit_manifest.yaml Β· fh_signal_*, never harvest_*). So the
|
|
59
|
+
# Β«No harvest historyΒ» line was unsatisfiable: it fired on every terminal open for every user,
|
|
60
|
+
# forever (measured 2026-09-26 on a hub whose latest weekly audit was 2 days old). The artifact
|
|
61
|
+
# the canonical cadence table names (CLAUDE.md Β§Cadence Rules Β· install-wizard Β§Step1-Checks
|
|
62
|
+
# `weekly_audit latest`) is `tracks/_audit/weekly_audit_*.md` β check THAT.
|
|
63
|
+
# Guard stays on the dir existing (`tracks/_audit/.gitkeep` ships in every clone), so a
|
|
64
|
+
# missing history still warns: not-found is not zero.
|
|
65
|
+
if [[ -n "${CC_HUB_DIR}" && -d "${CC_HUB_DIR}/tracks/_audit" ]]; then
|
|
66
|
+
local aud
|
|
67
|
+
# zsh: an unmatched glob is a SHELL error raised before `ls` runs β the `2>/dev/null` belongs to
|
|
68
|
+
# ls, so `_fh_audit_check:N: no matches found: β¦` printed on every terminal open of a hub with no
|
|
69
|
+
# harvest files (measured 2026-09-04). π₯ The obvious fix β appending `(N)` to the ls argument β
|
|
70
|
+
# is WRONG and was measured wrong the same day: the null glob drops the word entirely, `ls -t`
|
|
71
|
+
# then lists the CURRENT DIRECTORY, `head -1` returns an unrelated file, and the Β«No harvest
|
|
72
|
+
# historyΒ» warning silently disappears (not-found rendered as found). Collect into an array with
|
|
73
|
+
# `(N.om)` (null-glob Β· plain files Β· newest-first) and read element 1 β empty array β empty aud.
|
|
74
|
+
local -a _fh_audits
|
|
75
|
+
_fh_audits=( "${CC_HUB_DIR}/tracks/_audit"/weekly_audit_*.md(N.om) )
|
|
76
|
+
aud="${_fh_audits[1]:-}"
|
|
77
|
+
if [[ -n "$aud" ]]; then
|
|
78
|
+
local d=$(( (now - $(_fh_mtime "$aud")) / 86400 ))
|
|
79
|
+
(( d >= 7 )) && warns+=("weekly_audit ${d}d elapsed β run the weekly audit (/harvest-loop lightweight) in your CC hub cwd")
|
|
80
|
+
else
|
|
81
|
+
warns+=("No weekly audit history (tracks/_audit/weekly_audit_*.md) β run the weekly audit (/harvest-loop lightweight) in your CC hub cwd")
|
|
82
|
+
fi
|
|
83
|
+
fi
|
|
84
|
+
|
|
85
|
+
# β‘ frontier_digest β 7-day threshold (when CC_HUB_DIR is set)
|
|
86
|
+
# π₯ Same defect class as β : this globbed `knowledge/shared/harness-core/harness_frontier_
|
|
87
|
+
# diagnosis_*.md` at 90d and told you to Β«run /frontier-digestΒ» β but /frontier-digest writes
|
|
88
|
+
# `tracks/_meta/frontier_digest_*.md` (frontier-digest SKILL.md --save), never the diagnosis
|
|
89
|
+
# file. Running the advised command could not reset the clock, and the diagnosis file's mtime
|
|
90
|
+
# moves on unrelated edits. Aligned to CLAUDE.md Β§Cadence Rules (7d on frontier_digest_*.md).
|
|
91
|
+
# Absent history stays silent, as before (not every install runs digests).
|
|
92
|
+
if [[ -n "${CC_HUB_DIR}" && -d "${CC_HUB_DIR}/tracks/_meta" ]]; then
|
|
93
|
+
local -a _fh_digests
|
|
94
|
+
_fh_digests=( "${CC_HUB_DIR}/tracks/_meta"/frontier_digest_*.md(N.om) )
|
|
95
|
+
local fd="${_fh_digests[1]:-}"
|
|
96
|
+
if [[ -n "$fd" ]]; then
|
|
97
|
+
local d=$(( (now - $(_fh_mtime "$fd")) / 86400 ))
|
|
98
|
+
(( d >= 7 )) && warns+=("frontier_digest ${d}d elapsed β run /frontier-digest --save in your CC hub cwd")
|
|
99
|
+
fi
|
|
100
|
+
fi
|
|
101
|
+
|
|
102
|
+
# β’ FH sim Area B β REMOVED 2026-10-19 (operator decision Β«μ¬κ±΄κΈ°μ€μΌλ‘ λ°κΏμ€Β»).
|
|
103
|
+
# Area B used to nag here on a 30-day clock. It is now event-bound: run it before a minor/major
|
|
104
|
+
# release or a public announcement (templates/PRE-PUBLISH-CHECKLIST.md Β§Read it as a reader;
|
|
105
|
+
# sim-conductor SKILL.md Β§Frequency limits). A terminal opening is not that event, so this
|
|
106
|
+
# banner no longer has an Area B line. The 7-day minimum-interval guard stays in the skill.
|
|
107
|
+
# Lanes: scripts/test_fh_audit_check_lanes.sh β’ asserts the line is gone even at 116d.
|
|
108
|
+
|
|
109
|
+
# β£ Custom sentinels β per-file threshold in CC_SENTINELS_DIR (optional)
|
|
110
|
+
# Uppercase filename = env var key: CC_SENTINEL_{NAME}_DAYS (default 90)
|
|
111
|
+
# π₯ The same directory also holds STATE markers written by install-wizard and
|
|
112
|
+
# scripts/fh_env_delta_scan.sh β `*_wizard_done` Β· `*_mapping_skipped` Β· `*_wizard_declined` Β·
|
|
113
|
+
# `*_wizard_reminder_muted`. They record that something happened, not when an audit is due; aging
|
|
114
|
+
# them as 90-day clocks produced false lines (and Β«touch β¦ to resetΒ» would falsify a state
|
|
115
|
+
# record). They are skipped by suffix. Any other file is still a custom audit sentinel.
|
|
116
|
+
if [[ -n "${CC_SENTINELS_DIR}" && -d "${CC_SENTINELS_DIR}" ]]; then
|
|
117
|
+
for f in "${CC_SENTINELS_DIR}"/*(N); do
|
|
118
|
+
[[ -f "$f" ]] || continue
|
|
119
|
+
case "${f:t}" in
|
|
120
|
+
*_wizard_done|*_mapping_skipped|*_wizard_declined|*_wizard_reminder_muted) continue ;;
|
|
121
|
+
esac
|
|
122
|
+
local name="${${f:t}:u}"
|
|
123
|
+
local key="CC_SENTINEL_${name}_DAYS"
|
|
124
|
+
local threshold="${(P)key:-90}"
|
|
125
|
+
local d=$(( (now - $(_fh_mtime "$f")) / 86400 ))
|
|
126
|
+
(( d >= threshold )) && warns+=("${f:t} sentinel ${d}d elapsed β touch ${f} to reset")
|
|
127
|
+
done
|
|
128
|
+
fi
|
|
129
|
+
|
|
130
|
+
# Output
|
|
131
|
+
(( ${#warns[@]} == 0 )) && return
|
|
132
|
+
print ""
|
|
133
|
+
print "\033[33mββ forge-harness Audit Reminders ββββββββββββββββββββββββ\033[0m"
|
|
134
|
+
for w in "${warns[@]}"; do
|
|
135
|
+
print "\033[33m β ${w}\033[0m"
|
|
136
|
+
done
|
|
137
|
+
print "\033[33mββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\033[0m"
|
|
138
|
+
print ""
|
|
139
|
+
}
|
|
140
|
+
[[ "${FH_AUDIT_AUTO:-0}" == "1" ]] && _fh_audit_check
|
|
@@ -600,10 +600,40 @@ print('OK')
|
|
|
600
600
|
# NOTE: combined-count is a PRESENCE heuristic, not semantic equivalence β an
|
|
601
601
|
# unrelated detail-file line can absorb the count. True equivalence is owned by
|
|
602
602
|
# F2 (critical sections) + the Axis 2/3 review, not this counter.
|
|
603
|
+
# Python files: real comments are prose, not verdict surface. A `PASS` that lived only in a
|
|
604
|
+
# comment was counted as an operational token, so rewording one comment read as 100% loss and
|
|
605
|
+
# hard-blocked an otherwise clean port (measured 2026-11-04: a downstream harness's
|
|
606
|
+
# utterance_checklist_hook.py, `PASS` 1 -> 0, the only hit a comment). Comments are found by
|
|
607
|
+
# Python's own tokenizer, not by a `^#` line match: a `#` line inside a string or heredoc is
|
|
608
|
+
# data and keeps counting (cross-family review showed the line match erased it). If the
|
|
609
|
+
# tokenizer cannot run or parse either side, both sides are counted unfiltered β the stricter
|
|
610
|
+
# direction. Only the comment token's own text is removed, and only after checking that exactly
|
|
611
|
+
# that text sits at the tokenizer's reported position; any mismatch exits non-zero, which falls
|
|
612
|
+
# back to unfiltered counting. (Rebuilding lines from row numbers was tried first and was wrong
|
|
613
|
+
# twice under cross-family review: form feeds and lone CRs shift rows.) Shell files are deliberately NOT filtered: heredocs and multi-line strings make
|
|
614
|
+
# a `#` line ambiguous there, and no shell false positive has been observed.
|
|
615
|
+
f4_before=$before_content; f4_after=$after_content
|
|
616
|
+
case "$f" in
|
|
617
|
+
*.py)
|
|
618
|
+
_f4_strip='import sys,io,tokenize
|
|
619
|
+
lines=io.StringIO(sys.stdin.read()).readlines(); it=iter(lines); out=list(lines)
|
|
620
|
+
for t in tokenize.generate_tokens(lambda: next(it, "")):
|
|
621
|
+
if t.type!=tokenize.COMMENT: continue
|
|
622
|
+
r,c=t.start
|
|
623
|
+
if r>len(out) or out[r-1][c:c+len(t.string)]!=t.string: sys.exit(3)
|
|
624
|
+
out[r-1]=out[r-1][:c]+out[r-1][c+len(t.string):]
|
|
625
|
+
sys.stdout.write("".join(out))'
|
|
626
|
+
if _f4b=$(printf '%s\n' "$before_content" | python3 -c "$_f4_strip" 2>/dev/null) \
|
|
627
|
+
&& _f4a=$(printf '%s\n' "$after_content" | python3 -c "$_f4_strip" 2>/dev/null); then
|
|
628
|
+
f4_before=$_f4b; f4_after=$_f4a
|
|
629
|
+
else
|
|
630
|
+
verbose "F4: python tokenizer unavailable or failed on $f β counting comments too (stricter)"
|
|
631
|
+
fi ;;
|
|
632
|
+
esac
|
|
603
633
|
if [ "$is_deprecated" -eq 0 ]; then
|
|
604
634
|
for token in "M-tier" "S-tier" "R-tier" "PASS" "BLOCK" "Wave 0" "Wave 1" "Wave 4" "Step 0" "Step 1" "Step 2" "Step 3" "Step 4" "fan-in" "Done When"; do
|
|
605
|
-
before=$(count_in "$
|
|
606
|
-
after=$(count_in "$
|
|
635
|
+
before=$(count_in "$f4_before" "$token")
|
|
636
|
+
after=$(count_in "$f4_after" "$token")
|
|
607
637
|
if [ "$before" -gt 0 ] && [ "$after" -lt "$before" ]; then
|
|
608
638
|
if [ -n "$detail_content" ]; then
|
|
609
639
|
in_detail=$(_gain count_in "$token")
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
"counterweight is mechanical. Net-new coverage is the LOCAL destructive ops no git hook sees;",
|
|
39
39
|
"the pre-push hook remains the hard floor for the push-time surface (role deconfliction in the",
|
|
40
40
|
"script header). Advisory by design, same contract as pipe_verdict_guard (additionalContext +",
|
|
41
|
-
"systemMessage, no permissionDecision); escalate with FH_DESTRUCTIVE_BLOCK=1.
|
|
41
|
+
"systemMessage, no permissionDecision); escalate with FH_DESTRUCTIVE_BLOCK=1. Under",
|
|
42
|
+
"permission_mode=bypassPermissions it blocks by default (FH_DESTRUCTIVE_BLOCK=0 keeps advisory). Opt out with",
|
|
42
43
|
"`# noqa: destructive-op` β the opt-out exempts the ENTIRE Bash payload (whole-command match),",
|
|
43
44
|
"not a single line: a multi-statement payload with a destructive line 1 and a noqa on line 2 is",
|
|
44
45
|
"fully exempt (accepted advisory-surface residual β see the script header's PRECISION OVER RECALL list).",
|