@chrono-meta/fh-gate 3.42.0 → 3.43.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 (44) hide show
  1. package/.claude/regression/probes_live.yaml +16 -8
  2. package/.claude/rules/fh_4axis_gate.md +8 -0
  3. package/.claude-plugin/marketplace.json +4 -4
  4. package/AGENTS.md +5 -0
  5. package/README.ja.md +2 -0
  6. package/README.ko.md +2 -0
  7. package/README.md +2 -0
  8. package/README.zh.md +2 -0
  9. package/docs/HOW_FH_DIFFERS.en.md +37 -0
  10. package/docs/HOW_FH_DIFFERS.md +39 -0
  11. package/docs/USER_GUIDE.md +113 -2
  12. package/docs/model_tier_expectations.md +8 -4
  13. package/knowledge/shared/harness-core/claude_md_full_reference.md +10 -0
  14. package/knowledge/shared/harness-core/dispatch_conditional_prohibition.md +18 -0
  15. package/knowledge/shared/harness-core/fh_module_contract.md +19 -0
  16. package/knowledge/shared/harness-core/measurement-integrity-checklist.md +24 -0
  17. package/knowledge/shared/learnings/subagent_invocations_log.yaml +30 -0
  18. package/package.json +6 -1
  19. package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
  20. package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +2 -2
  21. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  22. package/plugins/fh-meta/CHANGELOG.md +32 -2
  23. package/plugins/fh-meta/skills/edit-manifest/SKILL.md +14 -1
  24. package/plugins/fh-meta/skills/harvest-loop/SKILL.md +1 -1
  25. package/plugins/fh-meta/skills/meta-prompt-builder/SKILL.md +19 -0
  26. package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
  27. package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
  28. package/scripts/capability_registry_check.sh +15 -2
  29. package/scripts/live_eval_trace.py +122 -0
  30. package/scripts/package_coverage_check.sh +7 -0
  31. package/scripts/pr_merge_verified.sh +7 -0
  32. package/scripts/probe_live_eval.sh +6 -3
  33. package/scripts/probe_live_eval_lib.py +89 -1
  34. package/scripts/remote_marker_gate.sh +56 -0
  35. package/scripts/selfcheck.sh +7 -0
  36. package/scripts/session_close_check.sh +16 -0
  37. package/scripts/sim_isolated_run.sh +17 -2
  38. package/scripts/test_fixture_guard_coverage_lanes.sh +71 -10
  39. package/scripts/test_live_eval_trace_lanes.sh +145 -0
  40. package/scripts/test_meta_prompt_restate_lanes.sh +36 -0
  41. package/scripts/test_mutation_probe_lanes.sh +26 -6
  42. package/scripts/test_pr_merge_verified_lanes.sh +23 -0
  43. package/scripts/test_remote_marker_gate_lanes.sh +96 -0
  44. package/scripts/test_session_close_lanes.sh +7 -0
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env bash
2
+ # test_meta_prompt_restate_lanes.sh — meta-prompt-builder carries the cold-reader restate check.
3
+ # Record-shape only: item 4 of Step 3 names the three fields, the GUESS -> WARN rule, the
4
+ # self-restate exclusion and the NOT RUN rule, and Done When lists it as a mandatory-pass row.
5
+ # Whether a session actually runs it is a blind sim, not this lane.
6
+ # Known-negative in-file: the same check on a copy with item 4 removed must FAIL.
7
+ # exit: 0 PASS · 1 FAIL · 10 harness error
8
+ set -uo pipefail
9
+ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
10
+ F="${1:-$ROOT/plugins/fh-meta/skills/meta-prompt-builder/SKILL.md}"
11
+ [ -f "$F" ] || { echo "harness error: $F missing -- not a pass" >&2; exit 10; }
12
+
13
+ check() { # $1 = file; prints findings, returns 0 if all present
14
+ local f="$1" item4 done_rows rc=0 n
15
+ # item 4 = from its own line to the next numbered item or "Items that fail"
16
+ item4=$(awk '/^4\. \*\*Restate check/{on=1} on && /^Items that fail/{on=0} on' "$f")
17
+ done_rows=$(awk '/^## Done When/{on=1;next} /^## /{on=0} on' "$f")
18
+ for n in 'GOAL' 'DONE' 'CONSTRAINTS' 'RESTATABLE' '`GUESS`' 'brief not restatable' \
19
+ 'Do not tell the reader' 'Restating your own draft yourself does not count' 'NOT RUN'; do
20
+ printf '%s\n' "$item4" | grep -qF -- "$n" || { echo " missing in item 4: $n"; rc=1; }
21
+ done
22
+ printf '%s\n' "$done_rows" | grep -qF 'Step 3 item 4 ran on every draft' \
23
+ || { echo " missing in Done When: item-4 row"; rc=1; }
24
+ return $rc
25
+ }
26
+
27
+ if check "$F"; then echo "PASS: item 4 and its Done When row present"; else echo "FAIL: $F"; exit 1; fi
28
+
29
+ # known-negative: strip item 4 and its Done When row -> must fail
30
+ tmp=$(mktemp) || { echo "harness error: mktemp" >&2; exit 10; }
31
+ trap 'rm -f "$tmp"' EXIT
32
+ awk '/^4\. \*\*Restate check/{skip=1} skip && /^Items that fail/{skip=0} !skip' "$F" \
33
+ | grep -vF 'Step 3 item 4 ran on every draft' > "$tmp"
34
+ if check "$tmp" >/dev/null; then echo "FAIL: control alive check — stripped copy still passed (lane is decorative)"; exit 1; fi
35
+ echo "PASS: control — stripped copy fails"
36
+ exit 0
@@ -18,7 +18,7 @@
18
18
  # the original · setsid escapees · --json only when measured · kernel shebang · mode bits · future
19
19
  # mtime · inode-keyed leftovers) — each lane red on v6.
20
20
  # G7 the v6 generator defect classes, pinned — fail-closed: an uncertain region yields no mutant.
21
- # K0 the /proc process counter used by N6/S7-5, on a known pair, before either trusts it.
21
+ # K0 the process counter used by N6/S7-5 (/proc, or ps on macOS), on a known pair, before either trusts it.
22
22
  #
23
23
  # Exit 0 = all lanes behave · 1 = regression (or an UNMEASURED lane — never folded into PASS).
24
24
  set -uo pipefail
@@ -156,6 +156,9 @@ ibkpath() { python3 -c 'import os,sys;st=os.stat(sys.argv[1]);print("/tmp/mutati
156
156
  sha_of() { python3 -c 'import hashlib,sys;print(hashlib.sha256(open(sys.argv[1],"rb").read()).hexdigest())' "$1"; }
157
157
  procs_matching() { # count live processes whose WHOLE cmdline is $1 — /proc, not pgrep (pgrep absent → vacuous);
158
158
  local n=0 c # exact match, so the counter never counts itself (a substring grep did)
159
+ if [ "$HAVE_PROC" -eq 0 ]; then # macOS: no /proc, but `ps` lists every process's argv — same exact-line rule
160
+ grep -cxF -- "$1" <<<"$(ps -axww -o command= 2>/dev/null)"; return 0
161
+ fi
159
162
  for c in /proc/[0-9]*/cmdline; do [ -e "$c" ] || continue; [ "$(tr '\0' ' ' < "$c" 2>/dev/null)" = "$1 " ] && n=$((n+1)); done
160
163
  echo "$n"
161
164
  }
@@ -171,6 +174,15 @@ procs_matching() { # count live processes whose WHOLE cmdline is $1 — /proc,
171
174
  _PSFX="$$${RANDOM}"
172
175
  TOK_N6="4747.$_PSFX"; TOK_K0="4646.$_PSFX"; TOK_S75="4848.$_PSFX"
173
176
  if [ -d /proc/self ]; then HAVE_PROC=1; else HAVE_PROC=0; fi
177
+ # HAVE_COUNTER (2026-11-14): N6 and K0 used to need /proc, so on macOS they printed UNMEASURED and the
178
+ # suite exited 1 on every local run — a red the author learned to read past (CI on Linux was green).
179
+ # N6 does not need /proc; it needs a process counter. `ps -axww -o command=` is one, and K0/K1 below
180
+ # calibrate whichever counter is in use on a known pair before N6 trusts it. No counter at all is
181
+ # still UNMEASURED (red), never a pass.
182
+ HAVE_COUNTER=0
183
+ if [ "$HAVE_PROC" -eq 1 ]; then HAVE_COUNTER=1; _COUNTER="/proc"
184
+ elif ps -axww -o command= >/dev/null 2>&1; then HAVE_COUNTER=1; _COUNTER="ps"; fi
185
+ NOT_APPLICABLE=0; NA_NAMES=""
174
186
 
175
187
  # B4 — the baseline lane writes its own subject: refuse, and leave the ORIGINAL bytes
176
188
  cp age.sh b4.sh; h0=$(sha_of b4.sh)
@@ -242,10 +254,10 @@ printf '. ./n1.sh\nis_adult 19 && exit 0\n( touch n6.started; exec sleep %s ) &\
242
254
  rm -f n6.started
243
255
  out=$(python3 "$PROBE" n1.sh lane_n6.sh --timeout 2 2>&1)
244
256
  sleep 0.5
245
- if [ "$HAVE_PROC" -eq 1 ]; then
246
- [ -e n6.started ] && grep -q 'TIMEOUT' <<<"$out" && [ "$(procs_matching "sleep $TOK_N6")" -eq 0 ] ; chk $? "N6 the timed-out lane's grandchildren are killed with its process group (counted via /proc — v6 used pgrep, vacuous when absent)"
257
+ if [ "$HAVE_COUNTER" -eq 1 ]; then
258
+ [ -e n6.started ] && grep -q 'TIMEOUT' <<<"$out" && [ "$(procs_matching "sleep $TOK_N6")" -eq 0 ] ; chk $? "N6 the timed-out lane's grandchildren are killed with its process group (counted via $_COUNTER, calibrated by K0 — v6 used pgrep, vacuous when absent)"
247
259
  else
248
- echo " ⚠️ N6 UNMEASURED — no /proc"; UNMEASURED=$((UNMEASURED+1))
260
+ echo " ⚠️ N6 UNMEASURED — no process counter (/proc absent and ps failed)"; UNMEASURED=$((UNMEASURED+1))
249
261
  fi
250
262
 
251
263
  # N2 · N3 · N7 — generator noise
@@ -564,9 +576,9 @@ printf '#!/bin/sh\n[ "$a" != b ] && echo d\n[ "$c" = d ] && echo e\n' > z28.sh
564
576
  out=$(python3 "$PROBE" z28.sh --list 2>&1)
565
577
  ! grep -qF '==' <<<"$out" && grep -qF '[=→!=]' <<<"$out" ; chk $? "Z28 #!/bin/sh: '!=' is not flipped to the non-POSIX '==' (= → != still is)"
566
578
 
567
- if [ "$HAVE_PROC" -eq 1 ]; then # the process counter itself, on a known pair, before any lane trusts it
579
+ if [ "$HAVE_COUNTER" -eq 1 ]; then # the process counter itself, on a known pair, before any lane trusts it
568
580
  sleep "$TOK_K0" & kp=$!; sleep 0.1; k1=$(procs_matching "sleep $TOK_K0"); kill "$kp"; wait "$kp" 2>/dev/null; k0=$(procs_matching "sleep $TOK_K0")
569
- [ "$k1" -eq 1 ] && [ "$k0" -eq 0 ] ; chk $? "K0 the /proc process counter sees a live sleep (1) and not a dead one (0) — and not itself"
581
+ [ "$k1" -eq 1 ] && [ "$k0" -eq 0 ] ; chk $? "K0 the process counter ($_COUNTER) sees a live sleep (1) and not a dead one (0) — and not itself"
570
582
  # K1 (2026-10-26) — the token must be unique to this run, not merely exact. Known pair against a
571
583
  # live FOREIGN process carrying the old shared name: the thing a concurrent sibling used to be.
572
584
  sleep 4747 & kf=$!; sleep 0.1
@@ -615,6 +627,13 @@ if [ "$HAVE_PROC" -eq 1 ] && command -v setsid >/dev/null 2>&1; then
615
627
  out=$(python3 "$PROBE" s75.sh lane_s75.sh --timeout 30 2>&1)
616
628
  sleep 0.3
617
629
  [ -e s75.started ] && grep -qE 'mutants=1 ' <<<"$out" && [ "$(procs_matching "sleep $TOK_S75")" -eq 0 ] ; chk $? "S7-5 a setsid descendant of the lane does not outlive the probe (v6: it kept running with the mutant)"
630
+ elif [ "$(uname -s)" != Linux ]; then
631
+ # NOT-APPLICABLE, not UNMEASURED: the subject itself declares this behaviour Linux-only
632
+ # (mutation_probe.py: PR_SET_CHILD_SUBREAPER; elsewhere it prints «no subreaper on this OS … named
633
+ # residual»). There is no contract here to measure. On Linux a missing /proc or setsid is still
634
+ # UNMEASURED and red — the platform is the oracle, not the tool's absence.
635
+ echo " ⏭️ S7-5 NOT-APPLICABLE on $(uname -s) — setsid-escapee kill is Linux-only by the probe's own contract (CI measures it)"
636
+ NOT_APPLICABLE=$((NOT_APPLICABLE+1)); NA_NAMES="$NA_NAMES S7-5"
618
637
  else
619
638
  echo " ⚠️ S7-5 UNMEASURED — no /proc or no setsid"; UNMEASURED=$((UNMEASURED+1))
620
639
  fi
@@ -856,5 +875,6 @@ grep -q '\[>→>=\] cmd >= out.txt' <<<"$out" ; chk $? "RV2 without the (( )) re
856
875
 
857
876
  echo ""
858
877
  if [ "$FAILED" -eq 0 ] && [ "$UNMEASURED" -gt 0 ]; then echo "INCOMPLETE mutation probe: $PASS lanes passed, $UNMEASURED UNMEASURED — not a pass"; exit 1; fi
878
+ if [ "$FAILED" -eq 0 ] && [ "$NOT_APPLICABLE" -gt 0 ]; then echo "PASS mutation probe: $PASS lanes · $NOT_APPLICABLE NOT-APPLICABLE on $(uname -s) ($NA_NAMES ) — not measured here, not counted as passed"; exit 0; fi
859
879
  if [ "$FAILED" -eq 0 ]; then echo "PASS mutation probe: $PASS lanes"; exit 0; fi
860
880
  echo "FAIL mutation probe"; exit 1
@@ -31,6 +31,10 @@ setup() {
31
31
  mkdir -p "$d/seed/plugins/p/skills/s"; printf 'Plain text one.\n' > "$d/seed/plugins/p/skills/s/SKILL.md"; git -C "$d/seed" add plugins
32
32
  git -C "$d/seed" commit -qm skill --no-verify; git -C "$d/seed" push -q origin HEAD:main
33
33
  git -C "$d/seed" switch -qc feat; printf 'Plain text two.\n' > "$d/seed/plugins/p/skills/s/SKILL.md"
34
+ elif [ -n "${SETUP_LANE:-}" ]; then # SETUP_LANE=1: the PR changes only a lane file (scripts/test_*)
35
+ mkdir -p "$d/seed/scripts"; printf 'echo l1\n' > "$d/seed/scripts/test_x_lanes.sh"; git -C "$d/seed" add scripts
36
+ git -C "$d/seed" commit -qm lane --no-verify; git -C "$d/seed" push -q origin HEAD:main
37
+ git -C "$d/seed" switch -qc feat; printf 'echo l2\n' > "$d/seed/scripts/test_x_lanes.sh"
34
38
  elif [ -n "${SETUP_DOCS:-}" ]; then
35
39
  mkdir -p "$d/seed/docs"; printf 'x1\n' > "$d/seed/docs/x.md"; git -C "$d/seed" add docs/x.md
36
40
  git -C "$d/seed" commit -qm docs --no-verify; git -C "$d/seed" push -q origin HEAD:main
@@ -248,6 +252,25 @@ SETUP_EXTRA=1 setup cvd; mkgh "$T/cvd"; run "$T/cvd" 7 --rerun 'git --version &&
248
252
  { [ "$RC" -eq 0 ] && printf '%s' "$OUT" | grep -q 'mentions none of this PR'; } \
249
253
  && ok "L25b --rerun naming a tracked dir → advisory still fires (blobs only)" || bad "L25b rc=$RC (dir listing counted as coverage?)"
250
254
 
255
+ # ── defect-path prompt (1c — print only, 2026-11-14 harvest H2) ──
256
+ DP='name the path the defect travels'
257
+ # D1 a code-changing PR (a, b) → the one-line prompt prints, rc and merge unchanged (L24's run, covering --rerun)
258
+ setup dp1; mkgh "$T/dp1"; run "$T/dp1" 7 --rerun "$GOOD"
259
+ { [ "$RC" -eq 0 ] && merged "$T/dp1" && [ "$(printf '%s\n' "$OUT" | grep -cF "$DP")" -eq 1 ]; } \
260
+ && ok "D1 code-changing PR → exactly one defect-path line, merge + verify unchanged (rc=0)" || { bad "D1 rc=$RC"; printf '%s\n' "$OUT" | tail -4; }
261
+ # D2 docs-only PR → quiet (the condition is narrowed so doc PRs carry no noise)
262
+ SETUP_DOCS=1 setup dp2; mkgh "$T/dp2"; run "$T/dp2" 7 --rerun "$GOODX"
263
+ { [ "$RC" -eq 0 ] && merged "$T/dp2" && ! printf '%s' "$OUT" | grep -qF "$DP"; } \
264
+ && ok "D2 docs-only PR → no defect-path line" || bad "D2 rc=$RC (prompt fired on a docs-only PR?)"
265
+ # D3 lane-only PR → quiet
266
+ SETUP_LANE=1 setup dp3; mkgh "$T/dp3"; run "$T/dp3" 7 --rerun 'grep -q l2 scripts/test_x_lanes.sh && echo instrument-ok'
267
+ { [ "$RC" -eq 0 ] && merged "$T/dp3" && ! printf '%s' "$OUT" | grep -qF "$DP"; } \
268
+ && ok "D3 lane-only PR (scripts/test_*) → no defect-path line" || { bad "D3 rc=$RC (prompt fired on a lane-only PR?)"; printf '%s\n' "$OUT" | tail -3; }
269
+ # D4 it is printed BEFORE the merge: a run whose merge is refused still shows it (and still exits 5, nothing verified)
270
+ setup dp4; mkgh "$T/dp4"; : > "$T/dp4/merge_fail"; run "$T/dp4" 7 --rerun "$GOOD"
271
+ { [ "$RC" -eq 5 ] && printf '%s' "$OUT" | grep -qF "$DP"; } \
272
+ && ok "D4 merge refused → line was already printed (pre-merge), rc unchanged (5)" || { bad "D4 rc=$RC"; printf '%s\n' "$OUT" | tail -3; }
273
+
251
274
  # ── completion record (tracks/_meta/fh_completed_<date>.md) ──
252
275
  # cl_setup <name> : a work clone that HAS a tracks/ dir (a consumer without one is skipped silently — L30)
253
276
  cl_setup() { setup "$1"; mkgh "$T/$1"; mkdir -p "$T/$1/work/tracks"; }
@@ -143,6 +143,77 @@ out=$(RMG_GUARD_FILE=templates/_tiny.sh run); rc=$?
143
143
  [ "$rc" -eq 10 ] && ok "H2: 배열 추출이 5개 미만이면 rc=10 (파서 파손을 «자산 없음» 으로 안 읽는다)" \
144
144
  || ng "H2 어긋남 (rc=$rc) — 깨진 파서가 조용히 통과시킨다"
145
145
 
146
+ echo
147
+ echo "== push 실행의 PR 본문 조회 (AQ-20261114-10 — 같은 HEAD 두 판정) =="
148
+ # 🟥 #1095 · #1103: 마커가 PR 본문에만 있으면 pull_request 실행은 초록인데 push 실행은 빨강이었다.
149
+ # push 실행은 이벤트 본문이 없어서다. 가짜 gh 로 조회 응답을 꽂아 다섯 갈래를 가른다.
150
+ FAKEGH="$TMPD/fakegh"; mkdir -p "$FAKEGH"
151
+ mkgh(){ # $1=이름 $2=모드(json|fail|garbage) $3=json 본문
152
+ printf '#!/usr/bin/env bash\n' > "$FAKEGH/$1"
153
+ case "$2" in
154
+ json) printf 'cat <<'"'"'JSON'"'"'\n%s\nJSON\n' "$3" >> "$FAKEGH/$1" ;;
155
+ fail) printf 'echo "HTTP 502: Bad Gateway" >&2; exit 1\n' >> "$FAKEGH/$1" ;;
156
+ garbage) printf 'echo "<html>not json</html>"\n' >> "$FAKEGH/$1" ;;
157
+ esac
158
+ chmod +x "$FAKEGH/$1"
159
+ }
160
+ BODY_JSON=$(python3 -c 'import json,sys; print(json.dumps(sys.argv[1]))' "$(printf '%s' "$FULL" | sed 1,2d)")
161
+ mk claude/frontier-auto-push plugins/fh-meta/skills/demo/SKILL.md "frontier-auto: 마커는 PR 본문에만"
162
+ PBR=$(git rev-parse --abbrev-ref HEAD)
163
+ mkgh ok json "[{\"head\":{\"ref\":\"$PBR\",\"repo\":{\"full_name\":\"o/r\"}},\"body\":$BODY_JSON}]"
164
+ mkgh fork json "[{\"head\":{\"ref\":\"$PBR\",\"repo\":{\"full_name\":\"x/fork\"}},\"body\":$BODY_JSON}]"
165
+ mkgh nulle json "[null]"
166
+ mkgh noref json "[{\"head\":{},\"body\":$BODY_JSON}]"
167
+ mkgh norepo json "[{\"head\":{\"ref\":\"$PBR\",\"repo\":null},\"body\":$BODY_JSON}]"
168
+ mkgh empty json "[]"
169
+ mkgh other json "[{\"head\":{\"ref\":\"claude/someone-else\",\"repo\":{\"full_name\":\"o/r\"}},\"body\":$BODY_JSON}]"
170
+ mkgh fail fail
171
+ mkgh junk garbage
172
+ plook(){ RMG_PR_LOOKUP=1 RMG_REPO=o/r RMG_GH="$FAKEGH/$1" RMG_BASE_REF=_base RMG_HEAD_REF="$PBR" bash "${2:-scripts/remote_marker_gate.sh}" 2>&1; }
173
+ out=$(plook ok); rc=$?
174
+ if [ "$rc" -eq 0 ] && printf '%s' "$out" | /usr/bin/grep -q "PR($PBR) 1 개 본문"; then
175
+ ok "L1 (a) push + 이 채널 PR 본문에 마커 → rc=0 (pull_request 실행과 같은 판정)"
176
+ else ng "L1 어긋남 (rc=$rc) — push 실행이 PR 본문을 못 읽는다: $(printf '%s' "$out" | tail -2)"; fi
177
+ out=$(plook empty); rc=$?
178
+ [ "$rc" -eq 1 ] && printf '%s' "$out" | /usr/bin/grep -q "PR 이 없다" \
179
+ && ok "L2 (c) push + PR 없음 + 커밋에 마커 없음 → rc=1 (빨강 유지)" \
180
+ || ng "L2 어긋남 (rc=$rc) — PR 없는 push 가 통과한다"
181
+ out=$(plook other); rc=$?
182
+ [ "$rc" -eq 1 ] && ok "L3 (d) 같은 커밋을 품은 «남의 채널» PR 본문으로는 통과 안 한다 → rc=1" \
183
+ || ng "L3 어긋남 (rc=$rc) — 다른 head ref 의 본문을 기록으로 셌다"
184
+ out=$(plook fail); rc=$?
185
+ [ "$rc" -eq 10 ] && printf '%s' "$out" | /usr/bin/grep -q "PR 조회가 실패" \
186
+ && ok "L4 (e) PR 조회 실패 → rc=10 빨강 («PR 없음» 으로 안 접는다)" \
187
+ || ng "L4 어긋남 (rc=$rc) — 조회 실패가 판정으로 접혔다"
188
+ out=$(plook junk); rc=$?
189
+ [ "$rc" -eq 10 ] && ok "L5 (e') 조회 응답이 JSON 이 아니면 rc=10" \
190
+ || ng "L5 어긋남 (rc=$rc) — 깨진 응답을 «PR 없음» 으로 읽었다"
191
+ out=$(plook fork); rc=$?
192
+ [ "$rc" -eq 1 ] && ok "L3b 같은 브랜치 이름의 «포크» PR 본문으로는 통과 안 한다 → rc=1 (codex R1)" \
193
+ || ng "L3b 어긋남 (rc=$rc) — 포크 PR 본문을 기록으로 셌다"
194
+ out=$(plook nulle); rc=$?
195
+ [ "$rc" -eq 10 ] && ok "L5b 응답 항목이 깨졌으면([null]) rc=10 — 조용히 버리지 않는다 (codex R1)" \
196
+ || ng "L5b 어긋남 (rc=$rc) — 깨진 항목을 «PR 없음» 으로 읽었다"
197
+ for _m in noref norepo; do
198
+ out=$(plook "$_m"); rc=$?
199
+ [ "$rc" -eq 10 ] && ok "L5c 응답 항목에 head.ref / head.repo 가 없으면($_m) rc=10 (codex R2)" \
200
+ || ng "L5c 어긋남 ($_m rc=$rc) — 귀속 불가 항목을 «PR 없음» 으로 읽었다"
201
+ done
202
+ out=$(RMG_PR_LOOKUP=1 RMG_GH="$FAKEGH/ok" RMG_BASE_REF=_base RMG_HEAD_REF="$PBR" bash scripts/remote_marker_gate.sh 2>&1); rc=$?
203
+ [ "$rc" -eq 10 ] && ok "L6 RMG_REPO 없이 조회 모드 → rc=10 (조회 불가를 통과로 안 읽는다)" \
204
+ || ng "L6 어긋남 (rc=$rc)"
205
+ # 되돌림 known-pair: 조회 블록만 끈 사본에서 L1 이 빨개져야 그 블록이 일한다.
206
+ sed -E 's/^if \[ -z "\$BODY_FILE" \] && \[ "\$\{RMG_PR_LOOKUP:-0\}" = "1" \]; then$/if false; then/' \
207
+ scripts/remote_marker_gate.sh > scripts/_nolookup.sh
208
+ if /usr/bin/grep -q '^if false; then$' scripts/_nolookup.sh; then
209
+ out=$(plook ok scripts/_nolookup.sh); rc=$?
210
+ [ "$rc" -eq 1 ] && ok "R2 되돌림: 조회 블록을 끄면 L1 이 rc=1 빨강 → 그 블록이 push 판정을 바꾼다" \
211
+ || ng "R2: 꺼도 rc=$rc — 다른 것이 L1 을 통과시킨다(앵커 귀속 틀림)"
212
+ else
213
+ ng "R2 계기 오류 — 되돌림 치환이 안 먹었다. 프로브가 죽었다"
214
+ fi
215
+ rm -f scripts/_nolookup.sh
216
+
146
217
  echo
147
218
  echo "== 되돌림 프로브 — 앵커가 장식인가 =="
148
219
  # 필수 필드 루프를 무력화한 사본으로 P1 을 다시 돌린다. 적색이 초록이 되어야 «그 줄이 일한다».
@@ -182,6 +253,31 @@ else
182
253
  /usr/bin/grep -q 'remote_marker_gate.sh' "$WF" \
183
254
  && ok "W2: validate.yml 이 remote_marker_gate.sh 를 실제로 부른다(배선됨)" \
184
255
  || ng "W2: 게이트가 CI 에 배선 안 됐다 — 산문이 실행기다"
256
+ # W3 은 «글자가 있나» 가 아니라 «그 스텝의 env 값이 그것인가» 를 YAML 로 읽는다(codex R2 — 주석 처리한 줄도 grep 엔 남는다).
257
+ w3(){ python3 - "$1" <<'PY'
258
+ import sys
259
+ try:
260
+ import yaml
261
+ except ImportError:
262
+ print("NO-YAML"); sys.exit(3)
263
+ wf = yaml.safe_load(open(sys.argv[1], encoding="utf-8"))
264
+ want = "${{ github.event_name == 'push' && '1' || '0' }}"
265
+ for job in (wf.get("jobs") or {}).values():
266
+ for st in job.get("steps") or []:
267
+ if str(st.get("name", "")).startswith("Floorless-channel"):
268
+ env = st.get("env") or {}
269
+ sys.exit(0 if env.get("RMG_PR_LOOKUP") == want and env.get("RMG_REPO") and env.get("GH_TOKEN") else 1)
270
+ sys.exit(2)
271
+ PY
272
+ }
273
+ w3 "$WF" >/dev/null; w3rc=$?
274
+ sed -E 's/^([[:space:]]+)RMG_PR_LOOKUP:/\1# RMG_PR_LOOKUP:/' "$WF" > "$TMPD/wf_mut.yml"
275
+ w3 "$TMPD/wf_mut.yml" >/dev/null; w3m=$?
276
+ if [ "$w3rc" -eq 0 ] && [ "$w3m" -eq 1 ] && /usr/bin/grep -q '# RMG_PR_LOOKUP:' "$TMPD/wf_mut.yml"; then
277
+ ok "W3: Floorless 스텝 env 에 push 조회가 배선됐다 · 그 줄을 주석 처리한 사본은 빨강(되돌림 컨트롤 살아 있음)"
278
+ else
279
+ ng "W3: push 조회 배선 판정 어긋남 (실물 rc=$w3rc · 주석 사본 rc=$w3m — 3 = PyYAML 없음 · 2 = 스텝 못 찾음)"
280
+ fi
185
281
  fi
186
282
 
187
283
  echo
@@ -100,6 +100,13 @@ _lane "⑤c-M «## 🟥 이 새벽이 잡은 것» is not the section" "$CA"
100
100
  - x')"
101
101
  _lane "⑤c-C no fh_completed file → no ⑤-catches line" '⑤-catches' 0 "$(_fixture 0 '')"
102
102
 
103
+ # ⑤-done-anchor record-only line (2026-11-14): bare «완료» is named; an anchored one is not
104
+ DA='ⓘ ⑤-done-anchor'
105
+ _lane "⑤d-N bare «완료» line → named" "$DA" 1 "$(_fixture 0 '- 수리 완료')"
106
+ _lane "⑤d-P «완료» with PR + sha → silent" "$DA" 0 "$(_fixture 0 '- 수리 완료 — #1097 merged a1b2c3d4')"
107
+ _lane "⑤d-P2 «완료» with a file path → silent" "$DA" 0 "$(_fixture 0 '- 문서 완료 scripts/foo.sh · 미해결: 없음')"
108
+ _lane "⑤d-C no done-word at all → silent" "$DA" 0 "$(_fixture 0 '- 항목 하나')"
109
+
103
110
  # ⑤ card-last fixture premise — the two ⑤ lanes are ORDERING lanes: each asserts what the subject
104
111
  # does when one file is strictly newer than another. Establishing that ordering by writing one file
105
112
  # after the other is not establishing it — it is hoping for it.