@chrono-meta/fh-gate 2.7.0 → 2.9.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/rules/fh_4axis_gate.md +33 -5
- package/.claude-plugin/marketplace.json +2 -2
- package/AGENTS.md +4 -0
- package/CLAUDE.md +169 -183
- package/README.ja.md +157 -53
- package/README.ko.md +147 -50
- package/README.md +136 -50
- package/README.zh.md +137 -46
- package/docs/ETHOS.md +20 -8
- package/docs/GATE_DAY.md +235 -0
- package/docs/OUTPUT_EVIDENCE.md +13 -2
- package/docs/codex-compat.md +10 -2
- package/knowledge/shared/dialogue/ai_dialogue_playbook.md +131 -0
- package/knowledge/shared/harness-core/agents_md_runtime_details.md +10 -3
- package/knowledge/shared/harness-core/claude_md_gate_details.md +90 -0
- package/knowledge/shared/harness-core/dispatch_conditional_prohibition.md +75 -0
- package/knowledge/shared/harness-core/fh_three_layer_canon.md +97 -5
- package/knowledge/shared/harness-core/field_verdict_crossfamily_gate.md +96 -5
- package/knowledge/shared/harness-core/harness_incubator_doctrine.md +6 -1
- package/knowledge/shared/harness-core/ship_readiness_gate.md +2 -2
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +137 -0
- package/knowledge/shared/rules/multi_session_close_protocol.md +15 -4
- package/package.json +12 -2
- 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 +116 -0
- package/plugins/fh-meta/skills/cross-ecosystem-synergy-detection/SKILL.md +127 -0
- package/scripts/branch_claim.sh +3 -1
- package/scripts/chamber_candidate_collect.sh +71 -13
- package/scripts/listing_watch.sh +187 -0
- package/scripts/mapped_tracks.sh +113 -0
- package/scripts/package_coverage_check.sh +54 -0
- package/scripts/prior_art_prompt.sh +49 -2
- package/scripts/selfcheck.sh +44 -1
- package/scripts/session_close_check.sh +56 -3
- package/scripts/test_chamber_sig_lanes.sh +151 -0
- package/scripts/test_leak_scan_control_lanes.sh +163 -0
- package/scripts/test_listing_watch_lanes.sh +162 -0
- package/scripts/test_mapped_tracks_lanes.sh +162 -0
- package/scripts/test_peer_worktree_detect_lanes.sh +138 -0
- package/scripts/test_prepush_destructive_lanes.sh +366 -0
- package/scripts/test_prior_art_prompt_lanes.sh +48 -0
- package/scripts/test_regression_guard_ci_lanes.sh +124 -0
- package/scripts/test_wizard_snippet_merge_lanes.sh +40 -0
- package/templates/predelete_check.test.sh +56 -0
- package/templates/regression_guard.sh +75 -3
- package/templates/settings.PriorArt.snippet.json +41 -12
package/scripts/selfcheck.sh
CHANGED
|
@@ -531,17 +531,30 @@ fi
|
|
|
531
531
|
# test_capability_entrypoint_shipping.sh pins two (degrade_probe_capability.sh and
|
|
532
532
|
# psa_probe_capability.sh); degrade is named here as the sentinel — the suite itself checks both and
|
|
533
533
|
# fails if either is gone, so nothing is lost by not listing both in this table.
|
|
534
|
+
# test_script_caller_ratchet_lanes.sh is the second of that shape: it pins BOTH
|
|
535
|
+
# scripts/script_caller_ratchet.sh (the checker) and scripts/ratchet_base_resolve.sh (the base
|
|
536
|
+
# resolver its L24–L26 lanes execute), and it hard-exits 1 naming the missing file if either is
|
|
537
|
+
# gone. The checker is the sentinel because it is the one whose absence means the gate itself is
|
|
538
|
+
# gone; the resolver's absence is a narrower failure the suite still reports by name. Neither
|
|
539
|
+
# script ships — both, and this anchor, are declared in package_coverage_check.sh ACCEPTED_ABSENT.
|
|
540
|
+
# On a consumer install the SUBJECT arm fires first and `_ships_per_files` returns 1, so the row
|
|
541
|
+
# resolves to "SKIP (subject not in files[], and absent)" — the anchor arm is never reached.
|
|
534
542
|
_LANE_TO=""; command -v timeout >/dev/null 2>&1 && _LANE_TO="timeout 300"
|
|
535
543
|
for _pair in \
|
|
536
544
|
"scripts/degrade_probe_capability.sh|scripts/test_capability_entrypoint_shipping.sh" \
|
|
537
545
|
"scripts/chamber_run.sh|scripts/test_chamber_run_lanes.sh" \
|
|
546
|
+
"scripts/chamber_candidate_collect.sh|scripts/test_chamber_sig_lanes.sh" \
|
|
538
547
|
"scripts/destructive_pre_gate.sh|scripts/test_destructive_pre_gate_lanes.sh" \
|
|
548
|
+
"templates/.git-hooks/pre-push|scripts/test_prepush_destructive_lanes.sh" \
|
|
549
|
+
"templates/.git-hooks/pre-push|scripts/test_prepush_destructive_liveness.sh" \
|
|
550
|
+
"scripts/session_close_check.sh|scripts/test_peer_worktree_detect_lanes.sh" \
|
|
539
551
|
"scripts/env_purity_scan.sh|scripts/test_env_purity_lanes.sh" \
|
|
540
552
|
"scripts/frontier_digest_daily.sh|scripts/test_frontier_digest_retry.sh" \
|
|
541
553
|
"scripts/knowledge_seam_check.sh|scripts/test_knowledge_seam_lanes.sh" \
|
|
542
554
|
"templates/.git-hooks/pre-commit|scripts/test_marker_crossfamily_lanes.sh" \
|
|
543
555
|
"templates/.git-hooks/pre-commit|scripts/test_marker_floor_lanes.sh" \
|
|
544
556
|
".github/workflows/regression-guard.yml|scripts/test_regression_guard_ci_lanes.sh" \
|
|
557
|
+
".github/workflows/validate.yml|scripts/test_leak_scan_control_lanes.sh" \
|
|
545
558
|
"templates/.git-hooks/pre-commit|scripts/test_marker_standpoint_lanes.sh" \
|
|
546
559
|
"templates/.git-hooks/pre-commit|scripts/test_marker_thirdparty_lanes.sh" \
|
|
547
560
|
"templates/.git-hooks/pre-commit|scripts/test_marker_soul_check_lanes.sh" \
|
|
@@ -549,7 +562,9 @@ for _pair in \
|
|
|
549
562
|
"scripts/reviewer_capability_corpus.tsv|scripts/test_reviewer_capability_conformance.sh" \
|
|
550
563
|
"scripts/field_canon_preload.sh|scripts/test_field_canon_lanes.sh" \
|
|
551
564
|
"scripts/stale_clone_guard.sh|scripts/test_stale_clone_guard_lanes.sh" \
|
|
552
|
-
"plugins/fh-commons/skills/ko-tech-writer/SKILL.md|scripts/test_ko_tech_writer_lanes.sh"
|
|
565
|
+
"plugins/fh-commons/skills/ko-tech-writer/SKILL.md|scripts/test_ko_tech_writer_lanes.sh" \
|
|
566
|
+
"scripts/script_caller_ratchet.sh|scripts/test_script_caller_ratchet_lanes.sh" \
|
|
567
|
+
"scripts/mapped_tracks.sh|scripts/test_mapped_tracks_lanes.sh"
|
|
553
568
|
do
|
|
554
569
|
_subj="${_pair%%|*}"; _anc="${_pair##*|}"; _lbl="${_anc##*/}"
|
|
555
570
|
if [ ! -f "$_subj" ]; then
|
|
@@ -1064,10 +1079,38 @@ else
|
|
|
1064
1079
|
fail=1
|
|
1065
1080
|
fi
|
|
1066
1081
|
|
|
1082
|
+
# listing_watch — 같은 형태. 🟥 이 블록을 «레인을 짓는 같은 커밋에서» 붙인다: 바로 위 주석이
|
|
1083
|
+
# 기록한 「레인은 지었는데 selfcheck 배선을 안 했다」 재발이 **최소 다섯 번**이고, 그 다섯 다 CI 나
|
|
1084
|
+
# lane-runner 가 뒤늦게 잡았다. 순서를 바꾸는 것이 유일한 처방이라 여기서 그렇게 한다.
|
|
1085
|
+
# 🟥 **2026-08-23 정정 — 「세 번」은 stale 이었다. 그리고 숫자보다 함의가 중요하다**: 네 번째는
|
|
1086
|
+
# 2026-08-22 에 났는데, **이 주석 바로 아래에서** 났다. 처방이 «읽히는 자리»에 있었는데도 재발한
|
|
1087
|
+
# 것이다. ⇒ 「주석을 더 잘 쓰자」가 아니라 **「살리언스로는 이 축이 안 닫힌다」**의 근거다.
|
|
1088
|
+
# (회수 경위: 그 관측은 폐기된 워크트리 사본에만 있었고, peer 세션이 버리기 전에 건져 올렸다.)
|
|
1089
|
+
# 🟥 **다섯 번째 = 바로 이 주석을 「네 번」으로 고친 그 커밋 자신이다** (2026-08-23, CI 적발).
|
|
1090
|
+
# 그 델타가 `:546` 의 `chamber_candidate_collect.sh|test_chamber_sig_lanes.sh` 배선 한 줄을
|
|
1091
|
+
# **의도 없이 지웠고**, 레인 파일은 그대로 남아 lane-runner 가 「돌리는 게 없는 스위트」로
|
|
1092
|
+
# 잡았다. 즉 **이 축을 서술하는 행위가 이 축의 다음 사례를 생산했다.** 자력 적발 0.
|
|
1093
|
+
# ⚠️ 이번 것은 앞의 넷과 형태가 하나 다르다 — 앞의 넷은 «배선을 안 붙였다»(누락)인데
|
|
1094
|
+
# 이건 «있던 배선을 지웠다»(회귀)다. 같은 계기(lane-runner)가 둘 다 잡았으므로 한 카운터에
|
|
1095
|
+
# 두지만, 처방이 갈릴 수 있다는 뜻이므로 접지 말고 여기 적어 둔다.
|
|
1096
|
+
if [ ! -f scripts/listing_watch.sh ]; then
|
|
1097
|
+
echo "FAIL scripts/listing_watch.sh is in package.json files[] but absent — a deleted subject, not a skip"
|
|
1098
|
+
fail=1
|
|
1099
|
+
elif [ -f scripts/test_listing_watch_lanes.sh ]; then
|
|
1100
|
+
if ! bash scripts/test_listing_watch_lanes.sh; then
|
|
1101
|
+
fail=1
|
|
1102
|
+
fi
|
|
1103
|
+
else
|
|
1104
|
+
echo "FAIL test_listing_watch_lanes.sh: listing_watch.sh present but its anchor is missing"
|
|
1105
|
+
fail=1
|
|
1106
|
+
fi
|
|
1107
|
+
|
|
1067
1108
|
# residency_admission — 같은 형태. 🟥 그리고 **또 같은 얼굴이었다**: 2026-08-20 에 이 레인을
|
|
1068
1109
|
# 지으면서 여기 배선을 안 했고, `lane-runner` 가 «돌리는 게 없는 스위트는 산문이다» 로 CI 에서
|
|
1069
1110
|
# 잡았다. 아래 target_freeze 주석이 기록한 그 형태의 **최소 세 번째**다 — 즉 이건 개인 부주의가
|
|
1070
1111
|
# 아니라 «레인을 짓는 사람이 배선 지점을 안 본다» 는 구조적 순서 문제다.
|
|
1112
|
+
# ⚠️ 2026-08-23: 그 뒤 **네 번째**가 났다(위 listing_watch 주석 참조). 이 «세 번째»는 시점 기록이라
|
|
1113
|
+
# 그대로 두고, 누계는 위 주석이 갱신본이다 — 두 곳에 같은 카운터를 두면 하나는 반드시 낡는다.
|
|
1071
1114
|
if [ ! -f scripts/residency_admission_check.sh ]; then
|
|
1072
1115
|
echo "FAIL scripts/residency_admission_check.sh is wired into pre-commit but absent — a deleted subject, not a skip"
|
|
1073
1116
|
fail=1
|
|
@@ -139,6 +139,12 @@ if [ -z "${CLAUDE_CODE_CHILD_SESSION:-}${CLAUDE_CODE_AGENT:-}" ] && [ "${FH_PEER
|
|
|
139
139
|
: # solo/top-level surface — ①-c is out of scope here, and silence is the correct output
|
|
140
140
|
else
|
|
141
141
|
PEER_LIVE=0; PEER_UNKNOWN=0; PEER_STALE=0; PEER_SPARE=0; PEER_IDS=""
|
|
142
|
+
# Two more counters, added 2026-08-22. WHY they are SEPARATE values and not one bucket: a peer whose
|
|
143
|
+
# cwd resolves to a DIFFERENT repo has been placed — excluding it is a measurement. A peer whose cwd
|
|
144
|
+
# resolves to no repo at all has NOT been placed, and folding that into the same number would render
|
|
145
|
+
# an unmeasured thing as a decided one (not-found != zero, one level up from line 170's case).
|
|
146
|
+
PEER_OTHERREPO=0 # placed, and it is somebody else's repo → correctly excluded, stays quiet
|
|
147
|
+
PEER_OFFTREE=0 # cwd READ but placeable in neither this repo nor any repo → must not read as 0
|
|
142
148
|
SOCK_DIR="${FH_PEER_SOCK_DIR:-/tmp/cc-socks}"
|
|
143
149
|
# Self-exclusion must walk the ANCESTOR chain, not compare `$$`. This script is a grandchild of the
|
|
144
150
|
# session process that owns the socket, so `$$` never matches it — measured: the first run counted
|
|
@@ -155,6 +161,27 @@ _peer_cwd() { # $1=pid → cwd on stdout, empty if unresolvable
|
|
|
155
161
|
command -v lsof >/dev/null 2>&1 || return 0
|
|
156
162
|
lsof -a -p "$1" -d cwd -Fn 2>/dev/null | sed -n 's/^n//p' | head -1
|
|
157
163
|
}
|
|
164
|
+
# Repo identity, NOT directory prefix. Measured 2026-08-22 (probe_2026-08-22_A2_replication.md):
|
|
165
|
+
# `--show-toplevel` yields the WORKTREE's own path, and a worktree by definition lives outside the
|
|
166
|
+
# main tree — so `"$FH"/*` prefix matching fails STRUCTURALLY for every worktree of this repo, in
|
|
167
|
+
# both directions. From the main tree it silently dropped the worktree peer (no counter moved at
|
|
168
|
+
# all); from a worktree it printed a confident "✅ no live peer" with three live same-repo sessions
|
|
169
|
+
# running. `git rev-parse --git-common-dir` returns the MAIN tree's .git from inside any worktree,
|
|
170
|
+
# which is exactly the equality this question needs — the same property templates/.git-hooks/pre-commit
|
|
171
|
+
# already relies on to reach evidence from a worktree.
|
|
172
|
+
# ⚠️ It can return a RELATIVE path (plain '.git' when run at a repo root — measured here, git 2.50),
|
|
173
|
+
# so the raw output of the main tree and of its own worktree DIFFER as strings. Normalising to an
|
|
174
|
+
# absolute real path is not tidiness; comparing raw output would reproduce the very bug being fixed.
|
|
175
|
+
_repo_id() { # $1=dir → absolute real path of the repo's COMMON .git, empty if not placeable in a repo
|
|
176
|
+
( cd "$1" 2>/dev/null || exit 0
|
|
177
|
+
_c=$(git rev-parse --git-common-dir 2>/dev/null) || exit 0
|
|
178
|
+
[ -n "$_c" ] || exit 0
|
|
179
|
+
cd "$_c" 2>/dev/null || exit 0
|
|
180
|
+
pwd -P )
|
|
181
|
+
}
|
|
182
|
+
# Computed once. Empty = $FH itself is not inside a git repo; then repo-identity cannot decide
|
|
183
|
+
# anything and every off-prefix peer falls through to PEER_OFFTREE (unplaceable), never to "absent".
|
|
184
|
+
FH_REPO_ID="$(_repo_id "$FH")"
|
|
158
185
|
if [ -d "$SOCK_DIR" ]; then
|
|
159
186
|
for _s in "$SOCK_DIR"/*.sock; do
|
|
160
187
|
[ -e "$_s" ] || continue
|
|
@@ -174,6 +201,26 @@ if [ -d "$SOCK_DIR" ]; then
|
|
|
174
201
|
fi
|
|
175
202
|
case "$_pcwd" in
|
|
176
203
|
"$FH"|"$FH"/*) PEER_LIVE=$((PEER_LIVE+1)); PEER_IDS="$PEER_IDS $_pid" ;;
|
|
204
|
+
*)
|
|
205
|
+
# The `default` arm that was missing until 2026-08-22. Every peer that reaches here has a
|
|
206
|
+
# READ cwd that is not under $FH, and previously left the loop without touching a single
|
|
207
|
+
# counter — so the ladder below could not tell it from "there was nobody". Three outcomes,
|
|
208
|
+
# and the point is that they are three, not two.
|
|
209
|
+
_prepo="$(_repo_id "$_pcwd")"
|
|
210
|
+
if [ -n "$FH_REPO_ID" ] && [ "$_prepo" = "$FH_REPO_ID" ]; then
|
|
211
|
+
# Same repo, different worktree — a real peer of THIS harness. The case this fix exists for.
|
|
212
|
+
PEER_LIVE=$((PEER_LIVE+1)); PEER_IDS="$PEER_IDS $_pid"
|
|
213
|
+
elif [ -n "$_prepo" ]; then
|
|
214
|
+
# Placed in a DIFFERENT repo. Excluding it is a measurement, so it stays quiet on purpose:
|
|
215
|
+
# warning here would nag every close about unrelated projects, and an advisory that fires
|
|
216
|
+
# on every close trains skimming past the lines that matter.
|
|
217
|
+
PEER_OTHERREPO=$((PEER_OTHERREPO+1))
|
|
218
|
+
else
|
|
219
|
+
# cwd read, but it belongs to no repo we can name (or $FH is not in a repo). UNPLACEABLE —
|
|
220
|
+
# routed to the existing UNPLACEABLE branch below rather than to a new verdict of its own.
|
|
221
|
+
PEER_OFFTREE=$((PEER_OFFTREE+1))
|
|
222
|
+
fi
|
|
223
|
+
;;
|
|
177
224
|
esac
|
|
178
225
|
done
|
|
179
226
|
else
|
|
@@ -207,11 +254,17 @@ elif [ "$PEER_LIVE" -gt 0 ]; then
|
|
|
207
254
|
echo " 2026-08-09: 2 of 5 notices were held while the card already claimed all 5 informed."
|
|
208
255
|
echo " Record ANSWERS, not sends, and put the unanswered count in the card."
|
|
209
256
|
[ "$PEER_UNKNOWN" -gt 0 ] && echo " + $PEER_UNKNOWN live session(s) whose directory is UNKNOWN (counted, not dismissed)"
|
|
210
|
-
|
|
211
|
-
|
|
257
|
+
[ "$PEER_OFFTREE" -gt 0 ] && echo " + $PEER_OFFTREE live session(s) whose directory belongs to NO repo (counted, not dismissed)"
|
|
258
|
+
elif [ "$PEER_UNKNOWN" -gt 0 ] || [ "$PEER_OFFTREE" -gt 0 ]; then
|
|
259
|
+
echo "⚠️ ①-c 0 peers placed in this harness, but $((PEER_UNKNOWN+PEER_OFFTREE)) live session(s) are UNPLACEABLE"
|
|
260
|
+
echo " ($PEER_UNKNOWN with no readable cwd · $PEER_OFFTREE whose cwd belongs to no repo)"
|
|
212
261
|
echo " — treat as possible peers and ask; do not read this as 'closing alone'."
|
|
213
262
|
else
|
|
214
|
-
|
|
263
|
+
# The parenthetical must account for EVERY kind that was dropped, not only the flattering ones.
|
|
264
|
+
# Before 2026-08-22 it listed stale+spare while silently discarding same-repo worktree peers, so
|
|
265
|
+
# "0 stale · 0 spare" read as "three kinds swept, all empty" at the exact moment three real peers
|
|
266
|
+
# had been thrown away. A green line is only allowed to be green about what it actually counted.
|
|
267
|
+
echo "✅ ①-c no live peer in this harness (${PEER_STALE} stale · ${PEER_SPARE} pre-warmed spare(s) · ${PEER_OTHERREPO} in other repo(s) — all placed)"
|
|
215
268
|
fi
|
|
216
269
|
|
|
217
270
|
fi
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_chamber_sig_lanes.sh — known-pair calibration for chamber_candidate_collect.sh's LAYER-2
|
|
3
|
+
# dedup signature (`_sig`/`_ksig`) on a NON-ASCII corpus.
|
|
4
|
+
#
|
|
5
|
+
# WHY (measured 2026-08-22, live corpus, this repo):
|
|
6
|
+
# A freshly-registered candidate was grepped correctly by LAYER 1 and then VANISHED from the
|
|
7
|
+
# ranked queue. The loss was LAYER 2. Root cause = **locale-dependent collation**, and it is not
|
|
8
|
+
# one bug but a family, all in the same pipeline:
|
|
9
|
+
# · `sort -u` in en_US.UTF-8 treats Hangul syllables as EQUAL to one another. Measured on
|
|
10
|
+
# macOS/BSD sort: 8 distinct Korean tokens → 2 survivors (grouped by syllable count, first
|
|
11
|
+
# one wins, input-order dependent). Measured on GNU coreutils 9.7 sort: same 8 → **1**.
|
|
12
|
+
# · `comm -12` inherits that collation, so it reports two COMPLETELY DIFFERENT Korean tokens
|
|
13
|
+
# as a common line. Measured: comm -12 <(레인) <(발주) → prints a line. The jaccard
|
|
14
|
+
# numerator is therefore computed against a collation, not against the tokens.
|
|
15
|
+
# · `awk 'length()>=4'` counts BYTES on BSD awk and CHARACTERS on gawk in a UTF-8 locale. The
|
|
16
|
+
# same 2-syllable Korean token passes on macOS (6 bytes) and is DROPPED on Linux (2 chars),
|
|
17
|
+
# so the two platforms disagree about the signature before any comparison happens.
|
|
18
|
+
# Net effect on the live corpus (64 raw markers): unrelated candidates were folded into clusters
|
|
19
|
+
# of 11, 7, 7, 4 and 3, and only each cluster's FIRST member reached the output. Everything else
|
|
20
|
+
# was silently deleted from the queue while the run reported a healthy "deduped candidates: 31".
|
|
21
|
+
#
|
|
22
|
+
# That is the [[feedback_not_found_is_not_zero_family]] shape — a silent fold rendered as a clean
|
|
23
|
+
# number — which is why it needs a mechanical anchor rather than a note.
|
|
24
|
+
#
|
|
25
|
+
# WHAT IT PINS (the lanes below, in pairs, because a merge check with only one direction is not a
|
|
26
|
+
# measurement — over-merging and never-merging both produce a "correct" number on half the corpus):
|
|
27
|
+
# L1 Korean, DIFFERENT → must NOT merge (known-positive: the actual live mis-merge)
|
|
28
|
+
# L2 Korean, SAME → must merge (known-negative: the fix must not kill real dedup)
|
|
29
|
+
# L3 English, DIFFERENT → must NOT merge (control: the defect is Hangul-only; if this lane ever
|
|
30
|
+
# goes red the diagnosis above is wrong)
|
|
31
|
+
# L4 English, SAME → must merge (control, other direction)
|
|
32
|
+
# L5 Korean ×3 unrelated → must stay 3 ("does it collapse a set, not just a pair")
|
|
33
|
+
# L6 Korean vs English → must NOT merge (mixed-script pair)
|
|
34
|
+
#
|
|
35
|
+
# 🟥 EVERY LANE DRIVES THE REAL SCRIPT. Nothing here re-implements `_sig`. A lane suite that carries
|
|
36
|
+
# its own copy of the logic grades the copy ([[feedback_adversarial_review_not_substitute_for_first_use]]
|
|
37
|
+
# — "초록의 출처를 물어라: 사본이 통과시키고 있었다").
|
|
38
|
+
#
|
|
39
|
+
# 🟥 FIXTURES ARE SELF-BUILT under mktemp, never this repo's own tracks/ — a suite that reads
|
|
40
|
+
# repo-specific paths FAILs wholesale once the script is ported (portability_lint P9).
|
|
41
|
+
#
|
|
42
|
+
# Usage: bash scripts/test_chamber_sig_lanes.sh
|
|
43
|
+
# Exit: 0 = all lanes pass · 1 = a lane failed · 10 = harness error (could not measure)
|
|
44
|
+
|
|
45
|
+
set -uo pipefail
|
|
46
|
+
|
|
47
|
+
REPO="$(cd "$(dirname "$0")/.." && pwd)"
|
|
48
|
+
SUBJ="$REPO/scripts/chamber_candidate_collect.sh"
|
|
49
|
+
[ -f "$SUBJ" ] || { echo "HARNESS ERROR: subject missing: $SUBJ"; exit 10; }
|
|
50
|
+
|
|
51
|
+
TMP="$(mktemp -d 2>/dev/null)" || { echo "HARNESS ERROR: mktemp failed"; exit 10; }
|
|
52
|
+
trap 'rm -rf "$TMP"' EXIT
|
|
53
|
+
|
|
54
|
+
fail=0
|
|
55
|
+
lane=0
|
|
56
|
+
|
|
57
|
+
# Build a throwaway FH root holding exactly the given marker lines, run the REAL collector inside
|
|
58
|
+
# it, and echo "NRAW NDEDUP". The collector locates its own FH root from its dirname, so the copy
|
|
59
|
+
# has to live in <root>/scripts/ — that is also why this cannot be done by calling the repo copy
|
|
60
|
+
# with an env var: the script offers no such knob and inventing one for the test would move the
|
|
61
|
+
# measurement off the shipped path.
|
|
62
|
+
_run() { # $@ = marker descriptions
|
|
63
|
+
local root="$TMP/fx.$lane"
|
|
64
|
+
rm -rf "$root"
|
|
65
|
+
mkdir -p "$root/scripts" "$root/tracks/_meta" "$root/plugins" || return 10
|
|
66
|
+
cp "$SUBJ" "$root/scripts/" || return 10
|
|
67
|
+
# NOTE: chamber_candidate_screen.sh is deliberately NOT copied. Its verdict column is irrelevant
|
|
68
|
+
# here and its absence keeps the fixture independent of this repo's asset tree.
|
|
69
|
+
local f="$root/tracks/_meta/fh_signal_2000-01-01_fixture.md"
|
|
70
|
+
: > "$f"
|
|
71
|
+
local d
|
|
72
|
+
for d in "$@"; do printf 'CHAMBER-CANDIDATE: %s\n' "$d" >> "$f"; done
|
|
73
|
+
local out
|
|
74
|
+
out=$(bash "$root/scripts/chamber_candidate_collect.sh" 2>&1) || true
|
|
75
|
+
local nraw ndedup
|
|
76
|
+
nraw=$(printf '%s\n' "$out" | sed -n 's/.*raw candidate markers found: \([0-9][0-9]*\).*/\1/p' | head -1)
|
|
77
|
+
ndedup=$(printf '%s\n' "$out" | sed -n 's/^deduped candidates: \([0-9][0-9]*\) .*/\1/p' | head -1)
|
|
78
|
+
printf '%s %s\n' "${nraw:-X}" "${ndedup:-X}"
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
# $1=label $2=expected dedup count $3..=descriptions
|
|
82
|
+
_lane() {
|
|
83
|
+
lane=$((lane+1))
|
|
84
|
+
local label="$1" want="$2"; shift 2
|
|
85
|
+
local got nraw ndedup
|
|
86
|
+
got=$(_run "$@")
|
|
87
|
+
nraw="${got%% *}"; ndedup="${got##* }"
|
|
88
|
+
# Instrument control BEFORE the verdict: if LAYER 1 did not even see the markers, a "correct"
|
|
89
|
+
# dedup number would be an accident. `not found` is not a zero.
|
|
90
|
+
if [ "$nraw" != "$#" ]; then
|
|
91
|
+
echo "HARNESS ERROR $label: collector saw $nraw raw markers, fixture planted $# — instrument dead, verdict void"
|
|
92
|
+
fail=1; return
|
|
93
|
+
fi
|
|
94
|
+
if [ "$ndedup" = "$want" ]; then
|
|
95
|
+
echo "PASS $label (deduped=$ndedup, expected $want)"
|
|
96
|
+
else
|
|
97
|
+
echo "FAIL $label: deduped=$ndedup, expected $want ($nraw raw markers)"
|
|
98
|
+
fail=1
|
|
99
|
+
fi
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
echo "── chamber signature lanes (LAYER-2 dedup, non-ASCII corpus) ──"
|
|
103
|
+
|
|
104
|
+
# L1 — KNOWN-POSITIVE. Both strings are lifted VERBATIM from this repo's live corpus, and this is
|
|
105
|
+
# the exact pair that folded on 2026-08-22: the second was swallowed by the first and never reached
|
|
106
|
+
# the queue. Deliberately NOT a synthetic minimal pair — the punctuation soup («」·—/+()) is the
|
|
107
|
+
# "뚫리는 표기" that a clean two-word fixture would step over.
|
|
108
|
+
# ⚠️ The strings must stay VERBATIM. A first draft of this lane paraphrased six characters of the
|
|
109
|
+
# second string's tail ("행위로 굳힌다" for "행위자가 읽는 곳에.") and the pair stopped folding —
|
|
110
|
+
# the lane went green against the very code it was written to indict. Do not "tidy" these.
|
|
111
|
+
_lane "L1 ko/different (live mis-merge pair)" 2 \
|
|
112
|
+
'「미사용 자산의 원인 3분할(값어치·배선·계기)」을 tier 전에 강제하는 렌즈 — 처분 tier 가 원인 판정을 앞서지 못하게 한다' \
|
|
113
|
+
'병렬 레인 발주 계약 — 보고 의무 3줄 + 취향/판정/승인 3축 라우팅 + idle 구독을 카드 안에 박은 형태. 별도 규칙 파일 없이 행위자가 읽는 곳에.'
|
|
114
|
+
|
|
115
|
+
# L2 — KNOWN-NEGATIVE. Real duplicates must still collapse; a fix that merely stops merging would
|
|
116
|
+
# pass L1 and destroy the feature. Same candidate, re-listed with a trailing qualifier.
|
|
117
|
+
_lane "L2 ko/same (true duplicate must still merge)" 1 \
|
|
118
|
+
'session-token-ledger — 세션 및 서브에이전트 토큰 실사용을 기계 출처에서 수집해 원장화하고 추정기가 역참조하는 계기' \
|
|
119
|
+
'session-token-ledger — 세션 및 서브에이전트 토큰 실사용을 기계 출처에서 수집해 원장화하고 추정기가 역참조하는 계기 (동일 건 재등재, 앵커 보강만)'
|
|
120
|
+
|
|
121
|
+
# L3/L4 — ENGLISH CONTROL. These pin the diagnosis, not the feature: the defect is a Hangul
|
|
122
|
+
# collation defect, so both English lanes must be green BEFORE and AFTER the repair. If L3 or L4
|
|
123
|
+
# is ever red, the cause is somewhere other than where this header says it is.
|
|
124
|
+
_lane "L3 en/different (control)" 2 \
|
|
125
|
+
'parallel lane dispatch contract — reporting duty condensed into three lines plus an idle subscription card' \
|
|
126
|
+
'unused asset triage lens — forces value versus wiring versus instrument before any disposal tier is assigned'
|
|
127
|
+
|
|
128
|
+
_lane "L4 en/same (control)" 1 \
|
|
129
|
+
'session token ledger — collect subagent token usage from a mechanical source and let the estimator dereference it' \
|
|
130
|
+
'session token ledger — collect subagent token usage from a mechanical source and let the estimator dereference it, relisted'
|
|
131
|
+
|
|
132
|
+
# L5 — SET COLLAPSE, not just a pair. The live failure produced clusters of 11; a pairwise-only
|
|
133
|
+
# suite would have called a 3→1 fold "one merge" and moved on.
|
|
134
|
+
_lane "L5 ko/three unrelated" 3 \
|
|
135
|
+
'낭독 렌즈 — 「소리 내어 읽히는가」를 재는 계기. 문서 린터가 구조적으로 못 보는 축이다' \
|
|
136
|
+
'fh-router-demotion — salience 상시부하를 플랫폼 네이티브 메커니즘으로 이관하는 대수술' \
|
|
137
|
+
'인물 시뮬레이터 하네스 — 닫힌 코퍼스 + 그라운딩 게이트 + 페르소나 캐스트를 한 틀로 묶는다'
|
|
138
|
+
|
|
139
|
+
# L6 — MIXED SCRIPT. A Korean signature that collapses to near-nothing can also collide with an
|
|
140
|
+
# unrelated ASCII one, which is a different failure path from ko↔ko.
|
|
141
|
+
_lane "L6 ko vs en" 2 \
|
|
142
|
+
'원정 수련 — 세계 강력 레포에서 배워오는 반복 루틴. 탐색 판별 흡수 3단이다' \
|
|
143
|
+
'entrypoint wiring generator — emit runtime-native hook settings from a single event manifest'
|
|
144
|
+
|
|
145
|
+
echo ""
|
|
146
|
+
if [ "$fail" -eq 0 ]; then
|
|
147
|
+
echo "chamber signature lanes: ALL PASS ($lane lanes)"
|
|
148
|
+
else
|
|
149
|
+
echo "chamber signature lanes: FAILURES PRESENT ($lane lanes run)"
|
|
150
|
+
fi
|
|
151
|
+
exit "$fail"
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_leak_scan_control_lanes.sh — anchors for the ONE required check's leak scan.
|
|
3
|
+
#
|
|
4
|
+
# SUBJECT: the "Check for operator-private token residue" step of .github/workflows/validate.yml.
|
|
5
|
+
#
|
|
6
|
+
# WHY (measured 2026-08-22 — a production fail-open on the only required check of this repo):
|
|
7
|
+
# the step was `FOUND=$(grep … || true)` followed by `[ -n "$FOUND" ]`. Three arms, one variable
|
|
8
|
+
# changed at a time, run against the extracted step body:
|
|
9
|
+
#
|
|
10
|
+
# leak present · instrument healthy rc=1 FAIL: … residue found ✅
|
|
11
|
+
# clean tree rc=0 PASS: no … residue ✅
|
|
12
|
+
# leak present · grep exits 2 (broken) rc=0 PASS: no … residue 🟥
|
|
13
|
+
#
|
|
14
|
+
# `|| true` folds grep's ERROR (2) into its NO-MATCH (1), so the PASS token is produced on the
|
|
15
|
+
# failure branch: a dead scanner renders byte-identically to a clean surface. This is the
|
|
16
|
+
# absence-assertion class, and it sat on an IRREVERSIBLE surface (a leak does not un-happen) with
|
|
17
|
+
# zero controls of any kind.
|
|
18
|
+
#
|
|
19
|
+
# The repair copies an instrument this repo already runs — scripts/env_purity_scan.sh's
|
|
20
|
+
# "컨트롤 사망 → 수치 무효, exit 10" — rather than inventing a second shape:
|
|
21
|
+
# ① grep's exit code is READ; rc >= 2 is an instrument error, never a clean scan.
|
|
22
|
+
# ② a known-positive control is planted in the scanned tree and MUST be found; zero control hits
|
|
23
|
+
# means the scan never ran over this tree, so its zero findings are void.
|
|
24
|
+
#
|
|
25
|
+
# These lanes assert both closures AND include revert probes, because the two closures are
|
|
26
|
+
# independent fail-closed layers: neutralizing one alone leaves the other catching the same arm.
|
|
27
|
+
# The probe that matters is therefore R3 — neutralize BOTH and the original bug returns exactly.
|
|
28
|
+
#
|
|
29
|
+
# Usage: bash scripts/test_leak_scan_control_lanes.sh Exit: 0 = all behave; 1 = regression.
|
|
30
|
+
|
|
31
|
+
set -uo pipefail
|
|
32
|
+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
33
|
+
WF="$REPO_ROOT/.github/workflows/validate.yml"
|
|
34
|
+
T=$(mktemp -d) || { echo "❌ HARNESS-ERROR — mktemp failed"; exit 10; }
|
|
35
|
+
trap 'rm -rf "$T"' EXIT
|
|
36
|
+
FAIL=0
|
|
37
|
+
|
|
38
|
+
[ -f "$WF" ] || { echo "❌ HARNESS-ERROR — subject workflow missing: $WF"; exit 2; }
|
|
39
|
+
|
|
40
|
+
# ── instrument calibration: prove the step body actually extracted ───────────────────────────
|
|
41
|
+
# An empty extraction would let every lane "pass" against nothing — the exact class this suite
|
|
42
|
+
# exists to close. stdlib only (PyYAML is not a declared dependency and this suite runs inside
|
|
43
|
+
# selfcheck.sh, where a missing module would block unrelated commits with an error about the
|
|
44
|
+
# wrong thing).
|
|
45
|
+
python3 - "$WF" > "$T/body.sh" <<'PYX'
|
|
46
|
+
import sys
|
|
47
|
+
lines = open(sys.argv[1], encoding="utf-8").read().split("\n")
|
|
48
|
+
NAME = "- name: Check for operator-private token residue"
|
|
49
|
+
try:
|
|
50
|
+
i = next(k for k, l in enumerate(lines) if l.strip() == NAME)
|
|
51
|
+
except StopIteration:
|
|
52
|
+
sys.exit(0) # emit nothing -> the calibration check below aborts loudly
|
|
53
|
+
j = next(k for k in range(i, len(lines)) if lines[k].strip().startswith("run:"))
|
|
54
|
+
indent = len(lines[j + 1]) - len(lines[j + 1].lstrip())
|
|
55
|
+
body = []
|
|
56
|
+
for l in lines[j + 1:]:
|
|
57
|
+
if l.strip() and (len(l) - len(l.lstrip())) < indent:
|
|
58
|
+
break
|
|
59
|
+
body.append(l[indent:])
|
|
60
|
+
sys.stdout.write("\n".join(body) + "\n")
|
|
61
|
+
PYX
|
|
62
|
+
for _need in 'INSTRUMENT DEAD' 'INSTRUMENT ERROR' 'PASS: no generic operator-private residue'; do
|
|
63
|
+
if ! grep -qF -- "$_need" "$T/body.sh"; then
|
|
64
|
+
echo "❌ HARNESS-ERROR — the leak-scan step body did not extract from $WF"
|
|
65
|
+
echo " (missing marker: '$_need'). Lanes below would measure an empty script. Aborting"
|
|
66
|
+
echo " rather than reporting green."
|
|
67
|
+
exit 1
|
|
68
|
+
fi
|
|
69
|
+
done
|
|
70
|
+
|
|
71
|
+
# ── fixtures ─────────────────────────────────────────────────────────────────────────────────
|
|
72
|
+
# Home-path literals are ASSEMBLED, never written out: a tracked file carrying the real shape is
|
|
73
|
+
# blocked by this repo's own pre-commit confidentiality scan (verified 2026-08-22, reports MED).
|
|
74
|
+
mkdir -p "$T/clean/docs" "$T/leaky/docs" "$T/shim"
|
|
75
|
+
printf '# nothing operator-private here\n' > "$T/clean/docs/x.md"
|
|
76
|
+
printf 'a planted leak for the FAIL arm:\n' > "$T/leaky/docs/x.md"
|
|
77
|
+
printf '/Users/%s/projects/secret\n' "plantedhome" >> "$T/leaky/docs/x.md"
|
|
78
|
+
|
|
79
|
+
# grep shim that breaks ONLY the recursive scan (the `-rIE` invocation). Breaking every grep would
|
|
80
|
+
# not attribute the failure to the branch under test.
|
|
81
|
+
REAL_GREP=$(command -v grep) || { echo "❌ HARNESS-ERROR — no grep on PATH"; exit 10; }
|
|
82
|
+
cat > "$T/shim/grep" <<SH
|
|
83
|
+
#!/bin/sh
|
|
84
|
+
for a in "\$@"; do case "\$a" in -rIE) exit 2 ;; esac; done
|
|
85
|
+
exec "$REAL_GREP" "\$@"
|
|
86
|
+
SH
|
|
87
|
+
chmod +x "$T/shim/grep"
|
|
88
|
+
|
|
89
|
+
run_body() { # $1=body file $2=tree $3=broken|ok ; echoes "rc|first verdict-ish line"
|
|
90
|
+
local out rc
|
|
91
|
+
if [ "$3" = "broken" ]; then
|
|
92
|
+
out=$(cd "$2" && PATH="$T/shim:$PATH" bash "$1" 2>&1); rc=$?
|
|
93
|
+
else
|
|
94
|
+
out=$(cd "$2" && bash "$1" 2>&1); rc=$?
|
|
95
|
+
fi
|
|
96
|
+
printf '%s|%s' "$rc" "$(printf '%s\n' "$out" | grep -E '^(PASS|FAIL|❌|⛔)' | head -1)"
|
|
97
|
+
}
|
|
98
|
+
lane() { # $1=id $2=body $3=tree $4=broken|ok $5=expected rc $6=expected substring
|
|
99
|
+
local r rc msg
|
|
100
|
+
r=$(run_body "$2" "$3" "$4"); rc="${r%%|*}"; msg="${r#*|}"
|
|
101
|
+
if [ "$rc" = "$5" ] && printf '%s' "$msg" | grep -qF -- "$6"; then
|
|
102
|
+
printf ' ✅ %-28s rc=%s %s\n' "$1" "$rc" "$(printf '%s' "$msg" | cut -c1-60)"
|
|
103
|
+
else
|
|
104
|
+
printf ' ❌ %-28s expected rc=%s /%s/, got rc=%s %s\n' "$1" "$5" "$6" "$rc" "$msg"; FAIL=1
|
|
105
|
+
fi
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
echo "== leak-scan lanes (subject: validate.yml operator-private residue step) =="
|
|
109
|
+
lane L1-clean-tree "$T/body.sh" "$T/clean" ok 0 "PASS: no generic operator-private residue"
|
|
110
|
+
lane L2-leak-detected "$T/body.sh" "$T/leaky" ok 1 "FAIL: operator-private token residue found"
|
|
111
|
+
lane L3-instrument-dead "$T/body.sh" "$T/leaky" broken 10 "INSTRUMENT ERROR"
|
|
112
|
+
|
|
113
|
+
# L4 — the control fixture itself is the second anchor: remove its planting and the scan must
|
|
114
|
+
# refuse to certify, even though the tree is genuinely clean. "Clean" and "not looked at" must not
|
|
115
|
+
# render the same, which is the whole thesis of this file.
|
|
116
|
+
sed "s|^ *printf '/Users/%s/projects/example.*|:|" "$T/body.sh" > "$T/body_noctl.sh"
|
|
117
|
+
if diff -q "$T/body.sh" "$T/body_noctl.sh" >/dev/null; then
|
|
118
|
+
echo " ❌ L4-control-removed neutralization was a no-op — the probe measured nothing"; FAIL=1
|
|
119
|
+
else
|
|
120
|
+
lane L4-control-removed "$T/body_noctl.sh" "$T/clean" ok 10 "INSTRUMENT DEAD"
|
|
121
|
+
fi
|
|
122
|
+
|
|
123
|
+
echo "== revert probes — are the two closures load-bearing, or decoration? =="
|
|
124
|
+
# R1: disarm the exit-code read alone. The arm stays RED (the control layer catches it), but the
|
|
125
|
+
# ATTRIBUTION must move — that is what proves this branch, not its neighbour, fires first.
|
|
126
|
+
sed 's|if \[ "$rc" -ge 2 \]; then|if false; then|' "$T/body.sh" > "$T/body_r1.sh"
|
|
127
|
+
if diff -q "$T/body.sh" "$T/body_r1.sh" >/dev/null; then
|
|
128
|
+
echo " ❌ R1-rc-branch neutralization was a no-op — the probe measured nothing"; FAIL=1
|
|
129
|
+
else
|
|
130
|
+
r=$(run_body "$T/body_r1.sh" "$T/leaky" broken)
|
|
131
|
+
if ! printf '%s' "${r#*|}" | grep -qF 'grep exited'; then
|
|
132
|
+
printf ' ✅ %-28s disarmed → verdict re-attributes to %s\n' "R1-rc-branch" "$(printf '%s' "${r#*|}" | cut -c1-40)"
|
|
133
|
+
else
|
|
134
|
+
echo " ❌ R1-rc-branch still reports 'grep exited' with the branch disarmed"; FAIL=1
|
|
135
|
+
fi
|
|
136
|
+
fi
|
|
137
|
+
|
|
138
|
+
# R2: disarm the control-liveness branch alone → L4's arm must go GREEN again, i.e. a scan that
|
|
139
|
+
# cannot find a planted leak once more certifies the surface as clean.
|
|
140
|
+
sed 's|if \[ "$ctl" -eq 0 \]; then|if false; then|' "$T/body_noctl.sh" > "$T/body_r2.sh"
|
|
141
|
+
if diff -q "$T/body_noctl.sh" "$T/body_r2.sh" >/dev/null; then
|
|
142
|
+
echo " ❌ R2-control-branch neutralization was a no-op — the probe measured nothing"; FAIL=1
|
|
143
|
+
else
|
|
144
|
+
r=$(run_body "$T/body_r2.sh" "$T/clean" ok)
|
|
145
|
+
if [ "${r%%|*}" = "0" ]; then
|
|
146
|
+
echo " ✅ R2-control-branch disarmed → dead-fixture scan passes again → anchor is alive"
|
|
147
|
+
else
|
|
148
|
+
echo " ❌ R2-control-branch disarmed branch STILL blocks — the lane is not testing it"; FAIL=1
|
|
149
|
+
fi
|
|
150
|
+
fi
|
|
151
|
+
|
|
152
|
+
# R3: disarm BOTH → the ORIGINAL 2026-08-22 bug must return exactly: a real leak, a dead scanner,
|
|
153
|
+
# and a green PASS. This is the fail-before measurement, mechanized so it cannot drift back.
|
|
154
|
+
sed 's|if \[ "$ctl" -eq 0 \]; then|if false; then|' "$T/body_r1.sh" > "$T/body_r3.sh"
|
|
155
|
+
r=$(run_body "$T/body_r3.sh" "$T/leaky" broken)
|
|
156
|
+
if [ "${r%%|*}" = "0" ] && printf '%s' "${r#*|}" | grep -qF 'PASS: no generic'; then
|
|
157
|
+
echo " ✅ R3-both-disarmed both off → leak+dead scanner renders PASS (the closed hole)"
|
|
158
|
+
else
|
|
159
|
+
echo " ❌ R3-both-disarmed expected rc=0 PASS, got $r — the lanes are not measuring the hole"; FAIL=1
|
|
160
|
+
fi
|
|
161
|
+
|
|
162
|
+
[ $FAIL -eq 0 ] && { echo "✅ all leak-scan control lanes behave"; exit 0; }
|
|
163
|
+
echo "❌ leak-scan control lane regression"; exit 1
|