@chrono-meta/fh-gate 3.29.0 → 3.30.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.
@@ -967,7 +967,7 @@ else
967
967
  _sr_uns=$(printf '%s' "$_sr_v" | sed -n 's/.*UNSCANNABLE=\([0-9]*\).*/\1/p')
968
968
  if [ "${_sr_sup:-0}" -gt 0 ] 2>/dev/null; then
969
969
  echo "⚠️ ①-g stale-ref: ${_sr_sup} 개 id 가 폐기된 버전을 가리킨다 — advisory, 막지 않는다."
970
- echo " 🟥 의도한 pin 일 수 있다 — 눈으로 확인하고 고쳐라(고정이면 파일에 'stale-ref: pinned')."
970
+ echo " 🟥 의도한 pin 일 수 있다 — 눈으로 확인하고 고쳐라(발행 스냅샷이면 파일 첫머리에 '<!-- stale-ref: pinned -->', 옛 판을 일부러 가리키는 한 줄이면 그 줄에 '<!-- stale-ref: pinned-line=<id> -->'). 일부러 빨갛게 둔 것(예: replace 전 arXiv 판)은 그대로 둔다."
971
971
  printf '%s\n' "$_sr_out" | grep -E '^ +🟥 SUPERSEDED' | sed 's/^/ /'
972
972
  fi
973
973
  if [ "${_sr_unr:-0}" -gt 0 ] 2>/dev/null || [ "${_sr_uns:-0}" -gt 0 ] 2>/dev/null; then
@@ -532,6 +532,67 @@ fh_timeout() {
532
532
  OUTDIR="${OUTDIR:-$(mktemp -d "${TMPDIR:-/tmp}/fh-sim-XXXXXX")}"
533
533
  mkdir -p "$OUTDIR"
534
534
 
535
+ # ── ancestor-instruction guard (2026-10-23) ───────────────────────────────────────────────────────
536
+ # 🟥 Every arm's clone lives under $OUTDIR, and `claude -p` loads CLAUDE.md / CLAUDE.local.md / .claude/rules
537
+ # from EVERY ancestor of its cwd. An --out inside a checkout (e.g. tracks/_meta/<exp>/out) therefore hands
538
+ # every arm the LIVE repo's instructions on top of the clone's own — measured 2026-10-23 with a known pair:
539
+ # under the FH checkout 3 instruction files, under /private/tmp NONE. A whole experiment series
540
+ # (P8/P8b/P9) ran that way; agents then edited the live repos by absolute path. Refuse before any arm
541
+ # starts (and again per rep for the wrapper the clone actually lands in — a pre-existing w_* can carry
542
+ # its own CLAUDE.md, codex R1). A bare .git is NOT an instruction source and is not refused (codex R1).
543
+ # FH_SIM_ALLOW_INHERIT=1 is the logged override for a run that WANTS the inheritance.
544
+ # --out is resolved to an absolute physical path once, so the walk below and every later `$OUTDIR/...`
545
+ # (including redirects made from inside `cd "$WORK"`) see the same place (Gemini R1: relative --out,
546
+ # logical vs physical symlink paths). An unresolvable --out stops here instead of looping on `dirname ""`.
547
+ OUTDIR=$(cd "$OUTDIR" 2>/dev/null && pwd -P) || { echo "FAIL: --out could not be resolved" >&2; exit 2; }
548
+ [ -n "$OUTDIR" ] || { echo "FAIL: --out resolved to an empty path" >&2; exit 2; }
549
+ # 🟥 사용자 설정 디렉터리(${CLAUDE_CONFIG_DIR:-$HOME/.claude})는 모든 팔이 어차피 싣는다 — 워크가 그 .claude 의 부모(보통 $HOME)에
550
+ # 닿았을 때 그 안의 CLAUDE.md/CLAUDE.local.md/AGENTS.md/rules 는 hit 가 아니다(아래 정보 줄이 한 번 찍는다). $HOME 에 직접 놓인
551
+ # CLAUDE.md 는 여전히 hit. 물리 경로(pwd -P)로 비교해 심볼릭 HOME/설정 디렉터리도 같게 동작한다.
552
+ _user_cfg="${CLAUDE_CONFIG_DIR:-$HOME/.claude}"
553
+ _user_cfg_phys=$(cd "$_user_cfg" 2>/dev/null && pwd -P) || _user_cfg_phys=""
554
+ FH_SIM_REPORTED_HITS=" " # 이미 경고한 hit — --reps N 에서 같은 경고를 매 rep 반복하지 않는다
555
+ fh_sim_instr_hits() { # $1=absolute dir → prints instruction sources in $1 and every ancestor (space-separated)
556
+ local d="$1" n hits="" skipclaude cp
557
+ while [ -n "$d" ]; do
558
+ skipclaude=0
559
+ if [ -n "$_user_cfg_phys" ] && [ -d "$d/.claude" ]; then
560
+ cp=$(cd "$d/.claude" 2>/dev/null && pwd -P) && [ "$cp" = "$_user_cfg_phys" ] && skipclaude=1
561
+ fi
562
+ for n in CLAUDE.md CLAUDE.local.md .claude/CLAUDE.md .claude/CLAUDE.local.md AGENTS.md .claude/AGENTS.md; do # not GEMINI.md: Claude does not load it (codex R2)
563
+ case "$n" in .claude/*) [ "$skipclaude" = 1 ] && continue ;; esac
564
+ [ -e "$d/$n" ] && hits="$hits $d/$n"
565
+ done
566
+ if [ "$skipclaude" = 0 ] && [ -d "$d/.claude/rules" ] && [ -n "$(find -L "$d/.claude/rules" -name '*.md' -print 2>/dev/null | head -1)" ]; then # -L: symlinked rules dirs load too (codex R2)
567
+ hits="$hits $d/.claude/rules/"
568
+ fi
569
+ [ "$d" = "/" ] && break
570
+ d=$(dirname "$d")
571
+ done
572
+ printf '%s' "$hits"
573
+ }
574
+ fh_sim_refuse_inherit() { # $1=dir $2=what → returns 0 to proceed, exits 2 on refusal
575
+ local hits h newhits=""; hits=$(fh_sim_instr_hits "$1")
576
+ [ -z "$hits" ] && return 0
577
+ if [ "${FH_SIM_ALLOW_INHERIT:-0}" = 1 ]; then
578
+ for h in $hits; do
579
+ case "$FH_SIM_REPORTED_HITS" in *" $h "*) ;; *) newhits="$newhits $h"; FH_SIM_REPORTED_HITS="$FH_SIM_REPORTED_HITS$h " ;; esac
580
+ done
581
+ [ -n "$newhits" ] && echo "⚠️ FH_SIM_ALLOW_INHERIT=1 — arms WILL inherit ($2):$newhits" >&2
582
+ return 0
583
+ fi
584
+ echo "🟥 REFUSED: $2 ($1) sits under instruction files — every arm would load them:$hits" >&2
585
+ echo " use an --out outside any checkout and outside \$HOME (default: mktemp under \$TMPDIR), or FH_SIM_ALLOW_INHERIT=1 if inheritance is the point" >&2
586
+ exit 2
587
+ }
588
+ fh_sim_refuse_inherit "$OUTDIR" "--out"
589
+ # User-level instructions load for every project whatever the cwd — not refused (identical for every arm),
590
+ # but printed so a reader of the run knows they were there (codex R1).
591
+ _user_instr=""
592
+ [ -e "$_user_cfg/CLAUDE.md" ] && _user_instr="$_user_instr $_user_cfg/CLAUDE.md"
593
+ [ -d "$_user_cfg/rules" ] && [ -n "$(find -L "$_user_cfg/rules" -name '*.md' -print 2>/dev/null | head -1)" ] && _user_instr="$_user_instr $_user_cfg/rules/"
594
+ [ -n "$_user_instr" ] && echo "ℹ️ user-level instructions load in every arm (same for all, not refused):$_user_instr" >&2
595
+
535
596
  # ── machine-surface snapshot ──────────────────────────────────────────────────────────────────
536
597
  # Enumerated, not guessed. Each line is a surface a past run actually touched or plausibly could.
537
598
  # `not found` is written as `ABSENT`, never as an empty string — an unreadable surface and an
@@ -581,6 +642,7 @@ for r in $(seq 1 "$REPS"); do
581
642
  # isolated, but their EXISTENCE leaked into the arm's reasoning, which is enough to change an
582
643
  # answer about "what projects are around". Isolation has to hold for the parent too.
583
644
  WRAP="$OUTDIR/w_${ARM}_r${r}"; mkdir -p "$WRAP"
645
+ fh_sim_refuse_inherit "$(cd "$WRAP" && pwd -P)" "rep wrapper" # a pre-existing w_* may carry its own instructions
584
646
  WORK="$WRAP/repo"
585
647
  # A disposable clone per REP, not per arm: two reps of the same arm contaminate each other
586
648
  # exactly as two different arms do. That was the measured failure — reps 1 and 2 of build_cron.
@@ -95,7 +95,16 @@ CHANGELOG_WORD_RE = re.compile(_CL_WORDS, re.IGNORECASE)
95
95
  #: 되므로 구조적으로 수리 불가능한 SUPERSEDED 를 영구히 낸다(적대검증 A-5: 이 레포에만 셋).
96
96
  #: 만족 불가능한 요구는 override 를 훈련시키므로, 파일이 스스로 «이건 스냅샷이다» 라고
97
97
  #: 말할 수단을 준다. 🟥 **파일명 추론이 아니라 «파일이 선언한 것»** 이다 — 추론은 조용히 틀린다.
98
- PIN_MARKER_RE = re.compile(r"stale-ref:\s*pinned", re.IGNORECASE)
98
+ #: 🟥 (2026-10-23) 선언은 **HTML 주석 안에서만**, 낱말은 **경계까지**: 산문이 마커 문법을 언급만 해도
99
+ #: 파일이 통째로 꺼지던 것(Argon R1 #4)과 `pinned-off` · `pinned_line` 같은 접두 일치(#2)를 닫는다.
100
+ PIN_MARKER_RE = re.compile(r"<!--\s*stale-ref:\s*pinned(?=\s|-->)", re.IGNORECASE)
101
+ #: 🟥 **줄 단위 pin (2026-10-23).** 살아 있는 문서 안에서 «v1 논문은 옛 이름을 쓴다» 처럼 옛 판을
102
+ #: 일부러 가리키는 한 줄 때문에 파일 전체를 pin 하면, 그 파일에 뒤에 생기는 진짜 낡은 인용까지 묻힌다.
103
+ #: 형식 `<!-- stale-ref: pinned-line=<id>[,<id>] -->` — **이름 붙인 id 만** 그 줄에서 기록으로 친다.
104
+ #: 같은 줄(표의 한 행)의 다른 DOI 는 살아 있다(Argon R1 #3). id 없는 형식 · `pinned-lines` ·
105
+ #: `pinned-line-disabled` 는 선언이 아니다(접두 일치는 낡은 인용을 조용히 숨긴다, codex R1). `-->`
106
+ #: 앞 공백은 없어도 된다(Argon R1 #1). 줄 pin 은 `pinned` 뒤가 `-` 라 파일 pin 으로 번지지 않는다(ⓕ-3).
107
+ LINE_PIN_RE = re.compile(r"<!--\s*stale-ref:\s*pinned-line=(\d+(?:,\d+)*)\s*-->", re.IGNORECASE)
99
108
 
100
109
  #: 못 읽은 입력의 판별 — NUL 바이트 또는 디코드 실패율. 적대검증 S-1.
101
110
  UNSCANNABLE_REPLACEMENT_RATIO = 0.02
@@ -143,7 +152,8 @@ def scan_body(path, lines):
143
152
  for the printed snippet. `in_changelog` reflects the flag's state AFTER this line is checked for a
144
153
  heading, so a heading line itself and everything after it (same file) are marked True."""
145
154
  in_changelog = False
146
- pinned = any(PIN_MARKER_RE.search(l) for l in lines[:40])
155
+ # 앞 40줄을 합쳐서 찾는다 — 주석이 `<!--` / `stale-ref: pinned` / `-->` 로 여러 줄에 걸쳐도 선언이다(codex R2)
156
+ pinned = bool(PIN_MARKER_RE.search("\n".join(lines[:40])))
147
157
  sites = []
148
158
  for i, line in enumerate(lines, 1):
149
159
  if is_changelog_heading(line):
@@ -151,9 +161,11 @@ def scan_body(path, lines):
151
161
  if pinned:
152
162
  in_changelog = True # 스냅샷 파일 전체를 «기록» 으로 취급
153
163
  flat = TAG_RE.sub("", line)
164
+ # 원문 줄에서 찾는다 — 마커가 HTML 주석이라 TAG_RE 가 지운다
165
+ line_pinned = {x for m in LINE_PIN_RE.finditer(line) for x in m.group(1).split(",")}
154
166
  for m in ZID_RE.finditer(flat):
155
167
  snippet = line.strip()[:140]
156
- sites.append((i, m.group(1), snippet, in_changelog))
168
+ sites.append((i, m.group(1), snippet, in_changelog or m.group(1) in line_pinned))
157
169
  return sites
158
170
 
159
171
 
@@ -355,6 +367,38 @@ def run_self_check():
355
367
  got = [(r, inc) for _, r, _, inc in scan_body("x.html", pin)]
356
368
  lane("exclude: 'stale-ref: pinned' marks the whole file a record", got == [("20397566", True)], str(got))
357
369
 
370
+ # ⓕ-2 줄 pin — 그 줄의 «이름 붙인 id» 만 기록, 같은 파일의 다른 인용은 살아 있다
371
+ lp = ['The v1 paper (Zenodo 10.5281/zenodo.20397566) cites the old name <!-- stale-ref: pinned-line=20397566 -->',
372
+ 'cite 10.5281/zenodo.22542168 for the method']
373
+ got = [(r, inc) for _, r, _, inc in scan_body("x.md", lp)]
374
+ lane("exclude: 'pinned-line=<id>' excludes only that id on its own line",
375
+ got == [("20397566", True), ("22542168", False)], str(got))
376
+
377
+ # ⓕ-3 🟥 known-NEGATIVE — 앞 40줄 안의 줄 pin 이 파일 pin 으로 번지지 않는다(같은 id 가 아래 줄에 다시)
378
+ got = [inc for _, _, _, inc in scan_body("x.md", lp[:1] + ['later 10.5281/zenodo.20397566 again'])]
379
+ lane("exclude NEG: a line pin is not a file pin", got == [True, False], str(got))
380
+
381
+ # ⓕ-4 🟥 known-NEGATIVE — 선언이 아닌 것들: 긴 낱말 · id 없음 · 산문 언급 · 파일 pin 접두
382
+ near = ['a 10.5281/zenodo.20397566 <!-- stale-ref: pinned-line-disabled -->',
383
+ 'b 10.5281/zenodo.20397566 <!-- stale-ref: pinned-lines=20397566 -->',
384
+ 'c 10.5281/zenodo.20397566 <!-- stale-ref: pinned-line -->',
385
+ 'd 10.5281/zenodo.20397566 write `stale-ref: pinned-line=20397566` to pin a line']
386
+ got = [inc for _, _, _, inc in scan_body("x.md", near)]
387
+ lane("exclude NEG: near-miss / id-less / prose markers are not line pins", got == [False] * 4, str(got))
388
+ for fp in ('<!-- stale-ref: pinned-off -->', '<!-- stale-ref: pinned_line -->', 'see `stale-ref: pinned` in prose'):
389
+ got = [inc for _, _, _, inc in scan_body("x.md", [fp, 'cite 10.5281/zenodo.20397566'])]
390
+ lane("exclude NEG: %r is not a file pin" % fp, got == [False], str(got))
391
+
392
+ # ⓕ-4b 여러 줄 주석의 파일 pin 도 선언이다(codex R2 — 줄마다 찾으면 놓친다)
393
+ got = [inc for _, _, _, inc in scan_body("x.html", ['<!--', 'stale-ref: pinned', '-->', 'cite 10.5281/zenodo.20397566'])]
394
+ lane("exclude: a multi-line comment file pin is honoured", got == [True], str(got))
395
+
396
+ # ⓕ-5 같은 줄 두 DOI — 이름 붙인 쪽만 빠진다 · `-->` 앞 공백 없어도 된다 · 40줄 밖에서도 된다
397
+ row = [''] * 60 + ['| a | 10.5281/zenodo.20397566 | 10.5281/zenodo.22542168 |<!-- stale-ref: pinned-line=20397566-->']
398
+ got = [(r, inc) for _, r, _, inc in scan_body("x.md", row)]
399
+ lane("exclude: line pin names one id of two, no space before -->, past line 40",
400
+ got == [("20397566", True), ("22542168", False)], str(got))
401
+
358
402
  # ⓖ 🟥 못 읽은 입력 — 이 파일 자신을 바이너리로 만들어 본다(임시 파일)
359
403
  import tempfile
360
404
  with tempfile.NamedTemporaryFile(suffix=".bin", delete=False) as tf:
@@ -72,7 +72,9 @@ echo " ── ①-c peer 스캔: claude-agents 스코프 ──"
72
72
  CC="$D/session_close_check.sh"
73
73
  if [ -f "$CC" ]; then
74
74
  a=$(CLAUDE_CODE_CHILD_SESSION=1 bash "$CC" 2>/dev/null | grep -cE '^[^[:space:]]+ +①-c' || true)
75
- b=$(env -u CLAUDE_CODE_CHILD_SESSION -u CLAUDE_CODE_AGENT bash "$CC" 2>/dev/null | grep -cE '^[^[:space:]]+ +①-c' || true)
75
+ # 아래 ①-g 팔이 읽는다 — 체커가 스텁을 «안 불렀다» 와 «가리고 진짜를 불렀다» 는 다르다.
76
+ _CCOUT="$(env -u CLAUDE_CODE_CHILD_SESSION -u CLAUDE_CODE_AGENT bash "$CC" 2>/dev/null || true)"
77
+ b=$(printf '%s\n' "$_CCOUT" | grep -cE '^[^[:space:]]+ +①-c' || true)
76
78
  c=$(env -u CLAUDE_CODE_CHILD_SESSION -u CLAUDE_CODE_AGENT FH_PEER_SCAN_FORCE=1 bash "$CC" 2>/dev/null | grep -cE '^[^[:space:]]+ +①-c' || true)
77
79
  [ "$a" -gt 0 ] && ok "자식 세션 → ①-c 뜬다" || ng "자식 세션인데 ①-c 없음"
78
80
  [ "$b" -eq 0 ] && ok "톱레벨(env 부재 시뮬) → 침묵 (솔로 세션 나그 금지)" || ng "env 부재인데 ①-c 떴다"
@@ -84,7 +86,19 @@ fi
84
86
 
85
87
  if [ -f "$CC" ]; then
86
88
  lane_stub_env_used gh && ok "lane_stub_env: gh 스텁 선택 확인(FH_LANE_STUB=off 면 해당 없음)" || ng "lane_stub_env: gh 스텁 미사용 — PATH 가림"
87
- lane_stub_env_used stale-ref && ok "lane_stub_env: ①-g 스텁 선택 확인(FH_LANE_STUB=off 면 해당 없음)" || ng "lane_stub_env: ①-g 스텁 미사용 — 진짜 스캐너가 돌았다"
89
+ # 🟥 «스텁이 안 불렸다» 의 원인이 둘이고, 초판은 둘을 한 문장으로 접어 **거짓 진단**을 냈다.
90
+ # 2026-10-19 클린룸 감사 실측: 깃 없는 소비자 타르볼에서 이 스위트가 재현성 있게 빨갛고
91
+ # (깃 트리 두 곳은 초록) 메시지가 「진짜 스캐너가 돌았다」였다. 실제로는 체커 자신이
92
+ # «①-g stale-ref: git 없음/비-레포 — 대상 목록을 못 만들었다. UNMEASURED» 를 찍고
93
+ # 스캐너를 **아예 안 불렀다**. 즉 가림이 아니라 미측정이고, 「진짜가 돌았다」는 거짓이다.
94
+ # ⇒ 체커 자신의 출력으로 가른다(기록의 속성을 보는 것이지 결론을 보는 게 아니다).
95
+ if lane_stub_env_used stale-ref; then
96
+ ok "lane_stub_env: ①-g 스텁 선택 확인(FH_LANE_STUB=off 면 해당 없음)"
97
+ elif printf '%s\n' "${_CCOUT:-}" | grep -q '①-g stale-ref: git 없음/비-레포'; then
98
+ ok "lane_stub_env: ①-g 는 체커가 UNMEASURED 를 선언해 스캐너를 안 불렀다 — 미측정(통과 아님), 가림 아님"
99
+ else
100
+ ng "lane_stub_env: ①-g 스텁 미사용 — PATH 가림(진짜 스캐너가 돌았다)"
101
+ fi
88
102
  fi
89
103
 
90
104
  echo
@@ -269,7 +269,7 @@ else
269
269
  python3 - "$SUT" "$MUTP" <<'PY'
270
270
  import io, sys
271
271
  src = io.open(sys.argv[1], encoding='utf-8').read()
272
- old = ' grep -qxF "$1" <<<"$_TRACKED"'
272
+ old = ' case "$_TRACKED_NL" in *$\'\\n\'"$1"$\'\\n\'*) return 0;; *) return 1;; esac'
273
273
  new = ' printf \'%s\\n\' "$_TRACKED" | grep -qxF "$1"'
274
274
  if src.count(old) != 1:
275
275
  sys.stderr.write("SUBN=%d\n" % src.count(old)); sys.exit(3)
@@ -287,6 +287,60 @@ PY
287
287
  fi
288
288
  rm -rf "$BIG"
289
289
 
290
+ # ─────────────────────────────────────────────────────────────────────────────
291
+ # L-glob — 🟥 `case "$_TRACKED_NL"` 전환 시 경로의 글로브 문자(`[`, `]`, `*`, `?`)가 패턴이 아닌
292
+ # 리터럴로 매치돼야 한다(`"$1"` 인용 필수). 인용이 빠지면:
293
+ # ① tracked 인 `shipped_[v1].md` 는 패턴 `[v1]` 이 리터럴 `[v1]` 과 불일치해 동봉 파일로 안 읽히고,
294
+ # ② untracked 인 근접 경로(`harness_bench_[i]ssue_monitor.md` 등)나 `[v1]` 문자클래스 전개(`shipped_v.md`)가
295
+ # 동봉 파일과 오매치될 수 있다.
296
+ printf '# bracket\n' > "$BR/tracks/_meta/shipped_[v1].md"
297
+ printf '# star\n' > "$BR/tracks/_meta/shipped_*.md"
298
+ git -C "$BR" add -f "tracks/_meta/shipped_[v1].md" "tracks/_meta/shipped_*.md" >/dev/null 2>&1
299
+ git -C "$BR" -c user.email=t@t -c user.name=t commit -q -m ship-glob 2>/dev/null
300
+ v=$(_bv "$BR")
301
+ [ "$v" = "new" ] \
302
+ && ok "L-glob tracked paths containing '[' or '*' are still recognised as shipped (got new)" \
303
+ || ng "L-glob tracked path with '[' or '*' misread as user-made (got '$v' — missing quoting on \"\$1\"?)"
304
+
305
+ printf '# near-miss class\n' > "$BR/tracks/_meta/shipped_v.md"
306
+ printf '# near-miss pattern\n' > "$BR/tracks/_meta/harness_bench_[i]ssue_monitor.md"
307
+ _g_out=$( cd "$BR" && bash scripts/mapped_tracks.sh 2>&1 )
308
+ _g_sess=$(printf '%s\n' "$_g_out" | sed -n 's/^session_files=//p')
309
+ _g_br=$(printf '%s\n' "$_g_out" | sed -n 's/^onboarding_branch=//p')
310
+ [ "$_g_sess" = "2" ] && [ "$_g_br" = "returning" ] \
311
+ && ok "L-glob control — untracked near-miss paths are NOT recognised as shipped (session_files=$_g_sess · $_g_br)" \
312
+ || ng "L-glob control — untracked near-miss path was swallowed as shipped (session_files=$_g_sess branch=$_g_br)"
313
+ rm -f "$BR/tracks/_meta/shipped_v.md" "$BR/tracks/_meta/harness_bench_[i]ssue_monitor.md"
314
+
315
+ # ─────────────────────────────────────────────────────────────────────────────
316
+ # L-fork — 🟥 파일 수에 비례하는 fork 가 없어야 한다(온보딩 지연 7~12s 의 원인, 2026-10-23 실측).
317
+ # grep · basename 을 세는 심(shim)을 PATH 앞에 두고 untracked 200개 위에서 돌린다. 수정판은 상수 회,
318
+ # 뮤턴트(here-string grep 복원)는 파일마다 1회 이상 → 이 레인이 «빨라짐» 의 기계 앵커다(codex: L-glob 은
319
+ # 옛 grep 에서도 초록이라 fork 제거를 증명하지 못한다).
320
+ SHIM="$(mktemp -d)"; CNT="$SHIM/count"; : > "$CNT"
321
+ for _t in grep basename; do
322
+ _real=$(command -v "$_t")
323
+ printf '#!/bin/bash\necho %s >> "%s"\nexec "%s" "$@"\n' "$_t" "$CNT" "$_real" > "$SHIM/$_t"; chmod +x "$SHIM/$_t"
324
+ done
325
+ for _i in $(seq 1 200); do printf '# u\n' > "$BR/tracks/_meta/u_$_i.md"; done
326
+ ( cd "$BR" && PATH="$SHIM:$PATH" bash scripts/mapped_tracks.sh >/dev/null 2>&1 )
327
+ _n=$(wc -l < "$CNT" | tr -d ' ')
328
+ [ "$_n" -lt 50 ] \
329
+ && ok "L-fork 200 files → grep/basename calls $_n (< 50, not per file)" \
330
+ || ng "L-fork 200 files → grep/basename calls $_n — forks per file again"
331
+ sed 's|case "\$_TRACKED_NL" in \*\$'"'"'\\n'"'"'"\$1"\$'"'"'\\n'"'"'\*) return 0;; \*) return 1;; esac|grep -qxF "$1" <<<"$_TRACKED"|' \
332
+ "$BR/scripts/mapped_tracks.sh" > "$BR/scripts/mapped_tracks_fork_mut.sh"
333
+ if cmp -s "$BR/scripts/mapped_tracks.sh" "$BR/scripts/mapped_tracks_fork_mut.sh"; then
334
+ ng "L-fork revert — 뮤턴트 생성 실패(치환 대상 부재). HARNESS ERROR, 초록으로 안 읽는다"
335
+ else
336
+ : > "$CNT"; ( cd "$BR" && PATH="$SHIM:$PATH" bash scripts/mapped_tracks_fork_mut.sh >/dev/null 2>&1 )
337
+ _m=$(wc -l < "$CNT" | tr -d ' ')
338
+ [ "$_m" -ge 200 ] \
339
+ && ok "L-fork revert — here-string grep 을 되돌리면 호출이 $_m 회로 늘어난다(레인이 결함에 결박됨)" \
340
+ || ng "L-fork revert — 뮤턴트도 $_m 회 — 이 레인은 fork 를 재지 못한다"
341
+ fi
342
+ rm -f "$BR"/tracks/_meta/u_*.md "$BR/scripts/mapped_tracks_fork_mut.sh"; rm -rf "$SHIM"
343
+
290
344
  if [ "$FAIL" -eq 0 ]; then
291
345
  echo "MAPPED-TRACKS LANES: PASS ($PASS/$PASS)"
292
346
  echo " NOT covered: whether the synergy skill (or any other consumer) actually CALLS this."
@@ -34,7 +34,7 @@ w fb_promote.md "$hdr
34
34
  - 2026-10-01 | same day again
35
35
  - 2026-10-05 | other day
36
36
  ---
37
- body"
37
+ body — fixed in 4cab596 (an evidence anchor, so this one may be promoted)"
38
38
  w fb_two_two.md "$hdr
39
39
  type: feedback
40
40
  hits:
@@ -206,5 +206,95 @@ Q="$T/q"; mkdir -p "$Q"; for f in z a; do printf -- '---\nmetadata:\n type: use
206
206
  printf -- '- [z](z.md) [a](a.md)\n' > "$Q/MEMORY.md"
207
207
  eq "L27 same-line links keep link order" "$(python3 "$HERE/memory_gc_report.py" "$Q" --json | "$PY" -c "import json,sys;print(json.load(sys.stdin)['order'])")" "['z.md', 'a.md']"
208
208
 
209
+
210
+ # 🟥 residual edges NOT chased (round cap 2, static matcher does not converge): '#123456 ' CSS colours without ';' · repo#N inside
211
+ # URLs counted twice (presence only, harmless) · sha-looking words in prose with mixed letters/digits (e.g. 'b2c3d4e') count.
212
+ # ── evidence anchors (harness2: a lesson is stored/promoted only with a cited contrast) — own fixture dir ──
213
+ M2="$T/m2"; mkdir -p "$M2"
214
+ w2(){ printf '%s\n' "$2" > "$M2/$1"; }
215
+ w2 fb_anchored.md "$hdr
216
+ type: feedback
217
+ hits:
218
+ - 2026-10-01 | a
219
+ - 2026-10-02 | b
220
+ - 2026-10-03 | c
221
+ ---
222
+ fixed in 4cab596 — measured with scripts/test_x.sh"
223
+ w2 fb_held.md "$hdr
224
+ type: feedback
225
+ hits:
226
+ - 2026-10-01 | a
227
+ - 2026-10-02 | b
228
+ - 2026-10-03 | c
229
+ ---
230
+ happened on 2026-10-03, three times (a date is not an evidence anchor)"
231
+ pos(){ w2 "$1" "$hdr
232
+ type: project
233
+ ---
234
+ $2"; }
235
+ pos a_sha.md "fixed in 4cab596"
236
+ pos a_sha_ctx.md "landed as commit 1234567"
237
+ pos a_pr.md "see #1"
238
+ pos a_repo_pr.md "see chrono-meta/forge-harness#938"
239
+ pos a_path.md "the bug was in src/main.rs"
240
+ pos a_upper.md "documented in README.MD"
241
+ pos a_docker.md "the Dockerfile pins it"
242
+ pos a_arxiv.md "per arXiv:2610.29609"
243
+ pos a_url.md "see https://example.org/x"
244
+ w2 a_hitline.md "$hdr
245
+ type: feedback
246
+ hits:
247
+ - 2026-10-01 | fixed in 4cab596
248
+ ---
249
+ the rule, stated without citing anything"
250
+ pos n_noise.md "color #fff, version 3.29, the word deadbeef, abcdefg, C# and &#39; are not anchors"
251
+ pos n_css.md "color: #123456;"
252
+ pos n_uuid.md "request 3f2a9c1e-8b7d-4e21-9a3b-0c5d6e7f8a9b failed"
253
+ pos n_slug.md "see [intro](#2-intro)"
254
+ pos n_wiki.md "see [[feedback_x]] for the relation"
255
+ pos n_wiki_ext.md "see [[feedback_x.md]] for the relation"
256
+ pos n_frag.md "see [step](#2)"
257
+ pos n_uuid_ctx.md "commit 1234567-dead-beef-1234-123456789abc"
258
+ pos a_arxiv_old.md "per arXiv:hep-th/9901001"
259
+ pos n_date.md "happened on 2026-10-03, three times"
260
+ w2 n_fm.md "---
261
+ name: x
262
+ description: |
263
+ quoted
264
+ ---
265
+ see https://example.org/frontmatter
266
+ metadata:
267
+ type: project
268
+ ---
269
+ plain body"
270
+ w2 MEMORY.md "# Memory Index
271
+ - [A](fb_anchored.md)
272
+ - [H](fb_held.md)
273
+ - [U](user_plain.md)
274
+ - [a1](a_sha.md)
275
+ - [a2](a_sha_ctx.md)
276
+ - [a3](a_pr.md)
277
+ - [a4](a_repo_pr.md)
278
+ - [a5](a_path.md)
279
+ - [a6](a_upper.md)
280
+ - [a7](a_docker.md)
281
+ - [a8](a_arxiv.md)
282
+ - [a9](a_url.md)
283
+ - [a10](a_hitline.md)
284
+ - [n1](n_noise.md)
285
+ - [n2](n_css.md)
286
+ - [n3](n_uuid.md)
287
+ - [n4](n_slug.md)
288
+ - [n5](n_wiki.md)
289
+ - [n6](n_date.md)
290
+ - [n7](n_fm.md)
291
+ - [n8](n_wiki_ext.md)
292
+ - [n9](n_frag.md)
293
+ - [n10](n_uuid_ctx.md)
294
+ - [a11](a_arxiv_old.md)"
295
+ q2(){ "$PY" "$HERE/memory_gc_report.py" "$M2" --today 2026-10-15 --json | "$PY" -c "import json,sys; d=json.load(sys.stdin); print($1)"; }
296
+ eq "L30 promote needs an evidence anchor; a recurring entry citing only dates is held, not promoted" "$(q2 "(d['promote'], d['promote_held'])")" "([['fb_anchored.md', 3, 3]], [['fb_held.md', 3, 3]])"
297
+ eq "L31 each anchor class counts on its own (sha · named sha · #N · owner/repo#N · path · upper-case ext · Dockerfile · arXiv · URL · hit line); every non-anchor stays unanchored (#fff · CSS · UUID · #slug · [[wiki]] · date · frontmatter URL)" "$(q2 "sorted(d['unanchored'])")" "['fb_held.md', 'n_css.md', 'n_date.md', 'n_fm.md', 'n_frag.md', 'n_noise.md', 'n_slug.md', 'n_uuid.md', 'n_uuid_ctx.md', 'n_wiki.md', 'n_wiki_ext.md']"
298
+ eq "L32 user entries are never listed as unanchored (and the list is not empty, so this is not vacuous)" "$(q2 "('user_plain.md' in d['unanchored'], len(d['unanchored']) > 0)")" "(False, True)"
209
299
  echo "memory_gc_report lanes: $pass pass · $fail fail"
210
300
  [ $fail -eq 0 ]
@@ -152,6 +152,7 @@ grep -q 'TIMEOUT L2' <<<"$out" ; chk $? "R3 a hang is reported as TIMEOUT, its
152
152
 
153
153
  echo "── S: in-place safety — each lane is a blocking repro from the 2026-10-07 blind review"
154
154
  bkpath() { python3 -c 'import hashlib,os,sys;print("/tmp/mutation_probe-%d/path-%s.backup"%(os.getuid(),hashlib.sha256(os.path.realpath(sys.argv[1]).encode()).hexdigest()[:16]))' "$1"; }
155
+ ibkpath() { python3 -c 'import os,sys;st=os.stat(sys.argv[1]);print("/tmp/mutation_probe-%d/inode-%d-%d.backup"%(os.getuid(),st.st_dev,st.st_ino))' "$1"; }
155
156
  sha_of() { python3 -c 'import hashlib,sys;print(hashlib.sha256(open(sys.argv[1],"rb").read()).hexdigest())' "$1"; }
156
157
  procs_matching() { # count live processes whose WHOLE cmdline is $1 — /proc, not pgrep (pgrep absent → vacuous);
157
158
  local n=0 c # exact match, so the counter never counts itself (a substring grep did)
@@ -482,8 +483,23 @@ out=$(python3 "$PROBE" z16.sh lane_z16.sh --timeout 30 2>&1); rc=$?
482
483
  # Z17 — a closed stdout does not lose the run
483
484
  cp age.sh z17.sh; h0=$(sha_of z17.sh)
484
485
  sed 's#age\.sh#z17.sh#' lane_strong.sh > lane_z17.sh # v6 ran lane_strong here, which never sources z17.sh — the v7 control caught it
485
- python3 "$PROBE" z17.sh lane_z17.sh --timeout 30 2>z17.err | head -c 1 >/dev/null; rc=${PIPESTATUS[0]}; [ "$rc" -eq 0 ] || { echo " (Z17 rc=$rc)"; sed 's/^/ /' z17.err; }
486
- [ "$rc" -eq 0 ] && [ "$(sha_of z17.sh)" = "$h0" ] ; chk $? "Z17 stdout closed mid-run → still rc 0 and restored (v5: BrokenPipe traceback rc 1)"
486
+ # 🟥 전제 먼저 — 상태 디렉터리는 컨테이너 전역(`/tmp/mutation_probe-$uid`)이고 inode 키는
487
+ # 파일이 지워지면 재사용된다. 그래서 **다른 트리가 지난주에 남긴 백업**이 이번 픽스처의
488
+ # inode 와 같은 이름일 수 있고, 그러면 프로브는 (옳게) rc=2 «CANNOT JUDGE» 로 거절한다.
489
+ # 초판은 그 rc=2 를 `❌ Z17 stdout closed mid-run` 으로 찍었다 — 즉 **안 재어진 것을
490
+ # 「이 동작이 깨졌다」로 거짓 진단**했다. 2026-10-19 클린룸 감사 실측: 컨테이너 재사용 4회차,
491
+ # 10-12 자 백업 inode-65024-1941405 이 10-19 의 z17 픽스처와 같은 이름이었다.
492
+ # ⇒ 실행 **전에** 두 키(path·inode)를 보고, 이미 있으면 UNMEASURED 로 센다(통과 아님 —
493
+ # 스위트는 그래도 exit 1 이다). 메시지 문자열을 grep 하지 않고 기록의 존재만 본다.
494
+ _z17stale=""
495
+ for _b in "$(bkpath z17.sh)" "$(ibkpath z17.sh)"; do [ -e "$_b" ] && _z17stale="$_b"; done
496
+ if [ -n "$_z17stale" ]; then
497
+ echo " ⚠️ Z17 UNMEASURED — 전역 상태 디렉터리에 남의 백업이 먼저 있다: $_z17stale (inode 재사용). 비우고 다시 돌려라"
498
+ UNMEASURED=$((UNMEASURED+1))
499
+ else
500
+ python3 "$PROBE" z17.sh lane_z17.sh --timeout 30 2>z17.err | head -c 1 >/dev/null; rc=${PIPESTATUS[0]}; [ "$rc" -eq 0 ] || { echo " (Z17 rc=$rc)"; sed 's/^/ /' z17.err; }
501
+ [ "$rc" -eq 0 ] && [ "$(sha_of z17.sh)" = "$h0" ] ; chk $? "Z17 stdout closed mid-run → still rc 0 and restored (v5: BrokenPipe traceback rc 1)"
502
+ fi
487
503
  # Z18 — --json through a hard link to the subject
488
504
  cp age.sh z18.sh; ln -f z18.sh z18.json; h0=$(sha_of z18.sh)
489
505
  out=$(python3 "$PROBE" z18.sh lane_weak.sh --timeout 30 --json z18.json 2>&1); rc=$?
@@ -21,6 +21,8 @@ setup() {
21
21
  git init -q --bare -b main "$d/origin.git"
22
22
  git clone -q "$d/origin.git" "$d/seed" 2>/dev/null
23
23
  printf 'a1\n' > "$d/seed/a"; printf 'b1\n' > "$d/seed/b"
24
+ # SETUP_EXTRA=1: a tracked dir whose listing names `a`, and a runner whose text names `a` — the shapes a glob/dir word can drag in
25
+ [ -n "${SETUP_EXTRA:-}" ] && { mkdir -p "$d/seed/d"; printf 'x\n' > "$d/seed/d/a"; printf 'grep -q a2 a\n' > "$d/seed/r.sh"; }
24
26
  git -C "$d/seed" add -A; git -C "$d/seed" commit -qm init --no-verify; git -C "$d/seed" push -q origin HEAD:main
25
27
  git -C "$d/seed" switch -qc feat; printf 'a2\n' > "$d/seed/a"; printf 'b2\n' > "$d/seed/b"
26
28
  git -C "$d/seed" commit -qam feat --no-verify; git -C "$d/seed" push -q origin feat
@@ -67,7 +69,11 @@ esac
67
69
  EOF
68
70
  chmod +x "$D/bin/gh"
69
71
  }
70
- run() { local D="$1"; shift; OUT=$(cd "$D/work" && PATH="$D/bin:$PATH" PMV_RETRY_SLEEP=0 bash "$SC" "$@" 2>&1); RC=$?; }
72
+ # 🟥 env -u CLAUDECODE: the lane itself often runs inside Claude Code; without it every «no agent marker» control inherits the
73
+ # marker and reads agent-session (measured on the first run of L18).
74
+ run() { local D="$1"; shift; OUT=$(cd "$D/work" && env -u CLAUDECODE PATH="$D/bin:$PATH" PMV_RETRY_SLEEP=0 PMV_RECEIPTS="$D/receipts.jsonl" bash "$SC" "$@" 2>&1); RC=$?; }
75
+ # receipt field reader: rcpt <dir> <field> → value of the LAST receipt line (empty if none)
76
+ rcpt() { [ -s "$1/receipts.jsonl" ] && tail -1 "$1/receipts.jsonl" | python3 -c "import json,sys;v=json.load(sys.stdin).get(sys.argv[1]);print('' if v is None else v)" "$2"; }
71
77
  merged() { [ -s "$1/merge.log" ]; }
72
78
  GOOD='grep -q a2 a && grep -q b2 b && echo instrument-ok'
73
79
 
@@ -147,5 +153,46 @@ setup st; mkgh "$T/st"; : > "$T/st/local_fail"; : > "$T/st/stuck"; run "$T/st" 7
147
153
  { [ "$RC" -eq 5 ] && printf '%s' "$OUT" | grep -q 'NOT observed' && printf '%s' "$OUT" | grep -q 'read 3 time' && ! printf '%s' "$OUT" | grep -q 'nothing merged'; } \
148
154
  && ok "L16 stale OPEN through all re-reads → rc=5 «NOT observed», no false «nothing merged»" || { bad "L16 rc=$RC"; printf '%s\n' "$OUT" | tail -2; }
149
155
 
156
+ # ── merge receipt: actor + lease (frontier digest 2026-10-23, arXiv:2610.28683) ──
157
+ # L17 an agent session merging under a named lease → one receipt line naming both, with the merge commit and outcome
158
+ setup rl; mkgh "$T/rl"; OUT=$(cd "$T/rl/work" && CLAUDECODE=1 PATH="$T/rl/bin:$PATH" PMV_RETRY_SLEEP=0 PMV_RECEIPTS="$T/rl/receipts.jsonl" bash "$SC" 7 --rerun "$GOOD" --lease "night-2026-10-22" 2>&1); RC=$?
159
+ { [ "$RC" -eq 0 ] && [ "$(rcpt "$T/rl" actor)" = "agent-session:claude-code" ] && [ "$(rcpt "$T/rl" lease)" = "night-2026-10-22" ] \
160
+ && [ "$(rcpt "$T/rl" outcome)" = "verified" ] && [ "$(rcpt "$T/rl" merge)" = "$(cat "$T/rl/merge.oid")" ] && [ "$(wc -l < "$T/rl/receipts.jsonl")" -eq 1 ]; } \
161
+ && ok "L17 agent merge under a lease → receipt: actor agent-session · lease · verified · merge oid" || { bad "L17 rc=$RC receipt=$(cat "$T/rl/receipts.jsonl" 2>/dev/null)"; printf '%s\n' "$OUT" | tail -3; }
162
+ # L18 control: no lease, no agent marker → actor human-or-unknown, lease NONE (recorded, not refused)
163
+ { [ "$(rcpt "$T/ok" actor)" = "human-or-unknown" ] && [ "$(rcpt "$T/ok" lease)" = "NONE" ]; } \
164
+ && ok "L18 no lease, no agent marker → human-or-unknown · NONE (merge still allowed)" || bad "L18 receipt=$(cat "$T/ok/receipts.jsonl" 2>/dev/null)"
165
+ # L19 negative control — a refusal BEFORE the merge, or a merge GitHub did not take, leaves no receipt. It cannot detect the feature
166
+ # being removed on its own (codex R1); L17 · L18 · L21 are its positive pair.
167
+ { [ ! -s "$T/nore/receipts.jsonl" ] && [ ! -s "$T/triv/receipts.jsonl" ] && [ ! -s "$T/mf/receipts.jsonl" ]; } \
168
+ && ok "L19 refused / not-merged runs leave no receipt" || bad "L19 a receipt was written for a run that did not merge"
169
+ # L20 an empty --lease is a usage error before the merge
170
+ setup le; mkgh "$T/le"; run "$T/le" 7 --rerun "$GOOD" --lease ""
171
+ # the message names --lease: an unknown-option rc=2 alone would also pass (codex R1)
172
+ { [ "$RC" -eq 2 ] && ! merged "$T/le" && printf '%s' "$OUT" | grep -qF -- '--lease needs a non-empty label'; } && ok "L20 empty --lease → rc=2 «needs a non-empty label», no merge" || bad "L20 empty lease rc=$RC out=$OUT"
173
+ # L22 a queued merge (GitHub accepted the request, not completed) is receipted as such — the request was made
174
+ [ "$(rcpt "$T/q" outcome)" = "accepted-not-completed" ] && ok "L22 queued merge → receipt outcome accepted-not-completed" || bad "L22 receipt=$(cat "$T/q/receipts.jsonl" 2>/dev/null)"
175
+ # L21 a merged-but-failed verification still gets its receipt, with that outcome
176
+ [ "$(rcpt "$T/drop" outcome)" = "verify-failed" ] && ok "L21 verify FAILED after merge → receipt outcome verify-failed" || bad "L21 receipt=$(cat "$T/drop/receipts.jsonl" 2>/dev/null)"
177
+
178
+ # ── --rerun coverage advisory (warning only) ──
179
+ # L23 a real but unrelated --rerun (touches none of the PR's changed files) → warning, yet the merge and verify still go through
180
+ setup cv; mkgh "$T/cv"; run "$T/cv" 7 --rerun 'git --version && echo unrelated-ok'
181
+ { [ "$RC" -eq 0 ] && merged "$T/cv" && printf '%s' "$OUT" | grep -q 'mentions none of this PR'"'"'s 2 changed file'; } \
182
+ && ok "L23 --rerun naming no changed file → advisory warning, merge + verify unchanged (rc=0)" || { bad "L23 rc=$RC"; printf '%s\n' "$OUT" | tail -4; }
183
+ # L24 control: a --rerun that names the changed files stays silent (L1's GOOD names a and b)
184
+ setup cv2; mkgh "$T/cv2"; run "$T/cv2" 7 --rerun "$GOOD"
185
+ { [ "$RC" -eq 0 ] && ! printf '%s' "$OUT" | grep -q 'mentions none of this PR'; } \
186
+ && ok "L24 --rerun naming the changed files → no advisory" || bad "L24 rc=$RC (advisory fired on a covering --rerun?)"
187
+
188
+ # L25 a glob in --rerun is NOT expanded against the checkout — `echo *` would pull in r.sh (whose text names `a`) and silence the advisory (cross-family R1)
189
+ SETUP_EXTRA=1 setup cvg; mkgh "$T/cvg"; run "$T/cvg" 7 --rerun 'git --version && echo *'
190
+ { [ "$RC" -eq 0 ] && printf '%s' "$OUT" | grep -q 'mentions none of this PR'; } \
191
+ && ok "L25 --rerun with a bare glob → advisory still fires (no pathname expansion)" || bad "L25 rc=$RC (glob expanded into a runner that names a changed file?)"
192
+ # L25b a word naming a tracked DIRECTORY adds nothing — its tree listing (here `a`) is not a script's text (cross-family R1)
193
+ SETUP_EXTRA=1 setup cvd; mkgh "$T/cvd"; run "$T/cvd" 7 --rerun 'git --version && ls d'
194
+ { [ "$RC" -eq 0 ] && printf '%s' "$OUT" | grep -q 'mentions none of this PR'; } \
195
+ && ok "L25b --rerun naming a tracked dir → advisory still fires (blobs only)" || bad "L25b rc=$RC (dir listing counted as coverage?)"
196
+
150
197
  printf 'PASS %d · FAIL %d\n' "$PASS" "$FAIL"
151
198
  [ "$FAIL" -eq 0 ]