@chrono-meta/fh-gate 3.22.1 → 3.23.1
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/capability_composition_contract.md +21 -0
- package/knowledge/shared/harness-core/checkout_layer_drift.md +67 -0
- package/knowledge/shared/harness-core/gate_locality_principle.md +25 -2
- package/knowledge/shared/harness-core/hook_channel_visibility.md +23 -3
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +106 -0
- package/package.json +8 -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 +50 -0
- package/plugins/fh-meta/skills/agent-composer/SKILL.md +5 -0
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/context_continuity_score.sh +3 -1
- package/scripts/env_layer_fingerprint.sh +26 -10
- package/scripts/main_commit_guard.sh +47 -0
- package/scripts/mapped_tracks.sh +11 -1
- package/scripts/probe_live_eval.sh +11 -0
- package/scripts/round/nameleak_check.sh +85 -0
- package/scripts/selfcheck.sh +99 -8
- package/scripts/test_env_layer_fingerprint_lanes.sh +99 -0
- package/scripts/test_main_commit_guard_lanes.sh +72 -0
- package/scripts/test_mapped_tracks_lanes.sh +73 -0
- package/scripts/test_post_squash_verify_lanes.sh +183 -0
- package/scripts/test_pr_merge_verified_lanes.sh +104 -0
- package/scripts/test_probe_live_eval_lanes.sh +17 -1
- package/scripts/test_verdict_watermark_lanes.sh +8 -1
- package/templates/.git-hooks/pre-commit +12 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# main_commit_guard.sh — block a LOCAL commit of FH assets straight onto main/master.
|
|
3
|
+
#
|
|
4
|
+
# WHY (2026-09-29, operator «추천대로»): the integration branch is PR-only, and the server enforces
|
|
5
|
+
# it on push (`enforce_admins`), but local commits to `main` kept happening anyway — N≥5 measured
|
|
6
|
+
# (2026-09-11 list, 09-18 twice, 09-20). Each one had to be moved to a branch by hand afterwards,
|
|
7
|
+
# and on a shared checkout a stray `main` commit is also what the next session's `git switch -c`
|
|
8
|
+
# silently inherits. The push gate catches it late; this catches it at the point it is made.
|
|
9
|
+
#
|
|
10
|
+
# SCOPE — deliberately narrow:
|
|
11
|
+
# · Called by templates/.git-hooks/pre-commit ONLY on the path where an FH asset is staged. A
|
|
12
|
+
# commit with no FH asset (companion store, non-FH files) never reaches this script.
|
|
13
|
+
# · «FH asset» means what the 4-axis classifier in the hook calls one (HEAVY/LIGHT). A commit that
|
|
14
|
+
# stages only files outside it — e.g. `package.json` alone — does not reach this script. Named
|
|
15
|
+
# residual, not widened here: widening the classifier changes the 4-axis gate too.
|
|
16
|
+
# · Blocks on branch `main` or `master` — INCLUDING merge / cherry-pick / revert / `--amend`
|
|
17
|
+
# commits made while on main: each of those writes a new commit onto main. Only a detached HEAD
|
|
18
|
+
# (rebase in progress · bisect) passes, because no branch is being written.
|
|
19
|
+
# · If this script is absent the hook warns and does NOT block (same as branch_claim.sh): a
|
|
20
|
+
# consumer install may carry the hook template without the scripts/ helper.
|
|
21
|
+
# · Override: MAIN_COMMIT_OK=1 — same channel shape as MAIN_PUSH_OK / DESTRUCTIVE_OP_OK /
|
|
22
|
+
# PUBLIC_SURFACE_OK. Every use is appended to tracks/_meta/.main_commit_override_log.
|
|
23
|
+
#
|
|
24
|
+
# Exit: 0 pass · 1 block. Prints nothing on a plain pass (the hook's output is already long).
|
|
25
|
+
# Anchor: scripts/test_main_commit_guard_lanes.sh (unit + real-hook known-pair + revert).
|
|
26
|
+
set -u
|
|
27
|
+
# EVIDENCE_ROOT is supplied by the hook (main tree, worktree-safe); direct callers may point it elsewhere.
|
|
28
|
+
ROOT="${EVIDENCE_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"
|
|
29
|
+
BRANCH="${MAIN_GUARD_BRANCH:-$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")}"
|
|
30
|
+
|
|
31
|
+
case "$BRANCH" in
|
|
32
|
+
main|master) ;;
|
|
33
|
+
*) exit 0 ;;
|
|
34
|
+
esac
|
|
35
|
+
|
|
36
|
+
if [ "${MAIN_COMMIT_OK:-0}" = "1" ]; then
|
|
37
|
+
echo " ⚠️ [main-commit] FH asset committed directly on '$BRANCH' by MAIN_COMMIT_OK=1 (logged)"
|
|
38
|
+
mkdir -p "$ROOT/tracks/_meta" 2>/dev/null
|
|
39
|
+
echo "$(date +%Y-%m-%dT%H:%M:%S) MAIN_COMMIT_OK override — branch $BRANCH — $(git diff --cached --name-only 2>/dev/null | wc -l | tr -d ' ') staged path(s)" \
|
|
40
|
+
>> "$ROOT/tracks/_meta/.main_commit_override_log" 2>/dev/null || true
|
|
41
|
+
exit 0
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
echo " ❌ [main-commit] FH asset staged on '$BRANCH' — the integration branch is PR-only."
|
|
45
|
+
echo " Move it: git switch -c <branch> (the staged changes come with you), then commit there."
|
|
46
|
+
echo " Deliberate? MAIN_COMMIT_OK=1 git commit … (logged to tracks/_meta/.main_commit_override_log)"
|
|
47
|
+
exit 1
|
package/scripts/mapped_tracks.sh
CHANGED
|
@@ -142,7 +142,17 @@ _SESS=0
|
|
|
142
142
|
_SESS_NAMES=""
|
|
143
143
|
_is_shipped() { # $1 = path relative to HUB_ROOT
|
|
144
144
|
[ "$_TRACKED_OK" = "1" ] || return 1
|
|
145
|
-
|
|
145
|
+
# 🟥 here-string, NOT a pipe. Under `set -o pipefail` a matching `grep -qxF` exits before
|
|
146
|
+
# reading its input, the producer dies of SIGPIPE, and pipefail raises that 141 as the
|
|
147
|
+
# pipeline's status — so **a match is read as a non-match**. `$_TRACKED` is `git ls-files`
|
|
148
|
+
# output, which grows with the hub, so there is no structural bound to hide behind: the
|
|
149
|
+
# scanner's own measurements put the onset near ~16 KB (`pipefail_earlyexit_scan.sh` header),
|
|
150
|
+
# ≈300 tracked paths under tracks/. Reproduced deterministically at 6,000 paths
|
|
151
|
+
# (2026-09-28): pipe form → rc=141 “NO-MATCH”, here-string → MATCH.
|
|
152
|
+
# 🟥 And the direction is the one this function exists to prevent: a shipped file read as
|
|
153
|
+
# user-made makes a **fresh clone** answer `returning`, the onboarding FP CLAUDE.md names.
|
|
154
|
+
# Lane: test_mapped_tracks_lanes.sh §L-pipe.
|
|
155
|
+
grep -qxF "$1" <<<"$_TRACKED"
|
|
146
156
|
}
|
|
147
157
|
for _f in "$HUB_ROOT"/tracks/*/session_*.md "$HUB_ROOT"/tracks/_meta/*.md; do
|
|
148
158
|
[ -f "$_f" ] || continue
|
|
@@ -89,6 +89,17 @@ LIB="$REPO_ROOT/scripts/probe_live_eval_lib.py"
|
|
|
89
89
|
SIM_RUNNER="${FH_SIM_RUNNER_BIN:-$REPO_ROOT/scripts/sim_isolated_run.sh}"
|
|
90
90
|
|
|
91
91
|
# ── file-header constant — the "문턱" the design brief calls for. Change here, not per-invocation. ──
|
|
92
|
+
# 🟢 MEASURED BASIS (2026-09-29) — the value is unchanged; what changed is that it now has one.
|
|
93
|
+
# Nightly pass_rate since the roster was fixed at 12 probes (09-19 … 09-29, 11 nights):
|
|
94
|
+
# 0.83 · 0.92 · 1.00 · 0.92 · 1.00 · 1.00 · 0.92 · 0.92 · 1.00 · 1.00 · 1.00 → min 10/12.
|
|
95
|
+
# With 12 probes one probe = 0.083, so 0.8 sits exactly one step below the observed normal
|
|
96
|
+
# minimum: 9/12 (0.75) fails, 10/12 passes. Raising it to 0.85 would have flagged 09-19 (10/12)
|
|
97
|
+
# — 1 false alarm in 11 normal nights. The two known-bad nights before the roster change
|
|
98
|
+
# (09-12 = 0.18, 09-13 = UNCALIBRATED) sit far below either value, so 0.8 loses none of them.
|
|
99
|
+
# Per-stratum thresholds (STABLE/FLAKY/HARD) stay deferred until n≥30 per probe — the 2026-09-21
|
|
100
|
+
# stratification found the gain collapses to 0.003 MAE once those two nights are excluded.
|
|
101
|
+
# Source: tracks/_meta/live_eval_*.md (gitignored) · live_eval_stratify_RESULT_2026-09-21.md.
|
|
102
|
+
# 🟥 Re-derive when the roster size changes: the step width (1/N) is what this number rests on.
|
|
92
103
|
THRESHOLD="0.8"
|
|
93
104
|
|
|
94
105
|
# ── EVIDENCE PRESERVATION (2026-09-14) ────────────────────────────────────────────────────────
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# 이름 누출 — «생성기 + 백스톱». 검사기가 판정하지 않는다.
|
|
3
|
+
#
|
|
4
|
+
# 🟥 초판은 자기 논지를 반증했다. 헤더가 「목록은 안 본다」고 적어놓고
|
|
5
|
+
# `ASSIGN_RE='…(ARM|CTRL|arm|ctrl)…'` 로 **낱말 4개를 열거**했고,
|
|
6
|
+
# `OPAQUE_RE='^[0-9a-z_]+$'` 가 소문자면 통과시켜서 실측으로 뚫렸다:
|
|
7
|
+
# treatment · baseline · placebo · control_a · exposed → 전부 rc=0 «불투명» 🟥
|
|
8
|
+
# ⇒ «4낱말 대신 4낱말»이었다. 열거를 늘리는 수리는 REFUSE_RE 의 네 번째 수리와 같은 형태다.
|
|
9
|
+
# ([[feedback_citing_a_rule_is_not_obeying_it]] — 적는 행위가 «지켰다는 감각»을 만든다.
|
|
10
|
+
# 저자도 검토자도 못 잡았고 세 번째 팔이 잡았다.)
|
|
11
|
+
#
|
|
12
|
+
# 🟥 그래서 방향을 뒤집는다 — **화이트리스트**다:
|
|
13
|
+
# 「나쁜 낱말이 없으면 통과」 ✗ 열거는 언제나 불완전하다
|
|
14
|
+
# 「생성기가 낸 형태가 아니면 차단」 ✓ 사람이 고른 이름은 전부 막힌다
|
|
15
|
+
# 그리고 더 근본적으로: **라벨을 사람이 고르지 않게 한다.** `gen` 이 그 자리다.
|
|
16
|
+
# 검사기는 «생성이 안 쓰였을 때» 무는 백스톱으로만 남는다 —
|
|
17
|
+
# §1 결론(«사람의 읽기에 안 맡긴다»)의 라벨 판이다.
|
|
18
|
+
#
|
|
19
|
+
# 🟥 seal 파일명은 다른 근거로 판정한다 — 실물 규약을 **관측**했다(19건 전수,
|
|
20
|
+
# tracks/_meta/compaction/): `seal_<8hex>-<3hex>_<YYYYMMDD>-<HHMMSS>.md`.
|
|
21
|
+
# 그건 열거가 아니라 **형태 일치**이므로 이 문제가 없다.
|
|
22
|
+
#
|
|
23
|
+
# 🟥 시야 판별자 — 검사 «대상»을 이름 문자열 셋으로 좁힌다. 파일 전체 grep 을 안 한다.
|
|
24
|
+
# ⇒ `context_continuity_score.sh:481·728·729`(같은 basename 이지만 `echo` 로 운영자
|
|
25
|
+
# 콘솔에 간다)는 **애초에 입력이 아니다** = 구조적으로 오조준 불가.
|
|
26
|
+
# 필터는 뚫리고 형태는 안 뚫린다.
|
|
27
|
+
#
|
|
28
|
+
# 사용
|
|
29
|
+
# nameleak_check.sh gen → 회차가 쓸 라벨 하나를 «생성»해서 찍는다
|
|
30
|
+
# nameleak_check.sh <seal> <out-dir> <라벨> → rc 0 통과 · 1 누출 · 2 인자오류
|
|
31
|
+
# 🟥 판정은 rc 로 한다. 출력 문구를 grep 하지 마라 — 요약줄이 같이 잡혀서 개수가 틀린다(실측).
|
|
32
|
+
set -uo pipefail
|
|
33
|
+
|
|
34
|
+
# ── 생성 형태 (이 한 줄이 «불투명»의 정의다) ─────────────────────────────────
|
|
35
|
+
# w + 8자리 이상 hex. 길이가 8이면 사전 단어와 우연히 겹칠 확률이 사실상 0이다.
|
|
36
|
+
# 🟥 잔여를 이름으로 남긴다: `wdeadbeef` 같은 hex-단어는 형태를 통과한다. 막지 않는다 —
|
|
37
|
+
# 막으려면 다시 «낱말 열거»가 되고, 그게 이 파일이 폐기한 방식이다. 확률로 산다.
|
|
38
|
+
GEN_RE='^w[0-9a-f]{8,}$'
|
|
39
|
+
gen_one(){ printf 'w%s\n' "$(od -An -N4 -tx1 /dev/urandom | tr -d ' \n')"; }
|
|
40
|
+
|
|
41
|
+
# ── seal 이름 (관측한 실물 규약, 2026-09-01) ─────────────────────────────────
|
|
42
|
+
# 🟥 정규식이 «정본»이고 생성기는 그것에 «검정»된다. 두 곳에 따로 적으면 갈린다 —
|
|
43
|
+
# 오늘 그 축(「갈라 적을 수 있으면 다시 갈린다」)이라 생성 직후 SEAL_RE 로 자기검사한다.
|
|
44
|
+
# 통과 못 하면 이름을 «안 내고» 실패한다: 틀린 이름을 내면 회차가 통째로 무효다.
|
|
45
|
+
SEAL_RE='^seal_[0-9a-f]{8}-[0-9a-f]{3}_[0-9]{8}-[0-9]{6}\.md$'
|
|
46
|
+
gen_seal(){
|
|
47
|
+
local n
|
|
48
|
+
n="seal_$(od -An -N4 -tx1 /dev/urandom | tr -d ' \n')-$(od -An -N2 -tx1 /dev/urandom | tr -d ' \n' | cut -c1-3)_$(date +%Y%m%d-%H%M%S).md"
|
|
49
|
+
if printf '%s' "$n" | grep -qE "$SEAL_RE"; then printf '%s\n' "$n"; return 0; fi
|
|
50
|
+
echo "🟥 gen-seal 이 자기 검사기를 통과 못 했다: $n" >&2; return 1
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if [ "${1:-}" = gen ]; then gen_one; exit $?; fi
|
|
54
|
+
if [ "${1:-}" = gen-seal ]; then gen_seal; exit $?; fi
|
|
55
|
+
|
|
56
|
+
SEAL_NAME="${1:-}"; OUTDIR_NAME="${2:-}"; ARM_LABEL="${3:-}"
|
|
57
|
+
[ -n "$SEAL_NAME" ] && [ -n "$OUTDIR_NAME" ] && [ -n "$ARM_LABEL" ] || {
|
|
58
|
+
echo "usage: nameleak_check.sh gen | <seal-basename> <out-dir-basename> <arm-label>" >&2; exit 2; }
|
|
59
|
+
|
|
60
|
+
# 🟥 SEAL_RE 는 위에서 «한 번만» 정의한다 — 생성기와 검사기가 같은 상수를 쓴다
|
|
61
|
+
bad=0
|
|
62
|
+
say(){ printf ' %s %s\n' "$1" "$2"; }
|
|
63
|
+
|
|
64
|
+
# ① seal 파일명 — 관측한 실물 규약과 «구분 불가»한가
|
|
65
|
+
if printf '%s' "$SEAL_NAME" | grep -qE "$SEAL_RE"; then
|
|
66
|
+
say 🟢 "seal $SEAL_NAME"
|
|
67
|
+
else
|
|
68
|
+
say 🟥 "seal $SEAL_NAME — 실물 규약과 다르다 (seal_<8hex>-<3hex>_<YYYYMMDD>-<HHMMSS>.md)"
|
|
69
|
+
bad=$((bad+1))
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
# ② out-dir · ③ 팔 라벨 — 둘 다 팔의 cwd 조상/자신이라 시야 «안»이다.
|
|
73
|
+
# 🟥 실물 규약이 없으므로 «생성 형태»만 통과시킨다. 사람이 고른 이름은 전부 막힌다.
|
|
74
|
+
for _pair in "outdir:$OUTDIR_NAME" "arm:$ARM_LABEL"; do
|
|
75
|
+
_k="${_pair%%:*}"; _v="${_pair#*:}"
|
|
76
|
+
if printf '%s' "$_v" | grep -qE "$GEN_RE"; then
|
|
77
|
+
say 🟢 "$_k $_v"
|
|
78
|
+
else
|
|
79
|
+
say 🟥 "$_k $_v — 생성 형태가 아니다 — 'nameleak_check.sh gen' 을 써라"
|
|
80
|
+
bad=$((bad+1))
|
|
81
|
+
fi
|
|
82
|
+
done
|
|
83
|
+
|
|
84
|
+
[ "$bad" -gt 0 ] && { echo "🟥 이름 누출 ${bad}건 — 회차를 열지 않는다"; exit 1; }
|
|
85
|
+
echo "🟢 이름 누출 0건"; exit 0
|
package/scripts/selfcheck.sh
CHANGED
|
@@ -53,6 +53,35 @@ sys.exit(0 if any(p == f or p.startswith(f.rstrip('/') + '/') for f in files) el
|
|
|
53
53
|
SHIPPY
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
# Package mode = an installed tarball, not a checkout. The discriminator is a `.git` entry at this
|
|
57
|
+
# tree's root (selfcheck cd's there first) — NOT `git rev-parse`, which would find a consumer's own
|
|
58
|
+
# repo above node_modules and call their install a checkout. A worktree's `.git` is a file; -e covers it.
|
|
59
|
+
_package_mode() { [ ! -e .git ]; }
|
|
60
|
+
|
|
61
|
+
# ── Consumer profile (2026-09-29) — what `npm test` runs inside an installed package ──────────────
|
|
62
|
+
# `npm test` = `FH_SELFCHECK_PROFILE=consumer bash scripts/selfcheck.sh`; `npm run test:full` and CI
|
|
63
|
+
# run the full suite. Eight suites below measure things only a git CHECKOUT has (a clone to make,
|
|
64
|
+
# `.git/fh-claims`, docs/map, .github/workflows, .gitignore, `git ls-files`) — inside a tarball they
|
|
65
|
+
# are not failing, they are unmeasurable. A suite that is MOSTLY consumer-relevant stays in and skips
|
|
66
|
+
# only its checkout-bound lanes itself, by name (test_verdict_watermark_lanes.sh · test_probe_live_eval_lanes.sh do this). The consumer profile names each one it skips and prints
|
|
67
|
+
# the list again at the end; it never counts them as PASS.
|
|
68
|
+
# 🟥 The profile is honoured ONLY in package mode. Set in a checkout (CI, the author) it is ignored
|
|
69
|
+
# with a warning — otherwise one env var would silently shrink the required check.
|
|
70
|
+
_CONSUMER=0
|
|
71
|
+
if [ "${FH_SELFCHECK_PROFILE:-full}" = consumer ]; then
|
|
72
|
+
if _package_mode; then _CONSUMER=1
|
|
73
|
+
else echo "⚠️ FH_SELFCHECK_PROFILE=consumer IGNORED — this tree is a git checkout; running the full suite"; fi
|
|
74
|
+
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"
|
|
76
|
+
CONSUMER_SKIPPED=""
|
|
77
|
+
_consumer_skip() { # $1 = suite basename · rc 0 = skip it (and it has been named)
|
|
78
|
+
[ "$_CONSUMER" -eq 1 ] || return 1
|
|
79
|
+
case " $CHECKOUT_ONLY_SUITES " in *" $1 "*) ;; *) return 1 ;; esac
|
|
80
|
+
case " $CONSUMER_SKIPPED " in *" $1 "*) ;; *) CONSUMER_SKIPPED="$CONSUMER_SKIPPED $1" ;; esac
|
|
81
|
+
echo "SKIP $1 (consumer profile — needs a git checkout; run \`npm run test:full\` in a clone)"
|
|
82
|
+
return 0
|
|
83
|
+
}
|
|
84
|
+
|
|
56
85
|
# ── The single verdict for "my subject is not here" ───────────────────────────────────────────
|
|
57
86
|
# Measured 2026-08-12 (card §🔱⑮ A2): **18 blocks in this file** rendered a green SKIP when their
|
|
58
87
|
# subject was absent, and **all 18 subjects are declared in package.json files[] and present in the
|
|
@@ -200,7 +229,18 @@ for f in scripts/*.sh bin/fh-gate bin/fh-run bin/fh-goal \
|
|
|
200
229
|
if [ ! -f "$f" ]; then
|
|
201
230
|
case "$f" in
|
|
202
231
|
*'*'*) continue ;; # unmatched glob (nullglob off) — not a real path, legitimate skip
|
|
203
|
-
*)
|
|
232
|
+
*) # 🟥 Package mode (2026-09-28): the three extensionless bin wrappers are NOT in files[]
|
|
233
|
+
# (only their .js twins ship), so in an installed tarball they are absent by design and
|
|
234
|
+
# this line failed every consumer's `npm test`. Absent is legitimate ONLY when the path is
|
|
235
|
+
# undeclared AND this tree is not a git checkout — in a checkout (CI, the author) the
|
|
236
|
+
# 2026-09-03 deletion hole stays closed. Declared-but-absent and unreadable manifest stay FAIL.
|
|
237
|
+
_ships_per_files "$f"; _sp=$?
|
|
238
|
+
if [ "$_sp" -eq 1 ] && _package_mode; then
|
|
239
|
+
echo "SKIP bash -n coverage: $f (not in package.json files[] and this is an installed package, not a checkout)"
|
|
240
|
+
else
|
|
241
|
+
echo "FAIL bash -n coverage: gate-chain infra file missing: $f"; fail=1
|
|
242
|
+
fi
|
|
243
|
+
continue ;;
|
|
204
244
|
esac
|
|
205
245
|
fi
|
|
206
246
|
check "bash -n $f" bash -n "$f"
|
|
@@ -641,9 +681,41 @@ fi
|
|
|
641
681
|
if [ ! -f scripts/test_locale_invariance_lanes.sh ]; then
|
|
642
682
|
echo "FAIL locale-invariance lanes: scripts/test_locale_invariance_lanes.sh 가 없다 (부재는 통과가 아니다)"
|
|
643
683
|
fail=1
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
684
|
+
else
|
|
685
|
+
# 🟥 The suite's contract is 0 pass · 1 regression · 2 an arm UNMEASURED. The first version read
|
|
686
|
+
# any non-zero as FAIL, so an installed package — which deliberately does not ship
|
|
687
|
+
# test_marker_soul_tenet_lanes.sh (its fixture registry .claude/soul_tenets.txt is not shipped) —
|
|
688
|
+
# failed `npm test` on a coverage gap the suite itself labels "not a regression" (2026-09-28).
|
|
689
|
+
# rc=2 stays FAIL in a checkout: there every suite exists, so UNMEASURED means a missing UTF-8
|
|
690
|
+
# locale, and a green without its control is not a measurement (the rule above).
|
|
691
|
+
_li_out="$(bash scripts/test_locale_invariance_lanes.sh 2>&1)"; _li_rc=$?
|
|
692
|
+
case "$_li_rc" in
|
|
693
|
+
0) : ;;
|
|
694
|
+
2) # Non-blocking ONLY for the one expected reason: a suite that is absent because it is not
|
|
695
|
+
# shipped. rc=2 also means real instrument breakage against shipped subjects (hook count
|
|
696
|
+
# extraction, dead mutation controls) — that must stay FAIL even in a package (codex, 2026-09-28).
|
|
697
|
+
_li_other=0
|
|
698
|
+
while IFS= read -r _l; do
|
|
699
|
+
case "$_l" in
|
|
700
|
+
*'이 트리에 스위트가 없다'*)
|
|
701
|
+
_s=$(printf '%s\n' "$_l" | grep -oE 'test_[A-Za-z0-9_]+' | head -1)
|
|
702
|
+
if [ -z "$_s" ]; then _li_other=1
|
|
703
|
+
else _ships_per_files "scripts/$_s.sh"; [ "$?" -eq 1 ] || _li_other=1; fi ;;
|
|
704
|
+
*) _li_other=1 ;;
|
|
705
|
+
esac
|
|
706
|
+
done < <(printf '%s\n' "$_li_out" | grep -F 'UNMEASURED' | grep -vF '팔 하나 이상이 UNMEASURED')
|
|
707
|
+
if _package_mode && [ "$_li_other" -eq 0 ]; then
|
|
708
|
+
echo "⚠️ locale-invariance lanes: an arm is UNMEASURED in this installed package (unshipped suite — not a pass, not blocking):"
|
|
709
|
+
printf '%s\n' "$_li_out" | grep -F 'UNMEASURED' | sed 's/^/ /'
|
|
710
|
+
else
|
|
711
|
+
echo "FAIL locale-invariance lanes (rc=2 — arm UNMEASURED in a checkout)"
|
|
712
|
+
printf '%s\n' "$_li_out" | grep -F 'UNMEASURED' | sed 's/^/ /'
|
|
713
|
+
fail=1
|
|
714
|
+
fi ;;
|
|
715
|
+
*) echo "FAIL locale-invariance lanes (rc=$_li_rc)"
|
|
716
|
+
printf '%s\n' "$_li_out" | grep -vE 'ok$' | tail -20 | sed 's/^/ /'
|
|
717
|
+
fail=1 ;;
|
|
718
|
+
esac
|
|
647
719
|
fi
|
|
648
720
|
|
|
649
721
|
# multibyte-bracket lint — 열거로는 안 닫힌다. POSIX 브래킷은 비-UTF-8 로케일에서 바이트
|
|
@@ -713,7 +785,8 @@ fi
|
|
|
713
785
|
if [ ! -f scripts/package_coverage_check.sh ]; then
|
|
714
786
|
_absent_subject_verdict "test_package_coverage_lanes.sh" "scripts/package_coverage_check.sh" || fail=1
|
|
715
787
|
elif [ -f scripts/test_package_coverage_lanes.sh ]; then
|
|
716
|
-
if
|
|
788
|
+
if _consumer_skip test_package_coverage_lanes.sh; then :
|
|
789
|
+
elif ! bash scripts/test_package_coverage_lanes.sh; then
|
|
717
790
|
fail=1
|
|
718
791
|
fi
|
|
719
792
|
# The CHECKER's semantics are deliberately fail-closed and must not be softened: given a git
|
|
@@ -753,7 +826,8 @@ fi
|
|
|
753
826
|
if [ ! -f scripts/files_manifest_shipping_check.sh ]; then
|
|
754
827
|
_absent_subject_verdict "test_files_manifest_shipping_lanes.sh" "scripts/files_manifest_shipping_check.sh" || fail=1
|
|
755
828
|
elif [ -f scripts/test_files_manifest_shipping_lanes.sh ]; then
|
|
756
|
-
if
|
|
829
|
+
if _consumer_skip test_files_manifest_shipping_lanes.sh; then :
|
|
830
|
+
elif ! bash scripts/test_files_manifest_shipping_lanes.sh; then
|
|
757
831
|
fail=1
|
|
758
832
|
fi
|
|
759
833
|
# Same applicability guard as package-coverage directly above, same reason: a repo with no npm
|
|
@@ -965,6 +1039,8 @@ do
|
|
|
965
1039
|
_subj="${_pair%%|*}"; _anc="${_pair##*|}"; _lbl="${_anc##*/}"
|
|
966
1040
|
if [ ! -f "$_subj" ]; then
|
|
967
1041
|
_absent_subject_verdict "$_lbl" "$_subj" || fail=1
|
|
1042
|
+
elif [ -f "$_anc" ] && _consumer_skip "$_lbl"; then
|
|
1043
|
+
:
|
|
968
1044
|
elif [ -f "$_anc" ]; then
|
|
969
1045
|
# `< /dev/null` and the timeout are not decoration: test_frontier_digest_retry.sh deliberately
|
|
970
1046
|
# plants a `sleep 300` stub and asserts a 3s watchdog kills it. If that watchdog ever regresses
|
|
@@ -1494,7 +1570,8 @@ done
|
|
|
1494
1570
|
if [ ! -f scripts/sim_isolated_run.sh ]; then
|
|
1495
1571
|
_absent_subject_verdict "test_sim_isolated_run_lanes.sh" "scripts/sim_isolated_run.sh" || fail=1
|
|
1496
1572
|
elif [ -f scripts/test_sim_isolated_run_lanes.sh ]; then
|
|
1497
|
-
if
|
|
1573
|
+
if _consumer_skip test_sim_isolated_run_lanes.sh; then :
|
|
1574
|
+
elif ! bash scripts/test_sim_isolated_run_lanes.sh; then
|
|
1498
1575
|
fail=1
|
|
1499
1576
|
fi
|
|
1500
1577
|
else
|
|
@@ -1670,6 +1747,16 @@ else
|
|
|
1670
1747
|
fail=1
|
|
1671
1748
|
fi
|
|
1672
1749
|
|
|
1750
|
+
# main-commit guard (2026-09-29) — FH assets never land on main/master by a local commit. Same
|
|
1751
|
+
# subject/anchor shape as branch_claim above; both ship, so an absent subject is a deletion, not a skip.
|
|
1752
|
+
if [ ! -f scripts/main_commit_guard.sh ]; then
|
|
1753
|
+
_absent_subject_verdict "test_main_commit_guard_lanes.sh" "scripts/main_commit_guard.sh" || fail=1
|
|
1754
|
+
elif [ -f scripts/test_main_commit_guard_lanes.sh ]; then
|
|
1755
|
+
bash scripts/test_main_commit_guard_lanes.sh || fail=1
|
|
1756
|
+
else
|
|
1757
|
+
echo "FAIL test_main_commit_guard_lanes.sh: main_commit_guard.sh present but its anchor is missing"; fail=1
|
|
1758
|
+
fi
|
|
1759
|
+
|
|
1673
1760
|
# prless_delta_scan lanes — «커밋은 됐는데 착륙 경로에 안 올라간» 델타를 세는 advisory 계기.
|
|
1674
1761
|
# 🟥 레인의 하중선은 **음성 컨트롤**이다: 이 레포는 squash 머지를 쓰므로 순진한 per-commit 비교는
|
|
1675
1762
|
# 이미 착륙한 브랜치를 «미착륙» 으로 읽는다(2026-09-19 실측: naive 33/40 · git cherry 17/40 ·
|
|
@@ -2580,8 +2667,12 @@ else
|
|
|
2580
2667
|
echo "SKIP rules-dotfile (package mode: .git 없음 — 소스 트리 전용 검사)"
|
|
2581
2668
|
fi
|
|
2582
2669
|
|
|
2670
|
+
if [ "$_CONSUMER" -eq 1 ]; then
|
|
2671
|
+
_n=$(printf '%s\n' $CONSUMER_SKIPPED | grep -c .)
|
|
2672
|
+
echo "CONSUMER PROFILE — $_n checkout-only suite(s) NOT measured here (not a pass):$CONSUMER_SKIPPED"
|
|
2673
|
+
fi
|
|
2583
2674
|
if [ "$fail" -ne 0 ]; then
|
|
2584
2675
|
echo "SELFCHECK: FAIL"
|
|
2585
2676
|
exit 1
|
|
2586
2677
|
fi
|
|
2587
|
-
echo "SELFCHECK: PASS"
|
|
2678
|
+
if [ "$_CONSUMER" -eq 1 ]; then echo "SELFCHECK: PASS (consumer profile)"; else echo "SELFCHECK: PASS"; fi
|
|
@@ -188,5 +188,104 @@ PY
|
|
|
188
188
|
fi
|
|
189
189
|
fi
|
|
190
190
|
|
|
191
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
192
|
+
# L8b — 🟥 관측자 효과: **계기를 돌린 것 자체가 행을 뒤집으면 안 된다.**
|
|
193
|
+
# 게이트·스캔은 `tracks/_meta/governance_log_<날짜>.yaml` 과
|
|
194
|
+
# `tracks/_meta/.outbound_query_override_log` 를 실제로 쓴다(실측 2026-09-28, 이 저장소).
|
|
195
|
+
# 그 둘이 `evidence.tracks` 를 PRESENT 로 만들면, **같은 커밋의 두 체크아웃이 지문이 갈린다** —
|
|
196
|
+
# 그리고 이 계기의 유일한 용도가 그 대조라서, 그때 계기는 자기 목적을 잃는다.
|
|
197
|
+
# 그래서 이 레인은 판정만 보지 않고 **지문 문자열 전체가 바이트 동일한지**를 본다.
|
|
198
|
+
_t "L8b 기계 산출물은 판정도 지문도 안 바꾼다"
|
|
199
|
+
mk_hub "$TMP/obs"
|
|
200
|
+
git -C "$TMP/obs" add -A >/dev/null 2>&1
|
|
201
|
+
_d_before="$(FH_HUB="$TMP/obs" bash "$S" --digest 2>/dev/null)"
|
|
202
|
+
printf 'runs: []\n' > "$TMP/obs/tracks/_meta/governance_log_2026-01-01.yaml"
|
|
203
|
+
: > "$TMP/obs/tracks/_meta/.outbound_query_override_log"
|
|
204
|
+
_d_after="$(FH_HUB="$TMP/obs" bash "$S" --digest 2>/dev/null)"
|
|
205
|
+
_row_after="$(FH_HUB="$TMP/obs" bash "$S" --tsv 2>/dev/null | grep '^evidence.tracks ')"
|
|
206
|
+
if [ -z "$_d_before" ] || [ -z "$_d_after" ]; then
|
|
207
|
+
_no "계기 오류 — --digest 가 빈 문자열을 냈다. 이 팔은 공허했을 것"
|
|
208
|
+
elif [ "$_d_before" != "$_d_after" ]; then
|
|
209
|
+
_no "기계 산출물이 지문을 바꿨다 — 두 체크아웃 대조가 무의미해진다"
|
|
210
|
+
elif ! printf '%s' "$_row_after" | grep -q ' ABSENT '; then
|
|
211
|
+
_no "기계 산출물을 «이 체크아웃에만 사는 세션 기록» 으로 읽는다 — 설명문과 세는 것이 어긋남"
|
|
212
|
+
else _ok; fi
|
|
213
|
+
|
|
214
|
+
# L8b-pos — 같은 픽스처의 판별력 컨트롤. 위 팔이 «아무것도 안 세는 코드» 로도 통과하면 공허하므로,
|
|
215
|
+
# **진짜 기록 하나**를 같은 자리에 심어 행이 여전히 뒤집히는지 본다(안 뒤집히면 계기가 죽은 것).
|
|
216
|
+
_t "L8b-pos 진짜 세션 기록은 같은 자리에서 행을 뒤집는다"
|
|
217
|
+
printf '# session\n' > "$TMP/obs/tracks/_meta/session_probe.md"
|
|
218
|
+
# 🟥 CAPTURE FIRST, THEN GREP. 이 계기는 로컬 층이 비면 **rc=1 로 끝나는 것이 정상**이고(L2 가
|
|
219
|
+
# 그걸 앵커한다), `set -o pipefail` 아래에서 `계기 | grep -q` 는 grep 이 매치해도 계기의 1 을
|
|
220
|
+
# 파이프라인 코드로 올린다 — 즉 초록인 팔이 빨강으로 보인다. 이 레인의 초판이 그대로 밟았다.
|
|
221
|
+
_pos_out="$(FH_HUB="$TMP/obs" bash "$S" --tsv 2>/dev/null)" || true
|
|
222
|
+
if printf '%s\n' "$_pos_out" | grep -qc '^evidence.tracks EVIDENCE PRESENT' >/dev/null \
|
|
223
|
+
&& [ "$(printf '%s\n' "$_pos_out" | grep -c '^evidence.tracks EVIDENCE PRESENT')" -eq 1 ]; then _ok
|
|
224
|
+
else _no "기록을 심었는데도 PRESENT 가 아니다 — 술어가 아무것도 안 센다(L8b 가 공허하게 통과했을 것)"; fi
|
|
225
|
+
|
|
226
|
+
# L8c — 🟥 두 계기가 **같은 코퍼스**를 센다는 관계를 박는다.
|
|
227
|
+
# `evidence.tracks` 의 설명문이 약속하는 것은 «인사 분기와 recall 이 읽는 코퍼스» 이고,
|
|
228
|
+
# 그 인사 분기를 실제로 내는 것은 `mapped_tracks.sh` 의 `session_files` 다. 두 술어가 갈리면
|
|
229
|
+
# 지문은 «기록 있음» 을 말하면서 인사는 `new` 를 내거나 그 반대가 된다 — 어느 쪽도 오류가 안 뜬다.
|
|
230
|
+
# 한쪽 로직을 베끼는 대신 **관계**를 박는다(#784 L14g 와 같은 형태).
|
|
231
|
+
_t "L8c evidence.tracks ⟺ mapped_tracks session_files>0"
|
|
232
|
+
_agree() { # $1 = fixture dir → "TRACKS=<state> SESS=<n>"
|
|
233
|
+
local d="$1" _st _ss
|
|
234
|
+
_st="$(FH_HUB="$d" bash "$S" --tsv 2>/dev/null | awk -F'\t' '$1=="evidence.tracks"{print $3}')"
|
|
235
|
+
_ss="$( cd "$d" && bash "$SUT_MT" 2>/dev/null | sed -n 's/^session_files=//p' )"
|
|
236
|
+
printf 'TRACKS=%s SESS=%s' "${_st:-MISSING}" "${_ss:-MISSING}"
|
|
237
|
+
}
|
|
238
|
+
SUT_MT="$(pwd -P)/scripts/mapped_tracks.sh"
|
|
239
|
+
if [ ! -f "$SUT_MT" ]; then
|
|
240
|
+
echo "UNMEASURED — mapped_tracks.sh 부재, 관계를 잴 대상이 없다 (통과 아님)"
|
|
241
|
+
else
|
|
242
|
+
mk_hub "$TMP/agree_no"; git -C "$TMP/agree_no" add -A >/dev/null 2>&1
|
|
243
|
+
printf 'runs: []\n' > "$TMP/agree_no/tracks/_meta/governance_log_2026-01-01.yaml"
|
|
244
|
+
mk_hub "$TMP/agree_yes" full; git -C "$TMP/agree_yes" add -A >/dev/null 2>&1
|
|
245
|
+
# 🟥 full 픽스처는 tracked 로 add 된다 — 그러면 둘 다 «동봉된 것» 이라 세지 말아야 한다.
|
|
246
|
+
# 관계 레인이 재려는 것은 «untracked 기록» 이므로, 기록 하나를 add 이후에 만든다.
|
|
247
|
+
printf '# session\n' > "$TMP/agree_yes/tracks/_meta/session_after_add.md"
|
|
248
|
+
# 🟥 박는 것은 **개수가 아니라 존재의 일치**다. `mapped_tracks.sh` 의 두 글로브는
|
|
249
|
+
# `tracks/_meta/session_*.md` 를 양쪽에서 잡아 같은 파일을 두 번 센다(선행 동작, 이 PR 이
|
|
250
|
+
# 건드리지 않는다). 개수를 박으면 이 레인은 그 무해한 중복에 결박되고, 정작 재려던
|
|
251
|
+
# «둘이 같은 코퍼스를 보나» 는 안 재게 된다.
|
|
252
|
+
_a_no="$(_agree "$TMP/agree_no")"; _a_yes="$(_agree "$TMP/agree_yes")"
|
|
253
|
+
_no_st="${_a_no%% *}"; _no_ss="${_a_no##* }"
|
|
254
|
+
_yes_st="${_a_yes%% *}"; _yes_ss="${_a_yes##* }"
|
|
255
|
+
if [ "$_no_st" = "TRACKS=ABSENT" ] && [ "$_no_ss" = "SESS=0" ] \
|
|
256
|
+
&& [ "$_yes_st" = "TRACKS=PRESENT" ] && [ "$_yes_ss" != "SESS=0" ] \
|
|
257
|
+
&& [ "$_yes_ss" != "SESS=MISSING" ]; then _ok
|
|
258
|
+
else _no "두 계기가 어긋난다 — 기록없음팔:[$_a_no] 기록있음팔:[$_a_yes]"; fi
|
|
259
|
+
fi
|
|
260
|
+
|
|
261
|
+
# L8b-rev — 🟥 되돌림 프로브. 위 두 팔이 **이 수리에 결박돼 있나**를 본다: 술어를 옛 형태
|
|
262
|
+
# («untracked 면 전부 센다»)로 되돌린 복사본에서 L8b 가 **반드시 빨강**이어야 한다.
|
|
263
|
+
# 빨강이 안 되면 L8b 는 아무 결함에도 안 묶인 장식이다.
|
|
264
|
+
_t "L8b-rev 되돌림 — 넓은 술어로 복원하면 L8b 가 적색"
|
|
265
|
+
MUTB="$TMP/mut_broad.sh"
|
|
266
|
+
python3 - "$S" "$MUTB" <<'PY'
|
|
267
|
+
import io, re, sys
|
|
268
|
+
src = io.open(sys.argv[1], encoding='utf-8').read()
|
|
269
|
+
old = ' for _f in "$H"/tracks/*/session_*.md "$H"/tracks/_meta/*.md; do'
|
|
270
|
+
new = ' for _f in $(find "$H/tracks" -type f ! -name .gitkeep 2>/dev/null); do' # portability-noqa: 파이썬 문자열이다 — 셸 루프가 아니고, 뮤턴트 쪽 실제 루프는 바로 다음 줄에서 `[ -f "$_f" ] || continue` 를 그대로 물려받는다
|
|
271
|
+
if src.count(old) != 1:
|
|
272
|
+
sys.stderr.write("SUBN=%d\n" % src.count(old)); sys.exit(3)
|
|
273
|
+
io.open(sys.argv[2], 'w', encoding='utf-8').write(src.replace(old, new, 1))
|
|
274
|
+
PY
|
|
275
|
+
_revrc=$?
|
|
276
|
+
if [ "$_revrc" -ne 0 ]; then
|
|
277
|
+
_no "계기 오류 — 뮤턴트 치환이 1회가 아니었다(rc=$_revrc). 이 팔은 공허했을 것"
|
|
278
|
+
else
|
|
279
|
+
mk_hub "$TMP/rev"; git -C "$TMP/rev" add -A >/dev/null 2>&1
|
|
280
|
+
_rb="$(FH_HUB="$TMP/rev" bash "$MUTB" --digest 2>/dev/null)"
|
|
281
|
+
printf 'runs: []\n' > "$TMP/rev/tracks/_meta/governance_log_2026-01-01.yaml"
|
|
282
|
+
_ra="$(FH_HUB="$TMP/rev" bash "$MUTB" --digest 2>/dev/null)"
|
|
283
|
+
if [ -z "$_rb" ] || [ -z "$_ra" ]; then
|
|
284
|
+
_no "계기 오류 — 뮤턴트가 지문을 안 냈다. 침묵은 아무 뜻이 없다"
|
|
285
|
+
elif [ "$_rb" = "$_ra" ]; then
|
|
286
|
+
_no "뮤턴트도 지문이 안 변한다 — L8b 는 이 결함에 결박돼 있지 않다"
|
|
287
|
+
else _ok; fi
|
|
288
|
+
fi
|
|
289
|
+
|
|
191
290
|
echo "── $([ "$fail" -eq 0 ] && echo 'all lanes ok' || echo 'FAILURES above') ──"
|
|
192
291
|
exit "$fail"
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_main_commit_guard_lanes.sh — known pair for scripts/main_commit_guard.sh and its wiring in
|
|
3
|
+
# templates/.git-hooks/pre-commit. Runs in disposable clones — never touches this checkout.
|
|
4
|
+
#
|
|
5
|
+
# UNIT (the script alone, branch injected via MAIN_GUARD_BRANCH):
|
|
6
|
+
# U1 main → rc=1 · U2 master → rc=1 · U3 feature branch → rc=0, silent · U4 HEAD (detached) → rc=0
|
|
7
|
+
# U5 main + MAIN_COMMIT_OK=1 → rc=0 AND one log line appended (override is recorded, not just allowed)
|
|
8
|
+
# REAL HOOK (shallow clone, hook installed, output discriminated by the guard's own tag — the clone
|
|
9
|
+
# carries no marker/manifest, so OTHER axes block every commit and rc is not this lane's signal):
|
|
10
|
+
# H1 FH asset staged on main → «[main-commit]» ❌ line (the fixed case)
|
|
11
|
+
# H2 NON-FH file staged on main → no guard line (scope: FH assets only)
|
|
12
|
+
# H3 FH asset staged on a feature branch → no guard line (control: not unconditional)
|
|
13
|
+
# H4 FH asset on main + MAIN_COMMIT_OK=1 → override line (channel works through the hook)
|
|
14
|
+
# REVERT: the hook with the guard call removed must turn H1 red — else H1 is decoration.
|
|
15
|
+
# Usage: bash scripts/test_main_commit_guard_lanes.sh [--hook <path>]
|
|
16
|
+
set -u
|
|
17
|
+
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
18
|
+
HOOK="$ROOT/templates/.git-hooks/pre-commit"; [ "${1:-}" = "--hook" ] && HOOK="$2"
|
|
19
|
+
G="$ROOT/scripts/main_commit_guard.sh"
|
|
20
|
+
pass=0; fail=0
|
|
21
|
+
ok(){ printf ' ✅ %s\n' "$1"; pass=$((pass+1)); }
|
|
22
|
+
no(){ printf ' ❌ %s\n' "$1"; fail=$((fail+1)); }
|
|
23
|
+
[ -f "$G" ] || { echo "FAIL subject absent: $G"; exit 1; }
|
|
24
|
+
T=$(mktemp -d); trap 'rm -rf "$T"' EXIT
|
|
25
|
+
|
|
26
|
+
echo "[main-commit-guard] unit"
|
|
27
|
+
mkdir -p "$T/u" && cd "$T/u" && git init -q 2>/dev/null
|
|
28
|
+
for b in main master; do
|
|
29
|
+
out=$(MAIN_GUARD_BRANCH=$b EVIDENCE_ROOT="$T/u" bash "$G" 2>&1); rc=$?
|
|
30
|
+
{ [ "$rc" = 1 ] && printf '%s' "$out" | grep -q '\[main-commit\]'; } && ok "U $b → rc=1, names itself" || no "U $b → rc=$rc [$out]"
|
|
31
|
+
done
|
|
32
|
+
out=$(MAIN_GUARD_BRANCH=feat/x EVIDENCE_ROOT="$T/u" bash "$G" 2>&1); rc=$?
|
|
33
|
+
{ [ "$rc" = 0 ] && [ -z "$out" ]; } && ok "U3 feature branch → rc=0, silent" || no "U3 feature → rc=$rc [$out]"
|
|
34
|
+
out=$(MAIN_GUARD_BRANCH=HEAD EVIDENCE_ROOT="$T/u" bash "$G" 2>&1); rc=$?
|
|
35
|
+
[ "$rc" = 0 ] && ok "U4 detached HEAD (rebase/bisect) → rc=0" || no "U4 detached → rc=$rc"
|
|
36
|
+
out=$(MAIN_COMMIT_OK=1 MAIN_GUARD_BRANCH=main EVIDENCE_ROOT="$T/u" bash "$G" 2>&1); rc=$?
|
|
37
|
+
n=$(grep -c 'MAIN_COMMIT_OK override' "$T/u/tracks/_meta/.main_commit_override_log" 2>/dev/null); n=${n:-0}
|
|
38
|
+
{ [ "$rc" = 0 ] && [ "$n" = 1 ]; } && ok "U5 MAIN_COMMIT_OK=1 → rc=0 and logged once" || no "U5 override rc=$rc log=$n"
|
|
39
|
+
|
|
40
|
+
hook_case(){ # $1 label $2 hook $3 branch $4 file-to-stage $5 want(GUARD|NONE|OVERRIDE) [$6 env]
|
|
41
|
+
local label="$1" hook="$2" br="$3" f="$4" want="$5" envv="${6:-}" got out
|
|
42
|
+
rm -rf "$T/r"; git clone -q --depth 1 "file://$ROOT" "$T/r" 2>/dev/null || { no "$label — clone failed"; return; }
|
|
43
|
+
( cd "$T/r" && git config user.email t@t && git config user.name t \
|
|
44
|
+
&& mkdir -p .git/hooks && cp "$hook" .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit \
|
|
45
|
+
&& cp "$G" scripts/main_commit_guard.sh \
|
|
46
|
+
&& git checkout -q -B "$br" ) || { no "$label — setup failed"; return; } # the clone starts on the SOURCE's HEAD, not main
|
|
47
|
+
mkdir -p "$T/r/$(dirname "$f")"; printf 'lane probe\n' >> "$T/r/$f"
|
|
48
|
+
out=$(cd "$T/r" && git add "$f" && env $envv FH_SKIP_GATE_AXES=1 git commit -qm probe 2>&1)
|
|
49
|
+
if printf '%s' "$out" | grep -q '❌ \[main-commit\]'; then got=GUARD
|
|
50
|
+
elif printf '%s' "$out" | grep -q 'MAIN_COMMIT_OK=1 (logged)'; then got=OVERRIDE
|
|
51
|
+
else got=NONE; fi
|
|
52
|
+
[ "$got" = "$want" ] && ok "$label → $got" || { no "$label → $got (expected $want)"; printf '%s\n' "$out" | grep -E 'main-commit|FH 4-Axis|No FH' | head -3 | sed 's/^/ /'; }
|
|
53
|
+
}
|
|
54
|
+
if [ ! -e "$ROOT/.git" ]; then # installed package: nothing to clone — say so, never fold into PASS
|
|
55
|
+
echo " ⏭️ SKIP (PASS 아님) — hook/revert arms need a git checkout to clone; this tree has no .git"
|
|
56
|
+
echo "[main-commit-guard] $pass passed, $fail failed (hook arms skipped)"; [ "$fail" -eq 0 ]; exit $?
|
|
57
|
+
fi
|
|
58
|
+
echo "[main-commit-guard] real hook: $HOOK"
|
|
59
|
+
hook_case "H1 FH asset on main" "$HOOK" main scripts/lane_probe.sh GUARD
|
|
60
|
+
hook_case "H2 non-FH file on main" "$HOOK" main lane_probe.txt NONE
|
|
61
|
+
hook_case "H3 FH asset on a feature branch" "$HOOK" feat/lane scripts/lane_probe.sh NONE
|
|
62
|
+
hook_case "H4 FH asset on main + override" "$HOOK" main scripts/lane_probe.sh OVERRIDE "MAIN_COMMIT_OK=1"
|
|
63
|
+
|
|
64
|
+
echo "[main-commit-guard] revert probe"
|
|
65
|
+
M="$T/hook_mutant"; sed 's#bash "\$MCG"#true#' "$HOOK" > "$M"
|
|
66
|
+
if cmp -s "$HOOK" "$M"; then no "REVERT mutant did not apply (sed matched nothing) — HARNESS-ERROR, not a pass"
|
|
67
|
+
else
|
|
68
|
+
f0=$fail; hook_case "REVERT guard call removed → H1 must go red" "$M" main scripts/lane_probe.sh GUARD >/dev/null
|
|
69
|
+
if [ "$fail" -gt "$f0" ]; then fail=$f0; ok "REVERT without the call, H1 no longer blocks — the lane measures the wiring"
|
|
70
|
+
else no "REVERT H1 still GUARD with the call removed — H1 is decoration"; fi
|
|
71
|
+
fi
|
|
72
|
+
echo "[main-commit-guard] $pass passed, $fail failed"; [ "$fail" -eq 0 ]
|
|
@@ -214,6 +214,79 @@ printf '%s' "$_ngout" | grep -q '^onboarding_branch=' \
|
|
|
214
214
|
&& ok "B-5 the branch key is emitted even on the UNMEASURED path" \
|
|
215
215
|
|| ng "B-5 UNMEASURED path emits no branch key — silence is not an answer"
|
|
216
216
|
|
|
217
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
218
|
+
# L-pipe — 🟥 `_is_shipped` 가 **큰 tracked 목록에서 매치를 무매치로 읽으면** 안 된다.
|
|
219
|
+
#
|
|
220
|
+
# `set -o pipefail` 아래에서 `printf '%s\n' "$_TRACKED" | grep -qxF "$1"` 는, 매치가 목록 앞쪽에
|
|
221
|
+
# 있으면 grep 이 입력을 끝까지 안 읽고 끝나서 printf 가 SIGPIPE 로 죽고, pipefail 이 그 **141** 을
|
|
222
|
+
# 파이프라인 코드로 올린다 ⇒ 함수가 «동봉된 파일이 아니다» 로 답한다. `$_TRACKED` 는
|
|
223
|
+
# `git ls-files` 출력이라 허브가 커지면 같이 커진다 — 구조적 상한이 없다.
|
|
224
|
+
# (온셋 실측 ~16 KB: `scripts/pipefail_earlyexit_scan.sh` 헤더. 여기 픽스처는 결정적으로
|
|
225
|
+
# 뒤집히도록 그보다 크게 잡는다.)
|
|
226
|
+
#
|
|
227
|
+
# 🟥 방향이 이 함수의 존재 이유와 정반대다: **동봉된 파일이 사용자 기록으로 세어져, 갓 클론한
|
|
228
|
+
# 허브가 `returning` 을 답한다** — CLAUDE.md 가 이름으로 적어 둔 온보딩 FP 바로 그것.
|
|
229
|
+
BIG="$(fh_fixture_root "$(mktemp -d)")"
|
|
230
|
+
mkdir -p "$BIG/scripts" "$BIG/tracks/_meta" "$BIG/tracks/_pad"
|
|
231
|
+
cp "$SUT" "$BIG/scripts/mapped_tracks.sh"
|
|
232
|
+
git -C "$BIG" init -q 2>/dev/null
|
|
233
|
+
# 매치 대상: ls-files 정렬에서 **맨 앞**에 오도록 `_meta` 아래에 둔다('_' < 소문자).
|
|
234
|
+
printf '# shipped session record\n' > "$BIG/tracks/_meta/a.md"
|
|
235
|
+
# 그 뒤를 긴 경로로 채워 목록을 16 KB 훨씬 위로 올린다. 이름이 `session_*` 가 아니라서
|
|
236
|
+
# 세는 루프의 글로브에는 안 걸린다 — 오직 «목록 크기» 만 담당한다. 🟥 그리고 밑줄 접두
|
|
237
|
+
# 디렉터리(`_pad`)여야 한다: 일반 이름이면 «매핑된 프로젝트» 로 세어져 `COUNT>0` 이 되고,
|
|
238
|
+
# 그러면 `session_files=0` 이어도 분기가 `returning` 이라 이 레인이 엉뚱한 것을 잰다(초판 실측).
|
|
239
|
+
_i=0
|
|
240
|
+
while [ "$_i" -lt 2000 ]; do
|
|
241
|
+
printf 'x\n' > "$BIG/tracks/_pad/pad_${_i}_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.md"
|
|
242
|
+
_i=$((_i + 1))
|
|
243
|
+
done
|
|
244
|
+
git -C "$BIG" add -A >/dev/null 2>&1
|
|
245
|
+
_LSBYTES=$(git -C "$BIG" ls-files -- tracks | wc -c | tr -d ' ')
|
|
246
|
+
if [ "${_LSBYTES:-0}" -lt 65536 ]; then
|
|
247
|
+
echo "ⓘ L-pipe UNMEASURED — tracked 목록이 ${_LSBYTES}B 로 작아 경합을 세울 수 없다 (통과 아님)"
|
|
248
|
+
else
|
|
249
|
+
_mt_run() { ( cd "$1" && bash scripts/mapped_tracks.sh 2>/dev/null ); }
|
|
250
|
+
_o="$(_mt_run "$BIG")"
|
|
251
|
+
_sess=$(printf '%s\n' "$_o" | sed -n 's/^session_files=//p')
|
|
252
|
+
_br=$(printf '%s\n' "$_o" | sed -n 's/^onboarding_branch=//p')
|
|
253
|
+
[ "$_sess" = "0" ] && [ "$_br" = "new" ] \
|
|
254
|
+
&& ok "L-pipe ${_LSBYTES}B tracked 목록에서도 동봉 파일은 제외된다 (session_files=0 · new)" \
|
|
255
|
+
|| ng "L-pipe 동봉 파일이 사용자 기록으로 세어졌다 — session_files=$_sess branch=$_br (갓 클론이 returning)"
|
|
256
|
+
|
|
257
|
+
# 판별력 컨트롤 — 같은 픽스처에서 **정말 untracked** 인 기록 하나는 여전히 세어져야 한다.
|
|
258
|
+
# 이게 없으면 위 팔은 «아무것도 안 세는 코드» 로도 초록이다.
|
|
259
|
+
printf '# user record\n' > "$BIG/tracks/_meta/zz_user.md"
|
|
260
|
+
_o2="$(_mt_run "$BIG")"
|
|
261
|
+
_sess2=$(printf '%s\n' "$_o2" | sed -n 's/^session_files=//p')
|
|
262
|
+
[ "${_sess2:-0}" -ge 1 ] \
|
|
263
|
+
&& ok "L-pipe control — untracked 기록은 같은 목록 크기에서도 세어진다 (session_files=$_sess2)" \
|
|
264
|
+
|| ng "L-pipe control — untracked 기록이 안 세어졌다: 위 팔은 공허하게 통과했다"
|
|
265
|
+
rm -f "$BIG/tracks/_meta/zz_user.md"
|
|
266
|
+
|
|
267
|
+
# 되돌림 프로브 — 파이프 형태로 복원한 복사본은 **반드시** 위 팔을 깨야 한다.
|
|
268
|
+
MUTP="$BIG/scripts/mapped_tracks_mut.sh"
|
|
269
|
+
python3 - "$SUT" "$MUTP" <<'PY'
|
|
270
|
+
import io, sys
|
|
271
|
+
src = io.open(sys.argv[1], encoding='utf-8').read()
|
|
272
|
+
old = ' grep -qxF "$1" <<<"$_TRACKED"'
|
|
273
|
+
new = ' printf \'%s\\n\' "$_TRACKED" | grep -qxF "$1"'
|
|
274
|
+
if src.count(old) != 1:
|
|
275
|
+
sys.stderr.write("SUBN=%d\n" % src.count(old)); sys.exit(3)
|
|
276
|
+
io.open(sys.argv[2], 'w', encoding='utf-8').write(src.replace(old, new, 1))
|
|
277
|
+
PY
|
|
278
|
+
if [ $? -ne 0 ]; then
|
|
279
|
+
ng "L-pipe revert — 뮤턴트 치환이 1회가 아니었다. 이 프로브는 공허했을 것"
|
|
280
|
+
else
|
|
281
|
+
_om="$( cd "$BIG" && bash scripts/mapped_tracks_mut.sh 2>/dev/null )"
|
|
282
|
+
_sessm=$(printf '%s\n' "$_om" | sed -n 's/^session_files=//p')
|
|
283
|
+
[ "${_sessm:-0}" -ge 1 ] \
|
|
284
|
+
&& ok "L-pipe revert — 파이프 형태를 복원하면 동봉 파일이 다시 오집된다 (session_files=$_sessm)" \
|
|
285
|
+
|| ng "L-pipe revert — 뮤턴트도 0 을 냈다. 이 레인은 그 결함에 결박돼 있지 않다"
|
|
286
|
+
fi
|
|
287
|
+
fi
|
|
288
|
+
rm -rf "$BIG"
|
|
289
|
+
|
|
217
290
|
if [ "$FAIL" -eq 0 ]; then
|
|
218
291
|
echo "MAPPED-TRACKS LANES: PASS ($PASS/$PASS)"
|
|
219
292
|
echo " NOT covered: whether the synergy skill (or any other consumer) actually CALLS this."
|