@chrono-meta/fh-gate 3.22.0 → 3.22.2

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.
@@ -11,25 +11,25 @@
11
11
  "plugins": [
12
12
  {
13
13
  "name": "fh-meta",
14
- "version": "3.22.0",
14
+ "version": "3.22.2",
15
15
  "description": "New in 2.2.0: BREAKING (gate): chamber step 6 now reads ACTUAL.md, not BUDGET.md — an in-flight chamber run whose actual cost sits in BUDGET.md blocks until the ACTUAL: line moves to tracks/_chamber/<slug>/ACTUAL.md (the runner prints the path). Why: BUDGET.md's pre-verdict hash IS the ordering witness, and step 6 hard-blocked until that same file changed, so every run that reached COMPLETE necessarily mutated a witnessed artifact and verify returned TAMPERED — the chamber's promotion condition was unsatisfiable by construction, not by strictness. Two roles (immutable witness / post-verdict calibration sink) had collided in one file; each was correct alone, so neither side's code showed the conflict. Also: ko-tech-writer Step 2/4-b scans are now calibration-backed (known-pair fixtures + reproducible command, shipped) — discrimination is proven, 'zero residue' is explicitly NOT; chamber lane suite 12 -> 33 including the runner x witness seam no test covered; chamber_run.sh now teaches the two-commit discipline (gate hashes and verdict hash must land in separate commits/PRs — it previously advised the opposite). New in 2.1.0: BREAKING (gate): `crossfamily: declined` in an Axes 2-3 marker now requires grounds naming a record path that RESOLVES on disk — bare `declined`, and `declined` justified by author judgment, are blocked at commit. Remedy: cite where the operator decision lives (e.g. `.. — operator declined sidecars, per knowledge/shared/rules/operational_adaptation.md`), or use `DEGRADED_PANEL_UNUSED` if a panel was reachable and you chose not to recruit it — which is what author judgment actually is. `declined` was the only enum value with no grounds requirement; a cross-family review then broke the first (vocabulary-grep) fix three ways — self-validating on the value's own token, vacuous keyword passes, and over-blocking real declinations in natural prose — so the check asserts a resolvable record instead of words. Also: standpoint axis gains `tier1b` (a STATIC read of a target repo, executed nothing) plus a decide-in-order procedure, after blind floor-tier sims graded pure cold-reads as `tier2` three rounds running; steel-quench Wave 1's sixth angle (gate-locality) gains the output-template row it never had, so a mandatory angle stops being structurally unreportable; verify-bidirectional gains category 5 (prescriptive doctrine statement); Sister Asset Protocol gains an active-adoption trigger; new resident doctrine — Mechanization Boundary, Local Execution First, Skeleton-not-Muscle, Expedition track, and this package's versioning policy. Hub meta-operations toolkit — 35 skills + 7 agents. New in 2.0.1: harness-doctor cadence hook, portability lint wired into pre-commit, branch_claim.sh claim-count-vs-tree-count warning, louder confidentiality-scan fail-open notice, fh-gate.sh missing-package.json survival, identity ① reclassified 🟢 (cross-harness adapters + relay argument channel). New in 1.4.53: `fh-codex-doctor` (npm bin) — Codex adapter drift scanner; reads the documented M1/M2/M3 skill tier map + skill/agent source and reports codex-native/adapter-required/claude-native/unclassified per unit, wired into `npm test`/`prepublishOnly` (fail-closed on unclassified Claude-native primitives). New in 1.4.49: steel-quench gains Step 0.6 Verdict-Invariance Probe (groundedness axis — a load-bearing judged gate's verdict must track behavior, not rubric phrasing; measured flip-count over cross-family paraphrases; arXiv:2605.06161 Policy Invariance anchor); multi_model_sidecar_strategy §Vendor-native harness (a model is strongest in its own vendor CLI — Claude/CC, GPT/codex, Gemini/Antigravity; a universal router degrades all of them, so it stays an autocomplete/QA sidecar, never orchestration); predelete_check.sh fail-closed rewrite; memory-hygiene A-TMA anchor. New in 1.4.48: phantom-quench + steel-quench gain external frontier anchors (arXiv:2607.02052 package-hallucination; arXiv:2607.02057 prompt-coverage-adequacy); README model-flat claim reframed from a per-release point-curve to structural invariants (operation flattens across tiers; depth tier-order fixed within a generation). New in 1.4.47: onboarding step ① surfaces the Mode D companion-store session-start load in the auto-read salience anchor (previously only in the local binding + rules, so a greeting could skip the load). New in 1.4.46: context-doctor command-output axis (route to rtk/proxy for verbose CLI stdout, complementing .claudeignore; risk-gated to token-scarce envs). New in 1.4.41: context-doctor 2026 trigger vocab (context engineering/rot/collapse) + phantom-citation hardening; hub measurement-integrity-checklist (cross-model measurement pre-flight: display-name pin/reps≥3/discriminating probe). New in 1.4.40: install-wizard queryable-wiki scaffold (INDEX + session-start read + R/W/C ingest). New in 1.4.39: auto-decorrelation (cross-family verifier sidecar recruitment) + video-ingest (capability-routed video ingestion). New in 1.4.x: verify-axis check-class taxonomy (mandatory-pass/measured/judged), no-reinvention Tier-0 inventory, 7-class failure taxonomy, Destructive-Op Gate, Wave-T (Temper), tier-floor governance, Mode D Model Notice, FC consent lane, default-Sonnet guidance. New in 1.3.0: public-surface-audit, field-harvest Mode B auto-trigger, 4-axis gate scope ext. Validated cross-CLI: Claude Code, Codex, Gemini.",
16
16
  "source": "./plugins/fh-meta"
17
17
  },
18
18
  {
19
19
  "name": "fh-commons",
20
- "version": "3.22.0",
20
+ "version": "3.22.2",
21
21
  "description": "Project-agnostic utility skills — 6 skills (convergence-loop · deliberation · mcp-circuit-breaker · token-budget-gate · ko-tech-writer · persona-cast) + 7 agents (quench-challenger + the web-review cast: designer · ux-writer · fe-dev · be-dev · qa · a11y). Domain-independent utilities transplantable into any project.",
22
22
  "source": "./plugins/fh-commons"
23
23
  },
24
24
  {
25
25
  "name": "fh-qp",
26
- "version": "3.22.0",
26
+ "version": "3.22.2",
27
27
  "description": "QP (Quality Platform) — the generic edition of a field QA harness's Prepare→Automation→Regression loop as an FH plugin: 4 skills (qp router · qp-plan · qp-run · qp-regress) + qp_tools.sh (target-class · adapter-probe · mask · surface-reach · mtm-check · run-verbs, typed exit codes) + a zero-domain-constant profile slot + 29 known-pair lanes. Drives web targets through the session's Playwright MCP and desktop targets through computer-use MCP (mobile deferred); calls a registered qasp typed capability when one exists (strictest-wins) — none is registered today, so the MCP fallback is the first edition. Verdict contract: a MACHINE closure requires a recorded assertion; a failed first step is attributed BLOCKED, not FAIL; surface_reach counts every TC in the denominator. Born as chamber run #18 (EMIT, 2026-09-05).",
28
28
  "source": "./plugins/fh-qp"
29
29
  },
30
30
  {
31
31
  "name": "fh-preprep",
32
- "version": "3.22.0",
32
+ "version": "3.22.2",
33
33
  "description": "preprep — a presentation-preparation harness. 1 skill. One CLI over 17 lanes (7 built-in + 10 module) that reads a declared surface manifest and checks a talk's assets against each other: canonical terms, jargon glosses, retired vocabulary, inter-slide dependencies, pacing, get/put round-trips, adjacent duplication, slide relations, geometry, attribute consistency, fonts, diagrams, slide refs, and screen-parity between manuscript and deck. Verdict contract: exit 0 pass / 1 findings / 2 cannot-judge — a surface that could not be read is UNMEASURED, never 0. Promoted out of fh-commons 2026-09-13 after the skill grew past one role (routing / lane modules / fixtures).",
34
34
  "source": "./plugins/fh-preprep"
35
35
  }
@@ -19,6 +19,9 @@ FH 는 **읽는 층**과 **막는 층**이 서로 다른 수송로로 다니고,
19
19
  | **EVIDENCE** | `tracks/_meta` 의 4축 마커 · `edit_manifest.yaml` · 세션 카드 | gitignored | **안 온다** |
20
20
  | **PATTERN** | `.public-surface-patterns` · `.residency-patterns` · `LOCAL_SKILL_REGISTRY.md` · `CLAUDE.local.md` | gitignored | **안 온다** |
21
21
 
22
+ > 다섯째 층 **TOOLCHAIN**(PATH 가 고르는 인터프리터·라이브러리 버전 — 파일이 아니다)은 §10. 재생성 후
23
+ > 바이트 대조하는 레인에서만 문다.
24
+
22
25
  🟥 **훅이 «와 있는 것»과 «배선된 것»은 다르다.** `templates/.git-hooks/pre-commit` 은 tracked 라
23
26
  어느 클론에나 온다. 하지만 `core.hooksPath` 는 git 이 나르는 값이 아니라 **로컬 설정**이라,
24
27
  그 한 줄을 안 잡으면 실물은 있는데 아무것도 안 돈다. 새 클론이 읽는 문서는 전부 「훅이 하드
@@ -317,6 +320,70 @@ advisory 다(세션이 스스로 설정을 바꾸는 건 정당하다). 스냅
317
320
  넣지 마라 — 스니펫에 없는 로컬 항목은 세션 전사본에서 원래 값을 찾아 대조한다.
318
321
  4. **홈 설정**(`~/.claude/...`)은 이 레포 소유가 아니다 — 무엇이 바뀌었는지만 보고하고 사람이 판단한다.
319
322
 
323
+ ## 10. 다섯째 층 — TOOLCHAIN: «다시 구워 바이트로 대조» 하는 게이트는 도구 버전을 잰다 (2026-09-28)
324
+
325
+ §2 의 네 층은 전부 **파일**이다. 이 층은 파일이 아니라 **그 셸에서 PATH 앞에 오는 인터프리터와
326
+ 그 라이브러리 버전**이고, 수송로가 없다 — git 도, gitignored 도 아닌, venv 활성 여부 하나로 바뀐다.
327
+
328
+ | 층 | 무엇 | 수송로 | 새 클론에 |
329
+ |---|---|---|---|
330
+ | **TOOLCHAIN** | 게이트가 재생성에 쓰는 `python3`(또는 `node` · `ffmpeg` …)와 그 라이브러리 버전 | 없음 — **PATH 순서** | 머신마다 다른 것이 온다 |
331
+
332
+ **어디서 무는가**: «산출물이 소스와 같은 세대인가」를 **다시 만들어서 `cmp`** 로 재는 레인. 자기신고
333
+ 영수증보다 강한 계기라서 쓰는 형태인데, 재생성 결과가 도구 버전에 달리면 그 레인은 소스가 아니라
334
+ **환경**을 잰다.
335
+
336
+ **실측 — 필드 하네스 한 곳, 같은 날 두 레인** (friends-on-desk 메뉴바 지시자 프레임, 얼굴 둘 ·
337
+ FoD `main` @ `ddcce54`, 트리 무변경 · 재생성은 레포 밖 임시 폴더에). 분모 156 은 **생성기가 만든 장수**다 —
338
+ 커밋된 폴더는 얼굴 A 168 · 얼굴 B 156 파일이고, A 의 12장은 지금 생성기가 안 만드는 프레임이다(별건 —
339
+ 그 레인은 B 레인과 달리 «소스가 안 만드는 파일」 검사가 없다). 측정 명령(인터프리터마다, 얼굴마다):
340
+
341
+ ```
342
+ OUT=$(mktemp -d); $PY tools/make_tray_glyph.py [--profile squirrel] --indicator-out "$OUT"
343
+ n=0; d=0; for f in "$OUT"/*.png; do n=$((n+1)); cmp -s "$f" "<커밋된 폴더>/$(basename "$f")" || d=$((d+1)); done
344
+ echo "n=$n diff=$d"
345
+ ```
346
+
347
+ | 인터프리터 | 이미지 라이브러리 | 얼굴 A 차이 | 얼굴 B 차이 |
348
+ |---|---|---|---|
349
+ | 프로젝트 밖 venv (그 셸의 PATH 첫째) | Pillow 12.2.0 | 0/156 | 0/156 |
350
+ | `/usr/bin/python3` | Pillow 11.3.0 | **7/156** | **8/156** |
351
+ | Homebrew `python3` | 없음 | 재생성 실패 → 계기 오류 ❌ | 같음 |
352
+
353
+ 셋째 행은 **옳게 짖는다**(못 구웠으면 계기 오류). 문제는 둘째 행이다 — 라이브러리가 **있는데 버전이
354
+ 다를 때** 레인은 «소스와 다르다 — 먼저 다시 구워라」를 낸다. 그 처방을 따르면 그 머신의 바이트로
355
+ 커밋이 오염되고, 원래 머신에서 거꾸로 빨개진다. **처방까지 틀리는 빨강**이다.
356
+
357
+ **방향**: §4 의 ⓐ(여기 초록·저기 빨강)와 ⓑ(그 반대)가 **둘 다** 난다. 출하 프레임을 11.3 으로 구운
358
+ 머신에서 게이트도 11.3 이면 초록, 12.2 머신에서만 빨강이다.
359
+
360
+ **처방 형태 (일반형)**:
361
+ 1. 생성기가 굽고 나서 **도구 스탬프**를 남긴다 — 출하 번들에 실리지 않는 자리에. 최소 필드:
362
+ 라이브러리 버전 · 그 라이브러리를 불러온 경로(`PIL.__file__` 류) · 생성기 소스 해시.
363
+ 2. 게이트는 바이트 대조 **전에** 스탬프와 현재 값을 비교하고, 다르면 PASS 도 FAIL 도 아닌
364
+ **셋째 값**(«이 머신에선 대조 불가」)으로 낸다. 🟥 **스탬프가 없거나 못 읽으면 계기 오류(FAIL)** 다 —
365
+ 셋째 값도 아니고 PASS 는 더더욱 아니다. 어느 쪽이든 초록으로 접으면 이 절이 막으려는 것의
366
+ 반대 방향(«못 쟀다」를 «같다」로)이 된다.
367
+ ⚠️ **남는 잔여**: 버전 문자열이 같은데 빌드가 다른 경우(같은 버전의 다른 휠·다른 네이티브 의존성)는
368
+ 버전 비교가 못 가른다. 그때 남는 신호는 바이트 차이 자체뿐이다 — 그래서 3번이 필요하다.
369
+ 3. 레인 메시지에 **어느 인터프리터 경로와 버전으로 다시 구웠는지**를 같이 찍는다 — 두 머신의 출력이
370
+ 어긋날 때 원인이 한 줄로 보이게.
371
+ ✗ 픽셀 허용 오차로 바꾸는 것은 비추천 — «같은 세대인가」를 «비슷한가」로 바꿔 진짜 1픽셀 세대 차이를
372
+ 삼킬 수 있다.
373
+
374
+ **FH 자신은?** 2026-09-28 한 번 셌다. `scripts/`·`templates/` 에서 바이트 대조를 쓰는 `.sh`/`.py` 는
375
+ **24** 개다(`grep -rlE 'cmp -s|filecmp|diff -q' scripts templates`, 확장자 필터). 🟥 **도구 이름으로 거르면
376
+ 안 된다** — 좁은 어휘(이미지·렌더 도구)로는 2개가 걸렸고 둘 다 오탐이었지만, 넓은 어휘로는 14~20개가
377
+ 걸려 어휘가 곧 답을 정한다(교차 계열 검토가 지목). 그래서 **대조 줄 전부를 손으로 읽었다**: 대부분은
378
+ 복사 검증 · 되돌림 적용 확인 · 스냅숏 불변 확인이고, «다시 만들어서 커밋된 기록과 대조」 형태는 **1곳** —
379
+ `scripts/test_policy_lens_scorer_lanes.sh` P2(채점기로 1차 런을 재채점해 커밋된 `SCORES.tsv` 와 대조)다.
380
+ 그 채점기는 `/usr/bin/awk` 를 **절대경로로** 부른다 — PATH 순서에 안 흔들리는, 이 절 처방의 가장 싼 형태가
381
+ 이미 거기 있다(시스템 awk 자체의 버전은 여전히 머신마다 다를 수 있다 — 미측정).
382
+
383
+ **한계**: 한 하네스 · 한 머신 · 인터프리터 셋 · 1회. `env_layer_fingerprint.sh` 는 이 층을 **안 찍는다** —
384
+ FH 쪽 해당 레인이 절대경로 도구 1곳뿐이라 지금 넣을 칸의 값이 작다. 재생성-대조 레인이 PATH 의 도구를
385
+ 부르는 형태로 생기면 그때 넣는다.
386
+
320
387
  ---
321
388
 
322
389
  ## §CM-Resident-Paragraph — CLAUDE.md 상주 문단 원문 (2026-09-26 이관)
@@ -17,12 +17,34 @@ This is a sibling of the **judge-robustness / mechanical-anchor** spine: judge-r
17
17
  let a foolable judge hold the terminal verdict*; gate-locality says *don't put the gate somewhere the
18
18
  enforcer can't see it*. Both fail the same way — a control that looks present but cannot actually fire.
19
19
 
20
- ## The failure mode (two observed shapes)
20
+ ## The failure mode (three observed shapes)
21
21
 
22
22
  | Shape | Where the gate was | Who needed it | Why it didn't fire |
23
23
  |---|---|---|---|
24
24
  | **Code-locality** | absent from the write path entirely | the function that writes to JIRA | the writeback gate checked confidence but not provenance, so a self-inferred finding auto-posted as if verified |
25
25
  | **File-locality** | only in a Claude-only `CLAUDE.md` | a Gemini/Codex orchestrator that auto-loads root `AGENTS.md`, not `CLAUDE.md` | the runtime assumed the commander *role* without inheriting the *gates* |
26
+ | **Trigger-locality** (added 2026-09-28) | in the right hook, running the right checks | the commit that changes a path the hook's **trigger pattern** does not match | the gate code is correct and never runs — and "no path matched" renders exactly like "all checks passed" |
27
+
28
+ **The third shape is the quietest, because nothing is misplaced.** The gate lives where the enforcer
29
+ reads it; only its *trigger* — a path pattern deciding whether the gate runs at all — leaves a class
30
+ of changes outside. FH hit it four times on its own gate (`scripts/` · `AGENTS.md` inheritance ·
31
+ agent definitions · `SKILL_detail.md` — the history sits in `scripts/gate_pathspec_check.sh`'s header,
32
+ which is also the mechanical anchor for FH's instance). The **first field-harness instance** was
33
+ measured 2026-09-28 on friends-on-desk: its pre-commit runs the quality gate only when a staged path
34
+ matches an **allowlist** of directories, and the app-code directory was not on it — of 171
35
+ September `main` commits, 24 touched a path under `standalone/` and nothing on the list (18 if the
36
+ predicate is narrowed to `standalone/overlay/src/`; either way a lower bound, since `main` is
37
+ squash-merged and branch commits are not counted). The gate was caught up at merge time, by hand;
38
+ the commit-time green said nothing about app code.
39
+ **Fix pattern specific to this shape**: prefer a **skip-list** ("run unless every staged path is
40
+ known-safe") over an allowlist ("run only if a path is listed"). An allowlist puts every *new*
41
+ directory outside the gate by default. A skip-list moves the *default* to the over-block side — but it
42
+ is **not** fail-closed on its own: it fails silently too if a skip entry is broad (a parent directory
43
+ that later grows code), or if the "every staged path is skippable" predicate is malformed and matches
44
+ everything. So the choice buys a better default, not safety; the safety comes from the lane — a
45
+ known-pair that **extracts the live pattern from the hook** (a copy drifts from the thing it
46
+ verifies) and asserts both directions: code paths, including a *not-yet-existing* directory, run the
47
+ gate; the handful of genuinely safe paths do not; a mixed commit runs it.
26
48
 
27
49
  Both were found 2026-06-20 across **two field harnesses** (Harness-A: a provenance gate missing from a
28
50
  write path; Harness-B + Harness-A: orchestration gates that lived only in a Claude-only file). The
@@ -74,7 +96,8 @@ locality — review alone cannot show it (review reads all files; the runtime do
74
96
  enforcing actor never loads.
75
97
 
76
98
  These are external anchors for the **prose-vs-mechanical premise**; the locality claim itself
77
- (N=2, one operator) still awaits direct cross-operator confirmation as named above.
99
+ (N=2, one operator) still awaits direct cross-operator confirmation as named above. The
100
+ trigger-locality shape (2026-09-28) adds a second harness, not a second operator — same caveat.
78
101
 
79
102
  ## Relationship to other FH assets
80
103
 
@@ -35,6 +35,47 @@ gitignored)이고, 이 문서는 그 판정만 옮긴다. 모델은 전부 sonne
35
35
  - 이 사실이 고친 문서: `templates/.claude/rules/mcp_tool_gating.md` §2 주석 · CLAUDE.md
36
36
  §Irreversibility Gates · goal-quench rung ②.
37
37
 
38
+ ## 1-b. 관측 — 제한 시간을 넘긴 PreToolUse 훅 뒤에 도구가 **실행됐다** (표면 미확인 · 한 조건)
39
+
40
+ > **적용 범위를 먼저 읽어라**: CLI 2.1.283 · sonnet · Bash 도구 한 명령(원장에 명령 원문·권한 모드·표면이
41
+ > 안 적혔다) · 팔당 reps=3. **대화형 pty 인지 헤드리스 `-p` 인지 모른다.** PermissionRequest 훅 · 자동승인
42
+ > 훅이 있는 조합은 **이 표로 말할 수 없다**. 공식 문서와의 대조는 §1-c(2026-09-28) — 이 표는 실측만 싣는다.
43
+
44
+ | 팔 (위 조건 그대로) | reps | 착지 |
45
+ |---|---|---|
46
+ | PreToolUse 훅이 30초 잔 뒤 deny / exit 2, 훅 제한 시간 3초 | 3 | **3/3 실행됨** |
47
+ | 훅 없음 (대조) | 3 | 3/3 실행됨 |
48
+ | 즉시 deny (대조) | 3 | 0/3 — 멈췄다 |
49
+ | 2초 잔 뒤 deny, 제한 시간 15초 (대조) | 3 | 0/3 — 제한 안쪽의 느린 deny 는 멈췄다 |
50
+
51
+ - **설계 가정(안전한 쪽)**: 훅이 제한 시간 안에 판정을 못 내면 **도구가 실행될 수 있다**고 가정하고 게이트를
52
+ 지어라. 이 표는 그 가정을 **반박하지 않는다** — 반대 가정(«시간 초과면 막힌다»)은 이 표로 정당화되지 않는다.
53
+ - 같은 위험을 만들 수 있는 것(**미측정 가설**): 판정 경로의 막히는 읽기(FIFO · 네트워크 · 잠긴 파일) ·
54
+ 인터프리터 콜드 스타트. 재지 않았다 — 예시이지 결과가 아니다.
55
+ - 처방 후보(**미검증**): 제한 시간보다 먼저 스스로 끝나는 워치독, 막히지 않는 읽기. 워치독 자신이 늦거나
56
+ 죽을 때 deny 가 보장되는지는 따로 재야 한다 — 워치독을 두었다고 닫힌 것이 아니다.
57
+ - §1 과 같은 방향의 관측이다: 이 조건에서 멈춘 것은 **제한 안에 도착한** deny 뿐이었다.
58
+ - **미측정**: ⓐ 표면(대화형 / 헤드리스) ⓑ 제한 시간 경계 ⓒ PermissionRequest 훅의 시간 초과 ⓓ 자동승인
59
+ 훅이 있을 때 ⓔ 다른 도구(Edit · MCP) ⓕ 다른 CLI 버전. 출처: 필드 하네스(데스크톱 펫 게이트) 세션 원장
60
+ 2026-09-27(로컬, gitignored). 이 중 ⓑ·ⓒ·ⓔ·ⓕ 는 공식 문서가 답한다 — **«문서 계약 · 실측 미재현»** 으로 §1-c 에
61
+ 따로 적었다. 이 목록에서 지우지 않는다: 우리가 잰 것은 여전히 아니다.
62
+
63
+ ## 1-c. 공식 문서 계약 — 실측과 **다른 칸**이다 (수집 2026-09-28)
64
+
65
+ > 출처: Claude Code Hooks reference `https://code.claude.com/docs/en/hooks` (수집일 2026-09-28, 인용 행 번호는
66
+ > 그날 받은 사본 기준) · CLI `2.1.283` = npm `@anthropic-ai/claude-code` latest(같은 날 `npm view` · `claude --version`).
67
+ > 🟥 **이 표는 «문서가 그렇게 말한다」이지 «우리가 쟀다」가 아니다.** §1·§1-b 의 실측 칸과 섞어 인용하지 마라.
68
+
69
+ | 계약 | 문서 원문(요지) | 우리 실측과의 관계 |
70
+ |---|---|---|
71
+ | PreToolUse 의 `command`·`http`·`mcp_tool` 훅이 **시간 초과되면 도구는 진행**한다 | «A timed-out … hook doesn't block the tool call … don't count on a stalled hook to act as a gate» (§Timeouts, 855행) | §1-b 실측(3/3 실행됨)과 **같은 방향 — 문서가 확인** · 반대로 Agent SDK 콜백 훅은 시간 초과면 막는다(같은 절) — 우리는 안 쟀다 |
72
+ | 훅 기본 제한 시간 | `command`·`http`·`mcp_tool` **600초** · `prompt` 30 · `agent` 60 · 일부 이벤트는 30/10 으로 낮춤 (428행) | 문서 계약 · 실측 미재현(§1-b ⓑ 경계) |
73
+ | 시간 초과 훅은 출력이 버려져 **판정이 없다** | «cancels … discarding the hook's output, so on most events a timed-out hook renders no decision» (851행) | 문서 계약 · 실측 미재현(§1-b ⓒ PermissionRequest 시간 초과 — 판정 없음 = 정상 권한 흐름이라는 것은 **이 일반 규칙에서 읽은 것**이지 이벤트별 문장이 아니다. 단 문서는 프롬프트를 못 띄우는 세션에서는 훅 판정이 없으면 도구 호출이 **거부**된다고 따로 적는다(1875행) — 표면에 따라 방향이 갈린다) |
74
+ | **exit 1 은 막지 않는 오류** — 진행한다 (**대부분의 이벤트** — 같은 절이 worktree 이벤트 등 예외를 따로 적는다) | «For most hook events … treats exit code 1 as a non-blocking error and proceeds with the action» (846행) | 문서 계약 · 실측 미재현. 함의: PreToolUse 게이트 훅의 인터프리터가 죽어 트레이스백과 함께 exit 1 이 나면 **fail-open** 이다 |
75
+ | **PermissionRequest 의 exit 2 는 무시**된다 | «Exit code 2 isn't honored for this event … Deny through the `decision` object» (865행) | 문서 계약 · 실측 미재현(§2 `exit 2` 행은 여전히 미측정). §4-1 의 «exit 2 는 멈춘다」는 **PreToolUse 에 한한다** |
76
+ | 적용 도구 (PreToolUse 에 한해) | PreToolUse 시간 초과 문장이 «the tool call» 로 도구 종류를 가리지 않는다 — 다른 이벤트의 시간 초과 규칙이 아니다 | 문서 계약 · 실측 미재현(§1-b ⓔ Edit · MCP) |
77
+ | 2.1.282 → 2.1.283 | CHANGELOG 2.1.283 절에 훅 **계약** 변경 없음 — 훅 언급 2줄은 `/hooks` 목록 UI 개선과 self-hosted runner 의 git 훅 처리 | §1(2.1.282)·§1-b(2.1.283) 실측을 두 버전에 걸쳐 같이 읽어도 계약 쪽 변화는 없다 — **동작 불변을 잰 것은 아니다** |
78
+
38
79
  ## 2. 채널 × 표면 × 시점
39
80
 
40
81
  «앞» = 사람이 고르기(답·승인) **전**에 화면/알림에 나타남 · «뒤» = 고른 **뒤**에만 · «없음» = 끝까지 안 그려짐.
@@ -64,6 +105,9 @@ gitignored)이고, 이 문서는 그 판정만 옮긴다. 모델은 전부 sonne
64
105
  ## 4. 설계 함의
65
106
 
66
107
  1. **비가역을 멈추는 채널은 deny / exit 2 뿐이다.** ask 는 «사람이 프롬프트 앞에 있을 때» 의 채널이다.
108
+ 도구 호출 권한 흐름에서 exit 2 가 막는 자리는 PreToolUse 다 — PermissionRequest 에서는 문서상 무시되고
109
+ `decision` deny 만 먹는다(§1-c).
110
+ 그리고 판정은 **제한 시간 안에** 도착해야 한다 — 늦은 deny 는 진행이다(§1-b 실측 · §1-c 문서).
67
111
  2. **질문 창에서 사람을 돕는 부스트는 지금 없다.** systemMessage 는 고른 뒤에 그려지고, 나머지는
68
112
  안 그려진다. 후보: OSC 777(질문 쪽 미측정) · `updatedInput` 으로 선택지 설명에 싣기(질문을
69
113
  «바꾸는» 것이라 경계를 넘는다 — 운영자 결정) · 바깥 표면(펫 말풍선·상태표시줄).
@@ -4436,3 +4436,141 @@
4436
4436
  판정 코드는 교차 계열 한 번이 사실상 필수. 격리 규칙을 첫 줄에 넣어도 스크립트 결함(zsh 가 낱말을 안 쪼갬 → 빈 경로)은 못 막는다 —
4437
4437
  거버너가 팔 결과마다 레포 상태 + gitignored 설정 mtime 을 대조하는 절차가 유일하게 잡았다(→ FH #811 ④-f 로 기계화).
4438
4438
  머지 직후 로컬 main pull 은 설치 여부와 무관하게 항상.
4439
+
4440
+ - date: 2026-09-27
4441
+ session: 9d093859 (FH 로컬 거버너 · Opus 5.5 · 야간 자율 — 칸 3 S0 · FH 자체개발 병렬 · 로컬 LLM System One)
4442
+ agent: general-purpose ×11 (재개 SendMessage 4회 별도)
4443
+ task: >-
4444
+ FoD S0 그림자 판정기(#134) · 실행기 미탐(#135) · 기밀 스캔(#136) · S0 두 번째 판정자=로컬 모델(#137) · 콜드 적재(#138)
4445
+ · FH 신선도 미러 오탐(#815) · CLAUDE.md 150k 이관 스테이징(#816) · 터미널 감사 배너(#817) 스테이징
4446
+ · 메타하네스 공존 측정(옥토·warp·gstack·cmux) · 로컬 System One 판정기 설계·기준선(두 노드 17쌍, 2,737 판정)
4447
+ count: 11
4448
+ outcome: accepted
4449
+ evidence: >-
4450
+ PR 8건 머지(FoD #134~#138 · FH #815~#817) + v3.22.0 릴리스 PR · FoD 앱 3회 재빌드·교체(매회 실제 홈 gate_hook==출하 대조)
4451
+ · S0 그림자 + 로컬 판정자 운영자 머신에서 켬 · 결과 파일 2(공존 · 로컬 판정기). 교차 계열(codex) 검토 5회 — 채택 합 12건
4452
+ (S0 모호 조인 · 실행기 fail-open 4 · 기밀 스캔 3 · CLAUDE.md 의미 5 중 일부 · 배너 KSH_ARRAYS), 전부 거버너가 원문/실행으로 확증.
4453
+ learning: >-
4454
+ 🟥 같은 계열 팔이 «게이트 FAIL 0» 으로 올린 판정 코드에서 codex 가 실제 fail-open 을 또 찾았다 — 실행기 PR 은
4455
+ 거버너가 재현 명령을 실제 훅에 넣어 4/4 무응답을 확증(붙여 쓴 옵션 `--command=` · `-c'…'`). 판정 코드는 교차 계열 +
4456
+ «재현 명령을 실행» 이 한 쌍이다. 팔 셋이 FoD 게이트의 비가역 거부(강제 푸시·브랜치 강제 삭제)에 막혔고 셋 다 우회 대신
4457
+ 병합 경로로 돌았다 — 게이트가 자기 저자를 막는 게 정상 동작이다. 로컬 판정기는 따뜻한 4090 에서 `git push -uf` 를
4458
+ reversible p=1.0 로 판정 — 그림자 전용 근거가 실사용 경로에서 재현.
4459
+
4460
+ - date: 2026-09-27
4461
+ session: 9d093859 (FH 로컬 거버너 · Opus 5.5 · 저녁~야간 — forge-gate 챔버 v2·v3 · FoD 게이트 활동 창/지도 · 칸 3 백테스트)
4462
+ agent: fh-meta:beginner ×1 · fh-meta:main-player ×1 · fh-meta:challenger ×2 (v2 challenger 1 + v3 페르소나 3 중 합산)
4463
+ task: >-
4464
+ 챔버 forge-gate-v2 페르소나(challenger) · forge-gate-v3 블라인드 페르소나 3(beginner · main-player · challenger)
4465
+ count: 4
4466
+ outcome: accepted
4467
+ evidence: >-
4468
+ v2 challenger S5/A20/B8 → v2 KILL(운영자 HITL) · v3 beginner HARD2/SOFT11 · main-player PARTIAL · challenger S6/A11/B4
4469
+ → 판정 보류 → 판정표 PREREG 로 매체 전환(codex r1 S11 → r2 S11 → r3 S0 · r4 diff-only S0).
4470
+ learning: >-
4471
+ 🟥 같은 계열 페르소나로 산문 INTENT 를 두 바퀴 돌리면 S 가 안 줄었다(5→6). 매체를 판정표로 바꾸고 다른 계열이 읽자 3라운드에 0.
4472
+ 그런데 **판정표의 결함(«비가역 ≠ 막아야 할 것」)은 페르소나 3 + codex 4라운드 누구도 못 봤고 실물 자연층 추출이 처음 드러냈다** —
4473
+ 봉인 전에 실물 분포를 한 번 뽑아라.
4474
+
4475
+ - date: 2026-09-27
4476
+ session: 9d093859 (같은 세션, 저녁~야간)
4477
+ agent: general-purpose ×9
4478
+ task: >-
4479
+ forge-gate-v3 첫 슬라이스 3(격리 러너+카나리 · 선행 가드 분류+비교군+P 층 · 자연층 H-N 추출) ·
4480
+ FoD 격리 가드 API 전수+다이얼 끔=원장 끔(#146) · 게이트 활동 창 v0(#148) · 게이트 지도 모델(#149)·레이아웃(#150)·보기(#152, 둘 대체) ·
4481
+ 칸 3 S0 역사 백테스트(PREREG r3)
4482
+ count: 9
4483
+ outcome: accepted
4484
+ evidence: >-
4485
+ forge-gate-v3 KILL(판정표 행 ① — 보존 30일로 세션 조건·W2 불가) · FoD PR 머지 #146 #148 #152(+ #147 #151 #153 거버너 직접) ·
4486
+ 설치본 교체 4회(매회 asar==빌드 · 옛≠새 · 실제 홈 gate_hook==출하) · 백테스트 NOT-CONVERGED(비가역 allow 0 · 뒤집음 15/17 전부 거절한 가역 명령).
4487
+ learning: >-
4488
+ 🟥 판정표 봉인 후 첫 슬라이스가 dcg 라이선스 라이더(AI 사용 금지)를 찾았다 — 비교군은 라이선스부터. 팔 둘이 같은 레인(module_wired)에
4489
+ 서로 다른 미배선 예외를 넣었다 — 병렬 조각은 «배선될 때 합쳐 한 PR」로 머지해 예외를 걷어라. 에이전트 하나가 거버너 대기 루프의
4490
+ pgrep 자기 매칭을 지목했다(자력 0) — 대기 패턴은 `[b]ash` 식으로 자기 명령줄을 피한다. 역사 백테스트는 «거절 = 조종 신호」를 드러냈다.
4491
+
4492
+ - date: 2026-09-27
4493
+ session: 9d093859 (같은 세션, 야간)
4494
+ agent: general-purpose ×1 (재개 SendMessage 1회 — 교차 계열 지적 수리)
4495
+ task: >-
4496
+ FoD 카드 사람 답 → 원장(human.answer) + 활동 창 «FH 답 검토」(human.review) — 칸 3 전향 확인 계기(#154)
4497
+ count: 1
4498
+ outcome: accepted
4499
+ evidence: >-
4500
+ #154 머지(dc7be36) · 레인 69/0 · 패치 self-check 16길 · 라이브 6/0 · gate 313/0. 거버너 codex R1 S3(세션 신뢰·창 닫힘 문자열 폴백과
4501
+ 원격 승인이 표지 없이 human) → 재개 수리 → R2 r1 8/8 CLOSED, 새 «S」 3 은 거버너가 원문 대조로 판정(2 = 방어층 중복 → B, 1 = 소스 반증).
4502
+ learning: >-
4503
+ 🟥 «사람이 답했다」를 코드 길이 아니라 문자열로 추정하는 폴백이 셋이었다 — 게이트 FAIL 0 · 레인 57 인 PR 이었다. 승격 근거가 될
4504
+ 기록은 «사람」을 기본값·폴백으로 절대 만들지 않는 불변식을 세 겹(길 표 · 분류 안전망 · 스키마)으로 둬야 하고, 그걸 잡은 것은 또 교차 계열이었다.
4505
+ 교차 계열의 2라운드 «S」도 전부 옳지는 않다 — 원문 대조가 절반을 강등·반증했다(판정은 거버너가 원문으로).
4506
+
4507
+ - date: 2026-09-28
4508
+ session: 9d093859 (자정 이후 — 2026-09-27 야간 이어짐)
4509
+ agent: general-purpose ×1 (SendMessage 재개 — 2026-09-27 «FoD 카드 사람 답」 에이전트)
4510
+ task: >-
4511
+ #154 교차 계열 지적(S1~S3 · A4~A6 · B9 · B10) 수리 — human 은 사람 UI 표지에서만
4512
+ count: 1
4513
+ outcome: accepted
4514
+ evidence: >-
4515
+ 커밋 94dd0d4 · 레인 69/0 · 패치 self-check 16길 · 라이브 6/0 · gate 313/0 → 머지 dc7be36. 2026-09-27 엔트리(«카드 사람 답」)의 재개분을 날짜별로 분리 기록.
4516
+ learning: >-
4517
+ 재개 디스패치는 날짜가 바뀌면 그 날짜 원장에 따로 남는다(④-e 는 날짜로 센다) — 한 엔트리로 묶어 적으면 다음 날 마감이 «원장 0」으로 막는다.
4518
+
4519
+ - date: 2026-09-28
4520
+ session: 9d093859 (아침 — 운영자 판정 반영)
4521
+ agent: general-purpose ×2 (명령 머리 에이전트는 보고 누락으로 SendMessage 재개 1회)
4522
+ task: >-
4523
+ FoD S0 영수증 명령 머리 + 판정기 재봉인(#155, 운영자 ⓐ) · 게이트 지도 조작(휠=이동 · 돋보기 확대 · 위치 막대 · «최신으로」 · 세션 빈 값 이름, #156)
4524
+ count: 2
4525
+ outcome: accepted
4526
+ evidence: >-
4527
+ #155 back-to-back 450 페이로드 판정 칸 20 차이 0 · 누설 0/121 · 새 판정기 090767ef… · gate 316/0 → 머지 ba4b037 ·
4528
+ #156 뷰포트 순수 모듈 레인 45 · 라이브 새 팔 2 · gate 320/0 → 머지 ddcce54 · 설치 + 판정기 --install --apply + FoD 릴리스 v0.1.0(dmg 2종, 해시 일치).
4529
+ learning: >-
4530
+ 판정기를 바꾸는 «표시용 칸」 추가는 봉인을 깨므로 «판정 칸 바이트 동일」을 실행으로 증명하는 레인(back-to-back)이 재봉인의 값이다.
4531
+ 에이전트가 운영자 문구(«처음 위치로」)의 설명을 사실대로 고쳐 썼다 — 주문서의 틀린 설명을 따르지 않은 것이 옳았다.
4532
+
4533
+ - date: 2026-09-28
4534
+ session: 9d093859 (저녁~야간 — FoD 첫 설치 버그 → v0.1.1)
4535
+ agent: general-purpose ×6 (+SendMessage 재개 5회) · fh-commons:ux-writer-lens ×1
4536
+ task: >-
4537
+ FoD 첫 설치 버그 5건 3갈래 병렬(게이트 창 카운터·번역투 / 첫 설치 드리프트 / 디스플레이 크기) + 호버 설명 사전 ·
4538
+ README 재작성 · UX 라이터 번역투 전수 감사 · 앱 전체 용어 사전 수리 · 상류 아트 제거 + NOTICE 정합
4539
+ count: 7
4540
+ outcome: accepted
4541
+ evidence: >-
4542
+ FoD PR #157 머지(b69fbf0, 브랜치 트리 = main 트리) · gate 337/0 · 오프라인 49/49 · 라이브 레인 직렬 재실행 ·
4543
+ UX 감사 78건+이름 불일치 19종 → S·A급 수리(옛 이름 레인 HEAD 31/6 → 41/0) · 상류 아트 99장(v0.1.0 설치본) 제거 레인 20/20.
4544
+ learning: >-
4545
+ «이름이 자리마다 다르다」가 드리프트 버그의 뿌리였다 — 수리는 문구가 아니라 «원천 하나(MODE_LABELS · fod-glossary)」.
4546
+ 감사 렌즈는 읽기 전용이라 보고서를 거버너가 전사본에서 추출해 빌더에게 넘겼다. 라이브 영수증이 소스 지문이라
4547
+ README(비-standalone) 커밋이 게이트에 막혀 «standalone 먼저 → 라이브 갱신 → 나머지」 순서로 풀었다.
4548
+
4549
+ - date: 2026-09-28
4550
+ session: 9d093859 (야간 — FoD 독립·칸 3·게이트 최신화)
4551
+ agent: general-purpose ×8 · sonnet(클린룸 구현자) ×1 · 헤드리스 claude/codex 구현자 ×4(에이전트 내부)
4552
+ task: >-
4553
+ FoD 독립 계획(인벤토리 440파일·218,742줄) · 클린룸 교정 1바퀴(명세→codex 검수→격리 구현 89/89) · 계기 재교정 ·
4554
+ 사전등록 복제(구현 5개, 반증 F1c 발동) · 질문 판정기(그림자) · 메타감사 채점기(그림자, 교정 20/20) ·
4555
+ 프런티어 트렌드 → 게이트 최신화 제안(M1~M3) · 게이트 끄기 설정 변경 차단(진행 중)
4556
+ count: 9
4557
+ outcome: accepted
4558
+ evidence: >-
4559
+ 클린룸 전사 감사 금지 경로 0(구현자 5명) · PREREG_cleanroom_rule_v1 sha 0da2d558… 봉인 후 실행 · 규칙 C 반증(Opus 구현이
4560
+ 이벤트 리스너 관용구로 C 실패) · 채점기 PREREG 170402cb… · 질문 판정기 레인 52/0 · 45/0 · 봉인 판정기 090767ef… 불변.
4561
+ learning: >-
4562
+ «인터페이스 이름 가림」은 수렴과 복사를 못 가른다(공통 자리표시는 같은 이름을 못 쪼갠다) — 가른 것은 «독립 구현이
4563
+ 재현하지 않는 겹침」. 사전등록 복제 한 번에 봉인 규칙이 반증됐다 = 계기가 산다는 증거. 운영자 132건 전부 «맞다」 는
4564
+ 건별 채점의 판별력 상실 신호였다(운영자: «틀을 보는 게 더 효과적」).
4565
+
4566
+ - date: 2026-09-28
4567
+ session: cee7b509 (병렬 세션 B — FH 자체개발)
4568
+ agent: general-purpose ×1
4569
+ task: >-
4570
+ 세션 카드 1945줄에서 FH 자산 잔여 추출·분류
4571
+ count: 1
4572
+ outcome: accepted
4573
+ evidence: >-
4574
+ 15행 분류, 1순위(배포본 npm test 파손)를 타르볼 실측으로 확인 → #832
4575
+ learning: >-
4576
+ 에이전트가 말한 원인(bin 3개)보다 실제가 넓었다(❌148) — 분류 결과는 실측 전 착수 근거일 뿐
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrono-meta/fh-gate",
3
- "version": "3.22.0",
3
+ "version": "3.22.2",
4
4
  "description": "FH runtime adapters — run FH governance, skills, and agents via Claude or Codex with machine-parseable gates.",
5
5
  "homepage": "https://github.com/chrono-meta/forge-harness#readme",
6
6
  "bugs": {
@@ -119,7 +119,9 @@
119
119
  "scripts/.env_purity_tokens.defaults",
120
120
  "scripts/activity_log.sh",
121
121
  "scripts/post_squash_verify.sh",
122
+ "scripts/test_post_squash_verify_lanes.sh",
122
123
  "scripts/pr_merge_verified.sh",
124
+ "scripts/test_pr_merge_verified_lanes.sh",
123
125
  "scripts/adapters/fixtures/mate_agent_boundary_known_negative.md",
124
126
  "scripts/adapters/fixtures/mate_agent_boundary_known_positive.md",
125
127
  "scripts/adapters/fixtures/qasp_web_rules_known_negative.json",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fh-commons",
3
- "version": "3.22.0",
3
+ "version": "3.22.2",
4
4
  "engines": {
5
5
  "claudeCode": ">=1.0.0"
6
6
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fh-meta",
3
- "version": "3.22.0",
3
+ "version": "3.22.2",
4
4
  "engines": {
5
5
  "claudeCode": ">=1.0.0"
6
6
  },
@@ -1,5 +1,32 @@
1
1
  # forge-harness (fh-meta) Changelog
2
2
 
3
+ ### [3.22.2] — 2026-09-28 — 설치된 패키지의 자기검사가 없는 파일을 실패로 부르지 않고, 훅 계약 문서가 공식 문서와 실측을 가른다
4
+
5
+ **patch — 수정 + 문서.** 소비자의 게이트 수용은 안 깬다(막는 쪽으로 바뀐 것 없음).
6
+
7
+ - **`scripts/selfcheck.sh` 부분 수리** — 설치된 패키지에서 출하 안 된 bin 래퍼 3개를 FAIL 이 아니라 SKIP 으로
8
+ 부른다(체크아웃에서 지운 것은 여전히 FAIL). 로케일 rc=2 는 «미출하 스위트 부재」 사유일 때만 경고.
9
+ post_squash · pr_merge 레인을 `files[]` 에 더했다(타르볼 21/0). ⚠️ 배포본 `npm test` 는 체크아웃을 전제하는
10
+ 스위트 때문에 아직 rc=1 이다 — 부분 수리임을 명시한다.
11
+ - **`knowledge/shared/harness-core/hook_channel_visibility.md` §1-c** — 공식 hooks 문서의 계약(시간 초과 시 진행 ·
12
+ command 훅 기본 600초 · exit 1 비차단 · PermissionRequest 의 exit 2 무시)을 «문서 계약 · 실측 미재현」 칸으로
13
+ 실측과 분리. CLI 2.1.283 = npm latest, 282→283 사이 훅 계약 변경 없음.
14
+ - **`gate_locality_principle.md` 셋째 모양 «트리거 경로 사각」** · **`checkout_layer_drift.md` 다섯째 층 TOOLCHAIN**
15
+ (같은 판정이 도구 버전에 따라 갈리는 층 — Pillow 12.2 → 0/156 · 11.3 → 7/156).
16
+ - `scripts/utterance_skill_probe.sh` route 그림자(`FH_ROUTE_SHADOW` 일 때만, 기본 끔 · 출하 목록 밖) · 디스패치 원장.
17
+
18
+ ### [3.22.1] — 2026-09-28 — 동반 저장소 미러가 서드파티 클론을 안 싣고, 훅 제한 시간 관측을 싣는다
19
+
20
+ **patch — 수정 하나 + 문서.** 소비자의 게이트 수용은 안 깬다(막는 쪽으로 바뀐 것 없음).
21
+
22
+ - **`scripts/sync-to-be.sh` 가 `vendor/` 를 동반 저장소로 안 싣는다** — 측정용으로 받은 서드파티 클론이
23
+ 비공개 동반 저장소에 실린 사고(726 파일) 수리. rsync·tar 폴백 둘 다 같은 제외 배열이고, 제외되는 경로는
24
+ `--quiet` 에서도 stderr 로 한 줄씩 알린다(우리 것인 vendor 가 조용히 빠지지 않게). 레인 L4c·L4d, 178/0.
25
+ - **`knowledge/shared/harness-core/hook_channel_visibility.md` §1-b** — 제한 시간을 넘긴 PreToolUse 훅 뒤에
26
+ 도구가 실행된 관측(2.1.283 · sonnet · Bash 1건 · 팔당 3판)을 «안전한 쪽 설계 가정」으로만 싣는다. 표면
27
+ (대화형/헤드리스) · 다른 도구 · PermissionRequest · 자동승인 조합 · 버전은 미측정으로 명시.
28
+ - 챔버 순서 증인 원장(forge-gate v1~v3) · 서브에이전트 디스패치 원장 갱신.
29
+
3
30
  ### [3.22.0] — 2026-09-27 — clone 사용자의 세션 시작 경고·터미널 거짓 알림을 걷고, 사이드카 판정 어휘를 가른다
4
31
 
5
32
  **minor — 새 레인 셋 + 출하 스크립트 동작 변경.** 소비자의 게이트 수용은 안 깬다(막는 쪽으로 바뀐 것 없음).
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fh-preprep",
3
- "version": "3.22.0",
3
+ "version": "3.22.2",
4
4
  "engines": {
5
5
  "claudeCode": ">=1.0.0"
6
6
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fh-qp",
3
- "version": "3.22.0",
3
+ "version": "3.22.2",
4
4
  "engines": {
5
5
  "claudeCode": ">=1.0.0"
6
6
  },
@@ -53,6 +53,11 @@ sys.exit(0 if any(p == f or p.startswith(f.rstrip('/') + '/') for f in files) el
53
53
  SHIPPY
54
54
  }
55
55
 
56
+ # Package mode = an installed tarball, not a checkout. The discriminator is a `.git` entry at this
57
+ # tree's root (selfcheck cd's there first) — NOT `git rev-parse`, which would find a consumer's own
58
+ # repo above node_modules and call their install a checkout. A worktree's `.git` is a file; -e covers it.
59
+ _package_mode() { [ ! -e .git ]; }
60
+
56
61
  # ── The single verdict for "my subject is not here" ───────────────────────────────────────────
57
62
  # Measured 2026-08-12 (card §🔱⑮ A2): **18 blocks in this file** rendered a green SKIP when their
58
63
  # subject was absent, and **all 18 subjects are declared in package.json files[] and present in the
@@ -200,7 +205,18 @@ for f in scripts/*.sh bin/fh-gate bin/fh-run bin/fh-goal \
200
205
  if [ ! -f "$f" ]; then
201
206
  case "$f" in
202
207
  *'*'*) continue ;; # unmatched glob (nullglob off) — not a real path, legitimate skip
203
- *) echo "FAIL bash -n coverage: gate-chain infra file missing: $f"; fail=1; continue ;;
208
+ *) # 🟥 Package mode (2026-09-28): the three extensionless bin wrappers are NOT in files[]
209
+ # (only their .js twins ship), so in an installed tarball they are absent by design and
210
+ # this line failed every consumer's `npm test`. Absent is legitimate ONLY when the path is
211
+ # undeclared AND this tree is not a git checkout — in a checkout (CI, the author) the
212
+ # 2026-09-03 deletion hole stays closed. Declared-but-absent and unreadable manifest stay FAIL.
213
+ _ships_per_files "$f"; _sp=$?
214
+ if [ "$_sp" -eq 1 ] && _package_mode; then
215
+ echo "SKIP bash -n coverage: $f (not in package.json files[] and this is an installed package, not a checkout)"
216
+ else
217
+ echo "FAIL bash -n coverage: gate-chain infra file missing: $f"; fail=1
218
+ fi
219
+ continue ;;
204
220
  esac
205
221
  fi
206
222
  check "bash -n $f" bash -n "$f"
@@ -641,9 +657,41 @@ fi
641
657
  if [ ! -f scripts/test_locale_invariance_lanes.sh ]; then
642
658
  echo "FAIL locale-invariance lanes: scripts/test_locale_invariance_lanes.sh 가 없다 (부재는 통과가 아니다)"
643
659
  fail=1
644
- elif ! bash scripts/test_locale_invariance_lanes.sh >/dev/null 2>&1; then
645
- echo "FAIL locale-invariance lanes"
646
- fail=1
660
+ else
661
+ # 🟥 The suite's contract is 0 pass · 1 regression · 2 an arm UNMEASURED. The first version read
662
+ # any non-zero as FAIL, so an installed package — which deliberately does not ship
663
+ # test_marker_soul_tenet_lanes.sh (its fixture registry .claude/soul_tenets.txt is not shipped) —
664
+ # failed `npm test` on a coverage gap the suite itself labels "not a regression" (2026-09-28).
665
+ # rc=2 stays FAIL in a checkout: there every suite exists, so UNMEASURED means a missing UTF-8
666
+ # locale, and a green without its control is not a measurement (the rule above).
667
+ _li_out="$(bash scripts/test_locale_invariance_lanes.sh 2>&1)"; _li_rc=$?
668
+ case "$_li_rc" in
669
+ 0) : ;;
670
+ 2) # Non-blocking ONLY for the one expected reason: a suite that is absent because it is not
671
+ # shipped. rc=2 also means real instrument breakage against shipped subjects (hook count
672
+ # extraction, dead mutation controls) — that must stay FAIL even in a package (codex, 2026-09-28).
673
+ _li_other=0
674
+ while IFS= read -r _l; do
675
+ case "$_l" in
676
+ *'이 트리에 스위트가 없다'*)
677
+ _s=$(printf '%s\n' "$_l" | grep -oE 'test_[A-Za-z0-9_]+' | head -1)
678
+ if [ -z "$_s" ]; then _li_other=1
679
+ else _ships_per_files "scripts/$_s.sh"; [ "$?" -eq 1 ] || _li_other=1; fi ;;
680
+ *) _li_other=1 ;;
681
+ esac
682
+ done < <(printf '%s\n' "$_li_out" | grep -F 'UNMEASURED' | grep -vF '팔 하나 이상이 UNMEASURED')
683
+ if _package_mode && [ "$_li_other" -eq 0 ]; then
684
+ echo "⚠️ locale-invariance lanes: an arm is UNMEASURED in this installed package (unshipped suite — not a pass, not blocking):"
685
+ printf '%s\n' "$_li_out" | grep -F 'UNMEASURED' | sed 's/^/ /'
686
+ else
687
+ echo "FAIL locale-invariance lanes (rc=2 — arm UNMEASURED in a checkout)"
688
+ printf '%s\n' "$_li_out" | grep -F 'UNMEASURED' | sed 's/^/ /'
689
+ fail=1
690
+ fi ;;
691
+ *) echo "FAIL locale-invariance lanes (rc=$_li_rc)"
692
+ printf '%s\n' "$_li_out" | grep -vE 'ok$' | tail -20 | sed 's/^/ /'
693
+ fail=1 ;;
694
+ esac
647
695
  fi
648
696
 
649
697
  # multibyte-bracket lint — 열거로는 안 닫힌다. POSIX 브래킷은 비-UTF-8 로케일에서 바이트
@@ -0,0 +1,183 @@
1
+ #!/usr/bin/env bash
2
+ # test_post_squash_verify_lanes.sh — anchor for scripts/post_squash_verify.sh.
3
+ #
4
+ # Known pairs from the origin signal (fh_signal_2026-09-21_post-squash-verify.md §설계 조건):
5
+ # ⓐ a clean squash → pass ⓑ a squash that drops one file → 🟥 rc=1
6
+ # ⓒ no --rerun → rc=2 🟥 without ⓒ the "② is required" clause is decoration
7
+ # plus: trivial ② refused (rc=3) · failing ② (rc=1) · silent ② (rc=4) · a path main ALSO changed is
8
+ # COMBINED, not DIFFERS · an extra path in the squash is 🟥 EXTRA · the caller's HEAD is untouched.
9
+ # Every fixture is a throwaway repo built here (portable; no dependency on this repo's history).
10
+ set -uo pipefail
11
+ cd "$(dirname "$0")/.."
12
+ SC="$PWD/scripts/post_squash_verify.sh"
13
+ [ -f "$SC" ] || { echo "🟥 HARNESS-ERROR: target missing ($SC)" >&2; exit 9; }
14
+
15
+ PASS=0; FAIL=0
16
+ ok() { PASS=$((PASS+1)); printf ' ✅ %s\n' "$1"; }
17
+ bad() { FAIL=$((FAIL+1)); printf ' ❌ %s\n' "$1"; }
18
+
19
+ T=$(mktemp -d "${TMPDIR:-/tmp}/psv-lane-XXXXXX")
20
+ trap 'rm -rf "$T"' EXIT INT TERM
21
+ export GIT_AUTHOR_NAME=t GIT_AUTHOR_EMAIL=t@t GIT_COMMITTER_NAME=t GIT_COMMITTER_EMAIL=t@t
22
+
23
+ # mk <dir>: main has a,b,c · branch `feat` changes a and b · returns via globals TIP
24
+ mk() {
25
+ local d="$1"; git init -q -b main "$d"
26
+ printf 'a1\n' > "$d/a"; printf 'b1\n' > "$d/b"; printf 'c1\nc2\nc3\n' > "$d/c"
27
+ git -C "$d" add -A; git -C "$d" commit -qm init --no-verify
28
+ git -C "$d" switch -qc feat
29
+ printf 'a2\n' > "$d/a"; printf 'b2\n' > "$d/b"
30
+ git -C "$d" commit -qam feat --no-verify
31
+ TIP=$(git -C "$d" rev-parse HEAD)
32
+ git -C "$d" switch -q main
33
+ }
34
+ # squash <dir> [drop-path] : squash-merge feat into main, optionally reverting one path before commit
35
+ squash() {
36
+ local d="$1" drop="${2:-}"
37
+ git -C "$d" merge --squash -q feat >/dev/null 2>&1
38
+ [ -n "$drop" ] && git -C "$d" checkout -q HEAD -- "$drop"
39
+ git -C "$d" commit -qm squash --no-verify
40
+ }
41
+ run() { OUT=$(bash "$SC" --repo "$1" --tip "$2" "${@:3}" 2>&1); RC=$?; }
42
+
43
+ printf '── post_squash_verify ──\n'
44
+ GOOD='grep -q a2 a && grep -q b2 b && echo instrument-ok'
45
+
46
+ # ⓐ clean squash → rc=0
47
+ mk "$T/ok"; squash "$T/ok"; TIP_OK="$TIP"
48
+ # 🟥 every later "$T/ok" run uses TIP_OK, never the global: mk() for another repo overwrites TIP, and
49
+ # the stale value only "worked" when both repos committed in the same second (identical hashes).
50
+ # Found 2026-09-24 as a 1-in-2 flake: ② failing-lane got rc=4 «--tip not a commit».
51
+ run "$T/ok" "$TIP_OK" --rerun "$GOOD"
52
+ [ "$RC" -eq 0 ] && ok "ⓐ clean squash + live ② → rc=0" || { bad "ⓐ clean squash rc=$RC"; printf '%s\n' "$OUT" | tail -5; }
53
+
54
+ # ⓑ squash that silently dropped b → rc=1 with DIFFERS b (② checks only a, so ① alone must catch it)
55
+ mk "$T/drop"; squash "$T/drop" b
56
+ run "$T/drop" "$TIP" --rerun 'grep -q a2 a && echo a-ok'
57
+ { [ "$RC" -eq 1 ] && printf '%s' "$OUT" | grep -q 'DIFFERS b'; } \
58
+ && ok "ⓑ dropped file → rc=1 · DIFFERS b (① catches what a narrow ② misses)" \
59
+ || { bad "ⓑ dropped file rc=$RC"; printf '%s\n' "$OUT" | tail -6; }
60
+
61
+ # ⓒ no --rerun → rc=2, and it must refuse BEFORE doing anything
62
+ run "$T/ok" "$TIP_OK"
63
+ [ "$RC" -eq 2 ] && ok "ⓒ no --rerun → rc=2 (① alone cannot go green)" || bad "ⓒ no --rerun rc=$RC"
64
+
65
+ # trivial ② refused — each spelling
66
+ _tf=0
67
+ for triv in ':' 'true' ' true ; ' 'exit 0' '' '/usr/bin/true'; do
68
+ run "$T/ok" "$TIP_OK" --rerun "$triv"
69
+ [ "$RC" -eq 3 ] || { bad "trivial ② '$triv' → rc=$RC (want 3)"; _tf=1; }
70
+ done
71
+ [ "$_tf" -eq 0 ] && ok "trivial ② (: · true · ' true ; ' · exit 0 · '' · /usr/bin/true) → rc=3 each"
72
+
73
+ # failing ② on a byte-correct merge → rc=1
74
+ run "$T/ok" "$TIP_OK" --rerun 'grep -q NOPE a'
75
+ [ "$RC" -eq 1 ] && ok "failing ② on a byte-correct squash → rc=1" || { bad "failing ② rc=$RC"; printf '%s\n' "$OUT" | tail -4; }
76
+
77
+ # silent ② (rc=0, no output) → rc=4, never a pass
78
+ run "$T/ok" "$TIP_OK" --rerun 'grep -q a2 a'
79
+ [ "$RC" -eq 4 ] && ok "silent ② (rc=0, empty output) → rc=4" || { bad "silent ② rc=$RC"; printf '%s\n' "$OUT" | tail -4; }
80
+
81
+ # COMBINED: main also changed a (different line region) after the branch was cut → not DIFFERS
82
+ mk "$T/comb"; printf 'c1\nc2\nc3\nc4\n' > "$T/comb/c"; git -C "$T/comb" commit -qam main-c --no-verify
83
+ git -C "$T/comb" switch -q feat; printf 'c0\nc1\nc2\nc3\n' > "$T/comb/c"; git -C "$T/comb" commit -qam feat-c --no-verify
84
+ TIP=$(git -C "$T/comb" rev-parse HEAD); git -C "$T/comb" switch -q main; squash "$T/comb"
85
+ run "$T/comb" "$TIP" --rerun 'grep -q c0 c && grep -q c4 c && echo merged-ok'
86
+ { [ "$RC" -eq 0 ] && printf '%s' "$OUT" | grep -q 'COMBINED c'; } \
87
+ && ok "path changed on both sides → COMBINED (not DIFFERS), rc=0 when ② passes" \
88
+ || { bad "COMBINED rc=$RC"; printf '%s\n' "$OUT" | tail -6; }
89
+
90
+ # EXTRA: squash commit carries a path the branch never touched → rc=1
91
+ mk "$T/ext"; git -C "$T/ext" merge --squash -q feat >/dev/null 2>&1
92
+ printf 'x\n' > "$T/ext/extra"; git -C "$T/ext" add extra; git -C "$T/ext" commit -qm squash --no-verify
93
+ run "$T/ext" "$TIP" --rerun "$GOOD"
94
+ { [ "$RC" -eq 1 ] && printf '%s' "$OUT" | grep -q 'EXTRA extra'; } \
95
+ && ok "path in squash but not on branch → EXTRA · rc=1" || { bad "EXTRA rc=$RC"; printf '%s\n' "$OUT" | tail -4; }
96
+
97
+ # caller's HEAD and worktree list are untouched (② runs in a throwaway worktree)
98
+ H0=$(git -C "$T/ok" rev-parse HEAD); B0=$(git -C "$T/ok" branch --show-current)
99
+ run "$T/ok" "$TIP_OK" --rerun "$GOOD"
100
+ WTN=$(git -C "$T/ok" worktree list | wc -l | tr -d ' ')
101
+ { [ "$(git -C "$T/ok" rev-parse HEAD)" = "$H0" ] && [ "$(git -C "$T/ok" branch --show-current)" = "$B0" ] && [ "$WTN" = "1" ]; } \
102
+ && ok "caller HEAD/branch unchanged · throwaway worktree removed" || bad "side effect: HEAD/branch moved or worktrees=$WTN"
103
+
104
+ # ── cross-family R1 (codex/gpt-5.5, 2026-09-24) — each lane below was RED before its fix ──
105
+ # X1 newline in a path: --name-only C-quotes it, the quoted string is looked up literally, both
106
+ # sides read ABSENT and the path renders SAME. Squash drops the file → must be DIFFERS, rc=1.
107
+ mk "$T/nl"; git -C "$T/nl" switch -q feat; printf 'n\n' > "$T/nl/$(printf 'x\ny')"
108
+ git -C "$T/nl" add -A; git -C "$T/nl" commit -qm nl --no-verify; TIP_NL=$(git -C "$T/nl" rev-parse HEAD)
109
+ git -C "$T/nl" switch -q main; squash "$T/nl" "$(printf 'x\ny')" 2>/dev/null
110
+ git -C "$T/nl" rm -q --cached "$(printf 'x\ny')" 2>/dev/null; git -C "$T/nl" commit -q --amend --no-edit --no-verify 2>/dev/null
111
+ run "$T/nl" "$TIP_NL" --rerun 'echo hi && grep -q a2 a'
112
+ [ "$RC" -eq 1 ] && ok "X1 newline path dropped by squash → rc=1 (not SAME)" || { bad "X1 newline path rc=$RC"; printf '%s\n' "$OUT" | tail -5; }
113
+
114
+ # X2 --tip == --merge compares the commit to itself → rc=4, never a pass
115
+ M_OK=$(git -C "$T/ok" rev-parse HEAD)
116
+ run "$T/ok" "$M_OK" --rerun "$GOOD"
117
+ [ "$RC" -eq 4 ] && ok "X2 --tip == --merge → rc=4" || bad "X2 --tip == --merge rc=$RC"
118
+
119
+ # X3 echo/printf-only ② exercises nothing → rc=3 (the exact-string list missed these)
120
+ _tf=0
121
+ for triv in 'printf ok' 'echo ok; :' 'echo a && echo b' 'true; printf x'; do
122
+ run "$T/ok" "$TIP_OK" --rerun "$triv"
123
+ [ "$RC" -eq 3 ] || { bad "X3 echo-only ② '$triv' → rc=$RC (want 3)"; _tf=1; }
124
+ done
125
+ [ "$_tf" -eq 0 ] && ok "X3 echo/printf/:/true-only ② → rc=3"
126
+ # X3 control: a real command that ALSO echoes must still run (over-block guard)
127
+ run "$T/ok" "$TIP_OK" --rerun 'grep -q a2 a; echo checked'
128
+ [ "$RC" -eq 0 ] && ok "X3-ctrl grep + echo is not refused" || bad "X3-ctrl real command refused rc=$RC"
129
+
130
+ # X4 a true merge commit (2 parents) is not a squash → rc=4
131
+ mk "$T/mm"; git -C "$T/mm" merge -q --no-ff --no-edit feat >/dev/null 2>&1
132
+ run "$T/mm" "$TIP" --merge HEAD --rerun "$GOOD"
133
+ [ "$RC" -eq 4 ] && ok "X4 two-parent merge commit → rc=4" || bad "X4 multi-parent rc=$RC"
134
+
135
+ # ── cross-family R2 ──
136
+ # X5 a real \001 byte in a path collided with the R1 sentinel → dropped file rendered SAME
137
+ mk "$T/c1"; git -C "$T/c1" switch -q feat; printf 'q\n' > "$T/c1/$(printf 'x\001y')"
138
+ git -C "$T/c1" add -A; git -C "$T/c1" commit -qm c1 --no-verify; TIP_C1=$(git -C "$T/c1" rev-parse HEAD)
139
+ git -C "$T/c1" switch -q main; git -C "$T/c1" merge --squash -q feat >/dev/null 2>&1
140
+ git -C "$T/c1" rm -q --cached "$(printf 'x\001y')" >/dev/null 2>&1; git -C "$T/c1" commit -qm s --no-verify
141
+ run "$T/c1" "$TIP_C1" --rerun 'echo hi && grep -q a2 a'
142
+ [ "$RC" -eq 1 ] && ok "X5 \\001 byte in a dropped path → rc=1 (no sentinel collision)" || { bad "X5 \\001 path rc=$RC"; printf '%s\n' "$OUT" | tail -4; }
143
+ # X6 echo first, real check after `&&` → must NOT be refused (splitter over-block guard)
144
+ run "$T/ok" "$TIP_OK" --rerun 'echo checked && grep -q a2 a'
145
+ [ "$RC" -eq 0 ] && ok "X6 'echo … && grep …' runs (split on && works)" || bad "X6 echo-then-real refused rc=$RC"
146
+ # X7 a path with a space survives the array path end to end
147
+ mk "$T/sp"; git -C "$T/sp" switch -q feat; printf 's\n' > "$T/sp/has space"; git -C "$T/sp" add -A
148
+ git -C "$T/sp" commit -qm sp --no-verify; TIP_SP=$(git -C "$T/sp" rev-parse HEAD); git -C "$T/sp" switch -q main; squash "$T/sp"
149
+ run "$T/sp" "$TIP_SP" --rerun 'test -f "has space" && echo ok'
150
+ [ "$RC" -eq 0 ] && ok "X7 path with a space → SAME · rc=0" || { bad "X7 space path rc=$RC"; printf '%s\n' "$OUT" | tail -4; }
151
+
152
+ # ── cross-family R3 ──
153
+ # X8 an option with no operand must be a usage error, not an endless `shift 2` loop
154
+ _xf=0
155
+ for opt in --tip --merge --repo --rerun; do
156
+ OUT=$(timeout 10 bash "$SC" --repo "$T/ok" $opt 2>&1); RC=$?
157
+ [ "$RC" -eq 2 ] || { bad "X8 '$opt' with no operand → rc=$RC (want 2; 124 = hung)"; _xf=1; }
158
+ done
159
+ [ "$_xf" -eq 0 ] && ok "X8 option with no operand → rc=2 (checked: --tip --merge --repo --rerun)"
160
+ # X9 a failing `git diff` for the squash list must be rc=4, not an empty list that skips EXTRA
161
+ FB="$T/fakebin"; mkdir -p "$FB"; RG=$(command -v git)
162
+ printf '#!/bin/sh\ncase " $* " in *" diff "*"%s"*) exit 128 ;; esac\nexec "%s" "$@"\n' "$(git -C "$T/ext" rev-parse HEAD)" "$RG" > "$FB/git"; chmod +x "$FB/git"
163
+ OUT=$(PATH="$FB:$PATH" bash "$SC" --repo "$T/ext" --tip "$(git -C "$T/ext" rev-parse feat)" --rerun "$GOOD" 2>&1); RC=$?
164
+ # 🟥 rc=4 alone is not enough — «branch changed no paths» is also rc=4. Require the diff-failure message.
165
+ { [ "$RC" -eq 4 ] && printf '%s' "$OUT" | grep -q 'git diff failed'; } && ok "X9 git diff fails on the squash list → rc=4 (named)" || { bad "X9 swallowed git diff failure rc=$RC"; printf '%s\n' "$OUT" | tail -3; }
166
+
167
+ # ── cross-family R4 ──
168
+ # X10 a mode-only change (chmod +x) dropped by the squash → same blob, different entry → rc=1.
169
+ # This is the exec-bit class that silently disarms git hooks ([[feedback_exec_bit_loss_disarms_hooks_silently]]).
170
+ mk "$T/md"; git -C "$T/md" switch -q feat; chmod +x "$T/md/a"; git -C "$T/md" add a
171
+ git -C "$T/md" commit -qm mode --no-verify; TIP_MD=$(git -C "$T/md" rev-parse HEAD); git -C "$T/md" switch -q main
172
+ git -C "$T/md" merge --squash -q feat >/dev/null 2>&1; chmod -x "$T/md/a"; git -C "$T/md" add a; git -C "$T/md" commit -qm s --no-verify
173
+ run "$T/md" "$TIP_MD" --rerun 'grep -q a2 a && echo ok'
174
+ { [ "$RC" -eq 1 ] && printf '%s' "$OUT" | grep -q 'DIFFERS'; } && ok "X10 dropped mode change → DIFFERS · rc=1" || { bad "X10 mode-only drop rc=$RC"; printf '%s\n' "$OUT" | tail -4; }
175
+
176
+ # X11 --precheck validates --rerun with no git state: trivial → 3 · real → 0 · missing → 2 (no --tip needed)
177
+ _p1=$(bash "$SC" --precheck --rerun 'true' >/dev/null 2>&1; echo $?)
178
+ _p2=$(bash "$SC" --precheck --rerun 'grep -q x y; echo z' >/dev/null 2>&1; echo $?)
179
+ _p3=$(bash "$SC" --precheck >/dev/null 2>&1; echo $?)
180
+ [ "$_p1$_p2$_p3" = "302" ] && ok "X11 --precheck: trivial=3 · real=0 · missing=2" || bad "X11 --precheck got $_p1/$_p2/$_p3 (want 3/0/2)"
181
+
182
+ printf 'PASS %d · FAIL %d\n' "$PASS" "$FAIL"
183
+ [ "$FAIL" -eq 0 ]
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env bash
2
+ # test_pr_merge_verified_lanes.sh — anchor for scripts/pr_merge_verified.sh (the merge-path wiring of
3
+ # post_squash_verify.sh). Hermetic: a local bare "origin" and a fake `gh` on PATH; no network.
4
+ #
5
+ # The load-bearing lanes are the REFUSALS: a refusal must happen BEFORE the merge, so each refusal
6
+ # lane also asserts the fake gh never received `pr merge` (a merge log that stays empty).
7
+ set -uo pipefail
8
+ cd "$(dirname "$0")/.."
9
+ SC="$PWD/scripts/pr_merge_verified.sh"
10
+ [ -f "$SC" ] || { echo "🟥 HARNESS-ERROR: target missing ($SC)" >&2; exit 9; }
11
+
12
+ PASS=0; FAIL=0
13
+ ok() { PASS=$((PASS+1)); printf ' ✅ %s\n' "$1"; }
14
+ bad() { FAIL=$((FAIL+1)); printf ' ❌ %s\n' "$1"; }
15
+ T=$(mktemp -d "${TMPDIR:-/tmp}/pmv-lane-XXXXXX"); trap 'rm -rf "$T"' EXIT INT TERM
16
+ export GIT_AUTHOR_NAME=t GIT_AUTHOR_EMAIL=t@t GIT_COMMITTER_NAME=t GIT_COMMITTER_EMAIL=t@t
17
+
18
+ # setup <name> : bare origin with main(a,b) + feat(a2,b2); a clone at $T/<name>/work
19
+ setup() {
20
+ local d="$T/$1"; mkdir -p "$d"
21
+ git init -q --bare -b main "$d/origin.git"
22
+ git clone -q "$d/origin.git" "$d/seed" 2>/dev/null
23
+ printf 'a1\n' > "$d/seed/a"; printf 'b1\n' > "$d/seed/b"
24
+ 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
+ git -C "$d/seed" switch -qc feat; printf 'a2\n' > "$d/seed/a"; printf 'b2\n' > "$d/seed/b"
26
+ git -C "$d/seed" commit -qam feat --no-verify; git -C "$d/seed" push -q origin feat
27
+ git clone -q "$d/origin.git" "$d/work" 2>/dev/null; git -C "$d/work" fetch -q origin feat
28
+ printf '%s' "$(git -C "$d/seed" rev-parse feat)" > "$d/head.oid"
29
+ }
30
+ # fake gh. Behaviour knobs via files in $D: view_fail · merge_fail · drop_b
31
+ mkgh() {
32
+ local D="$1"; mkdir -p "$D/bin"
33
+ cat > "$D/bin/gh" <<EOF
34
+ #!/bin/sh
35
+ D="$D"
36
+ case "\$1 \$2" in
37
+ "pr view")
38
+ [ -f "\$D/view_fail" ] && exit 1
39
+ case "\$*" in *headRefOid*) cat "\$D/head.oid"; echo ;;
40
+ *state*) if [ -f "\$D/merge.oid" ] && [ ! -f "\$D/queued" ]; then echo MERGED; else echo OPEN; fi ;;
41
+ *mergeCommit*) if [ -f "\$D/queued" ]; then echo null; else cat "\$D/merge.oid" 2>/dev/null; echo; fi ;; esac ;;
42
+ "pr merge")
43
+ echo "\$*" >> "\$D/merge.log"
44
+ [ -f "\$D/merge_fail" ] && exit 1
45
+ case "\$*" in *--match-head-commit*) mh=\$(echo "\$*" | sed 's/.*--match-head-commit \([0-9a-f]*\).*/\1/')
46
+ [ -f "\$D/moved" ] && { echo "Head branch was modified" >&2; exit 1; }
47
+ [ "\$mh" = "\$(cat "\$D/head.oid")" ] || exit 1 ;; esac
48
+ [ -f "\$D/queued" ] && { git -C "\$D/seed" rev-parse HEAD > "\$D/merge.oid"; exit 0; }
49
+ git -C "\$D/seed" switch -q main && git -C "\$D/seed" merge --squash -q feat >/dev/null 2>&1
50
+ [ -f "\$D/drop_b" ] && git -C "\$D/seed" checkout -q HEAD -- b
51
+ git -C "\$D/seed" commit -qm squash --no-verify && git -C "\$D/seed" push -q origin main
52
+ git -C "\$D/seed" rev-parse HEAD > "\$D/merge.oid" ;;
53
+ *) exit 2 ;;
54
+ esac
55
+ EOF
56
+ chmod +x "$D/bin/gh"
57
+ }
58
+ run() { local D="$1"; shift; OUT=$(cd "$D/work" && PATH="$D/bin:$PATH" bash "$SC" "$@" 2>&1); RC=$?; }
59
+ merged() { [ -s "$1/merge.log" ]; }
60
+ GOOD='grep -q a2 a && grep -q b2 b && echo instrument-ok'
61
+
62
+ printf '── pr_merge_verified ──\n'
63
+
64
+ setup ok; mkgh "$T/ok"; run "$T/ok" 7 --rerun "$GOOD"
65
+ { [ "$RC" -eq 0 ] && printf '%s' "$OUT" | grep -q 'merged and verified'; } \
66
+ && ok "L1 merge + verify → rc=0" || { bad "L1 happy path rc=$RC"; printf '%s\n' "$OUT" | tail -6; }
67
+
68
+ setup nore; mkgh "$T/nore"; run "$T/nore" 7
69
+ { [ "$RC" -eq 2 ] && ! merged "$T/nore"; } && ok "L2 no --rerun → rc=2 and merge NEVER called" \
70
+ || bad "L2 no --rerun rc=$RC merged=$(merged "$T/nore" && echo yes || echo no)"
71
+
72
+ setup mf; mkgh "$T/mf"; : > "$T/mf/merge_fail"; run "$T/mf" 7 --rerun "$GOOD"
73
+ [ "$RC" -eq 5 ] && ok "L3 merge fails → rc=5" || bad "L3 merge failure rc=$RC"
74
+
75
+ setup drop; mkgh "$T/drop"; : > "$T/drop/drop_b"; run "$T/drop" 7 --rerun 'grep -q a2 a && echo a-ok'
76
+ { [ "$RC" -eq 1 ] && printf '%s' "$OUT" | grep -q 'IS MERGED but verification FAILED'; } \
77
+ && ok "L4 squash dropped a file → rc=1 · says the merge stands" || { bad "L4 dropped file rc=$RC"; printf '%s\n' "$OUT" | tail -5; }
78
+
79
+ setup bad; mkgh "$T/bad"; run "$T/bad" 7x --rerun "$GOOD"
80
+ { [ "$RC" -eq 2 ] && ! merged "$T/bad"; } && ok "L5 non-numeric PR → rc=2, no merge" || bad "L5 non-numeric PR rc=$RC"
81
+
82
+ setup vf; mkgh "$T/vf"; : > "$T/vf/view_fail"; run "$T/vf" 7 --rerun "$GOOD"
83
+ { [ "$RC" -eq 4 ] && ! merged "$T/vf"; } && ok "L6 PR head unreadable → rc=4 BEFORE merge" \
84
+ || bad "L6 head unreadable rc=$RC merged=$(merged "$T/vf" && echo yes || echo no)"
85
+
86
+ setup triv; mkgh "$T/triv"; run "$T/triv" 7 --rerun 'true'
87
+ # 🟥 the refusal must come BEFORE the merge — first draft refused it only after merging (rc=4 post-merge)
88
+ { [ "$RC" -eq 3 ] && ! merged "$T/triv"; } \
89
+ && ok "L7 trivial --rerun → rc=3 BEFORE merge (merge never called)" \
90
+ || bad "L7 trivial rerun rc=$RC merged=$(merged "$T/triv" && echo yes || echo no)"
91
+
92
+ # ── cross-family W1 (codex/gpt-5.5) ──
93
+ # L8 the merge is pinned to the RECORDED head: gh gets --match-head-commit <oid>; a moved head → no merge (rc=5)
94
+ grep -q -- "--match-head-commit $(cat "$T/ok/head.oid")" "$T/ok/merge.log" \
95
+ && ok "L8a merge call carries --match-head-commit <recorded head>" || bad "L8a merge not pinned to the recorded head: $(cat "$T/ok/merge.log")"
96
+ setup mv; mkgh "$T/mv"; : > "$T/mv/moved"; run "$T/mv" 7 --rerun "$GOOD"
97
+ [ "$RC" -eq 5 ] && ok "L8b head moved after recording → GitHub refuses, rc=5 (nothing merged)" || bad "L8b moved head rc=$RC"
98
+ # L9 merge accepted but not completed (queue / API lag: mergeCommit null) → rc=6, never «merged and verified», never «the merge stands»
99
+ setup q; mkgh "$T/q"; : > "$T/q/queued"; run "$T/q" 7 --rerun "$GOOD"
100
+ { [ "$RC" -eq 6 ] && ! printf '%s' "$OUT" | grep -q 'merged and verified\|IS MERGED'; } \
101
+ && ok "L9 merge queued / not completed → rc=6, reported as NOT verified" || { bad "L9 queued merge rc=$RC"; printf '%s\n' "$OUT" | tail -3; }
102
+
103
+ printf 'PASS %d · FAIL %d\n' "$PASS" "$FAIL"
104
+ [ "$FAIL" -eq 0 ]