@chrono-meta/fh-gate 3.9.0 → 3.11.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.
@@ -0,0 +1,142 @@
1
+ #!/usr/bin/env bash
2
+ # test_precommit_gitlink_lanes.sh — known pair for pre-commit's nested-repo gitlink guard.
3
+ #
4
+ # WHAT IT GUARDS. `.gitignore` does not apply to a nested repository. `tracks/**` ignores every
5
+ # FILE under tracks/, but a directory that carries its own `.git` is offered to the index as a
6
+ # mode-160000 entry anyway — so `git add -A` stages it while the author believes the subtree is
7
+ # ignored. Measured 2026-09-16: `tracks/_meta/dominance_bench_B/recovered_2026-09-09/benchB/
8
+ # target_repo_O` (a benchmark's target repo) was staged by `git add -A --dry-run`.
9
+ #
10
+ # 🟥 WHY IT IS SILENT, which is why it needs a gate rather than a habit. A gitlink records a commit
11
+ # SHA in ANOTHER repository. A clone cannot fetch it, so the content is absent while the tree still
12
+ # looks complete — nothing in the commit output says the subtree did not travel.
13
+ #
14
+ # 🟥 SCOPE IS ASYMMETRIC ON PURPOSE, and L4 pins the half that is easy to "unify" away. Under
15
+ # tracks/ a gitlink is provably wrong (local-only lane) → BLOCK. Elsewhere this repo has no
16
+ # submodules today, but calling that a defect would over-block a legitimate future one, and a gate
17
+ # that over-blocks trains `--no-verify` — which disarms the Destructive-Op gate in the SAME hook.
18
+ # So elsewhere it surfaces and proceeds. The absence of a block there is the design, not a gap.
19
+ #
20
+ # HERMETIC: every fixture is a throwaway repo under mktemp. Never reads the real tree or real tracks/.
21
+ #
22
+ # Usage: bash scripts/test_precommit_gitlink_lanes.sh Exit: 0 = all behave · 1 = regression · 10 = own setup broke.
23
+
24
+ set -uo pipefail
25
+ cd "$(dirname "$0")/.." || exit 1
26
+ ROOT="$(pwd -P)"
27
+ HOOK="$ROOT/templates/.git-hooks/pre-commit"
28
+ PASS=0; FAIL=0
29
+ ok() { echo "✅ $1"; PASS=$((PASS+1)); }
30
+ ng() { echo "❌ $1"; FAIL=$((FAIL+1)); }
31
+
32
+ [ -f "$HOOK" ] || { echo "ⓘ subject missing: $HOOK — skipped is NOT passed"; exit 2; }
33
+
34
+ T="$(mktemp -d 2>/dev/null)" || { echo "ⓘ mktemp failed — this suite's own setup broke (NOT a pass)"; exit 10; }
35
+ trap 'rm -rf "$T"' EXIT INT TERM
36
+
37
+ # 🟥 The guard is a block inside a long hook that runs many other gates. Running the whole hook
38
+ # would make this suite measure everything EXCEPT what it claims to. So the block is extracted and
39
+ # run against a fixture repo — the same bytes, isolated. If the anchor ever moves, extraction yields
40
+ # nothing and L0 fails loudly rather than every lane passing vacuously.
41
+ awk '/^echo "\[Privacy\] nested-repo gitlink\.\.\."$/,/^fi$/' "$HOOK" > "$T/block.sh"
42
+ if [ ! -s "$T/block.sh" ] || ! grep -q 'GITLINK_BLOCKED' "$T/block.sh"; then
43
+ ng "L0 setup — could not extract the gitlink block from the hook (anchor moved?)"
44
+ echo "── precommit-gitlink lanes: PASS=$PASS FAIL=$FAIL ──"; exit 1
45
+ fi
46
+ ok "L0 block extracted from the live hook (not a second copy)"
47
+
48
+ # 픽스처 레포 하나 + 그 안에 중첩 레포 하나. 실제 사고와 같은 모양으로 짓는다
49
+ # ([[feedback_fixture_shape_from_artifact_not_mental_model]]) — 손으로 mode 160000 을 써넣지 않고,
50
+ # **진짜 중첩 레포를 만들어** git 이 스스로 gitlink 으로 계상하게 둔다.
51
+ mk_repo() { # $1=경로
52
+ git init -q "$1" 2>/dev/null || return 1
53
+ git -C "$1" config user.email t@t; git -C "$1" config user.name t
54
+ echo x > "$1/f.txt"; git -C "$1" add f.txt; git -C "$1" commit -qm init
55
+ }
56
+ # 🟥 **레인마다 자기 픽스처 레포를 짓는다.** 초판은 하나를 공유했고 앞 레인이 스테이징한
57
+ # gitlink 이 인덱스에 남아 L3(known-negative)·L4 를 오염시켰다 — «막았다» 가 아니라
58
+ # «앞 레인 것을 막고 있었다»였다. 공유 상태는 known-negative 를 구조적으로 무효화한다.
59
+ new_outer() { # $1=이름 → stdout: 경로
60
+ local d="$T/$1"
61
+ mk_repo "$d" >/dev/null 2>&1 || return 1
62
+ printf 'tracks/**\n!tracks/**/\n' > "$d/.gitignore"
63
+ mkdir -p "$d/tracks/_meta/bench"
64
+ printf '%s' "$d"
65
+ }
66
+
67
+ run_block() { # cwd=$1, env 나머지는 호출자가 export
68
+ ( cd "$1" && FAILED=0 && . "$T/block.sh" >"$T/out.txt" 2>&1; echo "$FAILED" )
69
+ }
70
+
71
+ # ── L1 known-positive: tracks/ 밑 중첩 레포가 실제로 gitlink 으로 스테이징되고, 가드가 막는다 ──
72
+ # 🟥 이 레인이 증명하는 첫 번째 것은 가드가 아니라 **결함 자체**다: .gitignore 가 `tracks/**` 인데도
73
+ # add 가 그 디렉터리를 집는다. 그게 성립 안 하면 이 가드는 존재 이유가 없다.
74
+ O1=$(new_outer o1) || { ng "L0b 픽스처 레포 생성 실패"; exit 10; }
75
+ mk_repo "$O1/tracks/_meta/bench/target" >/dev/null 2>&1 || { ng "L0c 중첩 레포 생성 실패"; exit 10; }
76
+ ( cd "$O1" && git add -A 2>/dev/null )
77
+ STAGED_MODE=$(cd "$O1" && git diff --cached --raw --no-renames 2>/dev/null | awk -F'\t' '$1 ~ / 160000 /{print $2}')
78
+ if [ "$STAGED_MODE" = "tracks/_meta/bench/target" ]; then
79
+ ok "L1 결함 재현: .gitignore 가 tracks/** 인데도 중첩 레포가 gitlink 으로 스테이징된다"
80
+ else
81
+ ng "L1 결함이 재현 안 됨 — 스테이징된 gitlink: [$STAGED_MODE] (계기 오류: 이 가드의 전제가 성립 안 함)"
82
+ fi
83
+ RC=$(run_block "$O1")
84
+ if [ "$RC" = "1" ] && grep -q "nested repo staged as a gitlink under tracks/" "$T/out.txt"; then
85
+ ok "L2 BLOCK — tracks/ 밑 gitlink 에서 FAILED=1 이고 경로를 이름으로 댄다"
86
+ else
87
+ ng "L2 안 막았다 (FAILED=$RC)"; sed 's/^/ /' "$T/out.txt"
88
+ fi
89
+
90
+ # ── L3 known-negative: gitlink 이 없으면 통과. 「아무거나 막는 가드」가 아님을 박는다 ──
91
+ O3=$(new_outer o3) || { ng "L3 setup 실패"; }
92
+ echo y > "$O3/plain.txt"; ( cd "$O3" && git add plain.txt 2>/dev/null )
93
+ RC=$(run_block "$O3")
94
+ if [ "$RC" = "0" ] && grep -q "✅ PASS" "$T/out.txt"; then
95
+ ok "L3 known-negative: 평범한 파일만 스테이징되면 PASS (과차단 없음)"
96
+ else
97
+ ng "L3 gitlink 없는데 막았다 (FAILED=$RC)"; sed 's/^/ /' "$T/out.txt"
98
+ fi
99
+
100
+ # ── L4 비대칭 고정: tracks/ **밖** 의 gitlink 은 표면화하되 막지 않는다 ──
101
+ # 🟥 이 레인이 없으면 다음 사람이 「일관성」이라며 repo-wide 차단으로 «통일»하고, 그 순간
102
+ # 정당한 서브모듈이 과차단되어 --no-verify 를 훈련시킨다. 부재가 설계임을 여기서 박는다.
103
+ O4=$(new_outer o4) || { ng "L4 setup 실패"; }
104
+ mkdir -p "$O4/vendor"
105
+ mk_repo "$O4/vendor/dep" >/dev/null 2>&1 || { ng "L4 setup 실패(중첩)"; }
106
+ ( cd "$O4" && git add -A 2>/dev/null )
107
+ RC=$(run_block "$O4")
108
+ if [ "$RC" = "0" ] && grep -q "surfaced, not blocked" "$T/out.txt"; then
109
+ ok "L4 비대칭: tracks/ 밖 gitlink 은 표면화만 (차단 아님 — 부재가 설계다)"
110
+ else
111
+ ng "L4 tracks/ 밖 gitlink 처리가 규격과 다르다 (FAILED=$RC)"; sed 's/^/ /' "$T/out.txt"
112
+ fi
113
+
114
+ # ── L5 override 채널 — 검토된 경우에만, 그리고 조용하지 않게 ──
115
+ O5=$(new_outer o5) || { ng "L5 setup 실패"; }
116
+ mk_repo "$O5/tracks/_meta/bench/target2" >/dev/null 2>&1
117
+ ( cd "$O5" && git add -A 2>/dev/null )
118
+ RC=$( cd "$O5" && FAILED=0 && TRACKS_GITLINK_OK=1 . "$T/block.sh" >"$T/out.txt" 2>&1; echo "$FAILED" )
119
+ if [ "$RC" = "0" ] && grep -q "TRACKS_GITLINK_OK=1" "$T/out.txt"; then
120
+ ok "L5 override: TRACKS_GITLINK_OK=1 이면 통과하되 그 사실이 출력에 남는다"
121
+ else
122
+ ng "L5 override 채널이 규격과 다르다 (FAILED=$RC)"; sed 's/^/ /' "$T/out.txt"
123
+ fi
124
+
125
+ # ── L6 되돌림 프로브 — 가드를 떼면 L2 가 정확히 빨개진다 ──
126
+ # 🟥 적용 확인은 **의미**로 한다. 텍스트만 보면 무효 뮤턴트가 통과한다(2026-09-16 실측).
127
+ sed 's/GITLINK_BLOCKED=1; FAILED=1/GITLINK_BLOCKED=0/' "$T/block.sh" > "$T/block_neutered.sh"
128
+ if ! grep -q 'GITLINK_BLOCKED=0$' "$T/block_neutered.sh"; then
129
+ ng "L6 뮤턴트가 안 만들어졌다 (계기 오류)"
130
+ else
131
+ RC=$( cd "$O1" && FAILED=0 && . "$T/block_neutered.sh" >"$T/out.txt" 2>&1; echo "$FAILED" )
132
+ if [ "$RC" = "0" ]; then
133
+ ok "L6 되돌림: 차단을 떼면 같은 입력이 통과한다 (앵커 생존)"
134
+ else
135
+ ng "L6 차단을 뗐는데도 FAILED=$RC — 이 레인이 재는 것은 이 가드가 아니다"
136
+ fi
137
+ fi
138
+
139
+ echo
140
+ echo "── precommit-gitlink lanes: PASS=$PASS FAIL=$FAIL ──"
141
+ [ "$FAIL" -eq 0 ] || exit 1
142
+ exit 0
@@ -227,8 +227,14 @@ fi
227
227
  # ~G-LINT-01 — moved from NOT-YET-AUTHORED into ARM_CAPABILITY_EXCLUDE. Excluded either way, so
228
228
  # the counts are unaffected; what changed is that it no longer emits a nightly warning that
229
229
  # reads like a to-do for a spec nobody can write against a route the arm cannot take.
230
- _lane S2 select-guard "selected count == 13 (11 + G-GREET-02 + G-GREET-05)" "13" "$sel_count"
231
- _lane S3 select-guard "excluded count == 20 (33 probes.md rows - 13 selected)" "20" "$exc_count"
230
+ # ~G-TRIG-01 — 2026-09-17: moved into ARM_CAPABILITY_EXCLUDE, the TWIN of G-TRIG-03 above and
231
+ # for the identical reason (fh_detail_protocols.md:443-444 lists the two on adjacent lines
232
+ # of one row-diet removal list; neither route exists for an arm without the Skill tool).
233
+ # Unlike G-LINT-01 this DOES move the counts — it had been selected and authored — so 13 -> 12
234
+ # and 20 -> 21. It should have moved on 2026-09-14 with its twin; leaving it behind is the
235
+ # half-fix shape, and these three pinned numbers are what surfaced it.
236
+ _lane S2 select-guard "selected count == 12 (13 - G-TRIG-01, 2026-09-17)" "12" "$sel_count"
237
+ _lane S3 select-guard "excluded count == 21 (33 probes.md rows - 12 selected)" "21" "$exc_count"
232
238
 
233
239
  # S7/S8: the two newly-covered rows must actually be IN the selection, and the state-excluded row
234
240
  # must carry its OWN reason rather than the generic utterance-shape one. Counting alone would pass
@@ -240,6 +246,21 @@ ids={p['id'] for p in s}
240
246
  print('yes' if {'G-GREET-02','G-GREET-05'} <= ids else 'no')")
241
247
  _lane S7 select-guard "G-GREET-02 and G-GREET-05 are selected BY NAME (not just a count of 13)" "yes" "$greet_new"
242
248
 
249
+ # S10: the count-drift guard's other half — S2/S3 would pass again if some unrelated row swapped in
250
+ # to replace G-TRIG-01. Assert the IDENTITY on both sides: excluded by name, AND with the twin's own
251
+ # reason (not the generic utterance-shape one), AND that its live neighbour is still selected.
252
+ # 🟥 A pass here is NOT evidence that the row-diet delegation fires at the floor tier — that stays
253
+ # UNMEASURED. This asserts only that the exclusion is the one we meant.
254
+ trig01=$(python3 -c "
255
+ import json; d=json.load(open('$SELECT_JSON'))
256
+ exc={x['id']: x['reason'] for x in d['excluded']}
257
+ sel={p['id'] for p in d['selected']}
258
+ ok = ('G-TRIG-01' in exc and 'Skill' in exc['G-TRIG-01']
259
+ and exc.get('G-TRIG-01') == exc.get('G-TRIG-03')
260
+ and 'G-TRIG-02' in sel)
261
+ print('yes' if ok else 'no')")
262
+ _lane S10 select-guard "G-TRIG-01 excluded BY NAME with its twin's exact reason, G-TRIG-02 still selected" "yes" "$trig01"
263
+
243
264
  g03_reason=$(python3 -c "
244
265
  import json; e=json.load(open('$SELECT_JSON'))['excluded']
245
266
  r=[x['reason'] for x in e if x['id']=='G-GREET-03']
@@ -313,10 +334,10 @@ _lane R1 dry-run "probe_live_eval.sh --dry-run exits 0" "0" "$dry_rc"
313
334
  _lane R2 dry-run "--dry-run creates no OUTDIR (no live run attempted)" "absent" "$([ -d "$DRY_OUT" ] && echo present || echo absent)"
314
335
  # Pinned like S2/S3 and for the same reason — see the S2 note for why 11 became 13 on 2026-09-14.
315
336
  case "$dry_stdout" in
316
- *"SELECTED (13)"*) r3=yes ;;
337
+ *"SELECTED (12)"*) r3=yes ;;
317
338
  *) r3=no ;;
318
339
  esac
319
- _lane R3 dry-run "--dry-run stdout shows the real 13-probe selection" "yes" "$r3"
340
+ _lane R3 dry-run "--dry-run stdout shows the real 12-probe selection" "yes" "$r3"
320
341
 
321
342
  # ── fail-fast: probe_live_eval.sh aborts on the FIRST rc=2 runner call, not after burning the
322
343
  # rest of the selected set (2026-09-05, the launchd incident this exists for) ────────────────────
@@ -408,6 +408,137 @@ N23=$(python3 "$EXTRACT" "$T/tr23.jsonl" --min-chars 20 2>/dev/null | grep -c .)
408
408
  python3 "$EXTRACT" "$T/tr23.jsonl" --min-chars 20 2>/dev/null | grep -q "표시가 없는" && ok "L23b known-positive: 남은 것이 표시 없는 발화다" || ng "L23b 표시 없는 발화까지 버렸다"
409
409
  python3 "$EXTRACT" "$T/tr23.jsonl" --min-chars 20 2>/dev/null | grep -q "메타표시레코드\|사이드체인" && ng "L23c 표시된 레코드가 살아남았다" || ok "L23c 표시된 레코드는 없다 (known-negative)"
410
410
 
411
+ # ── L24 키 선택: 별칭 + 길이 대역 (2026-09-16) ──────────────────────────────
412
+ # WHY. 「가장 긴 토큰 3 개」 휴리스틱이 **붙여쓴 절**을 키로 고른다 — 절은 정의상 가장 길고
413
+ # 기록에 축자로 다시 나올 확률은 가장 낮다. 09-15 전사본 실측에서 미착지 고유 키 59 중
414
+ # ~42(71%)가 이 부류였고, 09-15 기록이 스스로 지목한 「음차 별칭」은 2~3(5%)뿐이었다.
415
+ # 그래서 수리는 두 축이다: ⓐ 표기 별칭(교대) ⓑ 한글 키 길이 대역 + 삼켜진 고유명사 꺼내기.
416
+ # 🟥 두 축이 **같이** 있어야 듣는다 — 각각은 ⌈n/2⌉ 를 못 넘긴다(한쪽만 켜면 키 3 중 1).
417
+ _probes() { # $1=발화 텍스트 → probes 의 TARGET 패턴들(한 줄에 하나)
418
+ printf '1\t2026-09-16T00:00:00Z\t%s\n' "$1" \
419
+ | "$SUT_PROBE_RUNNER" 2>/dev/null | awk -F'\t' '$1=="TARGET"{print $2}'
420
+ }
421
+ # mkprobes.py 를 SUT 에서 **그대로 뽑아** 돌린다 — 두 번째 사본을 쓰면 관대함이 갈린다
422
+ # ([[feedback_divergent_leniency_duplicate_normalizers]]).
423
+ awk "/^ cat > \"\\\$_py\" <<'PY'\$/{f=1;next} /^PY\$/{f=0} f" "$SUT" > "$T/mkprobes_sut.py"
424
+ if [ ! -s "$T/mkprobes_sut.py" ]; then
425
+ echo "❌ L24-setup mkprobes.py 추출 실패 — SUT 의 heredoc 앵커가 바뀌었다 (계기 오류)"
426
+ FAIL=$((FAIL+1))
427
+ else
428
+ SUT_PROBE_RUNNER="$T/run_mkprobes.sh"
429
+ { echo '#!/usr/bin/env bash'; echo "exec python3 \"$T/mkprobes_sut.py\" \"$T/l24.map\""; } > "$SUT_PROBE_RUNNER"
430
+ chmod +x "$SUT_PROBE_RUNNER"
431
+
432
+ # L24 별칭이 교대로 나간다 — `데스크탑` 키가 `Desktop` 도 본다
433
+ _probes '클로드 데스크탑앱에서 한번 테스트해봤는데 춘식이 반응이 움직이네' > "$T/l24.out"
434
+ grep -q 'Desktop' "$T/l24.out" \
435
+ && ok "L24 음차 별칭이 교대로 나간다 (데스크탑 → Desktop)" \
436
+ || ng "L24 별칭 교대 없음 — $(tr '\n' ' ' < "$T/l24.out")"
437
+
438
+ # L24b known-negative: 별칭표에 없는 일반어는 **맨 토큰 그대로** 나간다.
439
+ # 표를 일반어로 넓히면 우연 일치가 늘고, 이 검사는 advisory 라 거짓 착지가 조용한 쪽이다.
440
+ _probes '오늘은 그 배선을 확실하게 정리하고 나서 넘어가려고 한다 지금' > "$T/l24b.out"
441
+ grep -q '(' "$T/l24b.out" \
442
+ && ng "L24b 일반어에 교대가 붙었다 — 별칭표가 넓다: $(tr '\n' ' ' < "$T/l24b.out")" \
443
+ || ok "L24b known-negative: 별칭 없는 토큰은 맨 토큰 그대로"
444
+
445
+ # L24c 붙여쓴 절이 키 1군에서 밀린다 — `이건이미끝난것같은데`(10자) 는 대역 밖
446
+ _probes '이건이미끝난것같은데 담당팀에서 대기실 테스트 돌리는 중이고 배선도 끝났다' > "$T/l24c.out"
447
+ grep -qx '이건이미끝난것같은데' "$T/l24c.out" \
448
+ && ng "L24c 붙여쓴 절이 여전히 1군 키다 — 대역이 안 먹었다" \
449
+ || ok "L24c 붙여쓴 절(10자)이 대역 밖으로 밀린다"
450
+
451
+ # L24d 절에 삼켜진 고유명사를 꺼낸다 — `그리고프렌즈온데스크` → `프렌즈온데스크`
452
+ # 🟥 이게 없으면 별칭표가 토큰 경계를 못 넘어 무용지물이 된다(실측 미착지 4 건이 이 모양).
453
+ _probes '그리고프렌즈온데스크 릴리즈는 어제 판이라 다시 구워야 맞을 것 같은데' > "$T/l24d.out"
454
+ grep -q 'friends-on-desk' "$T/l24d.out" \
455
+ && ok "L24d 절에 삼켜진 고유명사를 꺼낸다 (그리고프렌즈온데스크 → 프렌즈온데스크)" \
456
+ || ng "L24d 삼켜진 고유명사 미추출 — $(tr '\n' ' ' < "$T/l24d.out")"
457
+
458
+ # L24e 긴 고유명사는 대역 상한의 **예외**다 — `프렌즈온데스크`(7자) 가 죽으면 안 된다.
459
+ # 길이 상한만 두면 실제로 착지하던 키가 같이 죽는다(대역의 부작용, 명시적으로 막는다).
460
+ _probes '프렌즈온데스크 쪽은 그대로 두고 나머지만 먼저 정리하자 오늘은' > "$T/l24e.out"
461
+ grep -q '프렌즈온데스크' "$T/l24e.out" \
462
+ && ok "L24e 별칭 등재 고유명사는 길이 상한 예외 (7자 생존)" \
463
+ || ng "L24e 긴 고유명사가 대역에 죽었다 — $(tr '\n' ' ' < "$T/l24e.out")"
464
+
465
+ # L24f 되돌림 프로브 — 별칭표를 비우면 L24/L24d 가 **정확히** 빨개진다.
466
+ # 🟥 앵커가 장식이 아님을 증명하는 유일한 방법이다([[feedback_anchor_can_be_decorative]]).
467
+ # 🟥 뮤테이션은 «텍스트가 바뀌었나» 가 아니라 «의미가 바뀌었나» 로 확인한다.
468
+ # 초판은 `ALIAS = {} or {`(파이썬에서 뒤 딕셔너리로 평가 = **무효 뮤턴트**)를 썼고,
469
+ # 텍스트 grep 은 통과했다. 그때 이 레인이 초록이었던 이유는 앵커가 살아서가 아니라
470
+ # **대상이 깨져 있어서**였다 — [[feedback_three_reasons_a_lane_is_green]] 의 ②.
471
+ sed 's/^_META = re.compile/ALIAS = {}\'$'\n''_META = re.compile/' "$T/mkprobes_sut.py" > "$T/mkprobes_neutered.py"
472
+ _applied=$(printf '1\t2026-09-16T00:00:00Z\t%s\n' '프렌즈온데스크 쪽은 그대로 두고 나머지만 먼저 정리하자 오늘' \
473
+ | python3 "$T/mkprobes_neutered.py" "$T/l24f0.map" 2>/dev/null | awk -F'\t' '$1=="TARGET"{print $2}')
474
+ case "$_applied" in
475
+ ''|*'friends-on-desk'*) ng "L24f 되돌림 **의미** 적용 실패 — 뮤턴트가 여전히 별칭을 낸다/죽었다 (계기 오류)" ;;
476
+ *)
477
+ _n_out=$(printf '1\t2026-09-16T00:00:00Z\t%s\n' '클로드 데스크탑앱에서 한번 테스트해봤는데 춘식이 반응이 움직이네' \
478
+ | python3 "$T/mkprobes_neutered.py" "$T/l24f.map" 2>/dev/null | awk -F'\t' '$1=="TARGET"{print $2}')
479
+ case "$_n_out" in
480
+ *Desktop*) ng "L24f 별칭표를 비웠는데도 Desktop 이 나온다 — 앵커가 장식이다" ;;
481
+ '') ng "L24f 뮤턴트가 출력 0 — 되돌림이 스크립트를 죽였다(레인 무효)" ;;
482
+ *)
483
+ # 🟥 L24d 의 되돌림도 같이 본다 (cross-family codex, B2). 초판은 `Desktop` 소멸만 봐서
484
+ # 「삼켜진 고유명사 추출이 죽는가」는 **검증하지 않았다** — 레인 주석이 주장하는 범위와
485
+ # 실제 검사 범위가 어긋난 자리다([[feedback_rule_misdescribes_its_own_machine]]).
486
+ _n_d=$(printf '1\t2026-09-16T00:00:00Z\t%s\n' '그리고프렌즈온데스크 릴리즈는 어제 판이라 다시 구워야 맞을 것 같은데' \
487
+ | python3 "$T/mkprobes_neutered.py" "$T/l24f2.map" 2>/dev/null | awk -F'\t' '$1=="TARGET"{print $2}')
488
+ case "$_n_d" in
489
+ *friends-on-desk*|*'|'*) ng "L24f 뮤턴트인데 삼켜진 고유명사 추출이 살아 있다" ;;
490
+ '') ng "L24f 뮤턴트 출력 0 (레인 무효)" ;;
491
+ *) ok "L24f 되돌림: 교대 **와** 삼켜진-고유명사 추출이 함께 사라진다 (앵커 생존)" ;;
492
+ esac
493
+ ;;
494
+ esac
495
+ ;;
496
+ esac
497
+
498
+ # L24g ALIAS 값에 ERE 메타문자가 섞이면 **죽는다** — 조용히 거르지 않는다.
499
+ # 정규식으로 새면 TARGET 의 의미가 바뀌고, 그건 「미착지」가 아니라 계기 고장이다.
500
+ sed "s/^ '오르카':.*/ '오르카': ['or(ca'],/" "$T/mkprobes_sut.py" > "$T/mkprobes_meta.py"
501
+ printf '1\t2026-09-16T00:00:00Z\t%s\n' '오르카 워크트리를 하나 더 띄워서 거기서 돌리자 오늘' \
502
+ | python3 "$T/mkprobes_meta.py" "$T/l24g.map" >/dev/null 2>&1
503
+ [ "$?" -eq 10 ] \
504
+ && ok "L24g ALIAS 에 ERE 메타문자 → rc=10 (계기 고장이지 미착지가 아니다)" \
505
+ || ng "L24g 메타문자가 조용히 통과했다"
506
+
507
+ # L24h A1 회귀 — 포함 일치일 때 **짧은 한글 이름**이 교대에 들어가면 안 된다.
508
+ # `(데스크탑앱|데스크탑|Desktop)` 은 더 흔한 `데스크탑` 으로 착지를 성립시킨다 =
509
+ # 조용한 거짓 착지. 교대가 날라야 하는 것은 **표기 변형**이지 더 넓은 한국어 낱말이 아니다.
510
+ _probes '클로드 데스크탑앱에서 한번 테스트해봤는데 춘식이 반응이 움직이네' > "$T/l24h.out"
511
+ if grep -q 'Desktop' "$T/l24h.out" && ! grep -qE '\(데스크탑앱\|데스크탑\|' "$T/l24h.out"; then
512
+ ok "L24h A1: 포함 일치 교대에 짧은 한글 이름이 없다 (Desktop 만 더한다)"
513
+ else
514
+ ng "L24h A1 회귀 — $(tr '\n' ' ' < "$T/l24h.out")"
515
+ fi
516
+
517
+ # L24i B1 회귀 — 부분 문자열 충돌. `오픈코드리뷰` 는 `오픈코드`(opencode) 가 아니다.
518
+ # 남는 쪽(`리뷰`)이 허용 접미사가 아니므로 교대를 붙이지 않는다.
519
+ _probes '오픈코드리뷰 기준은 여기서 따로 정하자 오늘 우리끼리' > "$T/l24i.out"
520
+ grep -q 'opencode' "$T/l24i.out" \
521
+ && ng "L24i B1 회귀 — `오픈코드리뷰` 를 opencode 로 오인했다: $(tr '\n' ' ' < "$T/l24i.out")" \
522
+ || ok "L24i B1: 부분 문자열 충돌(오픈코드리뷰)에 교대를 안 붙인다"
523
+
524
+ # L24i-b known-positive 짝 — 허용 접미사는 **여전히 붙어야** 한다. 없으면 L24i 는
525
+ # 「아무것도 안 붙인다」로도 초록이 되어 판별력이 없다.
526
+ _probes '데스크탑앱 쪽 설정만 먼저 보고 나머지는 내일 정리하자 오늘은' > "$T/l24ib.out"
527
+ grep -q 'Desktop' "$T/l24ib.out" \
528
+ && ok "L24i-b known-positive: 허용 접미사(앱)는 여전히 교대가 붙는다" \
529
+ || ng "L24i-b 경계 방어가 정상 파생어까지 죽였다 — $(tr '\n' ' ' < "$T/l24ib.out")"
530
+
531
+ # L24j A2 회귀 — 3 개를 넘겨 잘린 키를 **센다**. 「미측정을 0 으로」 접지 않는다.
532
+ # 대역 정렬이 들어오면서 붙여쓴 하중 절이 체계적으로 잘리게 됐고, 그 드롭이 조용하면
533
+ # 남은 흔한 셋으로 발화가 「착지」로 렌더된다 = 이 수리가 만든 fail-open.
534
+ _drop=$(printf '1\t2026-09-16T00:00:00Z\t%s\n' '절대자동승격하지마라 담당팀 대기실 배선도 테스트 먼저 보자 오늘' \
535
+ | "$SUT_PROBE_RUNNER" 2>&1 >/dev/null | grep -o '키드롭=[0-9]*')
536
+ case "$_drop" in
537
+ 키드롭=0|'') ng "L24j A2: 드롭이 0 으로 보고됐다 (조용한 드롭) — [$_drop]" ;;
538
+ *) ok "L24j A2: 잘린 키를 센다 ($_drop)" ;;
539
+ esac
540
+ fi
541
+
411
542
  echo
412
543
  echo "── utterance-intake lanes: PASS=$PASS FAIL=$FAIL ──"
413
544
  [ "$FAIL" -eq 0 ] || exit 1
@@ -181,6 +181,96 @@ this that with from have been will your about would should could there which the
181
181
  path host tmp home HOME
182
182
  then than when what where because those these into over under more most only just'''.split())
183
183
 
184
+ # ── 고유명사 별칭 + 길이 대역 ────────────────────────────────────────────────
185
+ # 🟥 **왜 「가장 긴 것 3 개」 만으로는 안 되나** (2026-09-16 실측, 09-15 전사본 × 그날 기록).
186
+ # 운영자는 붙여쓴다 — `이건이미끝난것같은데` · `지난히스토리봐서알겠지`. 한글 토큰화는
187
+ # 공백에서만 끊기므로 **절 하나가 토큰 하나**가 되고, 그것은 **정의상 가장 길면서**
188
+ # 기록에 축자로 다시 나타날 확률이 **가장 낮다.** 즉 길이 정렬이 최악의 키를 적극적으로
189
+ # 고른다. 미착지 고유 키 59 건을 눈으로 분류했을 때 ~42(71%)가 이 부류였다.
190
+ #
191
+ # 🟥 **그런데 길이 상한만 두면 진짜 고유명사가 같이 죽는다** — `프렌즈온데스크`(7)·
192
+ # `클로드온데스크`(7) 는 길지만 **기록에 그대로 나타나고 실제로 착지하던** 키다.
193
+ # 그래서 상한에 **별칭표 예외**를 건다: 표에 있는 이름은 길이와 무관하게 키가 된다.
194
+ #
195
+ # 🟥 **비순환 조건 — 표는 «기록» 이 아니라 손으로 얼린 어휘다.** 과잉 일반화를 막으려고
196
+ # 고유명사/도구명만 넣는다. `하네스` · `커밋` 같은 일반어를 넣으면 우연 일치가 늘고,
197
+ # 이 검사는 advisory 라 **거짓 착지가 조용한 방향**이다(미착지는 시끄럽다).
198
+ # 표에서 뽑은 후보를 기록에서 찾아 채우는 것은 **금지** — 그건 정의상 항상 맞는다.
199
+ KEY_MIN_KO, KEY_MAX_KO = 3, 6 # 한글 키 길이 대역. 초과분은 2군(3 개를 못 채울 때만)
200
+
201
+ # 표기 변형. 키(대표 표기) → 같이 볼 표기들. 값에 ERE 메타문자를 넣지 않는다(아래에서 검증).
202
+ ALIAS = {
203
+ '클로드코드': ['Claude Code', 'claude-code'],
204
+ '클로드온데스크': ['clawd-on-desk', 'Clawd on Desk'],
205
+ '프렌즈온데스크': ['friends-on-desk', 'Friends on Desk'],
206
+ '오픈코드': ['opencode'],
207
+ '데스크탑': ['Desktop'],
208
+ '코덱스': ['Codex'],
209
+ '텔레그램': ['Telegram', '텔레그렘'],
210
+ '컴퓨터유즈': ['computer use', 'computer-use', '컴퓨터 유즈'],
211
+ '거버넌스엔지니어링': ['governance engineering', '거버넌스 엔지니어링'],
212
+ '워크트리': ['worktree'],
213
+ '오르카': ['orca', 'Orca'],
214
+ '춘식이': ['chunsik'],
215
+ }
216
+ # 🟥 메타문자 검증 — 값이 정규식으로 새면 TARGET 의 의미가 바뀐다. 조용히 거르지 않고 죽는다.
217
+ _META = re.compile(r'[.^$*+?()\[\]{}|\\]')
218
+ for _k, _vs in ALIAS.items():
219
+ for _v in _vs:
220
+ if _META.search(_v):
221
+ sys.stderr.write("FATAL: ALIAS 값에 ERE 메타문자: %s\n" % _v)
222
+ sys.exit(10)
223
+
224
+ # 긴 것부터 — `클로드온데스크` 가 `클로드` 보다 먼저 걸려야 한다.
225
+ _ALIAS_KEYS = sorted(ALIAS, key=len, reverse=True)
226
+
227
+ # 🟥 **부분 문자열만 보면 다른 낱말을 도구명으로 오인한다** (cross-family codex, A/B1):
228
+ # `오픈코드리뷰` 는 `오픈코드`(opencode) 가 아니다. 그래서 «남는 쪽» 을 본다 — 앞에 붙은
229
+ # 것은 접속어, 뒤에 붙은 것은 짧은 파생 접미사일 때만 같은 지시대상으로 인정한다.
230
+ # 🟥 목록은 **작고 언 판단**이다. 못 알아보면 **교대를 안 붙일 뿐**이라 실패가
231
+ # 조용한 쪽(거짓 착지)이 아니라 시끄러운 쪽(미착지)으로 떨어진다 — 그래서 허용한다.
232
+ _LEAD_OK = ('그리고', '그래서', '근데', '그런데', '그', '이', '저', '그럼')
233
+ _TAIL_OK = ('앱', '쪽', '판', '건', '용', '들', '팀')
234
+
235
+ def alias_extract(tok):
236
+ """붙여쓴 절에 삼켜진 고유명사를 꺼낸다. 없으면 None.
237
+ `그리고프렌즈온데스크` → `프렌즈온데스크`. 기록을 안 보므로 순환하지 않는다."""
238
+ for name in _ALIAS_KEYS:
239
+ if name == tok or name not in tok:
240
+ continue
241
+ i = tok.index(name)
242
+ lead, tail = tok[:i], tok[i + len(name):]
243
+ if lead and lead not in _LEAD_OK:
244
+ continue
245
+ if tail and tail not in _TAIL_OK:
246
+ continue
247
+ return name
248
+ return None
249
+
250
+ def key_pattern(key):
251
+ """TARGET 의 정규식. 별칭이 있으면 교대, 없으면 맨 토큰 그대로.
252
+ 🟥 교대는 «같은 것의 다른 표기» 안에서만 쓴다 — 서로 다른 낱말을 OR 로 묶으면
253
+ 1/3 이 «전부 착지» 로 렌더된다(그래서 키마다 한 행이라는 기존 규약은 그대로다)."""
254
+ # 정확 일치가 없으면 **포함**도 본다 — 키가 `데스크탑앱` 인데 표에는 `데스크탑` 만
255
+ # 있는 형태. 🟥 이때 키를 짧게 바꾸지 않고 **교대에 더하기만** 한다: 키를 깎으면
256
+ # 한글 쪽 특이도가 떨어져 우연 일치(조용한 거짓 착지)가 늘어난다.
257
+ exact = key in ALIAS
258
+ name = key if exact else alias_extract(key)
259
+ if not name:
260
+ return key
261
+ # 🟥 **포함 일치일 때는 짧은 한글 이름을 교대에 넣지 않는다** (cross-family codex, A1).
262
+ # 초판은 `(데스크탑앱|데스크탑|Desktop)` 를 냈는데, 그러면 더 짧고 흔한 `데스크탑` 으로
263
+ # 착지가 성립한다 — 「키를 안 깎는다」는 주석과 정반대 효과였다
264
+ # ([[feedback_rule_misdescribes_its_own_machine]]). 교대가 나르는 것은 **표기 변형**
265
+ # (라틴/오타)이지 «더 넓은 한국어 낱말» 이 아니다.
266
+ members = [key] + ALIAS[name] if not exact else [key] + ALIAS[key]
267
+ return "(" + "|".join(list(dict.fromkeys(members))) + ")"
268
+
269
+ def band_ok(s):
270
+ if re.match(r'^[\uac00-\ud7a3]+$', s):
271
+ return KEY_MIN_KO <= len(s) <= KEY_MAX_KO or s in ALIAS
272
+ return True
273
+
184
274
  def strip_particle(tok):
185
275
  if not re.match(r'^[\uac00-\ud7a3]+$', tok):
186
276
  return tok
@@ -191,6 +281,7 @@ def strip_particle(tok):
191
281
 
192
282
  n_rows = 0
193
283
  n_unprobeable = 0
284
+ n_dropped = 0
194
285
  for line in sys.stdin:
195
286
  line = line.rstrip('\n')
196
287
  if not line:
@@ -216,8 +307,28 @@ for line in sys.stdin:
216
307
  seen.add(s)
217
308
  cand.append(s)
218
309
  # 가장 긴 것부터 3 개. 동률은 먼저 나온 것(발화 앞쪽이 대개 주제어).
219
- cand.sort(key=lambda s: -len(s))
220
- keys = cand[:3]
310
+ # 붙여쓴 절에 삼켜진 고유명사를 꺼내 **대신** 세운다(원본 절은 어차피 안 맞는다).
311
+ pulled = []
312
+ for s in cand:
313
+ if band_ok(s):
314
+ pulled.append(s)
315
+ continue
316
+ got = alias_extract(s)
317
+ pulled.append(got if (got and got not in pulled) else s)
318
+ cand = pulled
319
+ # 1군 = 대역 안(또는 별칭 등재) · 2군 = 붙여쓴 절. 2군은 3 개를 못 채울 때만 쓴다 —
320
+ # 버리지 않는다(«프로브불가» 로 접으면 미측정을 0 으로 렌더하는 쪽이 된다).
321
+ tier1 = [s for s in cand if band_ok(s)]
322
+ tier2 = [s for s in cand if not band_ok(s)]
323
+ tier1.sort(key=lambda s: -len(s))
324
+ tier2.sort(key=lambda s: -len(s))
325
+ ordered = tier1 + tier2
326
+ keys = ordered[:3]
327
+ # 🟥 **드롭을 센다** (cross-family codex, A2). `[:3]` 자체는 종전부터 있었지만, 대역 정렬이
328
+ # 들어오면서 «붙여쓴 하중 절»이 **체계적으로** 잘리는 쪽으로 바뀌었다 — `절대자동승격하지마라`
329
+ # 같은 키가 사라지고 남은 흔한 셋으로 발화가 「착지」로 렌더되면 그건 내가 만든 fail-open 이다.
330
+ # 막을 수는 없다(축자로 다시 안 나타나는 것은 사실이니까). 대신 **조용하지 않게** 만든다.
331
+ n_dropped += len(ordered) - len(keys)
221
332
  if not keys:
222
333
  # 프로브를 만들 수 없는 발화 — **버리지 않고 센다**(not found != 0).
223
334
  n_unprobeable += 1
@@ -228,11 +339,11 @@ for line in sys.stdin:
228
339
  # (codex finding 1). Keys are bare tokens ([가-힣]+ / [A-Za-z0-9_]+): no ERE metacharacters,
229
340
  # never dash-first, so the landing checker reads them as literals.
230
341
  for k_i, key in enumerate(keys, 1):
231
- print("TARGET\t%s\t#%s.%d/%d %s" % (key, idx, k_i, len(keys), text[:36]))
342
+ print("TARGET\t%s\t#%s.%d/%d %s" % (key_pattern(key), idx, k_i, len(keys), text[:36]))
232
343
  MAP.write("%s\t%s\t%s\t%d\n" % (idx, label, text[:60], len(keys)))
233
344
  n_rows += 1
234
345
  MAP.close()
235
- sys.stderr.write("probe utterances=%d · 프로브불가=%d\n" % (n_rows, n_unprobeable))
346
+ sys.stderr.write("probe utterances=%d · 프로브불가=%d · 키드롭=%d\n" % (n_rows, n_unprobeable, n_dropped))
236
347
  PY
237
348
  python3 "$_py" "$1"
238
349
  }
@@ -360,6 +360,53 @@ else
360
360
  echo " ✅ PASS"
361
361
  fi
362
362
 
363
+ # ── Nested-repo gitlink guard — a submodule entry BYPASSES .gitignore ─────────
364
+ # 🟥 WHY THIS IS NOT COVERED BY THE BLOCK ABOVE. That one reads `--name-only`, which lists a
365
+ # gitlink by path like any file — so a `tracks/` gitlink would be caught by it. What it does NOT
366
+ # cover is the reason a gitlink gets staged at all: **`.gitignore` does not apply to a nested
367
+ # repository.** `tracks/**` ignores every file under `tracks/`, but a directory containing its own
368
+ # `.git` is offered to the index as a mode-160000 entry regardless, so `git add -A` stages it while
369
+ # the author believes the whole subtree is ignored. Measured 2026-09-16 on
370
+ # `tracks/_meta/dominance_bench_B/recovered_2026-09-09/benchB/target_repo_O` (a benchmark's target
371
+ # repo, whose git history IS the evidence and must not be deleted): `git add -A --dry-run` staged it.
372
+ #
373
+ # 🟥 SAME ROOT AS THE SYNC DEFECT, DIFFERENT SURFACE. A nested `.git` under `tracks/` also made
374
+ # `sync-to-be.sh`'s destination-newer guard abort falsely four times (fixed separately). That one was
375
+ # noisy; this one is silent — a gitlink committed to a public repo points at a URL the clone cannot
376
+ # fetch, and nothing in the commit output says so.
377
+ #
378
+ # SCOPE, deliberately narrow. Under `tracks/` a gitlink is provably wrong (the lane is local-only),
379
+ # so it BLOCKS. Anywhere else this repo has no submodules today, but declaring that a defect would
380
+ # over-block a legitimate future one — and a gate that over-blocks trains `--no-verify`, which
381
+ # disarms the Destructive-Op gate living in this same hook. So elsewhere it SURFACES and proceeds.
382
+ # Override for a reviewed case: TRACKS_GITLINK_OK=1 (same channel shape as TRACKS_PUBLIC_OK).
383
+ echo "[Privacy] nested-repo gitlink..."
384
+ GITLINK_BLOCKED=0; GITLINK_SEEN=0
385
+ while IFS= read -r p; do
386
+ [ -z "$p" ] && continue
387
+ GITLINK_SEEN=1
388
+ case "$p" in
389
+ tracks/*)
390
+ if [ "${TRACKS_GITLINK_OK:-0}" = "1" ]; then
391
+ echo " ⚠️ gitlink under tracks/ allowed by TRACKS_GITLINK_OK=1: $p"
392
+ else
393
+ echo " ❌ FAIL — nested repo staged as a gitlink under tracks/: $p"
394
+ GITLINK_BLOCKED=1; FAILED=1
395
+ fi ;;
396
+ *)
397
+ echo " ⚠️ gitlink staged outside tracks/ (surfaced, not blocked): $p" ;;
398
+ esac
399
+ done <<GITLINK_EOF
400
+ $(git -c core.quotePath=false diff --cached --raw --no-renames --diff-filter=ACMR 2>/dev/null | awk -F'\t' '$1 ~ / 160000 / {print $2}')
401
+ GITLINK_EOF
402
+ if [ "$GITLINK_BLOCKED" -eq 1 ]; then
403
+ echo " A gitlink records a commit SHA in another repository — a clone cannot fetch it, so the"
404
+ echo ' content is lost while the tree still looks complete. .gitignore never applies to it.'
405
+ echo " Fix: git rm --cached <path> (the working directory and its history stay untouched)."
406
+ elif [ "$GITLINK_SEEN" -eq 0 ]; then
407
+ echo " ✅ PASS"
408
+ fi
409
+
363
410
  # ── Confidentiality guard — public-surface scan on staged tracked content ─────
364
411
  # A commit to a PUBLIC repo is an effective PUBLISH of its content, so the confidentiality boundary is
365
412
  # checked here as well as at push/publish. Pattern loading and matching come from