@chrono-meta/fh-gate 3.29.0 β†’ 3.31.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 (47) hide show
  1. package/.claude-plugin/marketplace.json +4 -4
  2. package/AGENTS.md +7 -2
  3. package/CLAUDE.md +1 -1
  4. package/README.ja.md +6 -5
  5. package/README.ko.md +6 -5
  6. package/README.md +15 -5
  7. package/README.zh.md +6 -5
  8. package/docs/REFERENCE.md +6 -5
  9. package/docs/USER_GUIDE.md +3 -0
  10. package/knowledge/shared/harness-core/claude_md_gate_details.md +1 -1
  11. package/knowledge/shared/harness-core/dispatch_conditional_prohibition.md +42 -0
  12. package/knowledge/shared/harness-core/sonnet_floor_doctrine.md +7 -0
  13. package/knowledge/shared/learnings/subagent_invocations_log.yaml +161 -0
  14. package/package.json +6 -1
  15. package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
  16. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  17. package/plugins/fh-meta/CHANGELOG.md +35 -0
  18. package/plugins/fh-meta/skills/install-wizard/SKILL.md +25 -0
  19. package/plugins/fh-meta/skills/install-wizard/SKILL_detail.md +24 -6
  20. package/plugins/fh-meta/skills/phantom-quench/SKILL.md +1 -1
  21. package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
  22. package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
  23. package/scripts/abstract_consult_check.py +573 -0
  24. package/scripts/fh_detach.py +444 -0
  25. package/scripts/mapped_tracks.sh +20 -13
  26. package/scripts/memory_gc_report.py +55 -5
  27. package/scripts/pr_merge_verified.sh +56 -8
  28. package/scripts/selfcheck.sh +85 -6
  29. package/scripts/session_checklist.py +3 -2
  30. package/scripts/session_close_check.sh +1 -1
  31. package/scripts/sim_isolated_run.sh +62 -0
  32. package/scripts/stale_ref_scan.py +47 -3
  33. package/scripts/test_abstract_consult_check_lanes.sh +201 -0
  34. package/scripts/test_fh_detach_lanes.sh +252 -0
  35. package/scripts/test_hook_source_gate_lanes.sh +16 -2
  36. package/scripts/test_mapped_tracks_lanes.sh +55 -1
  37. package/scripts/test_memory_gc_report_lanes.sh +91 -1
  38. package/scripts/test_mutation_probe_lanes.sh +86 -10
  39. package/scripts/test_ollama_panel_lanes.sh +107 -11
  40. package/scripts/test_pr_merge_verified_lanes.sh +48 -1
  41. package/scripts/test_prepush_real_fire_lanes.sh +215 -0
  42. package/scripts/test_selfcheck_state_lanes.sh +73 -1
  43. package/scripts/test_session_checklist_lanes.sh +34 -0
  44. package/scripts/test_sim_isolated_run_lanes.sh +88 -0
  45. package/scripts/test_stale_ref_scan_lanes.sh +11 -1
  46. package/templates/.git-hooks/pre-push +82 -1
  47. package/templates/CLAUDE.md +16 -0
@@ -16,7 +16,14 @@
16
16
  # πŸŸ₯ This script does not decide whether to merge. Approval is still yours β€” it only makes the
17
17
  # verification impossible to forget once you do.
18
18
  #
19
- # USAGE bash scripts/pr_merge_verified.sh <pr-number> --rerun '<command>' [--repo <path>]
19
+ # USAGE bash scripts/pr_merge_verified.sh <pr-number> --rerun '<command>' [--repo <path>] [--lease '<label>']
20
+ # RECEIPT once GitHub has accepted the merge request (every outcome from there: verified Β· verify failed Β· queued/not completed Β·
21
+ # merged from another head Β· not fetchable β€” never for a refusal or a merge GitHub did not take) one JSON line goes to
22
+ # ${PMV_RECEIPTS:-<git common dir>/fh-merge-receipts.jsonl} β€” local, never pushed: pr Β· head Β· merge Β· outcome Β·
23
+ # actor (agent-session:claude-code when CLAUDECODE is set, else human-or-unknown β€” a human cannot be proven) Β·
24
+ # lease (the --lease label of the standing approval the caller merges under, else NONE β€” recorded, not enforced) Β· rerun.
25
+ # Why: arXiv:2610.28683 β€” 27% of merges that passed a Β«non-author reviewΒ» gate rested on an agent approving under a
26
+ # human account; who decided must be on the record, not inferred later (frontier digest 2026-10-23).
20
27
  # EXIT 0 merged + verified Β· 1 merged but verify FAILED (the merge stands β€” act on it)
21
28
  # 2 usage (nothing merged) Β· 3 trivial --rerun refused (nothing merged)
22
29
  # 4 harness error (see message: before or after the merge)
@@ -26,13 +33,14 @@
26
33
  # (gh non-zero but GitHub says MERGED β†’ continue to verify; state unreadable β†’ 4, outcome UNKNOWN)
27
34
 
28
35
  set -uo pipefail
29
- PR=""; RERUN=""; RERUN_SET=0; REPO="."
36
+ PR=""; RERUN=""; RERUN_SET=0; REPO="."; LEASE="NONE"
30
37
  _need() { [ $# -ge 2 ] || { echo "πŸŸ₯ $1 needs a value" >&2; exit 2; }; }
31
38
  while [ $# -gt 0 ]; do
32
39
  case "$1" in
33
40
  --rerun) _need "$@"; RERUN="${2-}"; RERUN_SET=1; shift 2 ;;
34
41
  --repo) _need "$@"; REPO="${2:-}"; shift 2 ;;
35
- -h|--help) sed -n '2,24p' "$0"; exit 0 ;;
42
+ --lease) _need "$@"; LEASE="${2-}"; [ -n "$LEASE" ] || { echo "πŸŸ₯ --lease needs a non-empty label" >&2; exit 2; }; shift 2 ;;
43
+ -h|--help) sed -n '2,30p' "$0"; exit 0 ;;
36
44
  -*) echo "unknown arg: $1" >&2; exit 2 ;;
37
45
  *) [ -z "$PR" ] || { echo "πŸŸ₯ one PR number only" >&2; exit 2; }; PR="$1"; shift ;;
38
46
  esac
@@ -48,6 +56,23 @@ bash "$PSV" --precheck --rerun "$RERUN" >/dev/null; _pc=$?
48
56
 
49
57
  cd "$REPO" || { echo "πŸŸ₯ HARNESS-ERROR (before merge): cannot cd $REPO" >&2; exit 4; }
50
58
 
59
+ # receipt (after GitHub accepted the merge request β€” a queued merge counts: the request was made under this actor/lease). Best-effort: a receipt that cannot be written is said, never silently skipped,
60
+ # and never changes the exit code β€” the merge already happened.
61
+ _receipt() { # outcome merge_oid
62
+ local f="${PMV_RECEIPTS:-}"
63
+ if [ -z "$f" ]; then local gd; gd=$(git rev-parse --git-common-dir 2>/dev/null) || gd=""; [ -n "$gd" ] && f="$gd/fh-merge-receipts.jsonl"; fi
64
+ local actor="human-or-unknown"; [ -n "${CLAUDECODE:-}" ] && actor="agent-session:claude-code"
65
+ if [ -z "$f" ] || ! PMV_R_PR="$PR" PMV_R_HEAD="$HEAD_OID" PMV_R_MERGE="${2:-}" PMV_R_OUT="$1" PMV_R_ACTOR="$actor" PMV_R_LEASE="$LEASE" \
66
+ PMV_R_RERUN="$RERUN" python3 -c 'import json,os,time
67
+ e=os.environ
68
+ print(json.dumps({"at":time.strftime("%Y-%m-%dT%H:%M:%S%z"),"pr":int(e["PMV_R_PR"]),"head":e["PMV_R_HEAD"],"merge":e["PMV_R_MERGE"] or None,
69
+ "outcome":e["PMV_R_OUT"],"actor":e["PMV_R_ACTOR"],"lease":e["PMV_R_LEASE"],"rerun":e["PMV_R_RERUN"]},ensure_ascii=False))' >> "$f" 2>/dev/null; then
70
+ echo "⚠️ merge receipt NOT written (${f:-no git dir}) β€” record by hand: PR #$PR $1 actor=$actor lease=$LEASE" >&2
71
+ else
72
+ echo "── receipt: $f (actor=$actor Β· lease=$LEASE Β· $1)"
73
+ fi
74
+ }
75
+
51
76
  # 1. head before merge
52
77
  HEAD_OID=$(gh pr view "$PR" --json headRefOid -q .headRefOid < /dev/null) || HEAD_OID=""
53
78
  [ -n "$HEAD_OID" ] || { echo "πŸŸ₯ HARNESS-ERROR (before merge): could not read PR #$PR head" >&2; exit 4; }
@@ -56,6 +81,28 @@ git cat-file -e "$HEAD_OID^{commit}" 2>/dev/null \
56
81
  || { echo "πŸŸ₯ HARNESS-ERROR (before merge): PR head $HEAD_OID not fetchable β€” not merging" >&2; exit 4; }
57
82
  echo "── PR #$PR head recorded: $HEAD_OID"
58
83
 
84
+ # 1b. coverage advisory β€” WARNING ONLY (never changes rc, never merges or refuses). post_squash_verify's precheck rejects a
85
+ # command that is trivially empty; it cannot see a command that is real but never touches this PR's files. Static, pre-merge,
86
+ # no execution: does any word of --rerun (or a tracked script it names) mention a path/basename this PR changes?
87
+ _changed=$(git -c core.quotepath=off diff --name-only "$(git merge-base origin/main "$HEAD_OID" 2>/dev/null || echo "$HEAD_OID^")" "$HEAD_OID" < /dev/null 2>/dev/null) || _changed=""
88
+ if [ -n "$_changed" ]; then
89
+ _hay="$RERUN"
90
+ set -f # split --rerun into words WITHOUT globbing it against the checkout (cross-family R1: `echo *` listed dirs)
91
+ for _w in $RERUN; do # unquoted on purpose: split into words; a word naming a tracked FILE adds that file's text (a runner script)
92
+ _w="${_w//[\"\';|&()]/}"
93
+ [ -n "$_w" ] && [ "$(git cat-file -t "$HEAD_OID:$_w" < /dev/null 2>/dev/null)" = blob ] \
94
+ && _wc=$(git show "$HEAD_OID:$_w" < /dev/null 2>/dev/null) && _hay="$_hay $_wc"
95
+ done
96
+ set +f
97
+ _hay=" $(printf '%s' "$_hay" | tr -s '[:space:]"'"'"';|&()' ' ') "
98
+ _hit=0
99
+ while IFS= read -r _f; do
100
+ [ -n "$_f" ] || continue
101
+ case "$_hay" in *" $_f "*|*" $(basename "$_f") "*) _hit=1; break ;; esac
102
+ done <<< "$_changed"
103
+ [ "$_hit" -eq 1 ] || echo "⚠️ --rerun mentions none of this PR's $(printf '%s\n' "$_changed" | wc -l | tr -d ' ') changed file(s) (nor any script it names) β€” it may not exercise the change. Advisory only; merging continues." >&2
104
+ fi
105
+
59
106
  # 2. merge
60
107
  # πŸŸ₯ cross-family W1: pin the merge to the head we RECORDED. Without it, a push landing between the
61
108
  # record and the merge gets squashed in unverified, and Β«merged and verifiedΒ» describes a commit
@@ -76,7 +123,7 @@ if ! gh pr merge "$PR" --squash --delete-branch --admin --match-head-commit "$HE
76
123
  MERGED)
77
124
  # MERGED alone does not say WHICH head merged β€” someone may have pushed and merged after we
78
125
  # recorded (codex A2). Only the recorded head may continue to verification.
79
- [ "$HO" = "$HEAD_OID" ] || { echo "πŸŸ₯ HARNESS-ERROR: gh pr merge failed, and PR #$PR is MERGED from head ${HO:-?}, not the recorded $HEAD_OID β€” NOT verified" >&2; exit 4; }
126
+ [ "$HO" = "$HEAD_OID" ] || { _receipt "merged-other-head-not-verified" ""; echo "πŸŸ₯ HARNESS-ERROR: gh pr merge failed, and PR #$PR is MERGED from head ${HO:-?}, not the recorded $HEAD_OID β€” NOT verified" >&2; exit 4; }
80
127
  echo "⚠️ gh pr merge exited non-zero; GitHub reports MERGED from the recorded head β€” continuing to verify" >&2
81
128
  echo " the head branch may still exist on origin β€” delete it by hand if so" >&2 ;;
82
129
  # πŸŸ₯ a persistent OPEN cannot prove nothing merged (state may still be stale) β€” say what was seen
@@ -94,19 +141,20 @@ MC=$(gh pr view "$PR" --json mergeCommit -q .mergeCommit.oid < /dev/null) || MC=
94
141
  if [ "$ST" != "MERGED" ] || [ -z "$MC" ] || [ "$MC" = "null" ]; then
95
142
  echo "πŸŸ₯ merge ACCEPTED but not completed (state=${ST:-?} mergeCommit=${MC:-none}) β€” queued or lagging." >&2
96
143
  echo " NOT verified. When it lands: bash $PSV --tip $HEAD_OID --merge <merge commit> --rerun '<cmd>'" >&2
144
+ _receipt "accepted-not-completed" ""
97
145
  exit 6
98
146
  fi
99
147
  git fetch -q origin < /dev/null 2>/dev/null || true
100
148
  # W2 (B): a narrow/single-branch refspec may not bring the merge commit β€” ask for it by oid too
101
149
  git cat-file -e "$MC^{commit}" 2>/dev/null || git fetch -q origin "$MC" < /dev/null 2>/dev/null || true
102
150
  git cat-file -e "$MC^{commit}" 2>/dev/null \
103
- || { echo "πŸŸ₯ HARNESS-ERROR (AFTER merge): merge commit $MC not fetchable β€” run post_squash_verify by hand with --tip $HEAD_OID --merge $MC" >&2; exit 4; }
151
+ || { _receipt "merged-not-fetchable" "$MC"; echo "πŸŸ₯ HARNESS-ERROR (AFTER merge): merge commit $MC not fetchable β€” run post_squash_verify by hand with --tip $HEAD_OID --merge $MC" >&2; exit 4; }
104
152
  echo "── merged as $MC"
105
153
 
106
154
  # 4. verify
107
155
  bash "$PSV" --repo . --tip "$HEAD_OID" --merge "$MC" --rerun "$RERUN"; rc=$?
108
156
  case "$rc" in
109
- 0) echo "βœ… PR #$PR merged and verified"; exit 0 ;;
110
- 1) echo "πŸŸ₯ PR #$PR IS MERGED but verification FAILED β€” the merge stands; fix forward or revert" >&2; exit 1 ;;
111
- *) echo "πŸŸ₯ HARNESS-ERROR (AFTER merge): post_squash_verify rc=$rc β€” PR #$PR is merged, verification did not complete" >&2; exit 4 ;;
157
+ 0) _receipt "verified" "$MC"; echo "βœ… PR #$PR merged and verified"; exit 0 ;;
158
+ 1) _receipt "verify-failed" "$MC"; echo "πŸŸ₯ PR #$PR IS MERGED but verification FAILED β€” the merge stands; fix forward or revert" >&2; exit 1 ;;
159
+ *) _receipt "verify-incomplete" "$MC"; echo "πŸŸ₯ HARNESS-ERROR (AFTER merge): post_squash_verify rc=$rc β€” PR #$PR is merged, verification did not complete" >&2; exit 4 ;;
112
160
  esac
@@ -970,8 +970,12 @@ fi
970
970
  # `SELFCHECK: FAIL` with no FAIL line in 6,236 lines β€” the killed suite fell into a bare `*)`
971
971
  # that set fail and printed nothing (fh_signal_2026-10-18_selfcheck-timeout-unlabelled). The
972
972
  # catch-all now names the suite and its rc, so no exit code can fail without a line.
973
- _pair_rc_verdict() { # $1=label $2=subject $3=rc Β· return 1 = counts as a failure
974
- local _lbl="$1" _subj="$2" _rc="$3"
973
+ _pair_rc_verdict() { # $1=label $2=subject $3=rc $4=budget seconds (optional) Β· return 1 = counts as a failure
974
+ # $4 defaults to the table's default rather than being required: the lane suite lifts this
975
+ # function and calls it with three arguments, and so does any future caller that has no budget
976
+ # of its own. A hardcoded "300" in the message below was wrong the moment budgets stopped being
977
+ # one number β€” a verdict line that names a limit the run did not use is a confident wrong fact.
978
+ local _lbl="$1" _subj="$2" _rc="$3" _bud="${4:-${_LANE_BUDGET_DEFAULT:-300}}"
975
979
  case "$_rc" in
976
980
  0) ;;
977
981
  # The suite could not MEASURE. Distinguished from "the lane failed" because the two send a
@@ -990,9 +994,11 @@ _pair_rc_verdict() { # $1=label $2=subject $3=rc Β· return 1 = counts as a failu
990
994
  echo " prove nothing about $_subj. Not a lane failure, and not a pass either."
991
995
  return 1 ;;
992
996
  124)
993
- echo "TIMEOUT $_lbl: exited 124, the code \`timeout\` uses when it kills a suite (limit 300 s) β€”"
997
+ echo "TIMEOUT $_lbl: exited 124, the code \`timeout\` uses when it kills a suite (budget ${_bud} s) β€”"
994
998
  echo " not measured, not a pass. A suite that itself exits 124 lands here too."
995
999
  echo " Re-run that suite alone to see whether it hangs or is only slow under load."
1000
+ echo " If it needs longer than ${_bud} s on a healthy host, raise ITS budget in"
1001
+ echo " _lane_budget() with the measurement that set the number β€” do not raise the default."
996
1002
  return 1 ;;
997
1003
  *)
998
1004
  echo "FAIL $_lbl (rc=$_rc) β€” see that suite's output above; subject: $_subj"
@@ -1000,7 +1006,44 @@ _pair_rc_verdict() { # $1=label $2=subject $3=rc Β· return 1 = counts as a failu
1000
1006
  esac
1001
1007
  return 0
1002
1008
  }
1003
- _LANE_TO=""; command -v timeout >/dev/null 2>&1 && _LANE_TO="timeout 300"
1009
+ # Per-suite lane budget (2026-10-26). Until today every suite in the loop below ran under one
1010
+ # global `timeout 300`, and that number was invisible: nothing printed how long a suite took, so
1011
+ # the only way to learn a suite was near the limit was for it to cross it.
1012
+ #
1013
+ # MEASURED, in a clean cloud container on 2026-10-26: test_mutation_probe_lanes.sh takes 318–322 s
1014
+ # standalone (3 reps, 122 lanes, all green) and selfcheck killed it at 300. Neither the suite nor
1015
+ # its subject (scripts/mutation_probe.py) had changed since the run where it last passed β€” the host
1016
+ # got slower, the margin was never managed, and the result was one TIMEOUT line standing in for 122
1017
+ # known-pair lanes that went UNMEASURED. Timestamping the suite showed the cost is spread across it
1018
+ # (largest single block +40 s), so "make it faster" is not a small fix and would not be this one.
1019
+ #
1020
+ # So: the budget is per suite, declared next to the measurement that set it, and the loop prints an
1021
+ # advisory line BEFORE the kill when a run eats most of its budget. The default stays 300 β€” a suite
1022
+ # that needs more says so by name, which is the record a reader can argue with.
1023
+ _LANE_BUDGET_DEFAULT=300
1024
+ _LANE_BUDGET_WARN_PCT=80 # advisory at β‰₯80% of budget; advisory only, never a verdict
1025
+ _lane_budget() { # $1=label β†’ budget in seconds
1026
+ case "$1" in
1027
+ # 318–322 s measured standalone (above). 600 is ~1.9Γ— the measured cost: enough head-room for a
1028
+ # host slower than this one, and still a bound β€” not "no timeout", which is how the suite that
1029
+ # detects a broken watchdog would inherit a hang (see the loop's own comment below).
1030
+ test_mutation_probe_lanes.sh) echo 600 ;;
1031
+ *) echo "${_LANE_BUDGET_DEFAULT}" ;;
1032
+ esac
1033
+ }
1034
+ # A run that finished INSIDE its budget but close to it is the state nobody saw last week. It is an
1035
+ # advisory, printed and not counted: a suite at 85% of budget has measured everything it claims to,
1036
+ # and folding "nearly ran out" into FAIL would be the same untyped-verdict defect in the other
1037
+ # direction. `date` only β€” /usr/bin/time is absent in some containers (measured rc=127 here).
1038
+ _lane_margin_note() { # $1=label $2=elapsed s $3=budget s
1039
+ local _lbl="$1" _el="$2" _bud="$3" _pct
1040
+ [ "$_bud" -gt 0 ] 2>/dev/null || return 0
1041
+ _pct=$(( _el * 100 / _bud ))
1042
+ [ "$_pct" -ge "${_LANE_BUDGET_WARN_PCT:-80}" ] || return 0
1043
+ echo "NOTE $_lbl took ${_el} s of its ${_bud} s budget (${_pct}%) β€” it PASSED; this is margin,"
1044
+ echo " not a failure. A slower host crosses the limit and the suite's lanes go UNMEASURED."
1045
+ }
1046
+ _LANE_TO=""; command -v timeout >/dev/null 2>&1 && _LANE_TO="timeout ${_LANE_BUDGET_DEFAULT}"
1004
1047
  for _pair in \
1005
1048
  `# μ‚¬μš© 원μž₯ (2026-09-13 μ‹ μ„€). SUBJECT λ₯Ό 원μž₯ λͺ¨λ“ˆλ‘œ μž‘λŠ”λ‹€ β€” 배선이 λŠκΈ°λŠ” μžλ¦¬λŠ” preprep.py 의 __main__ ν•œ 쀄이 μ•„λ‹ˆλΌ λͺ¨λ“ˆμ΄ μ‚¬λΌμ§€λŠ” μͺ½μ΄κ³ , import κ°€ try/except 라 λͺ¨λ“ˆμ΄ μ—†μœΌλ©΄ 쑰용히 λ¬΄λ™μž‘μœΌλ‘œ λŒμ•„κ°„λ‹€. κ·Έ 무음이 이 레인이 μž‘μ„ 것이닀.` \
1006
1049
  "plugins/fh-preprep/skills/preprep/usage_ledger.py|scripts/test_usage_ledger_lanes.sh" \
@@ -1014,6 +1057,8 @@ for _pair in \
1014
1057
  "scripts/destructive_pre_gate.sh|scripts/test_destructive_pre_gate_lanes.sh" \
1015
1058
  "templates/.git-hooks/pre-push|scripts/test_prepush_destructive_lanes.sh" \
1016
1059
  "templates/.git-hooks/pre-push|scripts/test_prepush_destructive_liveness.sh" \
1060
+ `# μ‹€μ œ git push λ°œν™” 레인 (2026-10-24, ν˜•μ œ ν•˜λ„€μŠ€ νšŒμ‹ ). ν•©μ„± stdin λ ˆμΈμ€ Β«νŒμ •Β» 만 μž°λ‹€ β€” 이 λ ˆμΈμ€ git 이 κ·Έ λ™μž‘μ—μ„œ 훅을 Β«λΆ€λ₯΄λŠ”κ°€ Β· κ·Έ 쀄을 λ„˜κΈ°λŠ”κ°€Β» λ₯Ό μž°λ‹€. --mirror λŠ” μ‚­μ œ 쀄을 μ•ˆ λ„˜κΈ΄λ‹€(μ‹€μΈ‘).` \
1061
+ "templates/.git-hooks/pre-push|scripts/test_prepush_real_fire_lanes.sh" \
1017
1062
  `# ── 증거 vs νŒμ • 토큰 좩돌(2026-09-19). SUBJECT λŠ” 훅이 μ•„λ‹ˆλΌ «되돌림 ν”„λ‘œλΈŒ μžμ‹ Β»μ΄λ‹€ β€” 이 레인이 μž¬λŠ” 것은 게이트의 λ™μž‘μ΄ μ•„λ‹ˆλΌ κ·Έ ν”„λ‘œλΈŒμ˜ «좜λ ₯ 계약»(μžκΈ°κ°€ authored ν•œ μ€„μ—λ§Œ ❌ λ₯Ό μ“΄λ‹€)이고, 이 집계기가 ❌ 둜 μ‹€νŒ¨λ₯Ό νŒμ •ν•˜λ―€λ‘œ λ‘˜μ΄ 같은 채널을 κ³΅μœ ν•œλ‹€. μ‹€μΈ‘: run 35426860480 의 둜그λ₯Ό μ‚¬λžŒμ΄ 두 번 연속 μ˜€κ·€μ†ν–ˆλ‹€ ──` \
1018
1063
  "scripts/test_prepush_destructive_liveness.sh|scripts/test_liveness_echo_token_lanes.sh" \
1019
1064
  "templates/.git-hooks/pre-push|scripts/test_push_zone_lanes.sh" \
@@ -1151,8 +1196,16 @@ do
1151
1196
  # --self-test loop below, because `timeout` is GNU coreutils and stock macOS has neither it nor
1152
1197
  # a substitute; without it `< /dev/null` is the whole defence and a suite that reads stdin ends
1153
1198
  # immediately instead of waiting forever.
1154
- $_LANE_TO bash "$_anc" < /dev/null; _rc=$?
1155
- _pair_rc_verdict "$_lbl" "$_subj" "$_rc" || fail=1
1199
+ # The budget is resolved per suite into a LOCAL variable; `$_LANE_TO` keeps the default and is
1200
+ # read again by two blocks far below this loop (relay_channel, directional_diff_gate), so
1201
+ # reassigning it here would silently hand one suite's budget to unrelated dispatches.
1202
+ _bud="$(_lane_budget "$_lbl")"
1203
+ _lane_to=""; command -v timeout >/dev/null 2>&1 && _lane_to="timeout $_bud"
1204
+ _t0=$(date +%s 2>/dev/null || echo 0)
1205
+ $_lane_to bash "$_anc" < /dev/null; _rc=$?
1206
+ _t1=$(date +%s 2>/dev/null || echo 0)
1207
+ [ "$_t0" -gt 0 ] 2>/dev/null && _lane_margin_note "$_lbl" "$(( _t1 - _t0 ))" "$_bud"
1208
+ _pair_rc_verdict "$_lbl" "$_subj" "$_rc" "$_bud" || fail=1
1156
1209
  elif _pkg_accepted_absent "$_anc"; then
1157
1210
  # DECLARED legitimately unshipped β€” the single source for that answer, not a guess from the
1158
1211
  # environment. The first draft printed "this package predates it", which is a WRONG DIAGNOSIS
@@ -2259,6 +2312,32 @@ else
2259
2312
  fail=1
2260
2313
  fi
2261
2314
 
2315
+ # κ°€λ¦° 질문 솑신 μ „ 검사(κ±°μ£Ό 원칙 μ„Έ 번째 κΈΈ, D1) β€” 레포 μ‹λ³„μž Β· μž‘μ„±μž Β· 원문 쑰각 Β· 운영자 λ¦¬ν„°λŸ΄(μœ„ κ°€λ“œ μž¬μ‚¬μš©).
2316
+ # 레인이 κ±Έλ¦Ό/톡과 μ•„λŠ” 쌍과 λ―ΈμΈ‘μ • 6갈래(사전 Β· κ°€λ“œ Β· 레포 Β· 빈 λͺ©λ‘ Β· 빈 질문 Β· 곡개 λ§λ­‰μΉ˜)λ₯Ό 같이 μž°λ‹€. 호좜자 0 β€” κΈ°λ³Έ 꺼짐.
2317
+ if [ ! -f scripts/abstract_consult_check.py ]; then
2318
+ _absent_subject_verdict "test_abstract_consult_check_lanes.sh" "scripts/abstract_consult_check.py" || fail=1
2319
+ elif [ -f scripts/test_abstract_consult_check_lanes.sh ]; then
2320
+ if ! bash scripts/test_abstract_consult_check_lanes.sh; then
2321
+ fail=1
2322
+ fi
2323
+ else
2324
+ echo "FAIL test_abstract_consult_check_lanes.sh: abstract_consult_check.py present but its anchor is missing"
2325
+ fail=1
2326
+ fi
2327
+
2328
+ # λ–ΌκΈ° β€” install-wizard κ°€ μ“΄ ν”μ λ§Œ λ˜λŒλ¦°λ‹€. λ ˆμΈμ€ λ§ˆλ²•μ‚¬ λ¬Έμ„œμ˜ μ„€μΉ˜ 블둝을 κ·ΈλŒ€λ‘œ 뽑아 μž„μ‹œ HOME μ—μ„œ 돌리고,
2329
+ # λ–ΌκΈ° λ’€ νŠΈλ¦¬κ°€ μ„€μΉ˜ μ „κ³Ό λ°”μ΄νŠΈκΉŒμ§€ 같은지 λ³Έλ‹€(μ‚¬μš©μž 자기 ν›… Β· 고친 볡사본 Β· μ˜› 판 훅은 남기고 LEFT).
2330
+ if [ ! -f scripts/fh_detach.py ]; then
2331
+ _absent_subject_verdict "test_fh_detach_lanes.sh" "scripts/fh_detach.py" || fail=1
2332
+ elif [ -f scripts/test_fh_detach_lanes.sh ]; then
2333
+ if ! bash scripts/test_fh_detach_lanes.sh; then
2334
+ fail=1
2335
+ fi
2336
+ else
2337
+ echo "FAIL test_fh_detach_lanes.sh: fh_detach.py present but its anchor is missing"
2338
+ fail=1
2339
+ fi
2340
+
2262
2341
  # outbound-query PreToolUse ν›… β€” μœ„ CLI κ°€λ“œμ˜ **λ°°μ„ **(WebSearch|WebFetch). 레인이 두 μΈ΅ νŒμ •
2263
2342
  # (overrideβ†’deny Β· defaultsβ†’advisory), λ―ΈμΈ‘μ • 4κ°€μ§€β†’deny, N/A 무음, 그리고 πŸŸ₯ «좜λ ₯에 토큰 값이
2264
2343
  # μ—†λ‹€Β»(H10)λ₯Ό 각각 짝으둜 μž‘λŠ”λ‹€. λ§ˆμ§€λ§‰ 것이 이 ν›…μ˜ 쑴재 이유λ₯Ό μ§€ν‚€λŠ” λ ˆμΈμ΄λ‹€.
@@ -962,7 +962,8 @@ def do_unblocked(file_path):
962
962
  rid = re.sub(r"[^A-Za-z0-9]", "", cells[idx_num]).upper()
963
963
  if not rid:
964
964
  continue
965
- keys = classify_status(cells[idx_status] if idx_status < len(cells) else "")
965
+ # an empty/invalid status cell classifies to None β€” that row is open (idle), never a crash
966
+ keys = classify_status(cells[idx_status] if idx_status < len(cells) else "") or set()
966
967
  status_by_id[rid] = keys
967
968
  rows_flat.append((rid, keys, cells))
968
969
 
@@ -973,7 +974,7 @@ def do_unblocked(file_path):
973
974
  # open rows collapsed two different nothings into the same rc=4: "every dependency was
974
975
  # resolved and closed" and "nobody ever wrote a dependency". The first is a clean run; the
975
976
  # second is an unread channel. (Β«not foundΒ» is not Β«0Β» β€” the named family in this repo.)
976
- idle = not ("DONE" in keys or "n/a" in keys)
977
+ idle = not ("DONE" in keys or "N/A" in keys) # classify_status returns the key "N/A", never "n/a"
977
978
  joined = " | ".join(cells)
978
979
  for m in DEP_RE.finditer(joined):
979
980
  dep = m.group(1).upper()
@@ -967,7 +967,7 @@ else
967
967
  _sr_uns=$(printf '%s' "$_sr_v" | sed -n 's/.*UNSCANNABLE=\([0-9]*\).*/\1/p')
968
968
  if [ "${_sr_sup:-0}" -gt 0 ] 2>/dev/null; then
969
969
  echo "⚠️ β‘ -g stale-ref: ${_sr_sup} 개 id κ°€ 폐기된 버전을 가리킨닀 β€” advisory, 막지 μ•ŠλŠ”λ‹€."
970
- echo " πŸŸ₯ μ˜λ„ν•œ pin 일 수 μžˆλ‹€ β€” 눈으둜 ν™•μΈν•˜κ³  고쳐라(고정이면 νŒŒμΌμ— 'stale-ref: pinned')."
970
+ echo " πŸŸ₯ μ˜λ„ν•œ pin 일 수 μžˆλ‹€ β€” 눈으둜 ν™•μΈν•˜κ³  고쳐라(λ°œν–‰ μŠ€λƒ…μƒ·μ΄λ©΄ 파일 첫머리에 '<!-- stale-ref: pinned -->', μ˜› νŒμ„ μΌλΆ€λŸ¬ κ°€λ¦¬ν‚€λŠ” ν•œ 쀄이면 κ·Έ 쀄에 '<!-- stale-ref: pinned-line=<id> -->'). μΌλΆ€λŸ¬ λΉ¨κ°›κ²Œ λ‘” 것(예: replace μ „ arXiv 판)은 κ·ΈλŒ€λ‘œ λ‘”λ‹€."
971
971
  printf '%s\n' "$_sr_out" | grep -E '^ +πŸŸ₯ SUPERSEDED' | sed 's/^/ /'
972
972
  fi
973
973
  if [ "${_sr_unr:-0}" -gt 0 ] 2>/dev/null || [ "${_sr_uns:-0}" -gt 0 ] 2>/dev/null; then
@@ -532,6 +532,67 @@ fh_timeout() {
532
532
  OUTDIR="${OUTDIR:-$(mktemp -d "${TMPDIR:-/tmp}/fh-sim-XXXXXX")}"
533
533
  mkdir -p "$OUTDIR"
534
534
 
535
+ # ── ancestor-instruction guard (2026-10-23) ───────────────────────────────────────────────────────
536
+ # πŸŸ₯ Every arm's clone lives under $OUTDIR, and `claude -p` loads CLAUDE.md / CLAUDE.local.md / .claude/rules
537
+ # from EVERY ancestor of its cwd. An --out inside a checkout (e.g. tracks/_meta/<exp>/out) therefore hands
538
+ # every arm the LIVE repo's instructions on top of the clone's own β€” measured 2026-10-23 with a known pair:
539
+ # under the FH checkout 3 instruction files, under /private/tmp NONE. A whole experiment series
540
+ # (P8/P8b/P9) ran that way; agents then edited the live repos by absolute path. Refuse before any arm
541
+ # starts (and again per rep for the wrapper the clone actually lands in β€” a pre-existing w_* can carry
542
+ # its own CLAUDE.md, codex R1). A bare .git is NOT an instruction source and is not refused (codex R1).
543
+ # FH_SIM_ALLOW_INHERIT=1 is the logged override for a run that WANTS the inheritance.
544
+ # --out is resolved to an absolute physical path once, so the walk below and every later `$OUTDIR/...`
545
+ # (including redirects made from inside `cd "$WORK"`) see the same place (Gemini R1: relative --out,
546
+ # logical vs physical symlink paths). An unresolvable --out stops here instead of looping on `dirname ""`.
547
+ OUTDIR=$(cd "$OUTDIR" 2>/dev/null && pwd -P) || { echo "FAIL: --out could not be resolved" >&2; exit 2; }
548
+ [ -n "$OUTDIR" ] || { echo "FAIL: --out resolved to an empty path" >&2; exit 2; }
549
+ # πŸŸ₯ μ‚¬μš©μž μ„€μ • 디렉터리(${CLAUDE_CONFIG_DIR:-$HOME/.claude})λŠ” λͺ¨λ“  νŒ”μ΄ μ–΄μ°¨ν”Ό μ‹£λŠ”λ‹€ β€” μ›Œν¬κ°€ κ·Έ .claude 의 λΆ€λͺ¨(보톡 $HOME)에
550
+ # λ‹Ώμ•˜μ„ λ•Œ κ·Έ μ•ˆμ˜ CLAUDE.md/CLAUDE.local.md/AGENTS.md/rules λŠ” hit κ°€ μ•„λ‹ˆλ‹€(μ•„λž˜ 정보 쀄이 ν•œ 번 μ°λŠ”λ‹€). $HOME 에 직접 놓인
551
+ # CLAUDE.md λŠ” μ—¬μ „νžˆ hit. 물리 경둜(pwd -P)둜 비ꡐ해 심볼릭 HOME/μ„€μ • 디렉터리도 κ°™κ²Œ λ™μž‘ν•œλ‹€.
552
+ _user_cfg="${CLAUDE_CONFIG_DIR:-$HOME/.claude}"
553
+ _user_cfg_phys=$(cd "$_user_cfg" 2>/dev/null && pwd -P) || _user_cfg_phys=""
554
+ FH_SIM_REPORTED_HITS=" " # 이미 κ²½κ³ ν•œ hit β€” --reps N μ—μ„œ 같은 κ²½κ³ λ₯Ό λ§€ rep λ°˜λ³΅ν•˜μ§€ μ•ŠλŠ”λ‹€
555
+ fh_sim_instr_hits() { # $1=absolute dir β†’ prints instruction sources in $1 and every ancestor (space-separated)
556
+ local d="$1" n hits="" skipclaude cp
557
+ while [ -n "$d" ]; do
558
+ skipclaude=0
559
+ if [ -n "$_user_cfg_phys" ] && [ -d "$d/.claude" ]; then
560
+ cp=$(cd "$d/.claude" 2>/dev/null && pwd -P) && [ "$cp" = "$_user_cfg_phys" ] && skipclaude=1
561
+ fi
562
+ for n in CLAUDE.md CLAUDE.local.md .claude/CLAUDE.md .claude/CLAUDE.local.md AGENTS.md .claude/AGENTS.md; do # not GEMINI.md: Claude does not load it (codex R2)
563
+ case "$n" in .claude/*) [ "$skipclaude" = 1 ] && continue ;; esac
564
+ [ -e "$d/$n" ] && hits="$hits $d/$n"
565
+ done
566
+ if [ "$skipclaude" = 0 ] && [ -d "$d/.claude/rules" ] && [ -n "$(find -L "$d/.claude/rules" -name '*.md' -print 2>/dev/null | head -1)" ]; then # -L: symlinked rules dirs load too (codex R2)
567
+ hits="$hits $d/.claude/rules/"
568
+ fi
569
+ [ "$d" = "/" ] && break
570
+ d=$(dirname "$d")
571
+ done
572
+ printf '%s' "$hits"
573
+ }
574
+ fh_sim_refuse_inherit() { # $1=dir $2=what β†’ returns 0 to proceed, exits 2 on refusal
575
+ local hits h newhits=""; hits=$(fh_sim_instr_hits "$1")
576
+ [ -z "$hits" ] && return 0
577
+ if [ "${FH_SIM_ALLOW_INHERIT:-0}" = 1 ]; then
578
+ for h in $hits; do
579
+ case "$FH_SIM_REPORTED_HITS" in *" $h "*) ;; *) newhits="$newhits $h"; FH_SIM_REPORTED_HITS="$FH_SIM_REPORTED_HITS$h " ;; esac
580
+ done
581
+ [ -n "$newhits" ] && echo "⚠️ FH_SIM_ALLOW_INHERIT=1 β€” arms WILL inherit ($2):$newhits" >&2
582
+ return 0
583
+ fi
584
+ echo "πŸŸ₯ REFUSED: $2 ($1) sits under instruction files β€” every arm would load them:$hits" >&2
585
+ echo " use an --out outside any checkout and outside \$HOME (default: mktemp under \$TMPDIR), or FH_SIM_ALLOW_INHERIT=1 if inheritance is the point" >&2
586
+ exit 2
587
+ }
588
+ fh_sim_refuse_inherit "$OUTDIR" "--out"
589
+ # User-level instructions load for every project whatever the cwd β€” not refused (identical for every arm),
590
+ # but printed so a reader of the run knows they were there (codex R1).
591
+ _user_instr=""
592
+ [ -e "$_user_cfg/CLAUDE.md" ] && _user_instr="$_user_instr $_user_cfg/CLAUDE.md"
593
+ [ -d "$_user_cfg/rules" ] && [ -n "$(find -L "$_user_cfg/rules" -name '*.md' -print 2>/dev/null | head -1)" ] && _user_instr="$_user_instr $_user_cfg/rules/"
594
+ [ -n "$_user_instr" ] && echo "ℹ️ user-level instructions load in every arm (same for all, not refused):$_user_instr" >&2
595
+
535
596
  # ── machine-surface snapshot ──────────────────────────────────────────────────────────────────
536
597
  # Enumerated, not guessed. Each line is a surface a past run actually touched or plausibly could.
537
598
  # `not found` is written as `ABSENT`, never as an empty string β€” an unreadable surface and an
@@ -581,6 +642,7 @@ for r in $(seq 1 "$REPS"); do
581
642
  # isolated, but their EXISTENCE leaked into the arm's reasoning, which is enough to change an
582
643
  # answer about "what projects are around". Isolation has to hold for the parent too.
583
644
  WRAP="$OUTDIR/w_${ARM}_r${r}"; mkdir -p "$WRAP"
645
+ fh_sim_refuse_inherit "$(cd "$WRAP" && pwd -P)" "rep wrapper" # a pre-existing w_* may carry its own instructions
584
646
  WORK="$WRAP/repo"
585
647
  # A disposable clone per REP, not per arm: two reps of the same arm contaminate each other
586
648
  # exactly as two different arms do. That was the measured failure β€” reps 1 and 2 of build_cron.
@@ -95,7 +95,16 @@ CHANGELOG_WORD_RE = re.compile(_CL_WORDS, re.IGNORECASE)
95
95
  #: λ˜λ―€λ‘œ ꡬ쑰적으둜 수리 λΆˆκ°€λŠ₯ν•œ SUPERSEDED λ₯Ό 영ꡬ히 λ‚Έλ‹€(μ λŒ€κ²€μ¦ A-5: 이 λ ˆν¬μ—λ§Œ μ…‹).
96
96
  #: 만쑱 λΆˆκ°€λŠ₯ν•œ μš”κ΅¬λŠ” override λ₯Ό ν›ˆλ ¨μ‹œν‚€λ―€λ‘œ, 파일이 슀슀둜 «이건 μŠ€λƒ…μƒ·μ΄λ‹€Β» 라고
97
97
  #: 말할 μˆ˜λ‹¨μ„ μ€€λ‹€. πŸŸ₯ **파일λͺ… 좔둠이 μ•„λ‹ˆλΌ «파일이 μ„ μ–Έν•œ 것»** 이닀 β€” 좔둠은 쑰용히 ν‹€λ¦°λ‹€.
98
- PIN_MARKER_RE = re.compile(r"stale-ref:\s*pinned", re.IGNORECASE)
98
+ #: πŸŸ₯ (2026-10-23) 선언은 **HTML 주석 μ•ˆμ—μ„œλ§Œ**, 낱말은 **κ²½κ³„κΉŒμ§€**: 산문이 마컀 문법을 μ–ΈκΈ‰λ§Œ 해도
99
+ #: 파일이 ν†΅μ§Έλ‘œ κΊΌμ§€λ˜ 것(Argon R1 #4)κ³Ό `pinned-off` Β· `pinned_line` 같은 접두 일치(#2)λ₯Ό λ‹«λŠ”λ‹€.
100
+ PIN_MARKER_RE = re.compile(r"<!--\s*stale-ref:\s*pinned(?=\s|-->)", re.IGNORECASE)
101
+ #: πŸŸ₯ **쀄 λ‹¨μœ„ pin (2026-10-23).** μ‚΄μ•„ μžˆλŠ” λ¬Έμ„œ μ•ˆμ—μ„œ Β«v1 논문은 μ˜› 이름을 μ“΄λ‹€Β» 처럼 μ˜› νŒμ„
102
+ #: μΌλΆ€λŸ¬ κ°€λ¦¬ν‚€λŠ” ν•œ 쀄 λ•Œλ¬Έμ— 파일 전체λ₯Ό pin ν•˜λ©΄, κ·Έ νŒŒμΌμ— 뒀에 μƒκΈ°λŠ” μ§„μ§œ 낑은 μΈμš©κΉŒμ§€ λ¬»νžŒλ‹€.
103
+ #: ν˜•μ‹ `<!-- stale-ref: pinned-line=<id>[,<id>] -->` β€” **이름 뢙인 id 만** κ·Έ μ€„μ—μ„œ 기둝으둜 μΉœλ‹€.
104
+ #: 같은 쀄(ν‘œμ˜ ν•œ ν–‰)의 λ‹€λ₯Έ DOI λŠ” μ‚΄μ•„ μžˆλ‹€(Argon R1 #3). id μ—†λŠ” ν˜•μ‹ Β· `pinned-lines` Β·
105
+ #: `pinned-line-disabled` λŠ” 선언이 μ•„λ‹ˆλ‹€(접두 μΌμΉ˜λŠ” 낑은 μΈμš©μ„ 쑰용히 μˆ¨κΈ΄λ‹€, codex R1). `-->`
106
+ #: μ•ž 곡백은 없어도 λœλ‹€(Argon R1 #1). 쀄 pin 은 `pinned` λ’€κ°€ `-` 라 파일 pin 으둜 λ²ˆμ§€μ§€ μ•ŠλŠ”λ‹€(β“•-3).
107
+ LINE_PIN_RE = re.compile(r"<!--\s*stale-ref:\s*pinned-line=(\d+(?:,\d+)*)\s*-->", re.IGNORECASE)
99
108
 
100
109
  #: λͺ» 읽은 μž…λ ₯의 νŒλ³„ β€” NUL λ°”μ΄νŠΈ λ˜λŠ” λ””μ½”λ“œ μ‹€νŒ¨μœ¨. μ λŒ€κ²€μ¦ S-1.
101
110
  UNSCANNABLE_REPLACEMENT_RATIO = 0.02
@@ -143,7 +152,8 @@ def scan_body(path, lines):
143
152
  for the printed snippet. `in_changelog` reflects the flag's state AFTER this line is checked for a
144
153
  heading, so a heading line itself and everything after it (same file) are marked True."""
145
154
  in_changelog = False
146
- pinned = any(PIN_MARKER_RE.search(l) for l in lines[:40])
155
+ # μ•ž 40쀄을 ν•©μ³μ„œ μ°ΎλŠ”λ‹€ β€” 주석이 `<!--` / `stale-ref: pinned` / `-->` 둜 μ—¬λŸ¬ 쀄에 걸쳐도 선언이닀(codex R2)
156
+ pinned = bool(PIN_MARKER_RE.search("\n".join(lines[:40])))
147
157
  sites = []
148
158
  for i, line in enumerate(lines, 1):
149
159
  if is_changelog_heading(line):
@@ -151,9 +161,11 @@ def scan_body(path, lines):
151
161
  if pinned:
152
162
  in_changelog = True # μŠ€λƒ…μƒ· 파일 전체λ₯Ό «기둝» 으둜 μ·¨κΈ‰
153
163
  flat = TAG_RE.sub("", line)
164
+ # 원문 μ€„μ—μ„œ μ°ΎλŠ”λ‹€ β€” λ§ˆμ»€κ°€ HTML 주석이라 TAG_RE κ°€ μ§€μš΄λ‹€
165
+ line_pinned = {x for m in LINE_PIN_RE.finditer(line) for x in m.group(1).split(",")}
154
166
  for m in ZID_RE.finditer(flat):
155
167
  snippet = line.strip()[:140]
156
- sites.append((i, m.group(1), snippet, in_changelog))
168
+ sites.append((i, m.group(1), snippet, in_changelog or m.group(1) in line_pinned))
157
169
  return sites
158
170
 
159
171
 
@@ -355,6 +367,38 @@ def run_self_check():
355
367
  got = [(r, inc) for _, r, _, inc in scan_body("x.html", pin)]
356
368
  lane("exclude: 'stale-ref: pinned' marks the whole file a record", got == [("20397566", True)], str(got))
357
369
 
370
+ # β“•-2 쀄 pin β€” κ·Έ μ€„μ˜ «이름 뢙인 idΒ» 만 기둝, 같은 파일의 λ‹€λ₯Έ μΈμš©μ€ μ‚΄μ•„ μžˆλ‹€
371
+ lp = ['The v1 paper (Zenodo 10.5281/zenodo.20397566) cites the old name <!-- stale-ref: pinned-line=20397566 -->',
372
+ 'cite 10.5281/zenodo.22542168 for the method']
373
+ got = [(r, inc) for _, r, _, inc in scan_body("x.md", lp)]
374
+ lane("exclude: 'pinned-line=<id>' excludes only that id on its own line",
375
+ got == [("20397566", True), ("22542168", False)], str(got))
376
+
377
+ # β“•-3 πŸŸ₯ known-NEGATIVE β€” μ•ž 40쀄 μ•ˆμ˜ 쀄 pin 이 파일 pin 으둜 λ²ˆμ§€μ§€ μ•ŠλŠ”λ‹€(같은 id κ°€ μ•„λž˜ 쀄에 λ‹€μ‹œ)
378
+ got = [inc for _, _, _, inc in scan_body("x.md", lp[:1] + ['later 10.5281/zenodo.20397566 again'])]
379
+ lane("exclude NEG: a line pin is not a file pin", got == [True, False], str(got))
380
+
381
+ # β“•-4 πŸŸ₯ known-NEGATIVE β€” 선언이 μ•„λ‹Œ 것듀: κΈ΄ 낱말 Β· id μ—†μŒ Β· μ‚°λ¬Έ μ–ΈκΈ‰ Β· 파일 pin 접두
382
+ near = ['a 10.5281/zenodo.20397566 <!-- stale-ref: pinned-line-disabled -->',
383
+ 'b 10.5281/zenodo.20397566 <!-- stale-ref: pinned-lines=20397566 -->',
384
+ 'c 10.5281/zenodo.20397566 <!-- stale-ref: pinned-line -->',
385
+ 'd 10.5281/zenodo.20397566 write `stale-ref: pinned-line=20397566` to pin a line']
386
+ got = [inc for _, _, _, inc in scan_body("x.md", near)]
387
+ lane("exclude NEG: near-miss / id-less / prose markers are not line pins", got == [False] * 4, str(got))
388
+ for fp in ('<!-- stale-ref: pinned-off -->', '<!-- stale-ref: pinned_line -->', 'see `stale-ref: pinned` in prose'):
389
+ got = [inc for _, _, _, inc in scan_body("x.md", [fp, 'cite 10.5281/zenodo.20397566'])]
390
+ lane("exclude NEG: %r is not a file pin" % fp, got == [False], str(got))
391
+
392
+ # β“•-4b μ—¬λŸ¬ 쀄 μ£Όμ„μ˜ 파일 pin 도 선언이닀(codex R2 β€” μ€„λ§ˆλ‹€ 찾으면 λ†“μΉœλ‹€)
393
+ got = [inc for _, _, _, inc in scan_body("x.html", ['<!--', 'stale-ref: pinned', '-->', 'cite 10.5281/zenodo.20397566'])]
394
+ lane("exclude: a multi-line comment file pin is honoured", got == [True], str(got))
395
+
396
+ # β“•-5 같은 쀄 두 DOI β€” 이름 뢙인 μͺ½λ§Œ λΉ μ§„λ‹€ Β· `-->` μ•ž 곡백 없어도 λœλ‹€ Β· 40쀄 λ°–μ—μ„œλ„ λœλ‹€
397
+ row = [''] * 60 + ['| a | 10.5281/zenodo.20397566 | 10.5281/zenodo.22542168 |<!-- stale-ref: pinned-line=20397566-->']
398
+ got = [(r, inc) for _, r, _, inc in scan_body("x.md", row)]
399
+ lane("exclude: line pin names one id of two, no space before -->, past line 40",
400
+ got == [("20397566", True), ("22542168", False)], str(got))
401
+
358
402
  # β“– πŸŸ₯ λͺ» 읽은 μž…λ ₯ β€” 이 파일 μžμ‹ μ„ λ°”μ΄λ„ˆλ¦¬λ‘œ λ§Œλ“€μ–΄ λ³Έλ‹€(μž„μ‹œ 파일)
359
403
  import tempfile
360
404
  with tempfile.NamedTemporaryFile(suffix=".bin", delete=False) as tf: