@chrono-meta/fh-gate 3.33.0 → 3.35.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/docs/USER_GUIDE.md +7 -3
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +49 -0
- package/package.json +4 -1
- package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-commons/agents/a11y-lens.md +11 -0
- package/plugins/fh-commons/agents/be-dev-lens.md +11 -0
- package/plugins/fh-commons/agents/designer-lens.md +11 -0
- package/plugins/fh-commons/agents/fe-dev-lens.md +11 -0
- package/plugins/fh-commons/agents/qa-lens.md +11 -0
- package/plugins/fh-commons/agents/ux-writer-lens.md +11 -0
- package/plugins/fh-commons/skills/deliberation/SKILL.md +1 -9
- package/plugins/fh-commons/skills/deliberation/SKILL_detail.md +19 -0
- package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +8 -80
- package/plugins/fh-commons/skills/ko-tech-writer/SKILL_detail.md +107 -0
- package/plugins/fh-commons/skills/persona-cast/SKILL.md +12 -6
- package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/CHANGELOG.md +34 -0
- package/plugins/fh-meta/agents/fact-checker.md +11 -0
- package/plugins/fh-meta/agents/hub-persona-auditor.md +13 -0
- package/plugins/fh-meta/agents/persona-innovator.md +12 -0
- package/plugins/fh-meta/skills/auto-decorrelation/SKILL.md +6 -103
- package/plugins/fh-meta/skills/auto-decorrelation/SKILL_detail.md +132 -0
- package/plugins/fh-meta/skills/cross-ecosystem-synergy-detection/SKILL.md +3 -20
- package/plugins/fh-meta/skills/cross-ecosystem-synergy-detection/SKILL_detail.md +36 -0
- package/plugins/fh-meta/skills/frontier-digest/SKILL.md +3 -1
- package/plugins/fh-meta/skills/frontier-digest/SKILL_detail.md +12 -0
- package/plugins/fh-meta/skills/install-doctor/SKILL.md +4 -25
- package/plugins/fh-meta/skills/install-doctor/SKILL_detail.md +44 -0
- package/plugins/fh-meta/skills/verify-bidirectional/SKILL.md +7 -51
- package/plugins/fh-meta/skills/verify-bidirectional/SKILL_detail.md +75 -0
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-preprep/skills/preprep/SKILL.md +7 -207
- package/plugins/fh-preprep/skills/preprep/SKILL_detail.md +235 -0
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/absorption_queue.py +80 -4
- package/scripts/degrade_direction_scan.sh +87 -1
- package/scripts/digest_landing_check.sh +110 -5
- package/scripts/digest_slow_leg.py +456 -0
- package/scripts/pr_merge_verified.sh +20 -3
- package/scripts/selfcheck.sh +156 -7
- package/scripts/test_degrade_scan_shell_probes.sh +63 -0
- package/scripts/test_digest_slow_leg_lanes.sh +11 -0
- package/scripts/test_pr_merge_verified_lanes.sh +33 -0
- package/scripts/test_selfcheck_shard_lanes.sh +135 -0
- package/templates/.git-hooks/pre-commit +1 -1
- package/templates/degrade_direction_scan.sh +87 -1
|
@@ -73,6 +73,23 @@ print(json.dumps({"at":time.strftime("%Y-%m-%dT%H:%M:%S%z"),"pr":int(e["PMV_R_PR
|
|
|
73
73
|
fi
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
# completion record: one line in tracks/_meta/fh_completed_<date>.md so a merge is never forgotten at session close. Called only
|
|
77
|
+
# after the merge landed (verified · verify-failed · verify-incomplete). Local record (tracks/ is gitignored), best-effort: never changes rc. A repo with
|
|
78
|
+
# no tracks/ dir (a consumer that does not use tracks) is skipped silently. Opt-out: FH_MERGE_NO_COMPLETED_LOG=1.
|
|
79
|
+
_clog() { # outcome-label merge_oid
|
|
80
|
+
[ "${FH_MERGE_NO_COMPLETED_LOG:-}" = 1 ] && return 0
|
|
81
|
+
local root; root=$(git rev-parse --show-toplevel 2>/dev/null) || return 0
|
|
82
|
+
[ -d "$root/tracks" ] || return 0
|
|
83
|
+
local title; title=$(gh pr view "$PR" --json title -q .title < /dev/null 2>/dev/null) || title=""
|
|
84
|
+
title=$(printf '%s' "$title" | tr '\n' ' '); [ -n "$title" ] || title="(title unreadable)"
|
|
85
|
+
local d="$root/tracks/_meta" f; f="$d/fh_completed_$(date +%F).md"
|
|
86
|
+
if ! { mkdir -p "$d" && { [ -s "$f" ] || printf '# Completed %s\n\n' "$(date +%F)" > "$f"; } \
|
|
87
|
+
&& printf -- '- %s PR #%s %s → merged %s (%s) — auto\n' "$(date +%H:%M)" "$PR" "$title" "$(printf '%s' "$2" | cut -c1-7)" "$1" >> "$f"; } 2>/dev/null; then
|
|
88
|
+
echo "WARNING: completion record NOT written ($f) - add by hand: PR #$PR merged ($1)" >&2
|
|
89
|
+
fi
|
|
90
|
+
return 0
|
|
91
|
+
}
|
|
92
|
+
|
|
76
93
|
# 1. head before merge
|
|
77
94
|
HEAD_OID=$(gh pr view "$PR" --json headRefOid -q .headRefOid < /dev/null) || HEAD_OID=""
|
|
78
95
|
[ -n "$HEAD_OID" ] || { echo "🟥 HARNESS-ERROR (before merge): could not read PR #$PR head" >&2; exit 4; }
|
|
@@ -154,7 +171,7 @@ echo "── merged as $MC"
|
|
|
154
171
|
# 4. verify
|
|
155
172
|
bash "$PSV" --repo . --tip "$HEAD_OID" --merge "$MC" --rerun "$RERUN"; rc=$?
|
|
156
173
|
case "$rc" in
|
|
157
|
-
0) _receipt "verified" "$MC"; echo "✅ PR #$PR merged and verified"; exit 0 ;;
|
|
158
|
-
1) _receipt "verify-failed" "$MC"; echo "🟥 PR #$PR IS MERGED but verification FAILED — the merge stands; fix forward or revert" >&2; exit 1 ;;
|
|
159
|
-
*) _receipt "verify-incomplete" "$MC"; echo "🟥 HARNESS-ERROR (AFTER merge): post_squash_verify rc=$rc — PR #$PR is merged, verification did not complete" >&2; exit 4 ;;
|
|
174
|
+
0) _receipt "verified" "$MC"; _clog "verified" "$MC"; echo "✅ PR #$PR merged and verified"; exit 0 ;;
|
|
175
|
+
1) _receipt "verify-failed" "$MC"; _clog "verify-failed rc=1" "$MC"; echo "🟥 PR #$PR IS MERGED but verification FAILED — the merge stands; fix forward or revert" >&2; exit 1 ;;
|
|
176
|
+
*) _receipt "verify-incomplete" "$MC"; _clog "verify-incomplete rc=$rc" "$MC"; echo "🟥 HARNESS-ERROR (AFTER merge): post_squash_verify rc=$rc — PR #$PR is merged, verification did not complete" >&2; exit 4 ;;
|
|
160
177
|
esac
|
package/scripts/selfcheck.sh
CHANGED
|
@@ -15,6 +15,124 @@ set -u
|
|
|
15
15
|
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
|
16
16
|
fail=0
|
|
17
17
|
|
|
18
|
+
# ── --shard i/N (2026-10-31) — run one slice of the suite list so CI can fan out ─────────────────────
|
|
19
|
+
# Without --shard NOTHING below is active: no function named `bash` exists, every helper is a no-op
|
|
20
|
+
# that answers "run it", and the file behaves as it did before this section was added.
|
|
21
|
+
# With --shard i/N, a lane suite runs only in the shard the plan assigns it to; everything that is not
|
|
22
|
+
# a lane suite (syntax checks, count_check, ref-path scans, the `--self-test` entry points) runs in
|
|
23
|
+
# shard 1 only. Sharding is by suite BASENAME, so a suite named by several rows still lands in one shard.
|
|
24
|
+
# PLAN = greedy longest-first packing over scripts/selfcheck_shard_weights.txt ("<seconds> <suite>",
|
|
25
|
+
# measured). Computed, not stored, so any N works and the weights file is the only data. A suite that
|
|
26
|
+
# is not in the file is placed by cksum(name) mod N — deterministic, order-independent, so a new
|
|
27
|
+
# suite is never lost, only possibly unbalanced until someone adds its row.
|
|
28
|
+
# Why a shim named `bash` and not a call-site rewrite: test_selfcheck_state_lanes.sh greps this file
|
|
29
|
+
# for the literal `bash scripts/<suite>.sh` (it asserts "executed exactly once"), so the call text is
|
|
30
|
+
# an interface. The shim keeps that text and decides at call time. Calls that bypass a shell function
|
|
31
|
+
# (`timeout N bash …`) do not pass through it; each of those sites carries its own `_shard_skip` /
|
|
32
|
+
# `_shard_inline` arm — grep for them.
|
|
33
|
+
# --shard-dry / FH_SHARD_DRY=1: do not execute suites or inline checks, only record the decision to
|
|
34
|
+
# $FH_SHARD_TRACE as "RUN <name>" / "SKIP <name>" — what test_selfcheck_shard_lanes.sh asserts on.
|
|
35
|
+
_SHARD_I=""; _SHARD_N=""; _SHARD_DRY="${FH_SHARD_DRY:-0}"; _SHARD_GIVEN=0; _SHARD_SPEC=""
|
|
36
|
+
# FH_SELFCHECK_SHARD=i/N is the same switch as --shard (the flag wins). CI uses the env form because
|
|
37
|
+
# test_remote_marker_gate_lanes.sh W1 matches the workflow line `bash scripts/selfcheck.sh` exactly.
|
|
38
|
+
if [ -n "${FH_SELFCHECK_SHARD:-}" ]; then _SHARD_GIVEN=1; _SHARD_SPEC="$FH_SELFCHECK_SHARD"; fi
|
|
39
|
+
while [ $# -gt 0 ]; do
|
|
40
|
+
case "$1" in
|
|
41
|
+
--shard) _SHARD_GIVEN=1; shift; _SHARD_SPEC="${1:-}" ;;
|
|
42
|
+
--shard=*) _SHARD_GIVEN=1; _SHARD_SPEC="${1#--shard=}" ;;
|
|
43
|
+
--shard-dry) _SHARD_DRY=1 ;;
|
|
44
|
+
*) ;; # unknown arguments were ignored before this section existed; they still are
|
|
45
|
+
esac
|
|
46
|
+
shift
|
|
47
|
+
done
|
|
48
|
+
if [ "$_SHARD_GIVEN" = 1 ]; then
|
|
49
|
+
_SHARD_I="${_SHARD_SPEC%%/*}"; _SHARD_N="${_SHARD_SPEC##*/}"
|
|
50
|
+
# each side must be a positive integer without a leading zero: «01» compares unequal to «1» and «/4» concatenates to digits
|
|
51
|
+
# — both ran no suite and printed PASS (codex R1 2026-10-31)
|
|
52
|
+
case "$_SHARD_I" in [1-9]|[1-9]*[0-9]) case "$_SHARD_I" in *[!0-9]*) _SHARD_I=bad ;; esac ;; *) _SHARD_I=bad ;; esac
|
|
53
|
+
case "$_SHARD_N" in [1-9]|[1-9]*[0-9]) case "$_SHARD_N" in *[!0-9]*) _SHARD_I=bad ;; esac ;; *) _SHARD_I=bad ;; esac
|
|
54
|
+
if [ "$_SHARD_I" = bad ] || [ "$_SHARD_SPEC" = "${_SHARD_SPEC#*/}" ] \
|
|
55
|
+
|| [ "$_SHARD_I" -lt 1 ] || [ "$_SHARD_I" -gt "$_SHARD_N" ]; then
|
|
56
|
+
echo "HARNESS ERROR --shard '$_SHARD_SPEC': expected i/N with 1 <= i <= N — nothing was run (not a pass)"
|
|
57
|
+
exit 2
|
|
58
|
+
fi
|
|
59
|
+
fi
|
|
60
|
+
[ -n "$_SHARD_N" ] && [ "$_SHARD_DRY" != 1 ] && echo "SHARD this run covers shard $_SHARD_I of $_SHARD_N only — it is a slice of the suite list, not the whole of it"
|
|
61
|
+
_SHARD_PLAN_TXT=""
|
|
62
|
+
_shard_trace() { [ -n "${FH_SHARD_TRACE:-}" ] && printf '%s\n' "$1" >> "$FH_SHARD_TRACE"; return 0; }
|
|
63
|
+
_shard_of() { # $1 = suite basename → its shard number (1..N)
|
|
64
|
+
local _hit
|
|
65
|
+
_hit=$(printf '%s\n' "$_SHARD_PLAN_TXT" | awk -v n="$1" '$1 == n { print $2; exit }')
|
|
66
|
+
if [ -n "$_hit" ]; then printf '%s\n' "$_hit"
|
|
67
|
+
else printf '%s\n' $(( $(printf '%s' "$1" | cksum | cut -d' ' -f1) % _SHARD_N + 1 )); fi
|
|
68
|
+
}
|
|
69
|
+
if [ -n "$_SHARD_N" ]; then
|
|
70
|
+
if [ -f scripts/selfcheck_shard_weights.txt ]; then
|
|
71
|
+
# LPT: heaviest first (ties by name, C locale), each into the currently lightest bin (ties: lowest index).
|
|
72
|
+
# `@inline` is not a suite: its seconds pre-load shard 1, which owns every non-suite check.
|
|
73
|
+
_SHARD_PRE=$(awk '$2 == "@inline" && $1 ~ /^[0-9.]+$/ { s += $1 } END { print s + 0 }' scripts/selfcheck_shard_weights.txt)
|
|
74
|
+
_SHARD_PLAN_TXT=$(LC_ALL=C sort -k1,1nr -k2,2 scripts/selfcheck_shard_weights.txt \
|
|
75
|
+
| awk -v n="$_SHARD_N" -v pre="$_SHARD_PRE" 'BEGIN { load[1] = pre + 0 } $2 != "@inline" && NF >= 2 && $1 ~ /^[0-9.]+$/ { b = 1; for (i = 2; i <= n; i++) if (load[i] + 0 < load[b] + 0) b = i; load[b] += $1; print $2, b }')
|
|
76
|
+
fi
|
|
77
|
+
# A shard that owns no suite would run nothing and still print PASS (codex R1: `--shard 999/1000`). Shard 1 always owns the
|
|
78
|
+
# inline checks; any other shard must own at least one weighted suite, or it is not a measurement.
|
|
79
|
+
if [ "$_SHARD_I" != 1 ] && [ -z "$(printf '%s\n' "$_SHARD_PLAN_TXT" | awk -v i="$_SHARD_I" '$2 == i { print; exit }')" ]; then
|
|
80
|
+
echo "HARNESS ERROR --shard $_SHARD_I/$_SHARD_N owns no suite in the weights plan — nothing would run (not a pass)"
|
|
81
|
+
exit 2
|
|
82
|
+
fi
|
|
83
|
+
# shard 1 owns every non-suite check. In dry mode nobody executes them.
|
|
84
|
+
_shard_inline() {
|
|
85
|
+
[ "$_SHARD_DRY" = 1 ] && return 1
|
|
86
|
+
[ "$_SHARD_I" = 1 ]
|
|
87
|
+
}
|
|
88
|
+
_shard_mine() { [ "$(_shard_of "$1")" = "$_SHARD_I" ]; }
|
|
89
|
+
# rc 0 = this inline check is shard 1's, not ours (named, so the omission is visible); rc 1 = run it.
|
|
90
|
+
_shard_inline_skip() { # $1 = label
|
|
91
|
+
if _shard_inline; then _shard_trace "INLINE $1"; return 1; fi
|
|
92
|
+
_shard_trace "SKIPINLINE $1"
|
|
93
|
+
echo "SHARD-SKIP $1 (inline check — runs in shard 1 only; this is $_SHARD_I/$_SHARD_N)"
|
|
94
|
+
return 0
|
|
95
|
+
}
|
|
96
|
+
# rc 0 = SKIP this suite here (it belongs to another shard, or this is a dry run); rc 1 = run it.
|
|
97
|
+
_shard_skip() {
|
|
98
|
+
if _shard_mine "$1"; then
|
|
99
|
+
_shard_trace "RUN $1"
|
|
100
|
+
[ "$_SHARD_DRY" = 1 ] && return 0
|
|
101
|
+
return 1
|
|
102
|
+
fi
|
|
103
|
+
_shard_trace "SKIP $1"
|
|
104
|
+
echo "SHARD-SKIP $1 (shard $(_shard_of "$1")/$_SHARD_N, this is $_SHARD_I/$_SHARD_N)"
|
|
105
|
+
return 0
|
|
106
|
+
}
|
|
107
|
+
bash() {
|
|
108
|
+
local _a1="${1:-}" _nm _x _st=0
|
|
109
|
+
case "$_a1" in scripts/*.sh) ;; *) command bash "$@"; return $? ;; esac
|
|
110
|
+
_nm="${_a1##*/}"
|
|
111
|
+
for _x in "$@"; do case "$_x" in --self-test|--selftest) _st=1 ;; esac; done
|
|
112
|
+
if [ "$_st" = 1 ]; then # an embedded self-test is an inline check: shard 1 only
|
|
113
|
+
if _shard_inline; then _shard_trace "INLINE $_nm"; command bash "$@"; return $?; fi
|
|
114
|
+
_shard_trace "SKIPINLINE $_nm"; return 0
|
|
115
|
+
fi
|
|
116
|
+
case "$_nm" in
|
|
117
|
+
test_*.sh|*_lanes.sh)
|
|
118
|
+
if _shard_skip "$_nm"; then return 0; fi
|
|
119
|
+
command bash "$@"; return $? ;;
|
|
120
|
+
# Non-suite checkers selfcheck runs once. `--list-accepted` is a data load every later block
|
|
121
|
+
# depends on (top of file), so it is never skipped.
|
|
122
|
+
count_check.sh|prepush_guard_check.sh|gate_anchor_check.sh|multibyte_bracket_lint.sh|package_coverage_check.sh|files_manifest_shipping_check.sh|lane_runner_check.sh|gate_pathspec_check.sh|sync_guard_check.sh)
|
|
123
|
+
case " $* " in *" --list-accepted "*) command bash "$@"; return $? ;; esac
|
|
124
|
+
if _shard_inline_skip "$_nm"; then return 0; fi
|
|
125
|
+
command bash "$@"; return $? ;;
|
|
126
|
+
esac
|
|
127
|
+
command bash "$@"
|
|
128
|
+
}
|
|
129
|
+
else
|
|
130
|
+
_shard_inline() { return 0; }
|
|
131
|
+
_shard_mine() { return 0; }
|
|
132
|
+
_shard_skip() { return 1; }
|
|
133
|
+
_shard_inline_skip() { return 1; }
|
|
134
|
+
fi
|
|
135
|
+
|
|
18
136
|
# Single source of "declared legitimately unshipped" — package_coverage_check.sh's ACCEPTED_ABSENT,
|
|
19
137
|
# read once via its --list-accepted flag. Two blocks below (ref-path, SessionStart anchor pairs) used
|
|
20
138
|
# to each re-derive "is this absence OK" from an environment predicate (`.git` presence) instead of
|
|
@@ -72,7 +190,7 @@ if [ "${FH_SELFCHECK_PROFILE:-full}" = consumer ]; then
|
|
|
72
190
|
if _package_mode; then _CONSUMER=1
|
|
73
191
|
else echo "⚠️ FH_SELFCHECK_PROFILE=consumer IGNORED — this tree is a git checkout; running the full suite"; fi
|
|
74
192
|
fi
|
|
75
|
-
CHECKOUT_ONLY_SUITES="test_package_coverage_lanes.sh test_files_manifest_shipping_lanes.sh test_map_postprocess_lanes.sh test_remote_marker_gate_lanes.sh test_worktree_reclaim_lanes.sh test_sim_isolated_run_lanes.sh test_utterance_intake_lanes.sh test_precommit_pointer_index_lanes.sh"
|
|
193
|
+
CHECKOUT_ONLY_SUITES="test_package_coverage_lanes.sh test_files_manifest_shipping_lanes.sh test_map_postprocess_lanes.sh test_remote_marker_gate_lanes.sh test_worktree_reclaim_lanes.sh test_sim_isolated_run_lanes.sh test_utterance_intake_lanes.sh test_precommit_pointer_index_lanes.sh test_selfcheck_shard_lanes.sh"
|
|
76
194
|
CONSUMER_SKIPPED=""
|
|
77
195
|
_consumer_skip() { # $1 = suite basename · rc 0 = skip it (and it has been named)
|
|
78
196
|
[ "$_CONSUMER" -eq 1 ] || return 1
|
|
@@ -118,6 +236,7 @@ _absent_subject_verdict() {
|
|
|
118
236
|
|
|
119
237
|
check() { # check <label> <cmd...>
|
|
120
238
|
local label="$1"; shift
|
|
239
|
+
_shard_inline || return 0 # syntax checks are inline checks: shard 1 only (always true without --shard)
|
|
121
240
|
if "$@" 2>/dev/null; then
|
|
122
241
|
echo "PASS $label"
|
|
123
242
|
else
|
|
@@ -208,7 +327,8 @@ done
|
|
|
208
327
|
# its drift diagnostics to stdout (measured 2026-08-05: 686 B stdout / 0 B stderr), so a failure
|
|
209
328
|
# printed a bare `FAIL` line carrying no diagnosis at all — worse than the truncation this session
|
|
210
329
|
# repaired in the lane blocks. Fixed at the call site; check() itself is a separate job (see above).
|
|
211
|
-
if
|
|
330
|
+
if _shard_inline_skip "fh-codex-doctor --strict"; then :
|
|
331
|
+
elif _out=$(node bin/fh-codex-doctor.js --strict 2>&1); then
|
|
212
332
|
echo "PASS fh-codex-doctor --strict"
|
|
213
333
|
else
|
|
214
334
|
echo "FAIL fh-codex-doctor --strict"
|
|
@@ -1143,6 +1263,7 @@ for _pair in \
|
|
|
1143
1263
|
"scripts/proposal_hook.sh|scripts/test_proposal_hook_lanes.sh" \
|
|
1144
1264
|
"plugins/fh-commons/skills/ko-tech-writer/SKILL.md|scripts/test_ko_tech_writer_lanes.sh" \
|
|
1145
1265
|
"scripts/absorption_queue.py|scripts/test_absorption_queue_lanes.sh" \
|
|
1266
|
+
"scripts/digest_slow_leg.py|scripts/test_digest_slow_leg_lanes.sh" \
|
|
1146
1267
|
"scripts/script_caller_ratchet.sh|scripts/test_script_caller_ratchet_lanes.sh" \
|
|
1147
1268
|
"scripts/script_caller_ratchet.sh|scripts/test_runner_surface_index_lanes.sh" \
|
|
1148
1269
|
"scripts/mapped_tracks.sh|scripts/test_mapped_tracks_lanes.sh" \
|
|
@@ -1186,6 +1307,8 @@ do
|
|
|
1186
1307
|
_subj="${_pair%%|*}"; _anc="${_pair##*|}"; _lbl="${_anc##*/}"
|
|
1187
1308
|
if [ ! -f "$_subj" ]; then
|
|
1188
1309
|
_absent_subject_verdict "$_lbl" "$_subj" || fail=1
|
|
1310
|
+
elif [ -f "$_anc" ] && _shard_skip "$_lbl"; then
|
|
1311
|
+
: # another shard's suite (or a dry run) — _shard_skip said so
|
|
1189
1312
|
elif [ -f "$_anc" ] && _consumer_skip "$_lbl"; then
|
|
1190
1313
|
:
|
|
1191
1314
|
elif [ -f "$_anc" ]; then
|
|
@@ -1281,6 +1404,7 @@ for _subj in compaction_probe judgment_circuit_lint novelty_claim_check chamber_
|
|
|
1281
1404
|
# printing in every run before that, unread, because stderr scrolls past a 240-second check.
|
|
1282
1405
|
# ★ A guard that announces its own failure every single run is still a silent failure if
|
|
1283
1406
|
# nothing reads the announcement. Fixed by deleting one word.
|
|
1407
|
+
_shard_inline_skip "$_subj --self-test" && continue
|
|
1284
1408
|
_to=""; command -v timeout >/dev/null 2>&1 && _to="timeout 120"
|
|
1285
1409
|
_st_out="$($_to bash "scripts/$_subj.sh" --self-test < /dev/null 2>&1)"; _st_rc=$?
|
|
1286
1410
|
# rc=10 (or the sibling harness-error codes) means the subject could not even set up its own
|
|
@@ -1458,6 +1582,7 @@ fi
|
|
|
1458
1582
|
if [ ! -f scripts/cluster_capability_scan.sh ]; then
|
|
1459
1583
|
echo "FAIL cluster_capability_scan.sh: missing — it ships via package.json files[], so absence is deletion, not package mode"
|
|
1460
1584
|
fail=1
|
|
1585
|
+
elif _shard_inline_skip "cluster_capability_scan.sh --self-test"; then :
|
|
1461
1586
|
elif _out=$(bash scripts/cluster_capability_scan.sh --self-test < /dev/null 2>&1) \
|
|
1462
1587
|
&& printf '%s\n' "$_out" | grep -qE '캘리브레이션 통과: [1-9][0-9]* PASS / 0 FAIL'; then
|
|
1463
1588
|
echo "PASS cluster_capability_scan.sh --self-test ($(printf '%s\n' "$_out" | grep -oE '[0-9]+ PASS / [0-9]+ FAIL' | tail -1))"
|
|
@@ -1468,7 +1593,7 @@ else
|
|
|
1468
1593
|
fi
|
|
1469
1594
|
# 밀폐 레인(2026-10-02, pmh-dev #84) — 호출자 env 에 클러스터 변수가 살아 있어도 self-test 판정이 같아야 한다.
|
|
1470
1595
|
# known-pair: 위 블록(env 없음)과 이 블록(env 있음)이 같은 «0 FAIL» 을 내고, 이 블록은 비운 사실을 이름으로 말한다.
|
|
1471
|
-
if [ -f scripts/cluster_capability_scan.sh ]; then
|
|
1596
|
+
if [ -f scripts/cluster_capability_scan.sh ] && ! _shard_inline_skip "cluster_capability_scan.sh --self-test (hermetic)"; then
|
|
1472
1597
|
if _out=$(FH_CLUSTER_ROOTS=/nonexistent-fh-a:/nonexistent-fh-b FH_TRACKS_ROOT=/nonexistent-fh-tracks FH_PROJECTS_HOME=/nonexistent-fh-home \
|
|
1473
1598
|
bash scripts/cluster_capability_scan.sh --self-test < /dev/null 2>&1) \
|
|
1474
1599
|
&& printf '%s\n' "$_out" | grep -qE '캘리브레이션 통과: [1-9][0-9]* PASS / 0 FAIL' \
|
|
@@ -1496,6 +1621,7 @@ fi
|
|
|
1496
1621
|
if [ ! -f scripts/capability_effect_probe.sh ]; then
|
|
1497
1622
|
echo "FAIL capability_effect_probe.sh: missing — it ships via package.json files[], so absence is deletion, not package mode"
|
|
1498
1623
|
fail=1
|
|
1624
|
+
elif _shard_inline_skip "capability_effect_probe.sh --self-test"; then :
|
|
1499
1625
|
elif _out=$(bash scripts/capability_effect_probe.sh --self-test < /dev/null 2>&1) \
|
|
1500
1626
|
&& printf '%s\n' "$_out" | grep -qE '^── capability_effect_probe lanes: [1-9][0-9]* PASS / 0 FAIL ──$'; then
|
|
1501
1627
|
echo "PASS capability_effect_probe.sh --self-test ($(printf '%s\n' "$_out" | grep -oE '[0-9]+ PASS / [0-9]+ FAIL' | tail -1))"
|
|
@@ -1526,6 +1652,7 @@ fi
|
|
|
1526
1652
|
if [ ! -f scripts/relay_channel.sh ] || [ ! -f scripts/test_relay_channel_lanes.sh ]; then
|
|
1527
1653
|
echo "FAIL relay_channel.sh: missing (relay_channel.sh or its sibling test_relay_channel_lanes.sh) — ships via package.json files[], so absence is deletion, not package mode"
|
|
1528
1654
|
fail=1
|
|
1655
|
+
elif _shard_inline_skip "relay_channel.sh --self-test"; then :
|
|
1529
1656
|
elif _out=$($_LANE_TO bash scripts/relay_channel.sh --self-test < /dev/null 2>&1); then
|
|
1530
1657
|
echo "PASS relay_channel.sh --self-test ($(printf '%s\n' "$_out" | grep -oE 'relay_channel lanes: [0-9]+ PASS / [0-9]+ FAIL' | tail -1))"
|
|
1531
1658
|
else
|
|
@@ -1561,6 +1688,7 @@ fi
|
|
|
1561
1688
|
if [ ! -f scripts/directional_diff_gate.sh ]; then
|
|
1562
1689
|
echo "FAIL directional_diff_gate.sh: missing — it ships via package.json files[], so absence is deletion, not package mode"
|
|
1563
1690
|
fail=1
|
|
1691
|
+
elif _shard_inline_skip "directional_diff_gate.sh --self-test"; then :
|
|
1564
1692
|
else
|
|
1565
1693
|
_out=$($_LANE_TO bash scripts/directional_diff_gate.sh --self-test < /dev/null 2>&1); _dd_rc=$?
|
|
1566
1694
|
case "$_dd_rc" in
|
|
@@ -1620,6 +1748,7 @@ fi
|
|
|
1620
1748
|
if [ ! -f scripts/prepublish_scope_note.sh ]; then
|
|
1621
1749
|
echo "FAIL prepublish_scope_note.sh: missing — it ships via package.json files[], so absence is deletion, not package mode"
|
|
1622
1750
|
fail=1
|
|
1751
|
+
elif _shard_inline_skip "prepublish_scope_note.sh --self-test"; then :
|
|
1623
1752
|
elif _out=$(bash scripts/prepublish_scope_note.sh --self-test < /dev/null 2>&1) \
|
|
1624
1753
|
&& printf '%s\n' "$_out" | grep -qE '^ ── [1-9][0-9]* pass / 0 fail$'; then
|
|
1625
1754
|
echo "PASS prepublish_scope_note.sh --self-test ($(printf '%s\n' "$_out" | grep -oE '[0-9]+ pass / [0-9]+ fail' | tail -1))"
|
|
@@ -2626,6 +2755,24 @@ if [ -f scripts/test_selfcheck_state_lanes.sh ]; then
|
|
|
2626
2755
|
fi
|
|
2627
2756
|
fi
|
|
2628
2757
|
|
|
2758
|
+
# `--shard i/N` (2026-10-31): the plan must cover every suite exactly once, or a sharded CI run silently
|
|
2759
|
+
# drops (or doubles) a suite while every shard is green. Dry runs only — seconds, and it cannot recurse.
|
|
2760
|
+
if [ -f scripts/test_selfcheck_shard_lanes.sh ]; then
|
|
2761
|
+
if _consumer_skip test_selfcheck_shard_lanes.sh; then :
|
|
2762
|
+
elif _out=$(bash scripts/test_selfcheck_shard_lanes.sh 2>&1); then
|
|
2763
|
+
echo "PASS test_selfcheck_shard_lanes.sh (union == full plan · disjoint · known-negative · --shard absent = today)"
|
|
2764
|
+
else
|
|
2765
|
+
echo "FAIL test_selfcheck_shard_lanes.sh: the shard plan would drop or double a suite"
|
|
2766
|
+
_show_failure "$_out"
|
|
2767
|
+
fail=1
|
|
2768
|
+
fi
|
|
2769
|
+
elif _ships_per_files "scripts/test_selfcheck_shard_lanes.sh"; then
|
|
2770
|
+
echo "FAIL test_selfcheck_shard_lanes.sh: DECLARED SHIPPED (package.json files[]) but absent — deletion or broken install"
|
|
2771
|
+
fail=1
|
|
2772
|
+
else
|
|
2773
|
+
echo "SKIP test_selfcheck_shard_lanes.sh (not in this package's files[], and absent)"
|
|
2774
|
+
fi
|
|
2775
|
+
|
|
2629
2776
|
# test_lane_runner_lanes.sh — the checker that finds unrun suites had no suite of its own until
|
|
2630
2777
|
# 2026-08-13. It guarded its own WIRING (it fails when selfcheck stops calling it) and nothing
|
|
2631
2778
|
# measured its BEHAVIOUR — the shape it exists to catch, one level up. Wired in the same change
|
|
@@ -2765,7 +2912,8 @@ fi
|
|
|
2765
2912
|
# consults it before FAILing, so the two paths render SKIP regardless of how `.git` happens to be
|
|
2766
2913
|
# shaped in the consumer's tree. `[ -e .git ]` still gates whether the SCAN runs at all (an installed
|
|
2767
2914
|
# package with no tracked-refs source to lint), which is a real and unrelated question.
|
|
2768
|
-
if
|
|
2915
|
+
if _shard_inline_skip "ref-path"; then :
|
|
2916
|
+
elif [ -e ".git" ]; then
|
|
2769
2917
|
# Backtick-quoted repo-relative file refs in the always-loaded governance surface
|
|
2770
2918
|
# (CLAUDE.md + .claude/rules/*.md) must exist. Phantom-reference class recurred
|
|
2771
2919
|
# N>=3 in the 2026-06-11 audit window — instrument-not-habit.
|
|
@@ -2836,7 +2984,8 @@ fi
|
|
|
2836
2984
|
# 이고 package.json files[] 로 출하된다(소비자가 받는 기본 패턴). 초판은 «전부 ignored» 로
|
|
2837
2985
|
# 썼고 깨끗한 트리에서 그 둘에 FAIL 을 냈다 — 과차단은 override 를 훈련시키므로 결함이다.
|
|
2838
2986
|
# 남는 한 칸 «tracked 도 ignored 도 아님» 이 정확히 유출 상태다.
|
|
2839
|
-
if
|
|
2987
|
+
if _shard_inline_skip "rules-dotfile"; then :
|
|
2988
|
+
elif [ -e .git ]; then
|
|
2840
2989
|
# 🟥 «디렉터리가 없다»와 «있는데 비었다»를 한 칸으로 접지 않는다 — find 는 둘 다 빈 출력이다.
|
|
2841
2990
|
# 앞은 계기 오류(이 검사가 겨눌 자리가 없다), 뒤는 소비자 설치의 정상 상태다.
|
|
2842
2991
|
if [ ! -d .claude/rules ]; then
|
|
@@ -2889,7 +3038,7 @@ if [ "$_CONSUMER" -eq 1 ]; then
|
|
|
2889
3038
|
echo "CONSUMER PROFILE — $_n checkout-only suite(s) NOT measured here (not a pass):$CONSUMER_SKIPPED"
|
|
2890
3039
|
fi
|
|
2891
3040
|
if [ "$fail" -ne 0 ]; then
|
|
2892
|
-
echo "SELFCHECK: FAIL"
|
|
3041
|
+
echo "SELFCHECK: FAIL${_SHARD_N:+ (shard $_SHARD_I/$_SHARD_N)}"
|
|
2893
3042
|
exit 1
|
|
2894
3043
|
fi
|
|
2895
|
-
if [ "$_CONSUMER" -eq 1 ]; then echo "SELFCHECK: PASS (consumer profile)"; else echo "SELFCHECK: PASS"; fi
|
|
3044
|
+
if [ "$_CONSUMER" -eq 1 ]; then echo "SELFCHECK: PASS (consumer profile)"; else echo "SELFCHECK: PASS${_SHARD_N:+ (shard $_SHARD_I/$_SHARD_N)}"; fi
|
|
@@ -916,5 +916,68 @@ else
|
|
|
916
916
|
fi
|
|
917
917
|
rm -rf "$_s7"
|
|
918
918
|
|
|
919
|
+
# ── --staged: the scanner reads the INDEX, not the working tree (harness-doctor S-4, 2026-10-31) ──
|
|
920
|
+
# Known pair in a throwaway repo. A: smell STAGED, working tree fixed -> must be found.
|
|
921
|
+
# B: staged clean, working tree dirtied afterwards -> must NOT be found. Default mode keeps reading the tree.
|
|
922
|
+
_stg=$(mktemp -d)
|
|
923
|
+
(
|
|
924
|
+
cd "$_stg" && git init -q . && git config user.email t@t && git config user.name t
|
|
925
|
+
printf '#!/usr/bin/env bash\nr=$(run_scan) || return 0\n' > a.sh
|
|
926
|
+
printf '#!/usr/bin/env bash\nexit 1\n' > b.sh
|
|
927
|
+
git add a.sh b.sh
|
|
928
|
+
printf '#!/usr/bin/env bash\nexit 1\n' > a.sh # worktree fixed, index still smelly
|
|
929
|
+
printf '#!/usr/bin/env bash\nr=$(run_scan) || return 0\n' > b.sh # worktree smelly, index clean
|
|
930
|
+
)
|
|
931
|
+
_sa=$(cd "$_stg" && bash "$SCAN" --staged a.sh 2>&1 | grep -cE '\[S1:')
|
|
932
|
+
_sb=$(cd "$_stg" && bash "$SCAN" --staged b.sh 2>&1 | grep -cE '\[S1:')
|
|
933
|
+
_sd=$(cd "$_stg" && bash "$SCAN" b.sh 2>&1 | grep -cE '\[S1:')
|
|
934
|
+
if [ "$_sa" -eq 1 ]; then ok "STAGED POS: smell only in the index is found"; else bad "STAGED POS: index smell missed ($_sa)"; fi
|
|
935
|
+
if [ "$_sb" -eq 0 ]; then ok "STAGED NEG: smell only in the working tree is not reported"; else bad "STAGED NEG: read the working tree ($_sb)"; fi
|
|
936
|
+
if [ "$_sd" -eq 1 ]; then ok "STAGED CTL: default mode still reads the working tree (control for NEG)"; else bad "STAGED CTL: default mode changed ($_sd) — NEG UNINTERPRETABLE"; fi
|
|
937
|
+
rm -rf "$_stg"
|
|
938
|
+
# codex R1 (2026-10-31): quoted names, «nothing measured» read as clean, and target spellings.
|
|
939
|
+
_stg2=$(mktemp -d); _stg2=$(cd "$_stg2" && pwd -P)
|
|
940
|
+
(
|
|
941
|
+
cd "$_stg2" && git init -q . && git config user.email t@t && git config user.name t
|
|
942
|
+
mkdir sub
|
|
943
|
+
printf '#!/usr/bin/env bash\nr=$(run_scan) || return 0\n' > "한글.sh"
|
|
944
|
+
printf '#!/usr/bin/env bash\nr=$(run_scan) || return 0\n' > sub/c.sh
|
|
945
|
+
git add "한글.sh" sub/c.sh
|
|
946
|
+
)
|
|
947
|
+
_q=$(cd "$_stg2" && bash "$SCAN" --staged "한글.sh" 2>&1 | grep -cE '\[S1:')
|
|
948
|
+
_qa=$(cd "$_stg2" && bash "$SCAN" --staged 2>&1 | grep -cE '\[S1:')
|
|
949
|
+
_m=$(cd "$_stg2" && bash "$SCAN" --staged missing.sh 2>&1); _mrc=$?
|
|
950
|
+
_d=$(cd "$_stg2" && bash "$SCAN" --staged ./ 2>&1 | grep -cE '\[S1:')
|
|
951
|
+
_ab=$(cd "$_stg2" && bash "$SCAN" --staged "$_stg2/sub/c.sh" 2>&1 | grep -cE '\[S1:')
|
|
952
|
+
_sd2=$(cd "$_stg2/sub" && bash "$SCAN" --staged c.sh 2>&1 | grep -cE '\[S1:')
|
|
953
|
+
if [ "$_q" -eq 1 ]; then ok "STAGED Q1: non-ASCII staged name given as target is scanned"; else bad "STAGED Q1: non-ASCII name missed ($_q)"; fi
|
|
954
|
+
if [ "$_qa" -eq 2 ]; then ok "STAGED Q2: no targets reads every staged file incl. non-ASCII (2)"; else bad "STAGED Q2: expected 2 smells, got $_qa"; fi
|
|
955
|
+
if [ "$_mrc" -eq 2 ] && printf '%s' "$_m" | grep -q "COULD NOT BE MEASURED"; then ok "STAGED M1: a target matching no staged file is NOT clean (rc 2 + marker)"; else bad "STAGED M1: rc=${_mrc} «${_m}»"; fi
|
|
956
|
+
if [ "$_d" -eq 2 ]; then ok "STAGED P1: './' selects the whole index"; else bad "STAGED P1: './' gave $_d"; fi
|
|
957
|
+
if [ "$_ab" -eq 1 ]; then ok "STAGED P2: absolute path under the repo resolves"; else bad "STAGED P2: absolute path gave $_ab"; fi
|
|
958
|
+
if [ "$_sd2" -eq 1 ]; then ok "STAGED P3: path relative to a subdir cwd resolves"; else bad "STAGED P3: subdir-relative gave $_sd2"; fi
|
|
959
|
+
rm -rf "$_stg2"
|
|
960
|
+
# codex R2 (2026-10-31): unsupported types, symlinked absolute paths, one unmatched target among matched.
|
|
961
|
+
_stg3=$(mktemp -d); _stg3p=$(cd "$_stg3" && pwd -P)
|
|
962
|
+
(
|
|
963
|
+
cd "$_stg3" && git init -q . && git config user.email t@t && git config user.name t
|
|
964
|
+
mkdir sub
|
|
965
|
+
printf 'x\n' > gate.js
|
|
966
|
+
printf '#!/usr/bin/env bash\nr=$(run_scan) || return 0\n' > sub/a.sh
|
|
967
|
+
printf '#!/usr/bin/env bash\nexit 1\n' > clean.sh
|
|
968
|
+
git add gate.js sub/a.sh clean.sh
|
|
969
|
+
)
|
|
970
|
+
_js=$(cd "$_stg3" && bash "$SCAN" --staged gate.js 2>&1); _jsrc=$?
|
|
971
|
+
_jsd=$(cd "$_stg3" && bash "$SCAN" gate.js 2>&1); _jsdrc=$?
|
|
972
|
+
_ln=""; [ "$_stg3" != "$_stg3p" ] && _ln="$_stg3"; [ -z "$_ln" ] && { ln -s "$_stg3p" "$_stg3p.lnk"; _ln="$_stg3p.lnk"; }
|
|
973
|
+
_sy=$(cd "$_stg3p" && bash "$SCAN" --staged "$_ln/sub/a.sh" clean.sh 2>&1 | grep -cE '\[S1:')
|
|
974
|
+
_dt=$(cd "$_stg3p" && bash "$SCAN" --staged sub/./a.sh clean.sh 2>&1 | grep -cE '\[S1:')
|
|
975
|
+
_um=$(cd "$_stg3p" && bash "$SCAN" --staged clean.sh nope.sh 2>&1); _umrc=$?
|
|
976
|
+
if [ "$_jsrc" -eq "$_jsdrc" ] && [ "$_jsrc" -ne 0 ]; then ok "STAGED U1: unsupported staged file exits like the default mode (rc ${_jsrc}, not 0)"; else bad "STAGED U1: staged rc=${_jsrc} default rc=${_jsdrc}"; fi
|
|
977
|
+
if [ "$_sy" -eq 1 ]; then ok "STAGED S1: symlinked absolute path resolves to the physical repo path"; else bad "STAGED S1: symlinked path gave ${_sy}"; fi
|
|
978
|
+
if [ "$_dt" -eq 1 ]; then ok "STAGED S2: sub/./a.sh resolves"; else bad "STAGED S2: sub/./a.sh gave ${_dt}"; fi
|
|
979
|
+
if [ "$_umrc" -eq 2 ] && printf '%s' "$_um" | grep -q "COULD NOT BE MEASURED"; then ok "STAGED S3: one unmatched target among matched ones is NOT clean"; else bad "STAGED S3: rc=${_umrc}"; fi
|
|
980
|
+
rm -rf "$_stg3" "$_stg3p.lnk"
|
|
981
|
+
|
|
919
982
|
echo "degrade-scan shell probes: $pass passed, $fail failed"
|
|
920
983
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_digest_slow_leg_lanes.sh — digest_slow_leg.py known-pair (thin wrapper; lanes live in the python).
|
|
3
|
+
# RSS + Atom listed then 0 new · missing feed = UNREACHABLE (never 0) · empty feed = PARSE-ZERO
|
|
4
|
+
# · first sighting seeds instead of dumping · youtube RSS dead -> yt-dlp names its transport
|
|
5
|
+
# · both youtube transports dead -> UNREACHABLE · invalid source kind rejected. Offline (file:// + stubs).
|
|
6
|
+
# exit: 0 all lanes PASS · 1 a lane failed · 10 harness error (python3 absent)
|
|
7
|
+
set -uo pipefail
|
|
8
|
+
SRC="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
+
command -v python3 >/dev/null 2>&1 || {
|
|
10
|
+
echo "harness error: python3 absent -- cannot measure. Not a pass." >&2; exit 10; }
|
|
11
|
+
python3 "$SRC/digest_slow_leg.py" --self-test
|
|
@@ -48,6 +48,7 @@ case "\$1 \$2" in
|
|
|
48
48
|
else echo "MERGED \$(cat "\$D/head.oid")"; fi
|
|
49
49
|
elif [ -f "\$D/closed" ]; then echo "CLOSED \$(cat "\$D/head.oid")"
|
|
50
50
|
else echo "OPEN \$(cat "\$D/head.oid")"; fi ;;
|
|
51
|
+
*title*) echo "Fake PR title" ;;
|
|
51
52
|
*headRefOid*) cat "\$D/head.oid"; echo ;;
|
|
52
53
|
*state*) if [ -f "\$D/merge.oid" ] && [ ! -f "\$D/queued" ]; then echo MERGED; else echo OPEN; fi ;;
|
|
53
54
|
*mergeCommit*) if [ -f "\$D/queued" ]; then echo null; else cat "\$D/merge.oid" 2>/dev/null; echo; fi ;; esac ;;
|
|
@@ -194,5 +195,37 @@ SETUP_EXTRA=1 setup cvd; mkgh "$T/cvd"; run "$T/cvd" 7 --rerun 'git --version &&
|
|
|
194
195
|
{ [ "$RC" -eq 0 ] && printf '%s' "$OUT" | grep -q 'mentions none of this PR'; } \
|
|
195
196
|
&& ok "L25b --rerun naming a tracked dir → advisory still fires (blobs only)" || bad "L25b rc=$RC (dir listing counted as coverage?)"
|
|
196
197
|
|
|
198
|
+
# ── completion record (tracks/_meta/fh_completed_<date>.md) ──
|
|
199
|
+
# cl_setup <name> : a work clone that HAS a tracks/ dir (a consumer without one is skipped silently — L30)
|
|
200
|
+
cl_setup() { setup "$1"; mkgh "$T/$1"; mkdir -p "$T/$1/work/tracks"; }
|
|
201
|
+
cl_file() { echo "$T/$1/work/tracks/_meta/fh_completed_$(date +%F).md"; }
|
|
202
|
+
cl_lines() { [ -f "$(cl_file "$1")" ] && grep -c '^- .* PR #7 ' "$(cl_file "$1")" || echo 0; }
|
|
203
|
+
# L26 merged + verified → exactly one line, says verified, carries title and short merge sha
|
|
204
|
+
cl_setup c1; run "$T/c1" 7 --rerun "$GOOD"
|
|
205
|
+
{ [ "$RC" -eq 0 ] && [ "$(cl_lines c1)" -eq 1 ] && grep -q 'PR #7 Fake PR title → merged '"$(cut -c1-7 "$T/c1/merge.oid")"' (verified) — auto$' "$(cl_file c1)" \
|
|
206
|
+
&& awk 'NR==1{exit !/^# /}' "$(cl_file c1)"; } \
|
|
207
|
+
&& ok "L26 merged+verified → one completion line (verified · sha · title) + header" || { bad "L26 rc=$RC"; cat "$(cl_file c1)" 2>/dev/null; }
|
|
208
|
+
# L27 merged + verification failed → one line saying verify-failed, rc unchanged (1)
|
|
209
|
+
cl_setup c2; : > "$T/c2/drop_b"; run "$T/c2" 7 --rerun 'grep -q a2 a && echo a-ok'
|
|
210
|
+
{ [ "$RC" -eq 1 ] && [ "$(cl_lines c2)" -eq 1 ] && grep -q '(verify-failed rc=1)' "$(cl_file c2)"; } \
|
|
211
|
+
&& ok "L27 merged+verify-failed → one line «verify-failed», rc=1" || { bad "L27 rc=$RC"; cat "$(cl_file c2)" 2>/dev/null; }
|
|
212
|
+
# L28 merge refused (gh fails, PR stays OPEN) and queued (not completed) → no line
|
|
213
|
+
cl_setup c3; : > "$T/c3/merge_fail"; run "$T/c3" 7 --rerun "$GOOD"; rc3=$RC
|
|
214
|
+
cl_setup c3q; : > "$T/c3q/queued"; run "$T/c3q" 7 --rerun "$GOOD"; rc3q=$RC
|
|
215
|
+
{ [ "$rc3" -eq 5 ] && [ "$rc3q" -eq 6 ] && [ ! -e "$(cl_file c3)" ] && [ ! -e "$(cl_file c3q)" ]; } \
|
|
216
|
+
&& ok "L28 merge refused / queued → no completion line" || bad "L28 rc=$rc3/$rc3q file written for a merge that did not complete"
|
|
217
|
+
# L29 opt-out FH_MERGE_NO_COMPLETED_LOG=1 → merge verified as usual, no line
|
|
218
|
+
cl_setup c4; FH_MERGE_NO_COMPLETED_LOG=1 run "$T/c4" 7 --rerun "$GOOD"
|
|
219
|
+
{ [ "$RC" -eq 0 ] && [ ! -e "$(cl_file c4)" ]; } && ok "L29 opt-out env → no line, rc=0" || bad "L29 rc=$RC"
|
|
220
|
+
# L30 repo without tracks/ → silent skip (nothing created, no warning)
|
|
221
|
+
setup c5; mkgh "$T/c5"; run "$T/c5" 7 --rerun "$GOOD"
|
|
222
|
+
{ [ "$RC" -eq 0 ] && [ ! -e "$T/c5/work/tracks" ] && ! printf '%s' "$OUT" | grep -q 'completion record'; } \
|
|
223
|
+
&& ok "L30 no tracks/ dir → skipped silently, tracks/ not created" || bad "L30 rc=$RC"
|
|
224
|
+
# L31 unwritable tracks/_meta → one warning, same rc as without the feature (0), merge stands
|
|
225
|
+
cl_setup c6; mkdir -p "$T/c6/work/tracks/_meta"; chmod 500 "$T/c6/work/tracks/_meta"; run "$T/c6" 7 --rerun "$GOOD"; chmod 700 "$T/c6/work/tracks/_meta"
|
|
226
|
+
if [ "$(id -u)" -eq 0 ]; then ok "L31 SKIP (root can write anywhere) — not a pass"
|
|
227
|
+
else { [ "$RC" -eq 0 ] && printf '%s' "$OUT" | grep -q 'WARNING: completion record NOT written' && printf '%s' "$OUT" | grep -q 'merged and verified'; } \
|
|
228
|
+
&& ok "L31 unwritable tracks/_meta → warning, rc=0 unchanged" || { bad "L31 rc=$RC"; printf '%s\n' "$OUT" | tail -3; }; fi
|
|
229
|
+
|
|
197
230
|
printf 'PASS %d · FAIL %d\n' "$PASS" "$FAIL"
|
|
198
231
|
[ "$FAIL" -eq 0 ]
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_selfcheck_shard_lanes.sh — known-pair anchor for `selfcheck.sh --shard i/N`.
|
|
3
|
+
#
|
|
4
|
+
# WHAT IS PROVED, and how (every claim below is a lane, with a control that can fail):
|
|
5
|
+
# S1 bad --shard arguments are refused with rc 2 and run nothing (not a pass).
|
|
6
|
+
# S2 UNION: the suites shard 1..N run are exactly the suites an unsharded plan (1/1) runs.
|
|
7
|
+
# S3 DISJOINT: no suite basename is run by two shards.
|
|
8
|
+
# S4 NON-VACUOUS: the full set is large and contains a suite we know is wired (a lane that
|
|
9
|
+
# compares two empty sets passes — the control is a fact about the target, not the shim).
|
|
10
|
+
# S5 KNOWN-NEGATIVE: the same duplicate/union detector, pointed at a selfcheck whose assignment is
|
|
11
|
+
# broken on purpose (every shard "owns" every suite), must go RED. A detector that cannot fail
|
|
12
|
+
# proves nothing about S2/S3.
|
|
13
|
+
# S6 --shard ABSENT = today: the lifted helper block defines no `bash` function and every helper
|
|
14
|
+
# answers "run it".
|
|
15
|
+
# S7 every shard owns at least one suite for N in 2..4 (an empty shard is a wasted runner and a
|
|
16
|
+
# sign the plan collapsed).
|
|
17
|
+
# The runs are DRY (`--shard-dry`): nothing is executed, the decision is appended to $FH_SHARD_TRACE.
|
|
18
|
+
# So this suite costs seconds, and it cannot recurse into itself (a dry run never runs a suite).
|
|
19
|
+
set -u
|
|
20
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
21
|
+
ROOT="$(cd "$HERE/.." && pwd)"
|
|
22
|
+
SC="$ROOT/scripts/selfcheck.sh"
|
|
23
|
+
[ -f "$SC" ] || { echo "FAIL selfcheck shard lanes: subject $SC missing"; exit 1; }
|
|
24
|
+
T=$(mktemp -d "${TMPDIR:-/tmp}/shardlanes.XXXXXX") || { echo "HARNESS ERROR mktemp -d failed — lanes NOT run (not a pass)"; exit 10; }
|
|
25
|
+
: "${T:?}"
|
|
26
|
+
trap 'rm -rf "$T"' EXIT
|
|
27
|
+
pass=0; failn=0
|
|
28
|
+
chk() { # chk <rc> <label>
|
|
29
|
+
if [ "$1" -eq 0 ]; then pass=$((pass + 1)); echo " ✅ $2"; else failn=$((failn + 1)); echo " ❌ $2"; fi
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
# plan <selfcheck> <root> <i> <N> <out> — one dry run; the trace file is the evidence.
|
|
33
|
+
plan() {
|
|
34
|
+
: > "$5"
|
|
35
|
+
( cd "$2" && env -u FH_SELFCHECK_SHARD FH_SHARD_TRACE="$5" bash "$1" --shard "$3/$4" --shard-dry >/dev/null 2>&1 )
|
|
36
|
+
}
|
|
37
|
+
names() { awk '$1 == "RUN" { print $2 }' "$1" | LC_ALL=C sort -u; }
|
|
38
|
+
|
|
39
|
+
# ── S1 argument validation ────────────────────────────────────────────────────────────────────
|
|
40
|
+
for bad in 0/4 5/4 2 x/4 2/x 1/0 "" 01/4 /4 1/04 999/1000; do # 01/4 · /4 · 1/04 · 999/1000 = codex R1 2026-10-31 (ran nothing, printed PASS)
|
|
41
|
+
out=$(cd "$ROOT" && env -u FH_SELFCHECK_SHARD bash "$SC" --shard "$bad" --shard-dry 2>&1); rc=$?
|
|
42
|
+
[ "$rc" -eq 2 ] && printf '%s' "$out" | grep -q 'HARNESS ERROR'; chk $? "S1 --shard '$bad' refused with rc 2 and a HARNESS ERROR line (rc=$rc)"
|
|
43
|
+
done
|
|
44
|
+
|
|
45
|
+
# ── S2 / S3 / S4 / S7 union and disjointness ────────────────────────────────────────────────
|
|
46
|
+
full="$T/full.txt"; plan "$SC" "$ROOT" 1 1 "$full"
|
|
47
|
+
names "$full" > "$T/full.names"
|
|
48
|
+
nfull=$(wc -l < "$T/full.names" | tr -d ' ')
|
|
49
|
+
[ "$nfull" -ge 100 ]; chk $? "S4 control: the unsharded plan names $nfull suites (>= 100 — a plan of 0 would make S2/S3 vacuous)"
|
|
50
|
+
grep -qx 'test_mutation_probe_lanes.sh' "$T/full.names"; chk $? "S4 control: a suite known to be wired (test_mutation_probe_lanes.sh) is in the plan"
|
|
51
|
+
grep -qx 'test_selfcheck_shard_lanes.sh' "$T/full.names"; chk $? "S4 control: this suite is itself in the plan (an unwired anchor is prose)"
|
|
52
|
+
|
|
53
|
+
# check_split <selfcheck> <root> <N> <tag> → rc 0 iff union == full AND disjoint AND (all non-empty)
|
|
54
|
+
check_split() {
|
|
55
|
+
local sc="$1" root="$2" n="$3" tag="$4" i u_ok=0 dup_ok=0 empty_ok=0
|
|
56
|
+
: > "$T/$tag.all"
|
|
57
|
+
for i in $(seq 1 "$n"); do
|
|
58
|
+
plan "$sc" "$root" "$i" "$n" "$T/$tag.$i.trace"
|
|
59
|
+
names "$T/$tag.$i.trace" > "$T/$tag.$i.names"
|
|
60
|
+
[ -s "$T/$tag.$i.names" ] || empty_ok=1
|
|
61
|
+
cat "$T/$tag.$i.names" >> "$T/$tag.all"
|
|
62
|
+
done
|
|
63
|
+
LC_ALL=C sort "$T/$tag.all" | LC_ALL=C uniq -d > "$T/$tag.dups"
|
|
64
|
+
[ -s "$T/$tag.dups" ] && dup_ok=1
|
|
65
|
+
LC_ALL=C sort -u "$T/$tag.all" > "$T/$tag.union"
|
|
66
|
+
cmp -s "$T/$tag.union" "$T/full.names" || u_ok=1
|
|
67
|
+
SPLIT_UNION_BAD=$u_ok; SPLIT_DUP=$dup_ok; SPLIT_EMPTY=$empty_ok
|
|
68
|
+
[ $u_ok -eq 0 ] && [ $dup_ok -eq 0 ] && [ $empty_ok -eq 0 ]
|
|
69
|
+
}
|
|
70
|
+
for n in 2 3 4; do
|
|
71
|
+
check_split "$SC" "$ROOT" "$n" "n$n"
|
|
72
|
+
[ "$SPLIT_UNION_BAD" -eq 0 ]; chk $? "S2 N=$n: union of shards 1..$n == the unsharded plan ($(wc -l < "$T/n$n.union" | tr -d ' ') suites)"
|
|
73
|
+
[ "$SPLIT_DUP" -eq 0 ]; chk $? "S3 N=$n: no suite runs in two shards ($(wc -l < "$T/n$n.dups" | tr -d ' ') duplicated)"
|
|
74
|
+
[ "$SPLIT_EMPTY" -eq 0 ]; chk $? "S7 N=$n: every shard owns at least one suite"
|
|
75
|
+
done
|
|
76
|
+
|
|
77
|
+
# ── S5 known-negative: break the assignment, the same detector must go red ───────────────────
|
|
78
|
+
# The mutant lives in a scratch tree of symlinks (selfcheck cd's to its own parent, so a copy has to sit
|
|
79
|
+
# under a root that looks like the repo). Nothing is written into the real tree.
|
|
80
|
+
MR="$T/mutroot"; mkdir -p "$MR/scripts"
|
|
81
|
+
for e in "$ROOT"/* "$ROOT"/.[!.]*; do
|
|
82
|
+
[ -e "$e" ] || continue
|
|
83
|
+
b=$(basename "$e"); [ "$b" = scripts ] && continue
|
|
84
|
+
ln -s "$e" "$MR/$b"
|
|
85
|
+
done
|
|
86
|
+
for e in "$ROOT"/scripts/*; do
|
|
87
|
+
b=$(basename "$e"); [ "$b" = selfcheck.sh ] && continue
|
|
88
|
+
ln -s "$e" "$MR/scripts/$b"
|
|
89
|
+
done
|
|
90
|
+
# the one-line break: every shard owns every suite
|
|
91
|
+
sed 's|^ _shard_mine() { .*$| _shard_mine() { return 0; }|' "$SC" > "$MR/scripts/selfcheck.sh"
|
|
92
|
+
cmp -s "$SC" "$MR/scripts/selfcheck.sh" && echo " (!) mutant identical to subject — the _shard_mine line moved; S5 below is void"
|
|
93
|
+
cmp -s "$SC" "$MR/scripts/selfcheck.sh"; chk $((1 - $?)) "S5 control: the mutation was APPLIED (mutant differs from subject)"
|
|
94
|
+
check_split "$MR/scripts/selfcheck.sh" "$MR" 3 mut
|
|
95
|
+
[ "$SPLIT_DUP" -eq 1 ]; chk $? "S5 known-negative: with every shard owning every suite the duplicate detector goes RED"
|
|
96
|
+
|
|
97
|
+
# ── S6 --shard absent = today ────────────────────────────────────────────────────────────────
|
|
98
|
+
START=$(grep -n '^# ── --shard i/N' "$SC" | head -1 | cut -d: -f1)
|
|
99
|
+
END=$(grep -n '^ _shard_inline_skip() { return 1; }' "$SC" | head -1 | cut -d: -f1)
|
|
100
|
+
if [ -z "$START" ] || [ -z "$END" ]; then
|
|
101
|
+
chk 1 "S6 the shard block markers are still in selfcheck.sh (lane would test nothing)"
|
|
102
|
+
else
|
|
103
|
+
sed -n "${START},$((END + 1))p" "$SC" > "$T/block.sh"
|
|
104
|
+
res=$(cd "$ROOT" && env -u FH_SELFCHECK_SHARD bash -c '
|
|
105
|
+
set -u
|
|
106
|
+
f="$1"; set -- # no arguments, as `npm test` calls it
|
|
107
|
+
. "$f"
|
|
108
|
+
if declare -F bash >/dev/null 2>&1; then echo "BASH-SHADOWED"; fi
|
|
109
|
+
_shard_inline; echo "inline=$?"
|
|
110
|
+
_shard_mine anything; echo "mine=$?"
|
|
111
|
+
_shard_skip anything; echo "skip=$?"
|
|
112
|
+
_shard_inline_skip x; echo "inlineskip=$?"
|
|
113
|
+
' _ "$T/block.sh" 2>&1)
|
|
114
|
+
# control for the line below: the SAME block with --shard given must define the shim (else "absent" is vacuous)
|
|
115
|
+
resS=$(cd "$ROOT" && env -u FH_SELFCHECK_SHARD bash -c 'f="$1"; shift; set -- --shard 2/4 --shard-dry; . "$f"; declare -F bash >/dev/null 2>&1 && echo BASH-SHADOWED' _ "$T/block.sh" 2>&1)
|
|
116
|
+
printf '%s' "$resS" | grep -q 'BASH-SHADOWED'; chk $? "S6 control: with --shard 2/4 the same block DOES define the bash shim"
|
|
117
|
+
printf '%s' "$res" | grep -q 'BASH-SHADOWED'; chk $((1 - $?)) "S6 without --shard no function named bash exists"
|
|
118
|
+
printf '%s' "$res" | grep -qx 'inline=0'; chk $? "S6 without --shard inline checks run"
|
|
119
|
+
printf '%s' "$res" | grep -qx 'mine=0'; chk $? "S6 without --shard every suite is mine"
|
|
120
|
+
printf '%s' "$res" | grep -qx 'skip=1'; chk $? "S6 without --shard nothing is skipped"
|
|
121
|
+
printf '%s' "$res" | grep -qx 'inlineskip=1'; chk $? "S6 without --shard no inline check is skipped"
|
|
122
|
+
fi
|
|
123
|
+
|
|
124
|
+
# ── notes (printed, never a verdict) ────────────────────────────────────────────────────────
|
|
125
|
+
if [ -f "$ROOT/scripts/selfcheck_shard_weights.txt" ]; then
|
|
126
|
+
awk 'NF >= 2 && $1 ~ /^[0-9.]+$/ && $2 != "@inline" { print $2 }' "$ROOT/scripts/selfcheck_shard_weights.txt" | LC_ALL=C sort -u > "$T/w.names"
|
|
127
|
+
stale=$(comm -13 "$T/full.names" "$T/w.names" | wc -l | tr -d ' ')
|
|
128
|
+
unlisted=$(comm -23 "$T/full.names" "$T/w.names" | wc -l | tr -d ' ')
|
|
129
|
+
echo " NOTE weights file: $(wc -l < "$T/w.names" | tr -d ' ') rows · $stale name(s) no longer in the plan · $unlisted suite(s) unlisted (placed by hash)"
|
|
130
|
+
else
|
|
131
|
+
echo " NOTE no scripts/selfcheck_shard_weights.txt — every suite is placed by hash"
|
|
132
|
+
fi
|
|
133
|
+
|
|
134
|
+
echo "════ lanes: $pass passed · $failn failed ════"
|
|
135
|
+
[ "$failn" -eq 0 ]
|
|
@@ -3120,7 +3120,7 @@ if [ -n "$LOADBEARING" ]; then
|
|
|
3120
3120
|
# advisory result, :542) and for "files could not be measured" (_FORCE_NONCLEAN=2, :548) —
|
|
3121
3121
|
# codex cross-family catch on the first draft of this fix, which printed "DID NOT complete"
|
|
3122
3122
|
# for a completed scan that merely found smells. Discriminate by the output markers.
|
|
3123
|
-
_dd_raw=$(bash "$DDSCAN" "${_dd_targets[@]}" 2>/dev/null); _dd_rc=$?
|
|
3123
|
+
_dd_raw=$(bash "$DDSCAN" --staged "${_dd_targets[@]}" 2>/dev/null); _dd_rc=$?
|
|
3124
3124
|
_dd=$(printf '%s\n' "$_dd_raw" | grep -Ff <(printf '%s\n' "$LOADBEARING") 2>/dev/null | head -5 || true)
|
|
3125
3125
|
_dd_unm=$(printf '%s\n' "$_dd_raw" | grep -c "COULD NOT BE MEASURED" || true); _dd_unm=${_dd_unm:-0}
|
|
3126
3126
|
if [ "$_dd_unm" -gt 0 ]; then
|