@chrono-meta/fh-gate 3.31.0 → 3.33.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.
Files changed (37) hide show
  1. package/.claude-plugin/marketplace.json +4 -4
  2. package/AGENTS.md +23 -0
  3. package/CATALOG.md +44 -0
  4. package/CLAUDE.md +2 -2
  5. package/README.md +6 -3
  6. package/docs/USER_GUIDE.md +1 -1
  7. package/knowledge/shared/harness-core/claude_md_full_reference.md +19 -0
  8. package/knowledge/shared/harness-core/dispatch_conditional_prohibition.md +17 -0
  9. package/knowledge/shared/learnings/subagent_invocations_log.yaml +84 -0
  10. package/knowledge/shared/rules/operations.md +11 -0
  11. package/knowledge/shared/rules/sister_asset_protocol.md +21 -2
  12. package/package.json +3 -1
  13. package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
  14. package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +28 -0
  15. package/plugins/fh-commons/skills/ko-tech-writer/fixtures/known_negative.md +32 -0
  16. package/plugins/fh-commons/skills/ko-tech-writer/fixtures/known_positive.md +22 -0
  17. package/plugins/fh-commons/skills/ko-tech-writer/fixtures/rewrite_clean.md +4 -0
  18. package/plugins/fh-commons/skills/ko-tech-writer/fixtures/rewrite_drops_metaphor.md +4 -0
  19. package/plugins/fh-commons/skills/ko-tech-writer/fixtures/rewrite_invents_number.md +4 -0
  20. package/plugins/fh-commons/skills/ko-tech-writer/fixtures/rewrite_keep.txt +2 -0
  21. package/plugins/fh-commons/skills/ko-tech-writer/fixtures/rewrite_original.md +4 -0
  22. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  23. package/plugins/fh-meta/CHANGELOG.md +35 -0
  24. package/plugins/fh-meta/skills/install-wizard/SKILL.md +11 -5
  25. package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
  26. package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
  27. package/scripts/absorption_queue.py +417 -0
  28. package/scripts/fh_detach.py +41 -19
  29. package/scripts/fh_session_load.sh +29 -0
  30. package/scripts/ko_tech_writer_calibrate.py +284 -7
  31. package/scripts/mutation_probe.py +16 -0
  32. package/scripts/selfcheck.sh +1 -0
  33. package/scripts/test_absorption_queue_lanes.sh +10 -0
  34. package/scripts/test_fh_detach_lanes.sh +52 -2
  35. package/scripts/test_fh_run_resolver_lanes.sh +16 -0
  36. package/scripts/test_mutation_probe_lanes.sh +17 -35
  37. package/scripts/test_prepush_real_fire_lanes.sh +1 -1
@@ -227,6 +227,18 @@ if [ -d "$_AUDIT_DIR" ] && fh_cadence_due "$_FH_HOOK_SRC"; then
227
227
  fi
228
228
  fi
229
229
 
230
+ # 1-b2) 흡수 대기열 (2026-10-28) — 바깥에서 온 «가져올 것» (digest 후보 · 외부 자산 감사의 가져올
231
+ # 목록 · 운영자가 건넨 링크) 이 열린 채 남아 있으면 한 줄. MEASURED: techwriting 감사의 «가져올 것 5»
232
+ # 가 하루 동안 아무도 안 집었고, 다음 날 운영자가 직접 발표 요약을 들고 와서야 ko-tech-writer 가
233
+ # 고쳐졌다 — 목록은 있었고 읽는 쪽이 없었다. 위 1-b 와 같은 성격: 알리기만 하고 막지 않는다.
234
+ # 파일이 없거나 열린 항목이 0 이면 아무것도 안 찍는다(새 클론을 조르지 않는다).
235
+ _AQ="$FH/scripts/absorption_queue.py"
236
+ if [ -f "$_AQ" ] && fh_cadence_due "$_FH_HOOK_SRC"; then
237
+ # 출력을 받아서 찍는다 — `| head` 는 pipefail 아래 조기종료 소비자 취약형이다(class-lock 레인).
238
+ _AQ_OUT="$(CLAUDE_PROJECT_DIR="$FH" python3 "$_AQ" summary 2>&1)"
239
+ if [ -n "$_AQ_OUT" ]; then printf '%s\n' "$_AQ_OUT"; fi
240
+ fi
241
+
230
242
  # 1-c) harness-doctor cadence — 위 1-b 와 같은 이유로, 같은 훅에서, 한 블록 더.
231
243
  # MEASURED 2026-08-16 (weekly_audit_2026-08-16.md 🟥-3): 직전 감사(07-31)가 «산문 캐던스 미이행»을
232
244
  # N=2 로 집계하면서 **주간감사(50일)와 harness-doctor(당시 ~49일) 둘을 함께** 지목했다. 그 뒤 16일
@@ -644,6 +656,23 @@ if [ -x "$FH/scripts/mapped_tracks.sh" ]; then
644
656
  esac
645
657
  fi
646
658
 
659
+ # 5b) Companion-store sync refused a bulk intake (sync-to-be.sh rc=14). Under launchd that refusal is
660
+ # written only to a log nothing reads, and every later sync with changes refuses again — so the store
661
+ # silently stops receiving anything until a person acts. The marker is cleared by the next committed sync.
662
+ _SBR="$FH/tracks/_meta/logs/.sync_bulk_refused"
663
+ if [ -f "$_SBR" ]; then
664
+ IFS="$(printf '\t')" read -r _sbr_at _sbr_n _sbr_max _sbr_be < "$_SBR" 2>/dev/null || true
665
+ # Only for the store this session syncs to (a refusal against another store is not this store's state).
666
+ _sbr_here=1
667
+ if [ -n "${_sbr_be:-}" ] && [ -n "${BE:-}" ]; then
668
+ [ "$(cd "$_sbr_be" 2>/dev/null && pwd -P)" = "$(cd "$BE" 2>/dev/null && pwd -P)" ] || _sbr_here=0
669
+ fi
670
+ fi
671
+ if [ -f "$_SBR" ] && [ "${_sbr_here:-1}" = 1 ]; then
672
+ echo "🚫 [sync] 컴패니언 스토어 동기화가 멈춰 있다 — ${_sbr_at:-?} 에 새 파일 ${_sbr_n:-?}개(한도 ${_sbr_max:-?})를 거부(rc 14). 그 뒤 변화가 있는 동기화는 계속 거부된다."
673
+ echo " → bash scripts/sync-to-be.sh 로 가장 큰 폴더를 보고: 제외(scripts/sync_excludes.txt) · 스토어에서 삭제 · 의도한 양이면 FH_SYNC_BULK_OK=1 로 한 번."
674
+ fi
675
+
647
676
  # 6) Substrate-jump detection (structure-enforcing — version drift lives outside any session's
648
677
  # context boundary; silent when nothing changed). Detector, never a gate.
649
678
  [ -x "$FH/scripts/substrate_jump_detector.sh" ] && bash "$FH/scripts/substrate_jump_detector.sh" "$FH" 2>/dev/null
@@ -23,8 +23,10 @@ Python `re` 는 ⓐ 세 허용 엔진 중 **어디에나 있는 유일한 것**
23
23
 
24
24
  사용: python3 ko_tech_writer_calibrate.py (보정)
25
25
  python3 ko_tech_writer_calibrate.py --scan 문서.md (같은 레인·필터로 문서 스캔, 줄\t레인\t본문)
26
+ python3 ko_tech_writer_calibrate.py --check-rewrite --original 원문.md --rewrite 개고.md [--keep 목록.txt] [--listed C9,C15]
27
+ (개고 사후 점검: 남길 곳 · 확인할 곳 · 고칠 곳 세 칸. 발상 출처: 우아콘26 세션 «AI야, 네 글 너무 AI티 나» 의 사후 Eval 3분류. 구현은 이 레포 것)
26
28
 
27
- exit: 0 전 레인 판별 · 1 판별 실패(픽스처 부재 포함 — known_unclosed.md 가 없으면 1) · 3 --scan 대상에 안 닫힌 블록 · 10 harness error(입력 오류)
29
+ exit: 0 전 레인 판별 · 1 판별 실패(--check-rewrite 에서는 어느 칸이든 FAIL 또는 UNSURE) · 2 --check-rewrite 에서 FAIL 은 없으나 남길 곳 목록이 없어 UNMEASURED(픽스처 부재 포함 — known_unclosed.md 가 없으면 1) · 3 --scan 대상에 안 닫힌 블록 · 10 harness error(입력 오류)
28
30
  """
29
31
  import os
30
32
  import re
@@ -79,6 +81,12 @@ LANES = [
79
81
  # ── 경동사 «내다» 후보 (S23 변종). 🟥 UNCALIBRATED: 「판정을 내리다」는 관용구라 «내는» 도 정상 용례가 많다 → 과차단이 예상 결과.
80
82
  # 판별력을 주장하지 않는다. 잡는 형태 둘: 따옴표 명사+를 냈다 / 판정을 내는.
81
83
  ("C15 경동사 내다(후보·UNCALIBRATED)", r"['’”」»』\"`]\s?(을|를) (냈|낸|내는|낼|냅)|판정을 (냈|낸|내는|낼|냅)", "candidate", "uncalibrated", "neg=1"),
84
+ # ── AI티 후보 클래스 C17~C21 (우아콘26 세션 «AI티 패턴» 목록에서 온 후보. 🟥 운영자 교정 쌍 없음 — 구성한 쌍으로만 판별을 잰다, 실문서 정밀도 UNMEASURED)
85
+ ("C17 가운뎃점 밀도(한 줄 3개 이상·후보)", r"(?:·[^·\n]*){3}"),
86
+ ("C18 대조형 «X가 아니라 Y입니다» 문말(후보)", r"[이가] 아니라 [^.\n]{1,50}(입니다|이다)[.\s]*(<!--.*)?$"),
87
+ ("C19 분열문 «~할 점은 ~입니다»(후보)", r"(할|둘|볼) 점은 [^.\n]*(입니다|이다)"),
88
+ ("C20 소제목 과밀(연속 3절 이상이 단락 2개 이하·후보)", None, "hdens"),
89
+ ("C21 뻔한 추상 표현(닫힌 어휘·후보)", r"생각의 근육|배움의 리듬|켜켜이|장면을 포착|손에 쥐여? ?주"),
82
90
  # ── S7 내부 조어 후보 추출기 (함수 lane — 줄 패턴이 아니라 문서 전체를 본다)
83
91
  ("C16 내부 조어 후보(S7·후보)", None, "s7"),
84
92
  ]
@@ -215,6 +223,41 @@ def s7_candidates(path, common=None, st=None):
215
223
  return out
216
224
 
217
225
 
226
+ def heading_dense(path, common=None, st=None):
227
+ """C20: 소제목이 단락 2개 이하마다 붙은 절이 3개 이상 연달아 나오는 구간. [(제목, 줄번호, 종류)] — 후보 전용.
228
+ 단락 = 빈 줄로 갈린 비어 있지 않은 덩어리. 펜스·그림 블록·HTML 주석은 단락이 아니다."""
229
+ text = open(path, encoding="utf-8").read()
230
+ text = COMMENT.sub(lambda m: re.sub(r"[^\n]", " ", m.group(0)), text)
231
+ secs, cur, para = [], None, False
232
+ for i, line in iter_lines(text.split("\n"), True, st or Blocks()):
233
+ if HEADING.match(line):
234
+ if cur:
235
+ secs.append(cur)
236
+ cur, para = [i, line.strip(), 0], False
237
+ elif line.strip():
238
+ if cur and not para:
239
+ cur[2] += 1
240
+ para = True
241
+ else:
242
+ para = False
243
+ if cur:
244
+ secs.append(cur)
245
+ out, run = [], []
246
+ for sec in secs + [None]:
247
+ if sec is not None and sec[2] <= 2:
248
+ run.append(sec)
249
+ continue
250
+ if len(run) >= 3:
251
+ out.extend((r[1], r[0], "sparse-section run of %d" % len(run)) for r in run)
252
+ run = []
253
+ return out
254
+
255
+
256
+ # 함수형 레인 레지스트리: 플래그 -> f(path, common) -> [(키, 줄번호, 종류)]
257
+ FUNC_LANES = {"s7": lambda path, common=None: s7_candidates(path, common),
258
+ "hdens": lambda path, common=None: heading_dense(path)}
259
+
260
+
218
261
  # 절대 잡히면 안 되는 토큰 — 「늘 잡는다」를 내는 죽은 계기 배제용
219
262
  NEVER = r"ZZZ_absent_token_ZZZ"
220
263
 
@@ -231,8 +274,9 @@ def scan(path, common=None):
231
274
  rows, st = [], Blocks()
232
275
  for lane in LANES:
233
276
  label, pat, flags = lane[0], lane[1], lane[2:]
234
- if "s7" in flags:
235
- for term, i, kind in s7_candidates(path, common):
277
+ fl = [f for f in flags if f in FUNC_LANES]
278
+ if fl:
279
+ for term, i, kind in FUNC_LANES[fl[0]](path, common):
236
280
  rows.append((label, i, "%s [%s]" % (term, kind)))
237
281
  continue
238
282
  rx = re.compile(pat)
@@ -246,6 +290,203 @@ def scan(path, common=None):
246
290
  return rows, st
247
291
 
248
292
 
293
+ # ── 개고 사후 점검 (--check-rewrite) — 세 칸: 남길 곳 · 확인할 곳 · 고칠 곳.
294
+ # 🟥 기계가 하는 것은 «기록의 속성» 뿐이다: 목록에 적힌 구절이 개고에 남았나 · 숫자 집합이 움직였나 · 발화한 클래스가 줄었나.
295
+ # 무엇을 남길지의 «선정» 은 판단이고 개고 전에 사람/모델이 --keep 목록으로 적는다. 목록이 없으면 그 칸은 UNMEASURED(0 아님).
296
+ # 한글 수사(세 배)·표로 된 수치는 못 잡는다 — Step 4 의 눈 판정 잔여로 간다.
297
+ VAGUE = ("대폭", "크게", "많이", "상당히", "대거", "급격히", "훨씬", "현저히")
298
+ # 수치 토큰 = 숫자 + (천·만·억·조) + 단위. 단위를 떼어 비교하면 «3배 → 3천 배», «12% → 12배» 가 통과한다.
299
+ # 원칙(R2 교차검토 후 뒤집음): 점검기는 영리하려 들지 않는다. 확신이 없으면 UNSURE 를 낸다 — 통과가 아니다(exit 1, «사람이 볼 곳»).
300
+ # 정규화는 NFKC + 연속 공백 한 칸뿐이다. 목록 기호 제거·단위 정규화·0 정리는 하지 않는다(각각이 새 구멍이었다).
301
+ # 수치 토큰 = [부호] 숫자([.,] 묶음) + 바로 뒤 최대 4자(단위·자릿수어)를 그대로. «1.0 vs 1.00», «30 ms vs 30ms» 처럼 표기만 달라도 NEW/LOST 로 뜬다 — 표기만 달라도 사람이 본다(닫힌 방향의 비용).
302
+ NUMRX = re.compile(r"[+\-\u2212]?\d+(?:[.,]\d+)*[\w%]{0,4}")
303
+
304
+
305
+ def _norm(text):
306
+ import unicodedata
307
+ return re.sub(r"\s+", " ", unicodedata.normalize("NFKC", text)).strip()
308
+
309
+
310
+ def _full(path):
311
+ """NFKC + 공백 한 칸. 코드 펜스·인라인 코드·주석·목록 기호를 건드리지 않는다 — 수치·모호 표현·남길 곳은 전부 본다."""
312
+ return _norm(open(path, encoding="utf-8").read())
313
+
314
+
315
+ def _numtoks(text):
316
+ from collections import Counter
317
+ return Counter(re.sub(r"(?<=\d),(?=\d{3})", "", m.group(0)) for m in NUMRX.finditer(text))
318
+
319
+
320
+ def check_rewrite(orig_path, rw_path, keep_path=None, listed=()):
321
+ """{칸: (상태, [항목…])}. 상태: PASS · FAIL · UNSURE(사람이 볼 곳) · UNMEASURED. 키 구절이 원문에 없거나 비어 있거나 입력 파일이 비면 ValueError."""
322
+ o, r = _full(orig_path), _full(rw_path)
323
+ if not o or not r:
324
+ raise ValueError("empty original or rewrite file")
325
+ nows = lambda t: re.sub(r"\s+", "", t)
326
+ # ① 남길 곳 — 정확 부분문자열 → OK · 공백을 지워야만 찾으면 UNSURE · 아니면 DROPPED
327
+ keep = []
328
+ if keep_path:
329
+ for raw in open(keep_path, encoding="utf-8").read().split("\n"):
330
+ if raw.strip() and not raw.lstrip().startswith("#"):
331
+ ph, _, why = raw.partition("\t")
332
+ if not _norm(ph):
333
+ raise ValueError("empty keep phrase in row %r" % raw)
334
+ keep.append((_norm(ph), why.strip()))
335
+ items, bad, unsure = [], False, False
336
+ for ph, why in keep:
337
+ if nows(ph) not in nows(o):
338
+ raise ValueError("keep phrase not in the original: %r" % ph)
339
+ if ph in r:
340
+ items.append("KEEP-OK %s" % ph)
341
+ elif nows(ph) in nows(r):
342
+ items.append("KEEP-UNSURE %s (found only with whitespace removed -- a person looks)" % ph)
343
+ unsure = True
344
+ elif why:
345
+ items.append("KEEP-LISTED %s -- %s" % (ph, why))
346
+ else:
347
+ items.append("KEEP-DROPPED %s" % ph)
348
+ bad = True
349
+ keep_state = "UNMEASURED" if not keep else ("FAIL" if bad else "UNSURE" if unsure else "PASS")
350
+ if not keep:
351
+ items.append("NO-KEEP-LIST (not measured; this is not a pass)")
352
+ # ② 확인할 곳 — 다중집합 비교, 코드 안 수치도 센다
353
+ to, tr = _numtoks(o), _numtoks(r)
354
+ items2, bad2 = [], False
355
+ for t in sorted((tr - to).elements()):
356
+ items2.append("NUMBER-NEW %s" % t)
357
+ bad2 = True
358
+ for t in sorted((to - tr).elements()):
359
+ items2.append("NUMBER-LOST %s" % t)
360
+ bad2 = True
361
+ for t in sorted((to & tr).elements()):
362
+ items2.append("NUMBER-KEPT %s" % t)
363
+ for v in VAGUE:
364
+ if v in o:
365
+ if v in r:
366
+ items2.append("VAGUE-KEPT %s" % v)
367
+ elif v in listed:
368
+ items2.append("VAGUE-LISTED %s (author decision via --listed)" % v)
369
+ else:
370
+ # 모호 수량은 본문에 그대로 둔다 — 자리표시자나 숫자로 바꾸는 것도 소실이다. 면죄는 --listed 로 이름을 적는 것(저자 결정)뿐.
371
+ items2.append("VAGUE-LOST %s (removed from the body; only --listed excuses it)" % v)
372
+ bad2 = True
373
+ # ③ 고칠 곳
374
+ def per_lane(path):
375
+ out = {}
376
+ for label, _, _ in scan(path)[0]:
377
+ out[label.split()[0]] = out.get(label.split()[0], 0) + 1
378
+ return out
379
+ lo, lr = per_lane(orig_path), per_lane(rw_path)
380
+ items3, bad3 = [], False
381
+ for lid in sorted(set(lo) | set(lr), key=lambda x: int(re.sub(r"\D", "", x))):
382
+ a, b = lo.get(lid, 0), lr.get(lid, 0)
383
+ tag = "FIXED" if a and not b else "REDUCED" if a > b > 0 else "SAME" if a and a == b else "WORSE" if a and b > a else "NEW"
384
+ if tag in ("SAME", "WORSE", "NEW", "REDUCED") and lid not in listed:
385
+ bad3 = True
386
+ tag += "-UNLISTED"
387
+ elif tag in ("SAME", "WORSE", "NEW", "REDUCED"):
388
+ tag += "-LISTED"
389
+ items3.append("%s %s %d->%d" % (tag, lid, a, b))
390
+ if not lo:
391
+ items3.append("NO-CLASS-FIRED in the original (nothing to resolve)")
392
+ return {"keep": (keep_state, items), "verify": ("FAIL" if bad2 else "PASS", items2),
393
+ "fix": ("FAIL" if bad3 else "PASS", items3)}
394
+
395
+
396
+ def rw_edge_cases():
397
+ """[(이름, 통과여부)] — --check-rewrite 의 경계 사례(R1 교차검토). 각 사례는 기대한 칸의 상태까지 단언한다."""
398
+ import tempfile
399
+ out = []
400
+ with tempfile.TemporaryDirectory() as d:
401
+ def w(name, text):
402
+ fp = os.path.join(d, name)
403
+ with open(fp, "w", encoding="utf-8") as fh:
404
+ fh.write(text)
405
+ return fp
406
+
407
+ def run(o, r, keep=None, listed=()):
408
+ try:
409
+ return check_rewrite(w("o.md", o), w("r.md", r), w("k.txt", keep) if keep is not None else None, listed)
410
+ except ValueError:
411
+ return "ERR"
412
+
413
+ def v(res, kind=None):
414
+ if res == "ERR":
415
+ return "ERR"
416
+ st, items = res["verify"]
417
+ return st if kind is None else (st, any(x.startswith(kind) for x in items))
418
+
419
+ out.append(("S1 unit 3배 -> 3천 배 fails (NUMBER-NEW/LOST)", v(run("속도는 3배 빨라졌습니다.", "속도는 3천 배 빨라졌습니다."), "NUMBER-") == ("FAIL", True)))
420
+ out.append(("S1 unit 12% -> 12배 fails", v(run("오류율은 12% 입니다.", "오류율은 12배 입니다.")) == "FAIL"))
421
+ out.append(("S1 control: same number tokens in another order pass", v(run("오류율은 12% 입니다. 지연은 30ms 입니다.", "지연은 30ms 입니다. 오류율은 12% 입니다.")) == "PASS"))
422
+ out.append(("S2 number inside a fenced block is seen", v(run("본문\n```\nx = 1\n```\n", "본문\n```\nx = 2\n```\n"), "NUMBER-") == ("FAIL", True)))
423
+ out.append(("S3 empty keep phrase is a harness error", run("본문입니다.", "본문입니다.", "\t사유\n") == "ERR"))
424
+ out.append(("S3 empty rewrite is a harness error", run("본문입니다.", " \n") == "ERR"))
425
+ out.append(("S3 empty original is a harness error", run("", "본문입니다.") == "ERR"))
426
+ saved, rcs = sys.stderr, []
427
+ sys.stderr = open(os.devnull, "w")
428
+ try:
429
+ rcs = [check_main(["--original", w("o.md", "가"), "--rewrite", w("r.md", "가"), "--listed"]),
430
+ check_main(["--original", w("o.md", "가"), "--rewrite", w("r.md", "가"), "--keep"]),
431
+ check_main(["--original", w("o.md", "가"), "--rewrite"])]
432
+ finally:
433
+ sys.stderr.close()
434
+ sys.stderr = saved
435
+ out.append(("S4 a flag missing its value exits 10", rcs == [10, 10, 10]))
436
+ ph = run("처리 시간이 크게 줄었습니다.", "처리 시간이 [확인 필요: 전후 수치] 줄었습니다.")
437
+ far = run("처리 시간이 대폭 줄었습니다.\n다른 문장입니다.", "처리 시간이 줄었습니다.\n다른 문장은 확인 필요.")
438
+ listed_ok = run("처리 시간이 크게 줄었습니다.", "처리 시간이 줄었습니다.", listed=("크게",))
439
+ out.append(("S5 a placeholder replacing a vague word is VAGUE-LOST", v(ph, "VAGUE-LOST") == ("FAIL", True)))
440
+ out.append(("S5 a marker elsewhere does not excuse VAGUE-LOST", v(far, "VAGUE-LOST") == ("FAIL", True)))
441
+ out.append(("S5 control: naming the word in --listed excuses it", v(listed_ok) == "PASS"))
442
+ out.append(("A1 a wrap inside a Korean word is KEEP-UNSURE (not PASS, not DROPPED)", run("요술램프 같은 도구입니다.", "요술\n램프 같은 도구입니다.", "요술램프\n")["keep"][0] == "UNSURE"))
443
+ out.append(("A2 1.0 vs 1.00 shows as NEW/LOST (a person looks)", v(run("정확도 1.0 입니다.", "정확도 1.00 입니다.")) == "FAIL"))
444
+ out.append(("A2 control: 1,000 == 1000 and full-width digits normalise by NFKC/commas", v(run("건수 1,000건 12건", "건수 1000건 12건")) == "PASS"))
445
+ # R2 (codex): 정규화 수리가 만든 구멍 다섯 — 각 사례는 PASS 로 끝나면 안 된다
446
+ k = run("데이터가 쌓입니다.", "데이터 가공이 쌓입니다.", "데이터가\n")
447
+ out.append(("R2-1 keep across a word boundary is UNSURE, never PASS", k != "ERR" and k["keep"][0] == "UNSURE"))
448
+ out.append(("R2-2 a fabricated line-start number fails", v(run("1. 첫째\n2. 둘째\n", "999. 첫째\n2. 둘째\n")) == "FAIL"))
449
+ out.append(("R2-3 a dropped sign (3 vs -3) fails", v(run("변화량은 3 입니다.", "변화량은 -3 입니다.")) == "FAIL"))
450
+ out.append(("R2-4 a detached unit (30ms vs 30 ms) fails", v(run("지연은 30ms 입니다.", "지연은 30 ms 입니다.")) == "FAIL"))
451
+ k5 = run("ABC 도구를 씁니다.", "ABC 도구를 씁니다.", "ABC\n")
452
+ out.append(("R2-5 keep phrases are NFKC-normalised like the documents", k5 != "ERR" and k5["keep"][0] == "PASS"))
453
+ same = run("지연은 30ms 입니다. 크게 줄었습니다.", "지연은 30ms 입니다. 크게 줄었습니다.", "크게 줄었습니다\n")
454
+ out.append(("R2 control: identical text passes every bucket", same != "ERR" and all(same[b][0] == "PASS" for b in same)))
455
+ return out
456
+
457
+
458
+ BUCKET_KO = {"keep": "남길 곳", "verify": "확인할 곳", "fix": "고칠 곳"}
459
+
460
+
461
+ def check_main(args):
462
+ opts, it = {}, iter(args)
463
+ for a in it:
464
+ if a in ("--original", "--rewrite", "--keep", "--listed"):
465
+ val = next(it, None)
466
+ if val is None or val.startswith("--"):
467
+ sys.stderr.write("usage error: %s needs a value\n" % a)
468
+ return 10
469
+ opts[a] = val
470
+ else:
471
+ opts["bad"] = a
472
+ if "bad" in opts or not opts.get("--original") or not opts.get("--rewrite"):
473
+ sys.stderr.write("usage: ko_tech_writer_calibrate.py --check-rewrite --original F --rewrite F [--keep LIST] [--listed C9,C15]\n")
474
+ return 10
475
+ listed = tuple(x.strip() for x in (opts.get("--listed") or "").split(",") if x.strip())
476
+ try:
477
+ res = check_rewrite(opts["--original"], opts["--rewrite"], opts.get("--keep"), listed)
478
+ except (OSError, UnicodeDecodeError, ValueError) as e:
479
+ sys.stderr.write("harness error: %s\n" % e)
480
+ return 10
481
+ for k in ("keep", "verify", "fix"):
482
+ state, items = res[k]
483
+ print("BUCKET %s(%s) %s" % (BUCKET_KO[k], k, state))
484
+ for x in items:
485
+ print(" " + x)
486
+ states = [res[k][0] for k in res]
487
+ return 1 if ("FAIL" in states or "UNSURE" in states) else 2 if "UNMEASURED" in states else 0
488
+
489
+
249
490
  def scan_main(args):
250
491
  """--scan FILE [--s7-common LIST]. 입력 오류는 stderr + 10, 안 닫힌 블록은 경고 + 3."""
251
492
  path = common_path = None
@@ -287,7 +528,9 @@ def main():
287
528
  if len(sys.argv) > 1:
288
529
  if sys.argv[1] == "--scan":
289
530
  return scan_main(sys.argv[2:])
290
- sys.stderr.write("usage: ko_tech_writer_calibrate.py [--scan FILE [--s7-common LIST]]\n")
531
+ if sys.argv[1] == "--check-rewrite":
532
+ return check_main(sys.argv[2:])
533
+ sys.stderr.write("usage: ko_tech_writer_calibrate.py [--scan FILE [--s7-common LIST] | --check-rewrite ...]\n")
291
534
  return 10
292
535
  for p in (POS, NEG):
293
536
  if not os.path.isfile(p):
@@ -305,12 +548,13 @@ def main():
305
548
  for lane in LANES:
306
549
  label, pat, flags = lane[0], lane[1], lane[2:]
307
550
  candidate = "candidate" in flags
551
+ fl = [f for f in flags if f in FUNC_LANES]
308
552
  if candidate or "s7" in flags:
309
553
  ncand.append(label.split()[0] + (" UNCALIBRATED" if "uncalibrated" in flags else ""))
310
- if "s7" in flags:
311
- p, n = len(s7_candidates(POS)), len(s7_candidates(NEG))
554
+ if fl:
555
+ p, n = len(FUNC_LANES[fl[0]](POS)), len(FUNC_LANES[fl[0]](NEG))
312
556
  if p >= 1 and n == 0:
313
- print("OK %s -- CANDIDATE-ONLY: positive %d / negative 0 (discriminates the constructed pair; "
557
+ print("OK %s -- positive %d / negative 0 (discriminates the constructed pair; "
314
558
  "precision on real documents UNMEASURED, hits need per-case judgment)" % (label, p))
315
559
  npass += 1
316
560
  else:
@@ -373,6 +617,39 @@ def main():
373
617
  % (unclosed(su), unclosed(sn), sn.skipped))
374
618
  nfail += 1
375
619
 
620
+ # 개고 사후 점검 레인 — 세 쌍이 각자 «자기 칸만» 빨개져야 한다. 컨트롤 값(키 구절·숫자·발화 클래스 수)을 같이 찍는다: 죽은 점검기는 깨끗한 개고의 PASS 와 똑같이 생겼다.
621
+ rwd = os.path.join(FIX, "rewrite_")
622
+ exp = [("clean", ("PASS", "PASS", "PASS")),
623
+ ("drops_metaphor", ("FAIL", "PASS", "PASS")),
624
+ ("invents_number", ("PASS", "FAIL", "PASS"))]
625
+ try:
626
+ for name, want in exp:
627
+ res = check_rewrite(rwd + "original.md", rwd + name + ".md", rwd + "keep.txt")
628
+ got = tuple(res[k][0] for k in ("keep", "verify", "fix"))
629
+ ctl = (sum(1 for x in res["keep"][1] if x.startswith("KEEP-")),
630
+ sum(1 for x in res["verify"][1] if x.startswith("NUMBER-")),
631
+ sum(1 for x in res["fix"][1] if x.startswith(("FIXED", "SAME", "NEW", "WORSE", "REDUCED"))))
632
+ if got == want and min(ctl) >= 1:
633
+ print("OK RW rewrite-check %s -- keep/verify/fix = %s (controls: keep items %d, numbers %d, classes fired %d)"
634
+ % (name, "/".join(got), ctl[0], ctl[1], ctl[2]))
635
+ npass += 1
636
+ else:
637
+ print("FAIL RW rewrite-check %s -- got %s want %s (controls %s; a control of 0 means the checker saw nothing)"
638
+ % (name, "/".join(got), "/".join(want), ctl))
639
+ nfail += 1
640
+ except (OSError, ValueError) as e:
641
+ print("FAIL RW rewrite-check -- fixture/keep list problem: %s" % e)
642
+ nfail += 1
643
+
644
+ # 개고 점검 R1 교차검토 수리 레인 — 입력 문자열을 임시 파일로 써서 같은 check_rewrite/check_main 을 부른다. 기대는 «그 칸만» 정확히 맞아야 한다.
645
+ for name, ok in rw_edge_cases():
646
+ if ok:
647
+ print("OK RW2 %s" % name)
648
+ npass += 1
649
+ else:
650
+ print("FAIL RW2 %s" % name)
651
+ nfail += 1
652
+
376
653
  # META 컨트롤 1 — 없는 토큰이 양쪽 다 0인가 (계기가 «늘 잡는다» 를 내지 않는다)
377
654
  if count(POS, NEVER) == 0 and count(NEG, NEVER) == 0:
378
655
  print("OK META control -- an absent token matches nothing in either fixture")
@@ -1102,6 +1102,22 @@ def main():
1102
1102
  say('CANNOT JUDGE: subject not found or not a regular file: %s' % a.subject, err=True)
1103
1103
  return 2
1104
1104
  orig = read_bytes(subj)
1105
+ # Test seam (lane R7-1 only; unset = no effect): announce «read» and wait for «go» so a lane can change the
1106
+ # subject between this read and the lock below by OBSERVATION, not a timed guess that one runner's speed
1107
+ # breaks (downstream report 2026-10-27: a measured half-time window landed after the lock on another runner).
1108
+ seam = os.environ.get('MUTATION_PROBE_TEST_AFTER_READ')
1109
+ if seam:
1110
+ try: # exclusive + no-follow: a pre-existing file or link at <seam>.read is never written (codex R1)
1111
+ os.close(os.open(seam + '.read', os.O_WRONLY | os.O_CREAT | os.O_EXCL | getattr(os, 'O_NOFOLLOW', 0), 0o600))
1112
+ except OSError as exc:
1113
+ say('CANNOT JUDGE: test seam %s.read cannot be created (%s)' % (seam, exc), err=True)
1114
+ return 2
1115
+ deadline = time.time() + 60
1116
+ while not os.path.exists(seam + '.go'):
1117
+ if time.time() > deadline:
1118
+ say('CANNOT JUDGE: test seam %s.go never appeared' % seam, err=True)
1119
+ return 2
1120
+ time.sleep(0.02)
1105
1121
  try:
1106
1122
  text = orig.decode('utf-8')
1107
1123
  except UnicodeDecodeError:
@@ -1142,6 +1142,7 @@ for _pair in \
1142
1142
  "scripts/stale_clone_guard.sh|scripts/test_stale_clone_guard_lanes.sh" \
1143
1143
  "scripts/proposal_hook.sh|scripts/test_proposal_hook_lanes.sh" \
1144
1144
  "plugins/fh-commons/skills/ko-tech-writer/SKILL.md|scripts/test_ko_tech_writer_lanes.sh" \
1145
+ "scripts/absorption_queue.py|scripts/test_absorption_queue_lanes.sh" \
1145
1146
  "scripts/script_caller_ratchet.sh|scripts/test_script_caller_ratchet_lanes.sh" \
1146
1147
  "scripts/script_caller_ratchet.sh|scripts/test_runner_surface_index_lanes.sh" \
1147
1148
  "scripts/mapped_tracks.sh|scripts/test_mapped_tracks_lanes.sh" \
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env bash
2
+ # test_absorption_queue_lanes.sh — absorption_queue.py 의 기록 규칙 known-pair (얇은 래퍼).
3
+ # 닫기 근거(landed=PR#·커밋 · declined/deferred=사유) · 중복 추가 · digest 후보 추출(같은 체커의 --extract)
4
+ # · 깨진 행/절 없는 digest 는 오류(0 아님) · 자산 후보 색인(스킬 + 에이전트). 레인은 파이썬 안에 있다.
5
+ # exit: 0 전 레인 PASS · 1 실패 · 10 harness error(python3 부재)
6
+ set -uo pipefail
7
+ SRC="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8
+ command -v python3 >/dev/null 2>&1 || {
9
+ echo "harness error: python3 absent -- cannot measure. Not a pass." >&2; exit 10; }
10
+ python3 "$SRC/absorption_queue.py" --self-test
@@ -112,9 +112,14 @@ install() { # install <world> [gate-consent | unset]
112
112
  mkdir -p "$W/hub/.claude/rules" && cp "$W/hub/templates/local_fh_context.md" "$W/hub/.claude/rules/"
113
113
  echo ".claude/rules/local_fh_context.md" >> "$W/hub/.git/info/exclude"
114
114
  }
115
- detach() { # detach <world> [args…] → rc
115
+ detach() { # detach <world> [args…] → rc (machine-wide: the lanes below check the whole install comes off)
116
116
  local W="$1"; shift
117
- ( cd "$W/hub" && python3 "$DETACH" --project "$W/hub" --fh-dir "$W/hub" --home "$W/home" "$@" ) > "$W/detach.out" 2>&1
117
+ ( cd "$W/hub" && python3 "$DETACH" --project "$W/hub" --fh-dir "$W/hub" --home "$W/home" --machine "$@" ) > "$W/detach.out" 2>&1
118
+ echo $?
119
+ }
120
+ detach_p() { # detach_p <world> <project> [args…] → rc (default scope: the project only)
121
+ local W="$1" P="$2"; shift 2
122
+ ( cd "$P" && python3 "$DETACH" --project "$P" --fh-dir "$W/hub" --home "$W/home" "$@" ) > "$W/detach.out" 2>&1
118
123
  echo $?
119
124
  }
120
125
  fhhooks() { python3 -c '
@@ -232,6 +237,50 @@ chk "Q4b … and detach removes it" "$([ -d "$W/home/.cc_sentinels" ] && echo p
232
237
  W="$T/w13"; mkworld "$W"; install "$W"
233
238
  chk "Q5 a write between plan and apply is not overwritten (LEFT instead)" "$(python3 "$T/race.py" "$DETACH" "$W")" "late=1 left=1"
234
239
 
240
+ echo "── M: default scope is the project; --machine adds what every project shares ──"
241
+ W="$T/w14"; mkworld "$W"
242
+ PRE="$(snap "$W/home" "$W/hub")"
243
+ install "$W"
244
+ ZB="$(shasum "$W/home/.zshrc")"
245
+ chk "M0 the install wrote the companion section (known-positive)" "$(grep -c 'Companion-store session-start read' "$W/hub/CLAUDE.local.md")" 1
246
+ chk "M1 project-only --apply: rc 0" "$(detach_p "$W" "$W/hub" --apply)" 0
247
+ chk "M1a … the project's companion section is gone" "$(cat "$W/hub/CLAUDE.local.md" 2>/dev/null | grep -c 'Companion-store session-start read')" 0
248
+ chk "M1f … ~/.zshrc is byte-for-byte untouched" "$([ "$(shasum "$W/home/.zshrc")" = "$ZB" ] && echo same)" same
249
+ chk "M1b … the project's FH hooks are gone" "$(fhhooks "$W/hub/.claude/settings.json" 2>/dev/null || echo 0)" 0
250
+ chk "M1c … the zshrc block stays" "$(grep -c 'forge-harness (install-wizard)' "$W/home/.zshrc")" 2
251
+ chk "M1d … core.hooksPath stays" "$(git -C "$W/hub" config --get core.hooksPath)" "templates/.git-hooks"
252
+ chk "M1e … and both are named as kept (machine-wide)" "$(grep -c '^ kept (machine-wide' "$W/detach.out")" 2
253
+ chk "M2 then --machine --apply: rc 0" "$(detach "$W" --apply)" 0
254
+ chk "M2b … tree is byte-equal to before install" "$([ "$(snap "$W/home" "$W/hub")" = "$PRE" ] && echo equal)" equal
255
+ W="$T/w15"; mkworld "$W"; install "$W"
256
+ mkdir -p "$W/proj/.claude" && git -C "$W/proj" init -q && cp "$W/hub/.claude/settings.json" "$W/proj/.claude/settings.json"
257
+ cp "$W/hub/CLAUDE.local.md" "$W/proj/CLAUDE.local.md"
258
+ echo '{"hooks": {}, "mine": 1}' > "$W/hub/.claude/settings.local.json"
259
+ HUBN="$(fhhooks "$W/hub/.claude/settings.json")"; HUBS="$(snap "$W/hub")"; ZB="$(shasum "$W/home/.zshrc")"
260
+ chk "M3 another project: rc 0" "$(detach_p "$W" "$W/proj" --apply)" 0
261
+ chk "M3b … its FH hooks go (file held only FH hooks + user keys)" "$(fhhooks "$W/proj/.claude/settings.json" 2>/dev/null || echo 0)" 0
262
+ chk "M3c … the FH clone's own hooks are untouched" "$(fhhooks "$W/hub/.claude/settings.json")" "$HUBN"
263
+ chk "M3e … its companion section goes" "$(cat "$W/proj/CLAUDE.local.md" 2>/dev/null | grep -c 'Companion-store session-start read')" 0
264
+ chk "M3f … the FH clone's tree is byte-for-byte untouched (settings · settings.local · CLAUDE.local.md · config)" "$([ "$(snap "$W/hub")" = "$HUBS" ] && echo same)/$([ "$(shasum "$W/home/.zshrc")" = "$ZB" ] && echo same)" "same/same"
265
+ chk "M3d … and the clone's settings are named as kept" "$(grep -c "^ kept (machine-wide.*$W/hub/.claude/settings.json" "$W/detach.out")" 1
266
+ chk "M4 dry run with --machine lists the zshrc step; without it, does not" "$(detach "$W" >/dev/null; grep -c '^ - ~/.zshrc' "$W/detach.out")/$(detach_p "$W" "$W/proj" >/dev/null; grep -c '^ - ~/.zshrc' "$W/detach.out")" "1/0"
267
+
268
+ W="$T/w16"; mkworld "$W"; install "$W"
269
+ mkdir -p "$W/proj/.claude" && git -C "$W/proj" init -q && cp "$W/hub/.claude/settings.json" "$W/proj/.claude/settings.json"
270
+ printf '{ "hooks": ' > "$W/hub/.claude/settings.local.json"
271
+ chk "M5 a broken FH-clone settings file does not stop a project detach (rc 0)" "$(detach_p "$W" "$W/proj" --apply)" 0
272
+ chk "M5b … the project is cleaned and the broken file is named as kept" "$(fhhooks "$W/proj/.claude/settings.json" 2>/dev/null || echo 0)/$(grep -c '^ kept (machine-wide, could not be read.*settings.local.json' "$W/detach.out")" "0/1"
273
+ chk "M5c … with --machine the same file is an error (rc 10)" "$(detach_p "$W" "$W/proj" --machine)" 10
274
+ W="$T/w17"; mkworld "$W"; install "$W"
275
+ mkdir -p "$W/proj/.claude" && git -C "$W/proj" init -q && cp "$W/hub/.claude/settings.json" "$W/proj/.claude/settings.json"
276
+ chmod 000 "$W/hub/.claude/settings.json"
277
+ chk "M5d an unreadable FH-clone settings file: project detach rc 0 · --machine rc 10" "$(detach_p "$W" "$W/proj" --apply)/$(detach_p "$W" "$W/proj" --machine)" "0/10"
278
+ chmod 644 "$W/hub/.claude/settings.json"
279
+ W="$T/w18"; mkworld "$W"; install "$W"
280
+ mkdir -p "$W/proj/.claude" && git -C "$W/proj" init -q && cp "$W/hub/CLAUDE.local.md" "$W/proj/CLAUDE.local.md"
281
+ printf '\xff\xfe not utf-8\n' >> "$W/proj/CLAUDE.local.md" # deterministic read failure (chmod 000 does not bind root — codex)
282
+ chk "M6 an unreadable PROJECT file (invalid UTF-8) → exit 10 with HARNESS-ERROR, not a traceback" "$(detach_p "$W" "$W/proj" --apply)/$(grep -c 'HARNESS-ERROR' "$W/detach.out")/$(grep -c 'Traceback' "$W/detach.out")" "10/1/0"
283
+
235
284
  echo "── G: the wizard's 4-axis gate block needs explicit consent ──"
236
285
  W="$T/w5"; mkworld "$W"; install "$W" unset
237
286
  chk "G1 FH_WIZARD_GATE_CONSENT unset → hooksPath not set" "$(git -C "$W/hub" config --get core.hooksPath || echo unset)" unset
@@ -245,6 +294,7 @@ chk "P1 --plugin uninstalls fh-meta and removes the marketplace" "$(cat "$T/cla
245
294
 
246
295
  echo "── W: wiring ──"
247
296
  chk "W1 package.json ships fh_detach.py" "$(grep -c '"scripts/fh_detach.py"' "$ROOT/package.json")" 1
297
+ chk "W3 install-wizard SKILL.md names --machine" "$(grep -c 'fh_detach.py" --project . --machine' "$ROOT/plugins/fh-meta/skills/install-wizard/SKILL.md")" 1
248
298
  chk "W2 install-wizard SKILL.md points at the detach command" "$(grep -q 'scripts/fh_detach.py" --project . --apply' "$ROOT/plugins/fh-meta/skills/install-wizard/SKILL.md" && echo yes)" yes
249
299
 
250
300
  echo
@@ -126,6 +126,22 @@ case "${R7}" in
126
126
  *) ng "F7 엉뚱한 곳으로: ${R7}" ;;
127
127
  esac
128
128
 
129
+ echo "== package.json 없는 트리에서도 말하고 계속 가나 (7a9f701 의 수리 — 2026-10-28 전까지 앵커 0) =="
130
+ # 🟥 7a9f701 은 «package.json 없는 트리 → 출력 0줄 · rc=1» 무음 사망을 고쳤고 이 파일을 앵커로 적었는데,
131
+ # 이 파일은 그 경우를 한 번도 안 돌렸다 — 2026-10-28 플로어 재검에서 수리 전 두 줄로 되돌려도 PASS 7 였다.
132
+ # 여기서 그 경우를 직접 돈다: 스크립트 사본만 두고 package.json 은 두지 않는다(plugins 는 링크로 빌린다).
133
+ _F8=$(mktemp -d)
134
+ mkdir -p "$_F8/scripts" && cp "$HERE/scripts/fh-run.sh" "$_F8/scripts/" && ln -s "$HERE/plugins" "$_F8/plugins"
135
+ R8=$(_ttl 60 env FH_DRY_RUN=1 bash "$_F8/scripts/fh-run.sh" --backend codex --skill preprep 2>&1); R8rc=$?
136
+ /bin/rm -rf "$_F8"
137
+ if [ "$R8rc" -eq 0 ] && /usr/bin/grep -q 'WARN: package.json not readable at .* — version reported as UNKNOWN-no-package-json' <<<"$R8" \
138
+ && /usr/bin/grep -qx 'FH RUNTIME ADAPTER vUNKNOWN-no-package-json' <<<"$R8" \
139
+ && /usr/bin/grep -q 'plugins/fh-preprep/skills/preprep/SKILL.md' <<<"$R8"; then
140
+ ok "F8 package.json 없음 → 경고 한 줄 · 버전 UNKNOWN-no-package-json · 해석은 계속 (rc 0)"
141
+ else
142
+ ng "F8 package.json 없는 트리: rc=$R8rc · 출력 $(printf '%s' "$R8" | wc -l | tr -d ' ')줄 (수리 전 = 0줄 · rc 1)"
143
+ fi
144
+
129
145
  echo
130
146
  echo "════════════════════════════════════════"
131
147
  printf ' PASS %s FAIL %s\n' "$PASS" "$FAIL"
@@ -693,45 +693,27 @@ echo "── R7: blind review of v7 (2026-10-08) — each lane red on fbfe773"
693
693
  # lane wrote the subject during the control run) and this lane went red on a correct probe. Now the
694
694
  # delay is measured on this machine: one undisturbed run times its «subject:» header (printed after
695
695
  # the lock), and the restore fires at half of that. Twice the lines makes that window seconds wide.
696
+ # 🟥 2026-10-28 (downstream report 2026-10-27): the measured half-time window was still a timed guess — on another
697
+ # downstream runner the second run was faster than the calibration run and the restore landed after
698
+ # the lock. Now the window is OBSERVED: MUTATION_PROBE_TEST_AFTER_READ makes the probe touch
699
+ # <seam>.read right after it reads the subject and wait for <seam>.go before it goes on to lock, so the
700
+ # restore lands inside the window on any runner. No timing, no calibration run, no UNMEASURED arm.
696
701
  printf '#!/usr/bin/env bash\n[ "$a" -ne 1 ] && echo x1\n' > r71.orig
697
- for k in $(seq 2 12000); do printf '[ "$a" -eq %d ] && echo x%d\n' "$k" "$k"; done >> r71.orig
698
702
  printf 'grep -q "exit 113" r71.sh && exit 1\nexit 0\n' > lane_r71.sh
699
- cp r71.orig r71.sh
700
- _ms(){ python3 -c 'import time; print(int(time.time() * 1000))'; } # BSD date has no %N
701
- c71=$(_ms); h71=""; _c71out=""
702
- while IFS= read -r l; do
703
- _c71out="$_c71out$l
704
- "
705
- case "$l" in subject:*) [ -n "$h71" ] || h71=$(( $(_ms) - c71 )) ;; esac
706
- done < <(python3 "$PROBE" r71.sh lane_r71.sh --max 1 --timeout 30 2>&1)
707
- cmp -s r71.sh r71.orig || cp r71.orig r71.sh
708
- # no header = the calibration run never reached the lock: the delay is unknown.
709
- # 🟥 2026-10-26: that used to be ONE outcome — the lane ran anyway with d71=0 and went red. Measured
710
- # here, the common cause is not a defect in the probe at all: the probe's state directory
711
- # /tmp/mutation_probe-$uid is MACHINE-GLOBAL and its inode key is (st_dev, st_ino), so a fixture this
712
- # suite creates fresh can land on an inode whose backup an EARLIER run left behind (the suite's own
713
- # kill/timeout lanes leave backups by design — 26 of them after one round of runs in this container).
714
- # The probe then answers `CANNOT JUDGE: a previous run left a backup …` BEFORE printing the header,
715
- # the calibration is unknown, and this lane called that a FAILURE. It is not: it is UNMEASURED, which
716
- # is neither a pass nor a fail, and the suite already has that counter. Any OTHER reason for a
717
- # missing header still falls through to the old behaviour — the point is a typed verdict, not a
718
- # looser one. The aliasing itself lives in scripts/mutation_probe.py (the subject, and the recovery
719
- # path for a subject's original bytes) and is a NAMED RESIDUAL here, not something a lane may patch.
720
- if [ -z "$h71" ] && grep -q 'a previous run left a backup' <<<"$_c71out"; then
721
- echo " ⚠️ R7-1 UNMEASURED — the probe refused the calibration run: a previous run's backup is still in"
722
- echo " the machine-global state dir and its inode key aliases this fixture. Not a pass, not a failure."
723
- printf ' %s\n' "$(grep -m1 'a previous run left a backup' <<<"$_c71out")"
724
- echo " Inspect those backups, restore anything real by hand, remove them, then re-run."
725
- UNMEASURED=$((UNMEASURED+1))
726
- else
727
- [ -n "$h71" ] || echo " ⚠️ R7-1 calibration: no «subject:» header — time-to-lock unknown on this machine"
728
- d71=$(awk -v ms="${h71:-0}" 'BEGIN { printf "%.3f", ms / 2000 }')
729
703
  sed '2s/-ne 1/-eq 1/' r71.orig > r71.sh # the other probe's mutant is live
730
- python3 "$PROBE" r71.sh lane_r71.sh --max 1 --timeout 30 > r71.out 2>&1 & pb=$!
731
- sleep "$d71"; cat r71.orig > r71.sh # … and now it restores (same inode)
704
+ _r71s="$PWD/r71.seam"; rm -f "$_r71s.read" "$_r71s.go"
705
+ MUTATION_PROBE_TEST_AFTER_READ="$_r71s" python3 "$PROBE" r71.sh lane_r71.sh --max 1 --timeout 30 > r71.out 2>&1 & pb=$!
706
+ _r71w=0; while [ ! -e "$_r71s.read" ] && kill -0 "$pb" 2>/dev/null && [ "$_r71w" -lt 600 ]; do sleep 0.1; _r71w=$((_r71w+1)); done
707
+ _r71seen=no; [ -e "$_r71s.read" ] && _r71seen=yes
708
+ cat r71.orig > r71.sh # … the other probe restores (same inode) — after the read
709
+ : > "$_r71s.go" # … and only now may this probe go on to lock
732
710
  wait "$pb"; rc=$?
733
- grep -q 'changed between reading it and locking it' r71.out && [ "$rc" -eq 2 ] && cmp -s r71.sh r71.orig && [ ! -e "$(bkpath r71.sh)" ] ; chk $? "R7-1 a subject that changed between read and lock → 2, the original stays (fbfe773: the stale mutant was backed up as «original» and written back)"
734
- fi
711
+ [ "$_r71seen" = yes ] && grep -q 'changed between reading it and locking it' r71.out && [ "$rc" -eq 2 ] && cmp -s r71.sh r71.orig && [ ! -e "$(bkpath r71.sh)" ] ; chk $? "R7-1 a subject that changed between read and lock → 2, the original stays (fbfe773: the stale mutant was backed up as «original» and written back)"
712
+ [ "$_r71seen" = yes ] || printf ' R7-1: the probe never signalled «read» (exit before reading?): %s\n' "$(head -2 r71.out | tr '\n' ' ')"
713
+ # R7-1c (codex R1) — the seam never writes through something already at <seam>.read: a link there → 2, target intact
714
+ printf 'keep\n' > r71c.target; ln -sf "$PWD/r71c.target" r71c.seam.read; cp r71.orig r71c.sh
715
+ MUTATION_PROBE_TEST_AFTER_READ="$PWD/r71c.seam" python3 "$PROBE" r71c.sh lane_r71.sh --max 1 --timeout 30 > r71c.out 2>&1; rc=$?
716
+ [ "$rc" -eq 2 ] && grep -q 'test seam .*cannot be created' r71c.out && [ "$(cat r71c.target)" = keep ] && cmp -s r71c.sh r71.orig ; chk $? "R7-1c a link already at <seam>.read → 2, the link's target is not truncated, the subject untouched"
735
717
 
736
718
  # R7-1b (2026-10-26) — the known pair for the UNMEASURED arm above. The claim it rests on is that a
737
719
  # leftover backup under either key makes the probe refuse BEFORE it prints its header; if that is not
@@ -77,7 +77,7 @@ EOF
77
77
  }
78
78
  remote_ref() { git -C "$1/remote.git" rev-parse -q --verify "$2" 2>/dev/null || echo ABSENT; }
79
79
  fired() { wc -l < "$1/fired" | tr -d ' '; }
80
- stdin_has() { cat "$1"/stdin.* 2>/dev/null | grep -qE "$2"; }
80
+ stdin_has() { grep -qE "$2" "$1"/stdin.* 2>/dev/null; } # no pipe: grep -q exiting early cannot SIGPIPE a producer (downstream report 2026-10-27)
81
81
 
82
82
  # run_lane <name> <ref-to-watch> <stdin-regex> <push args...>
83
83
  run_lane() {