@chrono-meta/fh-gate 3.15.0 → 3.17.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 (60) hide show
  1. package/.claude-plugin/marketplace.json +4 -4
  2. package/AGENTS.md +27 -0
  3. package/CATALOG.md +60 -0
  4. package/CLAUDE.md +5 -0
  5. package/README.ja.md +2 -2
  6. package/README.ko.md +2 -2
  7. package/README.md +2 -2
  8. package/README.zh.md +2 -2
  9. package/docs/OUTPUT_EVIDENCE.md +1 -1
  10. package/docs/codex-compat.md +24 -0
  11. package/knowledge/shared/harness-core/checkout_layer_drift.md +301 -0
  12. package/knowledge/shared/learnings/subagent_invocations_log.yaml +66 -0
  13. package/package.json +13 -1
  14. package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
  15. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  16. package/plugins/fh-meta/CHANGELOG.md +42 -0
  17. package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
  18. package/plugins/fh-preprep/skills/preprep/SKILL.md +5 -0
  19. package/plugins/fh-preprep/skills/preprep/lane_font_embed.py +235 -0
  20. package/plugins/fh-preprep/skills/preprep/ooxml/gate.py +67 -5
  21. package/plugins/fh-preprep/skills/preprep/ooxml/test_gate_exitcodes.py +136 -0
  22. package/plugins/fh-preprep/skills/preprep/preprep.py +16 -1
  23. package/plugins/fh-preprep/skills/preprep/presentation_checklist.md +108 -6
  24. package/plugins/fh-preprep/skills/preprep/safe_install.py +22 -3
  25. package/plugins/fh-preprep/skills/preprep/surfaces.example.yaml +11 -0
  26. package/plugins/fh-preprep/skills/preprep/test_lane_font_embed.py +117 -0
  27. package/plugins/fh-preprep/skills/preprep/test_safe_install_app_xml.py +77 -0
  28. package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
  29. package/scripts/count_check.sh +46 -14
  30. package/scripts/daily_report.sh +17 -1
  31. package/scripts/env_layer_fingerprint.sh +309 -0
  32. package/scripts/gate_bootstrap_ephemeral.sh +248 -0
  33. package/scripts/governor_board.sh +841 -0
  34. package/scripts/map_postprocess.py +89 -4
  35. package/scripts/multibyte_bracket_lint.sh +135 -0
  36. package/scripts/outbound_pr_gate.sh +12 -0
  37. package/scripts/package_coverage_check.sh +34 -0
  38. package/scripts/selfcheck.sh +263 -0
  39. package/scripts/session_close_check.sh +96 -1
  40. package/scripts/stale_ref_scan.py +511 -0
  41. package/scripts/test_count_check_decl_lanes.sh +176 -0
  42. package/scripts/test_env_layer_fingerprint_lanes.sh +192 -0
  43. package/scripts/test_gate_bootstrap_ephemeral_lanes.sh +262 -0
  44. package/scripts/test_locale_invariance_lanes.sh +581 -0
  45. package/scripts/test_map_postprocess_lanes.sh +84 -4
  46. package/scripts/test_marker_crossfamily_lanes.sh +5 -1
  47. package/scripts/test_marker_defense_lanes.sh +5 -1
  48. package/scripts/test_marker_standpoint_lanes.sh +5 -1
  49. package/scripts/test_marker_thirdparty_lanes.sh +5 -1
  50. package/scripts/test_multibyte_bracket_lint_lanes.sh +107 -0
  51. package/scripts/test_outbound_pr_gate_lanes.sh +133 -0
  52. package/scripts/test_preprep_drift_anchor.sh +34 -9
  53. package/scripts/test_preprep_drift_anchor_lanes.sh +64 -2
  54. package/scripts/test_session_close_chain_lanes.sh +45 -0
  55. package/scripts/test_stale_ref_close_lanes.sh +197 -0
  56. package/scripts/test_stale_ref_scan_lanes.sh +134 -0
  57. package/scripts/test_worktree_reclaim_lanes.sh +267 -1
  58. package/scripts/worktree_reclaim.sh +246 -11
  59. package/templates/.git-hooks/pre-commit +108 -27
  60. package/templates/settings.PreToolUse.snippet.json +54 -1
@@ -402,6 +402,24 @@ else
402
402
  fail=1
403
403
  fi
404
404
 
405
+ # count_check's COUNT DECLARATION parser — the sweep reads "N skills"/"N agents" out of a plugin
406
+ # description and compares it to disk. #768 shipped that sweep and wrote its own residual down:
407
+ # «순회는 description 의 첫 N skills 패턴만 읽는다 — 과탐/미탐 방향 미측정». Both were measured
408
+ # 2026-09-21 and both were real: a stale declaration masked by an earlier prose number went GREEN
409
+ # (false PASS, the #763/#768 substring class a third time), and `M1/M2/M3 skill tier map` — live
410
+ # in marketplace.json — was read AS a declaration (false FAIL). Without this anchor the "모호≠통과"
411
+ # branch and the boundary can both be deleted with every gate still green.
412
+ if [ ! -f scripts/count_check.sh ]; then
413
+ _absent_subject_verdict "count_check declaration lanes" "scripts/count_check.sh" || fail=1
414
+ elif [ -f scripts/test_count_check_decl_lanes.sh ]; then
415
+ if ! bash scripts/test_count_check_decl_lanes.sh; then
416
+ fail=1
417
+ fi
418
+ else
419
+ echo "FAIL count_check declaration lanes: count_check.sh present but its anchor is missing"
420
+ fail=1
421
+ fi
422
+
405
423
  # The public-surface scanner's SINGLE-FILE and MISUSE paths. Same subject-present/anchor-gone shape:
406
424
  # the scanner is a fail-closed gate on an irreversible surface, and its failure mode is a green that
407
425
  # was never earned — a misuse, an unloaded pattern set, or dead plumbing all used to render as clean.
@@ -449,6 +467,29 @@ else
449
467
  fail=1
450
468
  fi
451
469
 
470
+ # policy-lens scorer — the known-pair that decides whether a blind sim's numbers may be trusted.
471
+ # 🟥 Wired here because the gate caught it MENTION_ONLY: the scorer shipped with its own
472
+ # --selftest and no runner surface ever dispatched it, so «the suite is green» said nothing
473
+ # about this file. That is the same shape the scorer itself was fixed for on 2026-09-21
474
+ # (a zero-row run reporting rc=0). A calibration nobody runs is not a calibration.
475
+ if [ ! -f scripts/score_policy_lens.sh ]; then
476
+ _absent_subject_verdict "policy-lens scorer lanes" "scripts/score_policy_lens.sh" || fail=1
477
+ elif [ -f scripts/test_policy_lens_scorer_lanes.sh ]; then
478
+ # direct dispatch of the subject's own known pair (caller surface), then the lane suite —
479
+ # P2 there is the load-bearing one: it re-scores the COMMITTED round-1 runs and demands the
480
+ # recorded SCORES.tsv byte-for-byte, so a scorer change cannot silently restate a published
481
+ # number. P3 is P2's control (one tampered cell must turn it red).
482
+ if ! bash scripts/score_policy_lens.sh --selftest >/dev/null 2>&1; then
483
+ echo "FAIL policy-lens scorer selftest: known-pair calibration failed"; fail=1
484
+ fi
485
+ if ! bash scripts/test_policy_lens_scorer_lanes.sh; then
486
+ fail=1
487
+ fi
488
+ else
489
+ echo "FAIL policy-lens scorer lanes: script present but its anchor is missing"
490
+ fail=1
491
+ fi
492
+
452
493
  # gate-shape classifier — the mechanical half of the unmapped-file trigger of the Field-Harness
453
494
  # Load-Bearing Change Gate (2026-09-08). A classifier of scope, not a verdict; its lane holds the
454
495
  # known-pair (exposure/verdict positives · util/comment negatives · Promise reject( FP anchor).
@@ -467,6 +508,124 @@ else
467
508
  fail=1
468
509
  fi
469
510
 
511
+ # pipefail 조기종료 클래스 잠금 (2026-09-21) — #785 가 한 자리를 고쳤고, 그 파일에 같은 형태가
512
+ # **아직 셋** 남아 있었다(sync_to_be_lanes.sh:153·571·599, 생산자도 같은 `_sync_src`). 목록형
513
+ # 잠금이 왜 안 되는지의 실물 증거다. 🟥 이 스캐너는 «레포 전체 0» 을 요구하지 않는다 — 오늘
514
+ # 113 곳이라 그건 만족 불가능한 요구이고 override 훈련이다(§Mechanization Boundary). 잠그는
515
+ # 것은 **이 변경이 새 사례를 들여오는가 = 0** 이다. 여기서는 그 계기가 살아 있는지만 본다.
516
+ if [ ! -f scripts/pipefail_earlyexit_scan.sh ]; then
517
+ _absent_subject_verdict "pipefail class-lock lanes" "scripts/pipefail_earlyexit_scan.sh" || fail=1
518
+ elif [ -f scripts/test_pipefail_class_lock_lanes.sh ]; then
519
+ # 🟥 출력을 삼키지 마라. 초판은 둘 다 `>/dev/null 2>&1` 이었고, CI 에서 빨개졌을 때
520
+ # «known-pair calibration failed» 한 줄만 남아 **어느 팔이 깨졌는지 알 수 없었다.**
521
+ # 실패는 시끄러워야 한다 — 진단을 지우면 재현이 한 라운드씩 늘어난다.
522
+ _pf_out="$(bash scripts/pipefail_earlyexit_scan.sh --self-test 2>&1)" || {
523
+ echo "FAIL pipefail class-lock selftest: known-pair calibration failed"
524
+ printf '%s\n' "$_pf_out" | sed 's/^/ /'
525
+ fail=1
526
+ }
527
+ # 🟥 **rc=1(실패)과 rc=2(계기 오류)를 갈라서 받는다.** 스위트 계약이 `0 통과 · 1 실패 ·
528
+ # 2 팔 하나 이상 UNMEASURED` 인데, 초판은 `||` 로 둘을 같은 값으로 읽었다.
529
+ # 실측 2026-09-21: 런타임 프로브의 한 표기(`… | awk "/NEEDLE/{exit}"`)가 **맥에서 5/5,
530
+ # 리눅스 mawk 에서 0/5** 다. 그건 이 레포의 결함이 아니라 «이 환경에서 그 결함을 만들 수
531
+ # 없다» 는 사실이고, FAIL 로 렌더하면 리눅스 CI 가 영구 빨강이 된다.
532
+ # ⇒ rc=2 는 **시끄럽게 표면화하되 막지 않는다**(커밋은 가역 표면이고, 이 저장소가
533
+ # `portability_lint`·①-b 에 쓰는 것과 같은 형태다). 🟥 «통과» 로 접지는 않는다 —
534
+ # 줄이 남고, 무엇이 미측정인지 이름이 찍힌다.
535
+ _pf_out="$(bash scripts/test_pipefail_class_lock_lanes.sh 2>&1)"; _pf_rc=$?
536
+ case "$_pf_rc" in
537
+ 0) : ;;
538
+ 2) echo "⚠️ pipefail class-lock lanes: 팔 하나 이상 UNMEASURED (계기 오류 — 통과 아님, 막지도 않음)"
539
+ printf '%s\n' "$_pf_out" | grep -E '^ ⬜' | sed 's/^/ /' ;;
540
+ *) echo "FAIL pipefail class-lock lanes (rc=$_pf_rc)"
541
+ printf '%s\n' "$_pf_out" | grep -vE '^ ✅' | sed 's/^/ /'
542
+ fail=1 ;;
543
+ esac
544
+ else
545
+ echo "FAIL pipefail class-lock: scanner present but its anchor is missing"
546
+ fail=1
547
+ fi
548
+
549
+ # 휘발 클론 부트스트랩 (2026-09-21 신설) — 클라우드 컨테이너처럼 훅·기록·패턴 층이 없는
550
+ # 체크아웃에서 «무엇을 세울 수 있고 무엇이 구조적으로 못 서는가»를 가르는 계기. 게이트가
551
+ # 아니라 계기다(어떤 훅도 안 부른다) — 그래서 앵커는 여기 하나뿐이고, 레인이 안 돌면 이
552
+ # 스크립트는 그냥 산문이 된다. 레인의 하중 지는 자리는 L8 «증거를 안 만든다»: 마커를
553
+ # 자동 생성하는 부트스트랩은 4축을 가짜로 닫는 것이고 fh_4axis_gate.md 가 금지한다.
554
+ if [ ! -f scripts/gate_bootstrap_ephemeral.sh ]; then
555
+ _absent_subject_verdict "ephemeral-bootstrap lanes" "scripts/gate_bootstrap_ephemeral.sh" || fail=1
556
+ elif [ -f scripts/test_gate_bootstrap_ephemeral_lanes.sh ]; then
557
+ # 주체의 자기 known-pair 를 먼저 직접 부른다(계기 교정), 그다음 레인.
558
+ # 🟥 rc=1 은 «이 기계에 UTF-8 로케일이 없다»는 정직한 미측정이므로 실패로 치지 않는다.
559
+ # 계기 고장(rc=10)만 실패다 — 못 잰 것과 고장난 것은 다른 명제다.
560
+ _gbe_rc=0
561
+ bash scripts/gate_bootstrap_ephemeral.sh --selftest >/dev/null 2>&1 || _gbe_rc=$?
562
+ if [ "$_gbe_rc" = "10" ]; then
563
+ echo "FAIL ephemeral-bootstrap selftest: 계기 오류(wc -w 컨트롤 사망)"; fail=1
564
+ elif [ "$_gbe_rc" != "0" ]; then
565
+ # rc=1 은 「못 쟀다」가 아니라 **측정된 결함**이다 — 이 기계에서 정직한 한글이 훅의
566
+ # 비공허성 바닥을 못 넘는다(LC_CTYPE). 수리는 PR #780. 여기서 FAIL 로 안 올리는 이유는
567
+ # 환경 조건이지 이 레포의 회귀가 아니어서다 — 과차단은 override 를 훈련시킨다.
568
+ echo "WARN ephemeral-bootstrap selftest: 정직한 한글이 비공허성 바닥을 못 넘는다(LC_CTYPE) — 한국어 마커가 차단된다"
569
+ fi
570
+ if ! bash scripts/test_gate_bootstrap_ephemeral_lanes.sh >/dev/null; then
571
+ echo "FAIL ephemeral-bootstrap lanes"; fail=1
572
+ fi
573
+ else
574
+ echo "FAIL ephemeral-bootstrap lanes: gate_bootstrap_ephemeral.sh present but its anchor is missing"
575
+ fail=1
576
+ fi
577
+
578
+ # env-layer fingerprint — 두 체크아웃(운영자 맥 ↔ 클라우드 클론)의 **층 대조**를 가능하게 하는
579
+ # 계기. 게이트가 아니라 계기이므로 어떤 훅도 이걸 부르지 않는다 — 그래서 앵커는 여기 하나뿐이고,
580
+ # 레인이 안 돌면 이 스크립트는 그냥 산문이 된다(lane_runner_check.sh 가 세는 클래스).
581
+ if [ ! -f scripts/env_layer_fingerprint.sh ]; then
582
+ _absent_subject_verdict "env-layer lanes" "scripts/env_layer_fingerprint.sh" || fail=1
583
+ elif [ -f scripts/test_env_layer_fingerprint_lanes.sh ]; then
584
+ # 주체의 자기 known-pair 를 먼저 직접 부른다(계기 교정), 그다음 레인.
585
+ if ! bash scripts/env_layer_fingerprint.sh --selftest >/dev/null 2>&1; then
586
+ echo "FAIL env-layer selftest: known-pair calibration failed"; fail=1
587
+ fi
588
+ if ! bash scripts/test_env_layer_fingerprint_lanes.sh >/dev/null; then
589
+ echo "FAIL env-layer lanes"; fail=1
590
+ fi
591
+ else
592
+ echo "FAIL env-layer lanes: env_layer_fingerprint.sh present but its anchor is missing"
593
+ fail=1
594
+ fi
595
+
596
+ # locale-invariance — 같은 마커를 두 로케일에서 읽었을 때 판정이 같은가. 훅의 비공허성 바닥과
597
+ # 「①영혼 복붙」 검출이 `LC_CTYPE` 에 의존했다(2026-09-21, 갓 클론한 컨테이너에서 실측: 마커
598
+ # 레인 22건이 `LC_ALL` 만으로 뒤집혔고, 방향이 과차단·무음침묵·fail-OPEN 셋이었다).
599
+ # 🟥 UTF-8 로케일이 없는 기계에서는 rc=2 다 — 대조군 없는 초록은 측정이 아니므로 FAIL 로 센다.
600
+ if [ ! -f scripts/test_locale_invariance_lanes.sh ]; then
601
+ echo "FAIL locale-invariance lanes: scripts/test_locale_invariance_lanes.sh 가 없다 (부재는 통과가 아니다)"
602
+ fail=1
603
+ elif ! bash scripts/test_locale_invariance_lanes.sh >/dev/null 2>&1; then
604
+ echo "FAIL locale-invariance lanes"
605
+ fail=1
606
+ fi
607
+
608
+ # multibyte-bracket lint — 열거로는 안 닫힌다. POSIX 브래킷은 비-UTF-8 로케일에서 바이트
609
+ # 집합이 되고, 방향은 자리마다 다르다(2026-09-21 실측: fail-OPEN 둘 · 과차단 하나).
610
+ # 전수를 세려던 첫 계기가 11 중 1 을 놓쳤기 때문에 사람의 열거도 자동 열거도 믿지 않는다.
611
+ # 린트는 매 호출마다 known-pair 로 자가검정하고 그게 안 갈리면 rc=2 로 죽는다 — 여기서는 둘 다 FAIL 이다.
612
+ if [ ! -f scripts/multibyte_bracket_lint.sh ]; then
613
+ echo "FAIL multibyte-bracket lint: scripts/multibyte_bracket_lint.sh 가 없다 (부재는 통과가 아니다)"
614
+ fail=1
615
+ elif ! bash scripts/multibyte_bracket_lint.sh >/dev/null 2>&1; then
616
+ echo "FAIL multibyte-bracket lint (게이트 파일의 브래킷 안에 멀티바이트, 또는 자가검정 실패)"
617
+ fail=1
618
+ fi
619
+ # 그리고 린트 자신의 앵커. 내장 `_calibrate` 는 린트 파일 안에 살아서 정규식이 약해져도
620
+ # 자기 픽스처는 통과할 수 있다 — 이 스위트는 **실물 훅의 사본을 되돌려** 잡히는지를 본다.
621
+ if [ ! -f scripts/test_multibyte_bracket_lint_lanes.sh ]; then
622
+ echo "FAIL multibyte-bracket lint lanes: scripts/test_multibyte_bracket_lint_lanes.sh 가 없다 (부재는 통과가 아니다)"
623
+ fail=1
624
+ elif ! bash scripts/test_multibyte_bracket_lint_lanes.sh >/dev/null 2>&1; then
625
+ echo "FAIL multibyte-bracket lint lanes"
626
+ fail=1
627
+ fi
628
+
470
629
  # package-coverage — a shipped doc must not point at a file the tarball omits. Distinct from the
471
630
  # ref-path check below: that one asks "does this path exist at all", this one asks "does the
472
631
  # CONSUMER get it". Measured 2026-07-28: 35 paths existed, were named by a shipped doc, and were
@@ -695,6 +854,8 @@ for _pair in \
695
854
  "scripts/fixture_guard_lib.sh|scripts/test_fixture_guard_lanes.sh" \
696
855
  "scripts/stray_path_scan.sh|scripts/test_stray_path_lanes.sh" \
697
856
  "scripts/session_close_check.sh|scripts/test_stray_path_lanes.sh" \
857
+ `# ── ①-g stale-ref (2026-09-21 신설) — #773 이 「배선 안 함」이라 적은 자리의 호출부. SUBJECT 는 스캐너가 아니라 «마감 블록»이다: 스캐너 자체는 test_stale_ref_scan_lanes.sh 가 이미 앵커한다 ──` \
858
+ "scripts/session_close_check.sh|scripts/test_stale_ref_close_lanes.sh" \
698
859
  `# 티키타카 채점기 (2026-09-19 신설) — 다중턴 sim 의 «수렴/반영» 을 채점한다. 러너(--turns)는 있었고 채점기가 0줄이었다.` \
699
860
  "scripts/tikitaka_score.py|scripts/test_tikitaka_score_lanes.sh" \
700
861
  `# 체크리스트 unblocked (2026-09-19 신설) — 막혀 있던 행의 블로커가 DONE 이 됐는데 그 행이 안 움직였나.
@@ -706,8 +867,16 @@ for _pair in \
706
867
  "docs/map/fh_assets.architecture.json|scripts/test_fh_map_paths_lanes.sh" \
707
868
  `# ── 지도 후처리(2026-09-06): 발행 폭 하한 + SVG 재생성. 리터럴 드리프트를 fail-closed 로 잡는다 ──` \
708
869
  "scripts/map_postprocess.py|scripts/test_map_postprocess_lanes.sh" \
870
+ `# ── 지도 «깜빡임» 실물 렌더(2026-09-21): 위 줄은 억제 코드가 **문서에 있나**를 본다. 이 줄은 그것이 **실제 렌더에서 듣나**를 본다 — 첫 페인트 프레임과 헤더 점의 픽셀. 브라우저가 없는 머신에서는 레인이 NOT MEASURED 로 크게 적고 rc=0 으로 끝난다(되돌릴 수 있는 표면이라 advisory 로 떨어뜨린다) ──` \
871
+ "scripts/map_flash_render_probe.js|scripts/test_map_flash_render_lanes.sh" \
872
+ `# ── 휘도계(2026-09-21): 위 레인의 «눈» 이다. 브라우저 뒤에 숨기면 브라우저 없는 머신(= CI)에서 앵커가 통째로 죽으므로 자기 레인으로 분리한다 — 표준 라이브러리 전용이라 어디서든 돈다 ──` \
873
+ "scripts/png_luma.py|scripts/test_png_luma_lanes.sh" \
709
874
  `# ── 플로어 없는 채널(2026-09-14): 원격 자율 노드가 FH 자산을 바꾸면 마커가 tracks/ 와 함께 휘발한다. 실측 2/2(#675·#716). CI 가 gitignored 마커를 구조적으로 못 보므로, 그 채널에만 «마커가 커밋 기록에 실려 왔나» 를 건다 ──` \
710
875
  "scripts/remote_marker_gate.sh|scripts/test_remote_marker_gate_lanes.sh" \
876
+ `# ── pipefail × 조기종료 소비자 × 64 KiB 파이프 버퍼(2026-09-21): 「생산자 | grep -q」 는 **찾았을 때만** 거짓 빨강을 낸다. 실사고 = PR #782 의 validate 가 같은 커밋에서 push 초록·pull_request 빨강으로 갈렸다. known-positive 가 결정적이라 확률 레인이 아니다 ──` \
877
+ "scripts/sync_to_be_lanes.sh|scripts/test_pipefail_sigpipe_lanes.sh" \
878
+ `# ── 휘발 클론 부트스트랩(2026-09-21): 훅이 안 걸린 클론에서 커밋은 무음으로 성공한다. SUBJECT 는 그 계기의 판정과 **부작용 부재**다 ──` \
879
+ "scripts/gate_bootstrap_ephemeral.sh|scripts/test_gate_bootstrap_ephemeral_lanes.sh" \
711
880
  `# ── 발신 전 3프로브(2026-09-18): 비소유 레포에 PR 을 «열기 직전» 에 건다. 실측 — outbound 9건 중 기술 결함 지적 3건이 전부 같은 형태다: 우리 가드와 우리 테스트가 «대상의 모형» 위에서 돌았고, 메인테이너의 증거는 우리가 한 번도 안 돌린 실행이었다 ──` \
712
881
  "scripts/outbound_pr_gate.sh|scripts/test_outbound_pr_gate_lanes.sh" \
713
882
  `# ── 발행 «확인» 예산(2026-09-18): npm publish 는 이미 rc=0 으로 끝났고 이 스크립트는 전파만 관측한다. 둘을 한 종료코드로 접으면 성공한 발행이 빨간 잡이 되고, 그 빨강이 정확히 «손 발행» 을 훈련시킨다(v3.2.0·v3.4.0) ──` \
@@ -1354,6 +1523,22 @@ else
1354
1523
  fi
1355
1524
  fi
1356
1525
 
1526
+ # governor_board — 거버너/워크트리/계열 판. 자기검사 24 레인(known-pair 중심).
1527
+ # 🟥 이 계기의 핵심 known-pair 는 «마커 있음 → 계열이 나온다» ↔ «마커 없음 → 미측정» 이다.
1528
+ # 그 둘이 같은 글자로 나오면 판은 측정이 아니라 생성이고, 사람이 그걸 읽고 판단한다.
1529
+ # subject 있는데 anchor 없으면 FAIL 이지 skip 이 아니다.
1530
+ if [ ! -f scripts/governor_board.sh ]; then
1531
+ _absent_subject_verdict "governor_board --self-test" "scripts/governor_board.sh" || fail=1
1532
+ else
1533
+ if ! bash scripts/governor_board.sh --self-test >/dev/null 2>&1; then
1534
+ echo "FAIL governor_board --self-test"
1535
+ bash scripts/governor_board.sh --self-test 2>&1 | grep '❌' | head -5
1536
+ fail=1
1537
+ else
1538
+ echo "PASS governor_board --self-test (24 lanes)"
1539
+ fi
1540
+ fi
1541
+
1357
1542
  # launchd_wiring_check — 주기 실행(frontier-digest)이 실제로 배선됐나. 자기검사 10 레인.
1358
1543
  # 🟥 이 검사가 없던 동안, 추적본 plist 는 «템플릿»(/path/to/ 플레이스홀더)인데 «바꿨는지»도
1359
1544
  # «걸렸는지»도 보는 것이 0개였다. 소비자는 digest 가 돈다고 믿으면서 한 번도 안 도는 상태로
@@ -1640,6 +1825,24 @@ else
1640
1825
  fail=1
1641
1826
  fi
1642
1827
 
1828
+ # Stale-reference lanes — «this value is alive and resolves, but the world it points at moved».
1829
+ # Added 2026-09-20 after CITATION.cff and four paper versions were found citing the SUPERSEDED v1.0
1830
+ # record of this very work: every «does this DOI resolve» check passed, because the DOI does resolve.
1831
+ # 🟥 The suite exists because `new-code-anchor` caught the scanner shipping with no lane that RUNS
1832
+ # it — the author's own commit said «배선 안 함» and the gate turned that sentence red. A tool's own
1833
+ # `--self-check` is not an anchor until a runner surface executes it. Same pairing rule as above:
1834
+ # the lane exists only because the scanner does, so its absence beside a present subject is a FAIL.
1835
+ if [ ! -f scripts/stale_ref_scan.py ]; then
1836
+ _absent_subject_verdict "test_stale_ref_scan_lanes.sh" "scripts/stale_ref_scan.py" || fail=1
1837
+ elif [ -f scripts/test_stale_ref_scan_lanes.sh ]; then
1838
+ if ! bash scripts/test_stale_ref_scan_lanes.sh; then
1839
+ fail=1
1840
+ fi
1841
+ else
1842
+ echo "FAIL test_stale_ref_scan_lanes.sh: stale_ref_scan.py present but its anchor is missing"
1843
+ fail=1
1844
+ fi
1845
+
1643
1846
  # Paper-integrity lanes — the three checks the governor ran BY HAND with ad-hoc python on 2026-09-17
1644
1847
  # (paper 2; the sister paper had just been rejected by arXiv for 11/17 reference mismatches): every
1645
1848
  # cited key defined and every defined key cited (+ NEAR-MISS pairing for [MF24]↔[MF22]-style
@@ -2222,6 +2425,66 @@ else
2222
2425
  echo "SKIP ref-path (package mode: no .git at package root — source-tree-only check)"
2223
2426
  fi
2224
2427
 
2428
+ # ── .claude/rules 아래 dotfile 은 tracked 이거나 ignored 여야 한다 (둘 다 아님 = 유출 상태) ──
2429
+ # 그 자리의 dotfile 은 «리터럴은 gitignored 소스에만» 규약을 쓰는 운영자-사설 파일들이다
2430
+ # (.public-surface-patterns · .residency-patterns · .owned-owners). 🟥 **같은 누락이 두 번 났다**:
2431
+ # .residency-patterns 가 2026-08-09 스윕에서 발견됐고(.gitignore:23-26 이 그 경위를 적고 있다),
2432
+ # .owned-owners 가 2026-09-21 에 같은 모양으로 또 빠졌다. untracked 는 ignored 가 아니라서
2433
+ # 누가 `git add -A` 하면 공개 레포로 그대로 간다. 이름을 하나씩 세는 대신 **자리**를 검사한다 —
2434
+ # 다음 형제는 추가되는 순간 여기서 잡힌다.
2435
+ # 🟥 판별식은 «ignored 인가»가 아니라 **«tracked 도 ignored 도 아닌가»** 다. 같은 자리의
2436
+ # `.public-surface-patterns.defaults` · `.residency-patterns.defaults` 는 **일부러 tracked**
2437
+ # 이고 package.json files[] 로 출하된다(소비자가 받는 기본 패턴). 초판은 «전부 ignored» 로
2438
+ # 썼고 깨끗한 트리에서 그 둘에 FAIL 을 냈다 — 과차단은 override 를 훈련시키므로 결함이다.
2439
+ # 남는 한 칸 «tracked 도 ignored 도 아님» 이 정확히 유출 상태다.
2440
+ if [ -e .git ]; then
2441
+ # 🟥 «디렉터리가 없다»와 «있는데 비었다»를 한 칸으로 접지 않는다 — find 는 둘 다 빈 출력이다.
2442
+ # 앞은 계기 오류(이 검사가 겨눌 자리가 없다), 뒤는 소비자 설치의 정상 상태다.
2443
+ if [ ! -d .claude/rules ]; then
2444
+ echo "SKIP rules-dotfile: .claude/rules 디렉터리 자체가 없다 — 측정 불가(깨끗함 아님)"
2445
+ _rules_dot=""
2446
+ else
2447
+ _rules_dot=$(find .claude/rules -maxdepth 1 -type f -name '.*' 2>/dev/null | sed 's#^\./##')
2448
+ fi
2449
+ if [ ! -d .claude/rules ]; then
2450
+ :
2451
+ elif [ -z "$_rules_dot" ]; then
2452
+ echo "SKIP rules-dotfile: .claude/rules 에 dotfile 이 없다 (소비자 설치의 정상 상태)"
2453
+ else
2454
+ # 알려진 음성 — 이 검사가 «무엇이든 ignored 라고 말하는» 계기가 아님을 보인다.
2455
+ if git check-ignore -q ".claude/rules/__selfcheck_probe_not_ignored" 2>/dev/null; then
2456
+ echo "FAIL rules-dotfile: INSTRUMENT ERROR — 존재하지 않는 비-dotfile 도 ignored 라고 한다"
2457
+ fail=1
2458
+ else
2459
+ while IFS= read -r p; do
2460
+ [ -z "$p" ] && continue
2461
+ if git check-ignore -q "$p" 2>/dev/null; then
2462
+ echo "PASS rules-dotfile (ignored): $p"
2463
+ elif git ls-files --error-unmatch "$p" >/dev/null 2>&1; then
2464
+ # 🟥 «tracked 면 통과»로 두면 사고가 자기를 사면한다 — .owned-owners 가 실수로 한 번
2465
+ # 커밋되는 순간 이 레인이 영구히 초록이 된다. 그래서 tracked 가 정당한 경우를
2466
+ # **이름으로** 좁힌다: 출하되는 기본값은 `.defaults` 로 끝난다(package.json files[]).
2467
+ case "$p" in
2468
+ *.defaults) echo "PASS rules-dotfile (tracked — shipped defaults): $p" ;;
2469
+ *) echo "FAIL rules-dotfile: $p — tracked 인데 \`.defaults\` 가 아니다. 운영자-사설"
2470
+ echo " 파일이 커밋된 상태일 수 있다. 의도한 출하면 이름을 .defaults 로, 아니면"
2471
+ echo " \`git rm --cached\` 후 .gitignore 에 줄을 추가해라"
2472
+ fail=1 ;;
2473
+ esac
2474
+ else
2475
+ echo "FAIL rules-dotfile: $p — tracked 도 ignored 도 아니다. \`git add -A\` 한 번이면"
2476
+ echo " 공개 레포로 간다. 출하할 기본값이면 커밋하고, 운영자-사설이면 .gitignore 에 줄을 추가해라"
2477
+ fail=1
2478
+ fi
2479
+ done <<RULESDOT
2480
+ $_rules_dot
2481
+ RULESDOT
2482
+ fi
2483
+ fi
2484
+ else
2485
+ echo "SKIP rules-dotfile (package mode: .git 없음 — 소스 트리 전용 검사)"
2486
+ fi
2487
+
2225
2488
  if [ "$fail" -ne 0 ]; then
2226
2489
  echo "SELFCHECK: FAIL"
2227
2490
  exit 1
@@ -90,7 +90,35 @@ if command -v gh >/dev/null 2>&1; then
90
90
  # why an environment with zero open PRs can never surface this, and why the 0-case alone is not a
91
91
  # calibration. Observed live the same day: 2 open PRs reported as 1.
92
92
  # Anchored by scripts/test_session_close_chain_lanes.sh lane ①-b-P3.
93
- PRS=$(gh pr list --author "@me" --state open --json number 2>/dev/null | grep -o '"number"' | wc -l | tr -d ' ' || true)
93
+ # 🟥 `--author "@me"` ALONE counted ZERO for every cloud-session PR. Those are authored by the
94
+ # GitHub App `app/claude`, not by the local user (`chrono-meta`), so the sweep reported 0 while
95
+ # cloud PRs were open and a close passed silently as "no open PRs" — the same class of silence
96
+ # the occurrence-count fix above was written to end, one layer up. Measured 2026-09-21 with a
97
+ # known pair on MERGED PRs (the open set was empty, so the 0-case could not calibrate it):
98
+ # `--author app/claude` -> #785 #784 #783 #782 #781
99
+ # `--author @me` -> #779 #773 #772 ...
100
+ # The two sets are DISJOINT, and the recent merges are almost all bot-authored — so this line had
101
+ # been blind for a long time, not just on the day it was noticed.
102
+ # Union the two authors and dedup by NUMBER (not by line count: the same PR must never be counted
103
+ # twice if the author filters ever overlap). `--author` is deliberately NOT dropped — dropping it
104
+ # counts other contributors' PRs in a shared repo, which over-blocks and trains the override.
105
+ # Anchored by scripts/test_session_close_chain_lanes.sh lane (1)-b-P4.
106
+ # 🟥 The number extractor tolerates whitespace after the colon ON PURPOSE. The line this replaced
107
+ # counted occurrences of the bare token `"number"`, which is spacing-insensitive; a naive
108
+ # `'"number":[0-9]*'` is NOT — on `{"number": 782}` the `[0-9]*` matches ZERO digits, `cut` yields
109
+ # an empty field, and the later `sed '/^$/d'` deletes it, so the sweep silently reports 0 for a
110
+ # pretty-printed body. Measured 2026-09-21 (cross-family codex finding, then hand-verified):
111
+ # spaced JSON -> naive 0 / this 2 <- the silent-wrong-count the fix would have introduced
112
+ # compact JSON -> naive 2 / this 2
113
+ # empty array -> naive 0 / this 0 <- over-fire control, unchanged
114
+ # gh currently emits compact JSON when piped, so this is hardening against a formatting change,
115
+ # not a live break — recorded because a count that degrades toward 0 is the same fail-open
116
+ # direction this whole fix exists to close.
117
+ _open_pr_numbers() {
118
+ gh pr list --author "$1" --state open --json number 2>/dev/null \
119
+ | grep -oE '"number":[[:space:]]*[0-9]+' | grep -oE '[0-9]+$'
120
+ }
121
+ PRS=$( { _open_pr_numbers "@me"; _open_pr_numbers "app/claude"; } | sort -u | sed '/^$/d' | wc -l | tr -d ' ')
94
122
  [ "${PRS:-0}" -gt 0 ] && echo "⚠️ ①-b $PRS open PR(s) by you — classify: self-mergeable vs awaiting-external"
95
123
  fi
96
124
 
@@ -804,5 +832,72 @@ else
804
832
  echo "⏭️ ①-f push-zone UNCALIBRATED — script or owner-account list absent"
805
833
  fi
806
834
 
835
+ # ── ①-g STALE REF (advisory) ─────────────────────────────────────────────────
836
+ # WHY THIS IS HERE AND NOT AT COMMIT TIME. `scripts/stale_ref_scan.py` (#770) exists because the
837
+ # three sibling instruments — halffix_propagation_scan · claim_propagation_scan · doc_claim_triad_scan
838
+ # — all presuppose that SOMEONE TOUCHED SOMETHING. An aging reference satisfies no such trigger:
839
+ # nobody edits a DOI on the day it stops being the latest version. #773 then shipped the tool with
840
+ # its own residual: «배선 안 함 — 이 계기는 지금 아무도 안 부른다». Measured 2026-09-21: its only
841
+ # call sites were its own lane suite and that suite's selfcheck wiring, BOTH `--offline-fixture`.
842
+ # So nothing had ever asked the question of the real corpus.
843
+ #
844
+ # 🟥 A commit-time trigger would rebuild the exact blind spot — it would fire only when someone
845
+ # touches the file. A close-time sweep has no touch precondition, which is the whole point.
846
+ # 🟥 **advisory — it never blocks.** #773 states the corpus false-positive rate is UNMEASURED and
847
+ # some stale citations are deliberate pins; blocking a reversible surface on an unmeasured
848
+ # instrument trains `--no-verify` and disarms the Destructive-Op gate in the same hook
849
+ # (CLAUDE.md §Surface-Class Degrade Invariant, reversible half).
850
+ # 🟥 **못 읽음 ≠ 깨끗함.** The scanner folds SUPERSEDED and UNRESOLVED into one rc (its own header
851
+ # says so), so this block reads the VERDICT LINE's counters instead of the exit code — the #767
852
+ # lesson about scanners reporting "could not read" as "clean" applies to the caller too.
853
+ # SCOPE: tracked files only, `tracks/**` excluded — those are past local records that must not be
854
+ # edited, and #770 measured most corpus hits landing there. Including them would be pure noise.
855
+ _SR_SCAN="$FH/scripts/stale_ref_scan.py"
856
+ if [ ! -f "$_SR_SCAN" ]; then
857
+ echo "⏭️ ①-g stale-ref: stale_ref_scan.py 없음 — skipped, not passed (UNMEASURED)"
858
+ elif ! command -v python3 >/dev/null 2>&1; then
859
+ echo "⏭️ ①-g stale-ref: python3 없음 — skipped, not passed (UNMEASURED)"
860
+ elif ! command -v git >/dev/null 2>&1 || ! ( cd "$FH" && git rev-parse --git-dir >/dev/null 2>&1 ); then
861
+ # 🟥 대상 목록을 `git grep` 으로 만든다. git 이 없으면 목록이 **빈다** — 그리고 빈 목록은
862
+ # 아래에서 「참조 없음」으로 읽힌다. 「못 세었다」와 「0 이다」를 같은 침묵으로 두지 않는다.
863
+ echo "⚠️ ①-g stale-ref: git 없음/비-레포 — 대상 목록을 못 만들었다. UNMEASURED 지 「참조 없음」이 아니다"
864
+ else
865
+ _sr_files=$( cd "$FH" && git grep -lI -e 'zenodo' -- '*.md' '*.cff' '*.html' '*.json' 2>/dev/null \
866
+ | grep -v '^tracks/' || true )
867
+ if [ -z "$_sr_files" ]; then
868
+ echo "⏭️ ①-g stale-ref: 스캔할 Zenodo 참조가 추적 파일에 없다 — 대상 없음"
869
+ else
870
+ # 🟥 전체 상한을 건다. per-request 8초 × 서로 다른 id 수가 상한이라, 매달리는 네트워크에서
871
+ # 마감이 1분 가까이 멈출 수 있다 — 그것이 `--no-verify` 를 학습시키는 모양이다. 상한에
872
+ # 걸리면 판정 줄이 안 나오고, 그 경로는 아래에서 UNMEASURED 로 떨어진다(레인 L4).
873
+ # 실측(네트워크 차단, 22파일 · 서로 다른 id 7): 1초.
874
+ # shellcheck disable=SC2086
875
+ if command -v timeout >/dev/null 2>&1; then
876
+ _sr_out=$( cd "$FH" && timeout 45 python3 scripts/stale_ref_scan.py --timeout 8 --body $_sr_files 2>&1 )
877
+ else
878
+ _sr_out=$( cd "$FH" && python3 scripts/stale_ref_scan.py --timeout 8 --body $_sr_files 2>&1 )
879
+ fi
880
+ _sr_v=$(printf '%s\n' "$_sr_out" | grep -E '^stale-ref verdict:' | tail -1)
881
+ if [ -z "$_sr_v" ]; then
882
+ echo "⚠️ ①-g stale-ref: UNMEASURED — 스캐너가 판정 줄을 안 냈다 (0 으로 읽지 마라)"
883
+ else
884
+ _sr_sup=$(printf '%s' "$_sr_v" | sed -n 's/.*SUPERSEDED=\([0-9]*\).*/\1/p')
885
+ _sr_unr=$(printf '%s' "$_sr_v" | sed -n 's/.*UNRESOLVED=\([0-9]*\).*/\1/p')
886
+ _sr_uns=$(printf '%s' "$_sr_v" | sed -n 's/.*UNSCANNABLE=\([0-9]*\).*/\1/p')
887
+ if [ "${_sr_sup:-0}" -gt 0 ] 2>/dev/null; then
888
+ echo "⚠️ ①-g stale-ref: ${_sr_sup} 개 id 가 폐기된 버전을 가리킨다 — advisory, 막지 않는다."
889
+ echo " 🟥 의도한 pin 일 수 있다 — 눈으로 확인하고 고쳐라(고정이면 파일에 'stale-ref: pinned')."
890
+ printf '%s\n' "$_sr_out" | grep -E '^ +🟥 SUPERSEDED' | sed 's/^/ /'
891
+ fi
892
+ if [ "${_sr_unr:-0}" -gt 0 ] 2>/dev/null || [ "${_sr_uns:-0}" -gt 0 ] 2>/dev/null; then
893
+ echo "⚠️ ①-g stale-ref: UNRESOLVED=${_sr_unr:-?} UNSCANNABLE=${_sr_uns:-?} — 못 읽은 것이 있다. UNMEASURED 지 깨끗함이 아니다"
894
+ fi
895
+ if [ "${_sr_sup:-0}" = "0" ] && [ "${_sr_unr:-0}" = "0" ] && [ "${_sr_uns:-0}" = "0" ]; then
896
+ echo "✅ ①-g stale-ref: 살아있는 Zenodo 인용이 전부 최신을 가리킨다"
897
+ fi
898
+ fi
899
+ fi
900
+ fi
901
+
807
902
  echo "── close check: $([ "$FAIL" -eq 0 ] && echo CONSISTENT || echo VIOLATIONS) ──"
808
903
  exit "$FAIL"