@chrono-meta/fh-gate 2.13.0 → 2.14.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 (65) hide show
  1. package/.claude/rules/fh_4axis_gate.md +35 -1
  2. package/.claude-plugin/marketplace.json +2 -2
  3. package/AGENTS.md +17 -0
  4. package/CLAUDE.md +14 -1
  5. package/README.ja.md +3 -3
  6. package/README.ko.md +3 -3
  7. package/README.md +4 -4
  8. package/README.zh.md +3 -3
  9. package/docs/ETHOS.md +21 -0
  10. package/docs/IDENTITIES.md +83 -0
  11. package/knowledge/shared/harness-core/fh_detail_protocols.md +77 -1
  12. package/knowledge/shared/harness-core/measurement-integrity-checklist.md +80 -0
  13. package/knowledge/shared/harness-core/ship_readiness_gate.md +70 -4
  14. package/knowledge/shared/learnings/subagent_invocations_log.yaml +82 -0
  15. package/knowledge/shared/rules/multi_session_close_protocol.md +7 -1
  16. package/package.json +20 -2
  17. package/plugins/fh-commons/.claude-plugin/plugin.json +2 -2
  18. package/plugins/fh-commons/skills/preprep/README.md +45 -0
  19. package/plugins/fh-commons/skills/preprep/SKILL.md +214 -0
  20. package/plugins/fh-commons/skills/preprep/canon_terms.example.yaml +36 -0
  21. package/plugins/fh-commons/skills/preprep/fixtures/adjdup_known_negative.md +7 -0
  22. package/plugins/fh-commons/skills/preprep/fixtures/adjdup_known_positive.md +8 -0
  23. package/plugins/fh-commons/skills/preprep/fixtures/progression_known_negative.md +13 -0
  24. package/plugins/fh-commons/skills/preprep/fixtures/progression_known_positive.md +13 -0
  25. package/plugins/fh-commons/skills/preprep/fixtures/promise_known_negative.md +9 -0
  26. package/plugins/fh-commons/skills/preprep/fixtures/promise_known_positive.md +7 -0
  27. package/plugins/fh-commons/skills/preprep/interslide_deps.py +223 -0
  28. package/plugins/fh-commons/skills/preprep/jargon_terms.example.yaml +40 -0
  29. package/plugins/fh-commons/skills/preprep/lane_adjacent_dup.py +86 -0
  30. package/plugins/fh-commons/skills/preprep/lane_progression.py +81 -0
  31. package/plugins/fh-commons/skills/preprep/lane_promise.py +121 -0
  32. package/plugins/fh-commons/skills/preprep/ooxml/c1_baseline.txt +12 -0
  33. package/plugins/fh-commons/skills/preprep/ooxml/gate.py +164 -0
  34. package/plugins/fh-commons/skills/preprep/preprep.py +776 -0
  35. package/plugins/fh-commons/skills/preprep/presentation_checklist.md +310 -0
  36. package/plugins/fh-commons/skills/preprep/surfaces.example.yaml +148 -0
  37. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  38. package/plugins/fh-meta/CHANGELOG.md +78 -0
  39. package/plugins/fh-meta/skills/install-wizard/SKILL.md +39 -0
  40. package/scripts/com.forge-harness.daily-report.plist +44 -0
  41. package/scripts/context_continuity_score.sh +435 -0
  42. package/scripts/daily_report.sh +208 -0
  43. package/scripts/digest_landing_check.sh +71 -0
  44. package/scripts/fh_session_load.sh +19 -0
  45. package/scripts/field_canon_preload.sh +44 -0
  46. package/scripts/lane_runner_check.sh +34 -1
  47. package/scripts/launchd_wiring_check.sh +182 -0
  48. package/scripts/mapped_tracks.sh +69 -0
  49. package/scripts/package_coverage_check.sh +19 -0
  50. package/scripts/portability_lint.sh +30 -0
  51. package/scripts/selfcheck.sh +98 -1
  52. package/scripts/sim_isolated_run.sh +339 -0
  53. package/scripts/test_lane_runner_lanes.sh +75 -0
  54. package/scripts/test_mapped_tracks_lanes.sh +58 -0
  55. package/scripts/test_marker_address_lanes.sh +78 -0
  56. package/scripts/test_marker_soul_check_lanes.sh +36 -0
  57. package/scripts/test_precommit_staged_drift_lanes.sh +91 -0
  58. package/scripts/test_preprep_adjacent_dup_lanes.sh +57 -0
  59. package/scripts/test_preprep_drift_anchor.sh +65 -0
  60. package/scripts/test_preprep_progression_lanes.sh +53 -0
  61. package/scripts/test_preprep_promise_lanes.sh +56 -0
  62. package/scripts/test_preprep_retired_lanes.sh +54 -0
  63. package/scripts/test_sim_isolated_run_lanes.sh +219 -0
  64. package/scripts/test_skill_canon_preload_lanes.sh +58 -0
  65. package/templates/.git-hooks/pre-commit +405 -7
@@ -44,6 +44,26 @@ else
44
44
  bad "L1 known-positive did not fire (rc=$rc) — every lane below is meaningless without it"
45
45
  fi
46
46
 
47
+ # ── IDX7 the FAIL path must EXECUTE the provenance note, not merely contain a call to it ──────
48
+ # 🟥 THIS IS THE LANE THAT THE OTHER SIX SHOULD HAVE BEEN. IDX1–IDX6 source the function and call
49
+ # it with literals, and IDX6 asserts the call site by GREP. All six were green while the real FAIL
50
+ # path died twice in a row under `set -u`:
51
+ # line 880: INDEX_MODE: unbound variable (the value was extracted BELOW its use)
52
+ # line 886: index_source_note: command not found (the function was DEFINED below its use)
53
+ # Both were found by running the thing, not by the lanes. A grep that a call exists is not a test
54
+ # that the call works ([[feedback_anchor_can_be_decorative]]). This lane executes the branch.
55
+ # It asserts the SHAPE of provenance, not the exact sentence: the fixture is a non-git dir, so the
56
+ # honest answer there is the DISK one, and pinning the index wording would make the lane wrong.
57
+ D="$T/idx7"; mkfixture "$D"
58
+ out=$(run "$D")
59
+ if printf '%s' "$out" | grep -qE 'unbound variable|command not found|syntax error'; then
60
+ bad "IDX7 the FAIL path errored: $(printf '%s' "$out" | grep -E 'unbound|not found|syntax' | head -1)"
61
+ elif printf '%s' "$out" | grep -qE 'ⓘ|🟥'; then
62
+ ok "IDX7 the FAIL path actually emits a provenance line (executed, not grepped)"
63
+ else
64
+ bad "IDX7 no provenance line on the FAIL path — the note is defined but never reached"
65
+ fi
66
+
47
67
  # ── L2 NO-OP: no declaration file → behaviour is exactly the L1 behaviour ─────────────────────
48
68
  # This is the arm that protects THIS repo, which ships no company/ directory.
49
69
  D="$T/l2"; mkfixture "$D"
@@ -290,6 +310,61 @@ else
290
310
  printf '%s\n' "$out" | sed 's/^/ │ /'
291
311
  fi
292
312
 
313
+ # ── INDEX-SOURCE DISCLOSURE (2026-08-30) ──────────────────────────────────────────────────────
314
+ # WHY. This check enumerates runners from the git INDEX. In the normal (index) mode it used to say
315
+ # nothing about that, and the disclosure fired only in the anomalous DISK modes — so an author who
316
+ # had wired a suite but not staged it got "a suite nothing executes is prose" with no hint that the
317
+ # wiring existed on disk. Measured 2026-08-30: that happened, and it was the FIFTH instance in one
318
+ # day of «the tree I verified is not the tree the tool read». The note now fires on the FAIL path.
319
+ #
320
+ # 🟥 THREE STATES, NOT TWO. "read the index" · "read the disk" · "could not count" send a reader to
321
+ # three different places. Folding UNMEASURED into the index branch would render a thing that was
322
+ # never counted as a thing that was counted and found empty
323
+ # ([[feedback_not_found_is_not_zero_family]]).
324
+ _ISN=$(mktemp); sed -n '/^index_source_note()/,/^}/p' "$CHECK" > "$_ISN"
325
+ if ! grep -q 'UNMEASURED' "$_ISN"; then
326
+ no "IDX-harness — index_source_note did not extract from $CHECK (lanes would measure nothing)"
327
+ else
328
+ # shellcheck disable=SC1090
329
+ . "$_ISN"
330
+ o=$(index_source_note "index")
331
+ printf '%s' "$o" | grep -q "INDEX 기준" && printf '%s' "$o" | grep -q "스테이징" \
332
+ && ok "IDX1 index mode names the index AND the staging remedy" \
333
+ || no "IDX1 index mode note missing/incomplete: $o"
334
+
335
+ o=$(index_source_note "nongit")
336
+ printf '%s' "$o" | grep -q "DISK" && ok "IDX2 nongit mode says DISK, not index" \
337
+ || no "IDX2 nongit: $o"
338
+
339
+ o=$(index_source_note "UNMEASURED")
340
+ printf '%s' "$o" | grep -q "못 셌다" && ok "IDX3 UNMEASURED says «could not count», not «none»" \
341
+ || no "IDX3 UNMEASURED: $o"
342
+
343
+ # 🟥 CONTROL — an unknown/empty mode must stay SILENT. Inventing a source line for a state the
344
+ # check does not recognise is worse than saying nothing, and without this lane the function
345
+ # could pass IDX1–IDX3 while emitting the index sentence for every input.
346
+ o=$(index_source_note "")
347
+ [ -z "$o" ] && ok "IDX4 control — empty mode is silent (no invented provenance)" \
348
+ || no "IDX4 control — empty mode spoke: $o"
349
+
350
+ # 🟥 CONTROL 2 — the three states must be DISTINGUISHABLE from each other, not merely non-empty.
351
+ a=$(index_source_note "index"); b=$(index_source_note "nongit"); c=$(index_source_note "UNMEASURED")
352
+ if [ "$a" != "$b" ] && [ "$b" != "$c" ] && [ "$a" != "$c" ]; then
353
+ ok "IDX5 control — the three states produce three different sentences"
354
+ else
355
+ no "IDX5 control — states collapsed into the same sentence"
356
+ fi
357
+ fi
358
+ rm -f "$_ISN"
359
+
360
+ # The note must fire on the FAIL path — a function nothing calls is the very defect this file names.
361
+ if sed -n '/lane suite(s) with no runner and no declaration/,/Fix by ONE of/p' "$CHECK" \
362
+ | grep -q 'index_source_note'; then
363
+ ok "IDX6 the note is CALLED on the FAIL path (not just defined)"
364
+ else
365
+ no "IDX6 index_source_note is defined but the FAIL path does not call it"
366
+ fi
367
+
293
368
  echo "----"
294
369
  echo "lane-runner lanes: $pass passed, $fail failed"
295
370
  [ "$fail" -eq 0 ] || exit 1
@@ -152,6 +152,64 @@ if [ -z "${MT_LANES_NESTED:-}" ]; then
152
152
  fi
153
153
 
154
154
  echo "──────────────────────────────────────────────"
155
+ # ── B-1 … B-5 — THE ONBOARDING BRANCH VERDICT ────────────────────────────────────────────────
156
+ # WHY THESE EXIST. The branch test has two halves: ⓑ (mapped tracks, the lanes above) and ⓐ
157
+ # (session files). ⓑ has been mechanical since 2026-08-22; ⓐ was a SENTENCE the session judged —
158
+ # and the sentence counted files that SHIP WITH THE REPO. Measured 2026-08-30 with a control
159
+ # (nonsense pattern = 0 hits): two tracked files satisfied ⓐ, so `git clone` alone rendered the
160
+ # RETURNING menu and the NEW-USER branch was unreachable for anyone who clones.
161
+ # The rule is now one sentence — **ⓐ counts only files that did NOT ship** — and these lanes pin
162
+ # BOTH directions, because a rule that answers `new` to everything would pass B-1 alone.
163
+ BR="$TMP/branch"; mkdir -p "$BR/scripts"
164
+ git init -q "$BR" 2>/dev/null || { echo "ⓘ git init failed (branch fixtures) — NOT a pass"; exit 10; }
165
+ cp "$SUT" "$BR/scripts/mapped_tracks.sh"
166
+ mkdir -p "$BR/tracks/_meta" "$BR/tracks/_contrib"
167
+ : > "$BR/tracks/.gitkeep"; : > "$BR/tracks/_meta/.gitkeep"
168
+ # The two SHIPPED shapes that caused the defect, committed exactly as the real repo carries them.
169
+ printf '# monitor\n' > "$BR/tracks/_meta/harness_bench_issue_monitor.md"
170
+ printf '# contrib\n' > "$BR/tracks/_contrib/session_2026_06_27_cross-audit.md"
171
+ git -C "$BR" add -A >/dev/null 2>&1
172
+ git -C "$BR" -c user.email=t@t -c user.name=t commit -q -m ship 2>/dev/null
173
+
174
+ _bv() { ( cd "$1" && bash scripts/mapped_tracks.sh 2>&1 | sed -n 's/^onboarding_branch=//p' ); }
175
+
176
+ v=$(_bv "$BR")
177
+ [ "$v" = "new" ] && ok "B-1 shipped files do NOT make a clone look returning (got new)" \
178
+ || ng "B-1 a fresh clone reported '$v' — shipped content is being counted as prior use"
179
+
180
+ # 🟥 CONTROL — without this, a rule that always answers `new` passes B-1. A file the USER made
181
+ # must still flip the verdict.
182
+ mkdir -p "$BR/tracks/myproj"; printf '# s\n' > "$BR/tracks/myproj/session_2026-08-30.md"
183
+ v=$(_bv "$BR")
184
+ [ "$v" = "returning" ] && ok "B-2 control — a user-made session file DOES make it returning" \
185
+ || ng "B-2 control — user file ignored (got '$v'); the rule is too wide"
186
+ rm -rf "$BR/tracks/myproj"
187
+
188
+ # ⓐ's own half: an UNTRACKED file in _meta counts (someone who worked and quit without closing).
189
+ printf '# c\n' > "$BR/tracks/_meta/fh_completed_2026-08-30.md"
190
+ v=$(_bv "$BR")
191
+ [ "$v" = "returning" ] && ok "B-3 an untracked _meta file counts (worked, never closed)" \
192
+ || ng "B-3 untracked _meta file ignored (got '$v')"
193
+ rm -f "$BR/tracks/_meta/fh_completed_2026-08-30.md"
194
+
195
+ # THREE-VALUED. Outside a git tree the two classes cannot be separated, and that is UNKNOWN —
196
+ # never the friendlier value. Rendering it as `new` tells a returning user they look new.
197
+ NG="$TMP/nogit"; mkdir -p "$NG/scripts" "$NG/tracks/_meta"
198
+ cp "$SUT" "$NG/scripts/mapped_tracks.sh"; : > "$NG/tracks/.gitkeep"; : > "$NG/tracks/_meta/.gitkeep"
199
+ v=$(_bv "$NG")
200
+ [ "$v" = "UNKNOWN" ] && ok "B-4 non-git tree → UNKNOWN (not 'new')" \
201
+ || ng "B-4 non-git tree reported '$v' — an unmeasured state took a real value"
202
+
203
+ # The key must be present on EVERY path, including the UNMEASURED exit. A consumer that greps for
204
+ # it and finds silence fills the blank in with the friendlier branch.
205
+ # 🟥 CAPTURE FIRST, THEN GREP. The subject exits 3 on this path, and under `pipefail` that exit
206
+ # code becomes the pipeline's — so `subject | grep -q` reports the SUBJECT's failure, not grep's.
207
+ # The repo's own pre-commit hook warns about this shape; this lane reproduced it on the first try.
208
+ _ngout=$( cd "$NG" && bash scripts/mapped_tracks.sh 2>&1 ) || true
209
+ printf '%s' "$_ngout" | grep -q '^onboarding_branch=' \
210
+ && ok "B-5 the branch key is emitted even on the UNMEASURED path" \
211
+ || ng "B-5 UNMEASURED path emits no branch key — silence is not an answer"
212
+
155
213
  if [ "$FAIL" -eq 0 ]; then
156
214
  echo "MAPPED-TRACKS LANES: PASS ($PASS/$PASS)"
157
215
  echo " NOT covered: whether the synergy skill (or any other consumer) actually CALLS this."
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env bash
2
+ # test_marker_address_lanes.sh — fixtures for pre-commit's `unread_markers`.
3
+ #
4
+ # WHAT IT GUARDS. The Axes 2+3 gate reads exactly ONE file:
5
+ # `.axes_23_passed_<BRANCH_SLUG>_<TODAY>.marker`. A marker written under any other name is a valid
6
+ # RECORD and gets ZERO validation — yet its author believes "I wrote a marker" means "the evidence
7
+ # was checked". Measured 2026-08-30: one session wrote **8** markers at addresses the hook never
8
+ # reads; all 8 carried `floor-status: opus-tier`, which is not in the enum, and nothing caught it.
9
+ # The moment the name matched, the gate rejected two format errors in two attempts.
10
+ # This is [[feedback_half_externalization_slot_without_consumer]] applied to the gate's own evidence.
11
+ #
12
+ # 🟥 SCOPE — channel, never conclusion. The advisory asks "is your evidence at the address the
13
+ # reader uses", never "is that marker any good". It must NEVER block: writing extra records under
14
+ # descriptive names is legitimate practice, and blocking it would push authors toward writing
15
+ # fewer records, which is the opposite of the goal. L4 pins the non-blocking property.
16
+ #
17
+ # Usage: bash scripts/test_marker_address_lanes.sh Exit: 0 = all behave; 1 = regression.
18
+
19
+ set -uo pipefail
20
+ REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
21
+ HOOK="$REPO_ROOT/templates/.git-hooks/pre-commit"
22
+ T=$(mktemp -d); trap 'rm -rf "$T"' EXIT
23
+
24
+ sed -n '/^unread_markers()/,/^}/p' "$HOOK" > "$T/fn.sh"
25
+
26
+ # 🟥 CALIBRATE THE EXTRACTION FIRST. An empty function would let every lane below pass against
27
+ # nothing — the false-green this repo keeps closing elsewhere.
28
+ if ! grep -q 'grep -vxF' "$T/fn.sh"; then
29
+ echo "❌ HARNESS-ERROR — unread_markers did not extract from $HOOK."
30
+ echo " The lanes would measure an empty function. Aborting rather than reporting green."
31
+ exit 1
32
+ fi
33
+ # shellcheck disable=SC1090
34
+ . "$T/fn.sh"
35
+
36
+ pass=0; fail=0
37
+ ok() { pass=$((pass+1)); printf 'PASS %s\n' "$1"; }
38
+ no() { fail=$((fail+1)); printf 'FAIL %s\n' "$1"; [ -n "${2:-}" ] && printf ' got: %s\n' "$(printf '%s' "${2:-}" | tr '\n' '|')"; }
39
+
40
+ ADDR=".axes_23_passed_docs_branch_2026-08-30.marker"
41
+
42
+ # L1 — the real shape: the read address plus two strays
43
+ o=$(unread_markers ".axes_23_passed_docs_branch_2026-08-30.marker
44
+ .axes_23_passed_fix_something_2026-08-30.marker
45
+ .axes_23_passed_feat_other_2026-08-30.marker" "$ADDR")
46
+ [ "$(printf '%s\n' "$o" | grep -c .)" = "2" ] && ok "L1 two strays reported, the read address excluded" || no "L1" "$o"
47
+
48
+ # L2 — known-negative: only the read address exists → silence. Without this the lane could pass
49
+ # by always printing everything.
50
+ o=$(unread_markers "$ADDR" "$ADDR")
51
+ [ -z "$o" ] && ok "L2 control — only the read address present reports nothing" || no "L2" "$o"
52
+
53
+ # L3 — empty list. "No markers at all" is already said by NOT CONFIRMED below the call site;
54
+ # repeating it here would be a duplicate, so empty must stay empty.
55
+ o=$(unread_markers "" "$ADDR")
56
+ [ -z "$o" ] && ok "L3 empty list is empty (no duplicate of NOT CONFIRMED)" || no "L3" "$o"
57
+
58
+ # L4 — THE ADVISORY MUST NOT BLOCK. Pinned in the source, because the whole design rests on it:
59
+ # a blocking version would push authors to write FEWER records, inverting the intent.
60
+ if sed -n '/_MK_UNREAD=/,/^ fi$/p' "$HOOK" | grep -qE 'FAILED=1|exit 1'; then
61
+ no "L4 the unread-marker advisory sets FAILED/exit — it must stay advisory"
62
+ else
63
+ ok "L4 the unread-marker advisory never blocks"
64
+ fi
65
+
66
+ # L5 — EXACT match, not substring. A prefix must not silence a longer name, or a stray whose name
67
+ # begins with the read address would vanish — the exact class the `-x` flag exists for.
68
+ o=$(unread_markers "$ADDR
69
+ ${ADDR}.bak" "$ADDR")
70
+ [ "$o" = "${ADDR}.bak" ] && ok "L5 matching is exact — a superstring name is still reported" || no "L5" "$o"
71
+
72
+ # L6 — duplicates collapse; a doubled line would read as two separate strays.
73
+ o=$(unread_markers ".axes_23_passed_fix_x_2026-08-30.marker
74
+ .axes_23_passed_fix_x_2026-08-30.marker" "$ADDR")
75
+ [ "$(printf '%s\n' "$o" | grep -c .)" = "1" ] && ok "L6 duplicate stray reported once" || no "L6" "$o"
76
+
77
+ echo "marker-address lanes: $pass passed, $fail failed"
78
+ [ "$fail" -eq 0 ] || exit 1
@@ -30,6 +30,12 @@ REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
30
30
  HOOK="$REPO_ROOT/templates/.git-hooks/pre-commit"
31
31
  T=$(mktemp -d); trap 'rm -rf "$T"' EXIT
32
32
 
33
+ # 🟥 헬퍼도 같이 추출한다 — 안 하면 다리가 fail-open 이 되고 레인이 거짓 PASS 를 낸다
34
+ # (실측 2026-08-30: R1 이 BLOCK 기대에 PASS). 훅은 이제 헬퍼 부재를 HARNESS-ERROR 로 낸다.
35
+ # 🟥 v3 부터 `_marker_template_residue` 는 `marker_recreate_hint` 를 **부른다**(템플릿에서 파생).
36
+ # 헬퍼 하나만 뽑으면 미정의로 죽고, 그러면 이 검사는 SKIPPED 를 낸다(통과 아님).
37
+ sed -n '/^marker_recreate_hint()/,/^}/p' "$HOOK" > "$T/_helpers.sh"
38
+ sed -n '/^_marker_template_residue()/,/^}/p' "$HOOK" >> "$T/_helpers.sh"
33
39
  sed -n '/^validate_soul_check_leg()/,/^}/p' "$HOOK" > "$T/fn.sh"
34
40
 
35
41
  # Instrument calibration — an empty extraction would let every fixture "pass" against nothing.
@@ -106,6 +112,11 @@ soul-check: reflected(codex 가 성공정의 대조 — 어긋남 없음) — 20
106
112
 
107
113
  # ── ①영혼 presence lane (validate_soul_present_leg) ───────────────────────────
108
114
  sed -n '/^validate_soul_present_leg()/,/^}/p' "$HOOK" > "$T/fnp.sh"
115
+ cat "$T/_helpers.sh" "$T/fnp.sh" > "$T/fnp2.sh" && mv "$T/fnp2.sh" "$T/fnp.sh"
116
+ cat "$T/_helpers.sh" "$T/fn.sh" > "$T/fn2.sh" && mv "$T/fn2.sh" "$T/fn.sh"
117
+ # 🟥 계기 캘리브레이션 — 헬퍼가 실제로 붙었나. 안 붙으면 다리가 HARNESS-ERROR 를 내고
118
+ # 모든 레인이 BLOCK 으로 쏠려 «잘 막는다»처럼 보인다. 그건 판별력이 아니다.
119
+ grep -q '^_marker_template_residue()' "$T/fnp.sh" || { echo "❌ HARNESS-ERROR — 헬퍼 미결합"; exit 1; }
109
120
  if ! grep -q 'SOUL_PRESENT_GRACE' "$T/fnp.sh" && ! grep -q '①영혼 line' "$T/fnp.sh"; then
110
121
  echo "❌ HARNESS-ERROR — validate_soul_present_leg did not extract. Aborting."
111
122
  exit 1
@@ -206,6 +217,31 @@ soul-check: DEGRADED_NO_SOUL(설계 전에 성공 정의를 쓰지 않았다 —
206
217
  lane N3-padded-confession PASS 'soul: 없음 — 설계 전에 안 썼다. 사후 재구성이 아니라 그 사실을 적는다. 붙잡고 있던 것은 범위 결정 하나였다
207
218
  axes-run: ⓐ=codex'
208
219
 
220
+ # ── R1/R2 — 템플릿 잔여 (2026-08-30, 블라인드 sim 이 자기 힌트에 걸렸다) ──────────
221
+ # 힌트에 `soul:` 예시를 넣자마자 플로어 티어 3/3 이 **자리표시자를 그대로** 복사했고
222
+ # 비공허성 검사를 통과했다. 채널 검사로 닫았다: «이 기록이 템플릿 자신인가».
223
+ # 🟥 이 둘은 `planep`(presence 다리)로 돌려야 한다. 초판은 `lane`(soul-check 다리)로 짜서
224
+ # **틀린 함수를 겨눴고**, BLOCK 기대에 PASS 가 나왔다. 초록/적색이 아니라 «무엇을 겨눴나»였다.
225
+ # 🟥 **이 레인의 기대값이 v3 에서 바뀐다. 결과에 맞춘 게 아니라 범위가 좁아진 것이고,
226
+ # 그 좁아짐이 의도다.** v2 는 「꺾쇠+공백/비-ASCII」로 일반화해 이 문장을 잡았는데,
227
+ # 같은 규칙이 `Map<String, Object>` 와 `<사용자_ID>` 를 **과차단**했다(두 계열 독립 지적).
228
+ # 「이 꺾쇠가 자리표시자인가 타입인가」는 판단이고, 판단은 코드로 안 굳힌다.
229
+ # v3 는 «우리가 배포한 템플릿과 같은가»만 본다 — 아래 문장은 힌트에 없으므로 통과한다.
230
+ # ⚠️ 이것은 **명명된 잔여**다: 모델이 힌트를 자기 말로 바꿔 쓰면 안 잡힌다.
231
+ planep R1-nonhint-paraphrase-not-blocked PASS 2026-09-05 "soul: 성공 정의 = <이 fix가 통과했다고 판단할 관측 가능한 결과> · 절대 안 함 = <이번 수정에서 하지 않기로 정한 것>"
232
+ # 🟥 컨트롤 — 실제로 채운 줄은 통과해야 한다. 없으면 R1 은 «presence 검사를 통째로 껐다»와 구분 안 된다.
233
+ # 🟥 cross-family 가 잡은 우회 — 내 힌트의 자리표시자 `<...>` 가 잔여 목록에 없었다
234
+ # (codex #3 · agy 2-b 독립 수렴). 픽스처는 «가장 쉬운 표기»가 아니라 «뚫리는 표기»여야 한다.
235
+ planep R3-hint-placeholder-blocks BLOCK 2026-09-05 "soul: 성공 정의 = <...> · 절대 안 함 = <...>"
236
+ # 🟥 2라운드(agy 결함1): 잔여 목록이 «손목록»이라 규칙 문서가 새 자리표시자를 실을 때마다
237
+ # 어긋났다. 규칙으로 일반화했고, 아래가 그 양방향 고정이다. 차단 5 · 과차단 0 을 잰 뒤 박았다.
238
+ # 🟥 v3 는 «힌트가 실제로 주는» 자리표시자만 본다. 스펙 문서에만 있는 표기는 안 잡히고,
239
+ # 그건 명명된 잔여다(판단을 코드로 굳히는 것보다 낫다는 결정).
240
+ planep R4-hint-derived-placeholder-blocks BLOCK 2026-09-05 "soul-check: reflected(<무엇이 되돌아왔나>)"
241
+ planep R5-generic-type-not-blocked PASS 2026-09-05 "soul: 성공 정의 = Map<String, Object> 가 직렬화된다 · 절대 안 함 = 공개 API 깨기"
242
+ planep R6-inequality-not-blocked PASS 2026-09-05 "soul: 성공 정의 = n < 3 이면 판정 보류하고 n > 5 면 채점한다 · 절대 안 함 = 바 미달로 결론내기"
243
+ planep R2-real-content-still-passes PASS 2026-09-05 "soul: 성공 정의 = 레인 28개가 초록이고 되돌림에서 자기 레인만 적색 · 절대 안 함 = 결과에 맞춰 기대값 바꾸기"
244
+
209
245
  echo
210
246
  if [ $FAIL -eq 0 ]; then echo "SOUL LANES: PASS"; else echo "SOUL LANES: FAIL"; fi
211
247
  exit $FAIL
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env bash
2
+ # test_precommit_staged_drift_lanes.sh — fixtures for pre-commit's `staged_worktree_drift`.
3
+ #
4
+ # WHAT IT GUARDS. "The tree you verified is not the tree you commit" happened FOUR times in one
5
+ # day (2026-08-29/30) and a DIFFERENT instrument caught each one — which is luck, not coverage:
6
+ # ⑴ a pathspec failure was ignored and the verification credited to the commit anyway
7
+ # ⑵ a file was edited AFTER `git add`
8
+ # ⑶ a detector read the git index while the author ran it against the worktree
9
+ # ⑷ the caller-ratchet could not see new wiring until it was staged
10
+ # Only shape ⑵ is computable at commit time, and it is: `git diff` ∩ `git diff --cached`.
11
+ # This suite pins that computation, not the judgement about whether the drift matters.
12
+ #
13
+ # 🟥 SCOPE — channel, never conclusion. The gate says "these two byte streams diverged" and stops.
14
+ # It must NEVER block: partial/hunk staging is legitimate practice, and a gate that fires on it
15
+ # trains `--no-verify`, which disarms the Destructive-Op gate living in the same hook. So there is
16
+ # no BLOCK lane here on purpose — the absence is the design, and L5 pins it.
17
+ #
18
+ # Usage: bash scripts/test_precommit_staged_drift_lanes.sh Exit: 0 = all behave; 1 = regression.
19
+
20
+ set -uo pipefail
21
+ REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
22
+ HOOK="$REPO_ROOT/templates/.git-hooks/pre-commit"
23
+ T=$(mktemp -d); trap 'rm -rf "$T"' EXIT
24
+
25
+ sed -n '/^staged_worktree_drift()/,/^}/p' "$HOOK" > "$T/fn.sh"
26
+
27
+ # 🟥 INSTRUMENT CALIBRATION FIRST. An empty extraction would let every fixture below "pass"
28
+ # against nothing — the exact false-green this repo keeps closing elsewhere.
29
+ if ! grep -q 'comm -12' "$T/fn.sh"; then
30
+ echo "❌ HARNESS-ERROR — staged_worktree_drift did not extract from $HOOK."
31
+ echo " The fixtures would measure an empty function. Aborting rather than reporting green."
32
+ exit 1
33
+ fi
34
+ # shellcheck disable=SC1090
35
+ . "$T/fn.sh"
36
+
37
+ pass=0; fail=0
38
+ ok() { pass=$((pass+1)); printf 'PASS %s\n' "$1"; }
39
+ no() { fail=$((fail+1)); printf 'FAIL %s\n' "$1"; [ -n "${2:-}" ] && printf ' got: %s\n' "$(printf '%s' "${2:-}" | tr '\n' '|')"; }
40
+
41
+ # L1 — the real shape: a file both staged and further modified
42
+ o=$(staged_worktree_drift "a.sh
43
+ b.md" "b.md")
44
+ [ "$o" = "b.md" ] && ok "L1 a path in BOTH lists is reported" || no "L1" "$o"
45
+
46
+ # L2 — known-negative: staged only, no worktree edit → silent
47
+ o=$(staged_worktree_drift "a.sh
48
+ b.md" "c.txt")
49
+ [ -z "$o" ] && ok "L2 control — disjoint lists report nothing (no false positive)" || no "L2" "$o"
50
+
51
+ # L3 — worktree-only changes are NOT drift. A file you never staged is not "verified ≠ committed";
52
+ # it is simply not in this commit. Reporting it would make the gate noisy on every partial commit
53
+ # and that noise is how an advisory gets ignored.
54
+ o=$(staged_worktree_drift "a.sh" "b.md
55
+ c.txt")
56
+ [ -z "$o" ] && ok "L3 control — unstaged-only paths are not reported" || no "L3" "$o"
57
+
58
+ # L4 — empty inputs. Both directions, because "nothing to compare" and "nothing diverged" take the
59
+ # same action here (do nothing), and the lane records that the collapse is deliberate.
60
+ o=$(staged_worktree_drift "" "")
61
+ [ -z "$o" ] && ok "L4 empty ∩ empty is empty" || no "L4" "$o"
62
+ o=$(staged_worktree_drift "" "a.sh")
63
+ [ -z "$o" ] && ok "L4b empty staged ∩ nonempty worktree is empty" || no "L4b" "$o"
64
+
65
+ # L5 — THE GATE MUST NOT BLOCK. Pinned as a lane because the whole design rests on it: a blocking
66
+ # version would fire on legitimate hunk staging and train `--no-verify`.
67
+ if grep -A14 '^_DRIFT=' "$HOOK" | grep -qE 'FAILED=1|exit 1'; then
68
+ no "L5 the drift gate sets FAILED/exit — it must stay advisory"
69
+ else
70
+ ok "L5 the drift gate never blocks (advisory by construction)"
71
+ fi
72
+
73
+ # L6 — ordering must not matter; the function sorts. A caller handing git's raw output in a
74
+ # different order must get the same verdict.
75
+ o1=$(staged_worktree_drift "b.md
76
+ a.sh" "a.sh
77
+ b.md")
78
+ o2=$(staged_worktree_drift "a.sh
79
+ b.md" "b.md
80
+ a.sh")
81
+ [ "$o1" = "$o2" ] && [ -n "$o1" ] && ok "L6 order-independent (both orders agree, non-empty)" \
82
+ || no "L6" "$o1 // $o2"
83
+
84
+ # L7 — duplicates collapse. `git diff` can list a path twice across modes; a doubled report line
85
+ # would read as two problems.
86
+ o=$(staged_worktree_drift "a.sh
87
+ a.sh" "a.sh")
88
+ [ "$(printf '%s\n' "$o" | grep -c .)" = "1" ] && ok "L7 duplicate input reports once" || no "L7" "$o"
89
+
90
+ echo "staged-drift lanes: $pass passed, $fail failed"
91
+ [ "$fail" -eq 0 ] || exit 1
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env bash
2
+ # test_preprep_adjacent_dup_lanes.sh — L10 인접 장 중복 낭독 앵커.
3
+ #
4
+ # 실사고: 한 장을 두 프레임으로 쪼갤 때 뒤 프레임에 원본을 **통째로** 남겨
5
+ # 117자 중 82자(70%)가 중복이었다. 앞 장에서 이미 읽은 문장을 다시 읽는다.
6
+ #
7
+ # 재는 것 넷:
8
+ # J1 판별력 원본을 통째로 남기면 잡나
9
+ # J2 오탐 0 제대로 쪼개면 조용한가
10
+ # J3 임계분리 임계 미기재면 «재기만 하고 판정 안 함» 인가 (구조=A · 값=B 분리)
11
+ # J4 처방 몇 자 / 몇 % / 어느 문장인지를 내나 — 숫자 없는 지적은 처방이 아니다
12
+ set -uo pipefail
13
+ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
14
+ SKILL="$HERE/plugins/fh-commons/skills/preprep"
15
+ PASS=0; FAIL=0
16
+ ok(){ echo " ✅ $1"; PASS=$((PASS+1)); }
17
+ ng(){ echo " ❌ $1"; FAIL=$((FAIL+1)); }
18
+ command -v python3 >/dev/null 2>&1 || {
19
+ echo " ⚠️ UNMEASURED — python3 unavailable; adjacent-dup lanes NOT run (this is not a pass)"
20
+ echo "adjacent-dup lanes: SKIPPED (not passed)"; exit 0; }
21
+
22
+ out=$(cd "$SKILL" && python3 - <<'PY' 2>&1
23
+ import sys, json, importlib.util as ilu
24
+ sys.path.insert(0, '.')
25
+ import lane_adjacent_dup as L
26
+ sp = ilu.spec_from_file_location('i', 'interslide_deps.py'); im = ilu.module_from_spec(sp); sp.loader.exec_module(im)
27
+ lim = {'adjacent_dup': {'max_dup_chars': 30}}
28
+ r = {}
29
+ for k, f, cfg in (('pos', 'fixtures/adjdup_known_positive.md', lim),
30
+ ('neg', 'fixtures/adjdup_known_negative.md', lim),
31
+ ('nolim', 'fixtures/adjdup_known_positive.md', {})):
32
+ t = open(f, encoding='utf-8').read()
33
+ fi, no = L.scan(cfg, {'s': (t, 'markdown')}, {'s': {'spoken': True}}, im)
34
+ r[k] = {'n': len(fi), 'msg': ' '.join(x[4] for x in fi),
35
+ 'nolim_note': any('임계 미기재' in x for x in no)}
36
+ print(json.dumps(r, ensure_ascii=False))
37
+ PY
38
+ ); rc=$?
39
+ [ $rc -eq 0 ] || { echo " ❌ INSTRUMENT ERROR — lane_adjacent_dup 실행 실패 (rc=$rc): $out"; exit 1; }
40
+ g(){ python3 -c "import json,sys;d=json.loads(sys.argv[1]);print(d[sys.argv[2]][sys.argv[3]])" "$out" "$1" "$2"; }
41
+
42
+ [ "$(g pos n)" = "1" ] && ok "J1 판별력: 원본 통째 남김을 잡는다" || ng "J1 판별력 없음: $(g pos n)건"
43
+ [ "$(g neg n)" = "0" ] && ok "J2 오탐 0: 제대로 쪼개면 조용" || ng "J2 오탐 $(g neg n)건"
44
+ { [ "$(g nolim n)" = "0" ] && [ "$(g nolim nolim_note)" = "True" ]; } \
45
+ && ok "J3 임계분리: 미기재면 재기만 하고 판정 안 한다" \
46
+ || ng "J3 실패 — 임계를 코드에 박았거나, 미기재를 조용히 통과시킨다"
47
+ # 🟥 J4 의 초판은 glob `*%*자*` 였는데 **되돌림 프로브가 그걸 뚫었다** — 숫자를 지워도 남은
48
+ # 문자열에 «자» 와 «%» 가 우연히 들어 있어 통과했다. 장식 앵커였다.
49
+ # 지금은 «숫자 + 단위» 를 정규식으로 요구한다: `NN자` 와 `NN%` 가 둘 다 있어야 한다.
50
+ if printf '%s' "$(g pos msg)" | grep -qE '[0-9]+자' && printf '%s' "$(g pos msg)" | grep -qE '[0-9]+%'; then
51
+ ok "J4 처방: «NN자»·«NN%» 를 실제 숫자로 낸다"
52
+ else
53
+ ng "J4 실패 — 숫자 없는 지적은 처방이 아니다: $(g pos msg)"
54
+ fi
55
+
56
+ echo "adjacent-dup lanes: $PASS passed, $FAIL failed"
57
+ [ "$FAIL" -eq 0 ] || exit 1
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env bash
2
+ # test_preprep_drift_anchor.sh — 이원화의 단일-소스 앵커.
3
+ #
4
+ # preprep 은 두 진입점을 갖는다: FH 안의 스킬(plugins/fh-commons/skills/preprep/)과,
5
+ # 거기서 뽑아 세우는 standalone 현장 하네스. 🟥 **코드 사본이 둘이면 갈린다** —
6
+ # FH 자신의 규칙이 그것을 «single source of truth collapse · double maintenance burden»
7
+ # 이라 부른다. 그래서 이원화는 «복사본 둘»이 아니라 «단일 소스 + 얇은 두 진입점»이어야 하고,
8
+ # 이 앵커가 그 «단일»을 기계로 지킨다.
9
+ #
10
+ # 재는 것:
11
+ # D1 단일 소스가 실재하고 실행 가능한가 (부재를 통과로 렌더하지 않는다)
12
+ # D2 standalone 배포본이 있다면, 그 코드가 단일 소스와 «바이트 동일»한가
13
+ # — 없으면 SKIP 이고 SKIP 은 PASS 가 아니다. 있는데 다르면 FAIL
14
+ # D3 진입점 문서가 단일 소스를 가리키나 (죽은 포인터 금지)
15
+ set -uo pipefail
16
+ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
17
+ SRC="$HERE/plugins/fh-commons/skills/preprep"
18
+ # standalone 배포 위치는 환경변수로 받는다. 기본값을 박으면 다른 머신에서 거짓 SKIP 이 된다.
19
+ DIST="${PREPREP_STANDALONE_DIR:-}"
20
+ PASS=0; FAIL=0; SKIP=0
21
+ ok(){ echo " ✅ $1"; PASS=$((PASS+1)); }
22
+ ng(){ echo " ❌ $1"; FAIL=$((FAIL+1)); }
23
+ sk(){ echo " ⏭ $1 — SKIPPED (**통과 아님**)"; SKIP=$((SKIP+1)); }
24
+
25
+ # D1 — 단일 소스
26
+ missing=""
27
+ for f in preprep.py interslide_deps.py lane_progression.py lane_adjacent_dup.py lane_promise.py SKILL.md README.md surfaces.example.yaml; do
28
+ [ -f "$SRC/$f" ] || missing="$missing $f"
29
+ done
30
+ if [ -n "$missing" ]; then ng "D1 단일 소스 결손:$missing"
31
+ elif ! command -v python3 >/dev/null 2>&1; then
32
+ sk "D1 구문 검사 — python3 부재라 «돌 수 있나»를 못 쟀다(UNMEASURED)"
33
+ else
34
+ synerr=""
35
+ for f in preprep.py interslide_deps.py lane_progression.py lane_adjacent_dup.py lane_promise.py; do
36
+ python3 -c "import ast,sys;ast.parse(open(sys.argv[1],encoding='utf-8').read())" "$SRC/$f" 2>/dev/null || synerr="$synerr $f"
37
+ done
38
+ [ -z "$synerr" ] && ok "D1 단일 소스 8파일 실재 + python 5파일 구문 통과" \
39
+ || ng "D1 구문 실패:$synerr"
40
+ fi
41
+
42
+ # D2 — standalone 대조
43
+ if [ -z "$DIST" ]; then
44
+ sk "D2 standalone 대조 — PREPREP_STANDALONE_DIR 미설정이라 배포본을 못 찾았다"
45
+ elif [ ! -d "$DIST" ]; then
46
+ ng "D2 PREPREP_STANDALONE_DIR 이 가리키는 곳이 없다: $DIST (설정됐는데 부재 = 드리프트 아니라 배선 결함)"
47
+ else
48
+ drift=""
49
+ for f in preprep.py interslide_deps.py lane_progression.py lane_adjacent_dup.py; do
50
+ if [ ! -f "$DIST/$f" ]; then drift="$drift $f(부재)"
51
+ elif ! cmp -s "$SRC/$f" "$DIST/$f"; then drift="$drift $f(갈림)"; fi
52
+ done
53
+ [ -z "$drift" ] && ok "D2 standalone 코드 5파일이 단일 소스와 바이트 동일" \
54
+ || ng "D2 드리프트:$drift ⇒ 사본이 둘이 됐다. 단일 소스에서 다시 뽑아라"
55
+ fi
56
+
57
+ # D3 — 진입점 포인터가 죽었나
58
+ if grep -q "ko-tech-writer" "$SRC/SKILL.md" 2>/dev/null; then
59
+ if [ -f "$HERE/plugins/fh-commons/skills/ko-tech-writer/SKILL.md" ]; then
60
+ ok "D3 SKILL.md 가 가리키는 ko-tech-writer 가 실재"
61
+ else ng "D3 죽은 포인터 — SKILL.md 가 ko-tech-writer 를 가리키는데 그 스킬이 없다"; fi
62
+ else ng "D3 SKILL.md 가 ko-tech-writer 라우팅을 잃었다 — L9 는 절반만 덮는데 나머지 절반의 출구가 사라졌다"; fi
63
+
64
+ echo "preprep drift anchor: $PASS passed, $FAIL failed, $SKIP skipped (skip != pass)"
65
+ [ "$FAIL" -eq 0 ] || exit 1
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env bash
2
+ # test_preprep_progression_lanes.sh — L9 progression 레인의 회귀 앵커.
3
+ #
4
+ # 재는 것 셋:
5
+ # P1 판별력 실사고 재현(①이 화면에서 빠짐) → 그 단계를 «이름으로» 지목하나
6
+ # P2 오탐 0 네 칸이 다 있으면 findings 0
7
+ # P3 부재≠0 선언이 없으면 NOT_CONFIGURED 이고 «통과»로 렌더하지 않나
8
+ # 🟥 P3 이 없으면 선언을 지우는 것만으로 이 레인이 조용해진다(가장 싼 무마 경로).
9
+ set -uo pipefail
10
+ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
11
+ SKILL="$HERE/plugins/fh-commons/skills/preprep"
12
+ PASS=0; FAIL=0
13
+ ok(){ echo " ✅ $1"; PASS=$((PASS+1)); }
14
+ ng(){ echo " ❌ $1"; FAIL=$((FAIL+1)); }
15
+
16
+ if ! command -v python3 >/dev/null 2>&1; then
17
+ echo " ⚠️ UNMEASURED — python3 unavailable; progression lanes NOT run (this is not a pass)"
18
+ echo "progression lanes: SKIPPED (not passed)"; exit 0
19
+ fi
20
+
21
+ out=$(cd "$SKILL" && python3 - <<'PY' 2>&1
22
+ import sys, json
23
+ sys.path.insert(0, '.')
24
+ import lane_progression as LP
25
+ cfg = {'progressions': [{'id': 'escalation', 'steps': [
26
+ {'anchor': '좋아집니다'}, {'anchor': '그래도 남는'},
27
+ {'anchor': '더 늘려도'}, {'anchor': '입장을 바꾸면'}], 'screens': ['deck']}]}
28
+ r = {}
29
+ for k, f in (('pos', 'fixtures/progression_known_positive.md'),
30
+ ('neg', 'fixtures/progression_known_negative.md')):
31
+ t = open(f, encoding='utf-8').read()
32
+ fi, _ = LP.scan(cfg, {'deck': (t, 'markdown')}, {'deck': {}})
33
+ r[k] = {'n': len(fi), 'named': [x[2] for x in fi]}
34
+ fi, no = LP.scan({}, {'deck': ('x', 'markdown')}, {'deck': {}})
35
+ r['unconf'] = {'n': len(fi), 'nc': any('NOT_CONFIGURED' in s for s in no)}
36
+ print(json.dumps(r, ensure_ascii=False))
37
+ PY
38
+ ); rc=$?
39
+ [ $rc -eq 0 ] || { echo " ❌ INSTRUMENT ERROR — lane_progression 실행 실패 (rc=$rc): $out"; exit 1; }
40
+ pn=$(python3 -c "import json,sys;print(json.loads(sys.argv[1])['pos']['n'])" "$out")
41
+ pnm=$(python3 -c "import json,sys;print(','.join(json.loads(sys.argv[1])['pos']['named']))" "$out")
42
+ nn=$(python3 -c "import json,sys;print(json.loads(sys.argv[1])['neg']['n'])" "$out")
43
+ un=$(python3 -c "import json,sys;print(json.loads(sys.argv[1])['unconf']['n'])" "$out")
44
+ uc=$(python3 -c "import json,sys;print(json.loads(sys.argv[1])['unconf']['nc'])" "$out")
45
+
46
+ [ "$pn" = "1" ] && ok "P1 판별력: ①이 빠지면 1건 적발" || ng "P1 판별력 없음: ${pn}건 (기대 1)"
47
+ [ "$pnm" = "step1" ] && ok "P1-b 이름 지목: step1 을 «이름으로» 짚는다" || ng "P1-b 지목 실패: '$pnm' — 판정은 맞고 처방이 틀린 게이트다"
48
+ [ "$nn" = "0" ] && ok "P2 오탐 0" || ng "P2 오탐 ${nn}건"
49
+ { [ "$un" = "0" ] && [ "$uc" = "True" ]; } && ok "P3 부재≠0: 선언 없으면 NOT_CONFIGURED 명시" \
50
+ || ng "P3 실패 — 선언 없음이 «통과»로 렌더된다. 선언을 지우면 조용해지는 게이트다"
51
+
52
+ echo "progression lanes: $PASS passed, $FAIL failed"
53
+ [ "$FAIL" -eq 0 ] || exit 1
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env bash
2
+ # test_preprep_promise_lanes.sh — L11 예고↔상환 후보 레인의 앵커.
3
+ #
4
+ # 실사고: S6 이 «세 번» 을 예고했는데 본편 상환이 1건이었다. 기존 검사는 «결론이 첫 질문에
5
+ # 답하는가»만 봐서 **중반 티저의 미상환**을 구조적으로 못 잡았다.
6
+ #
7
+ # 🟥 재는 것은 «후보를 내는가» 가 아니라 **«가르는가»** 다. 둘 다 후보를 내면 판별력이 0 이고,
8
+ # 초판이 실제로 그랬다(대상어에 조사가 붙어 양쪽 다 «0회»가 나왔다).
9
+ # Q1 판별력 같은 예고에 대해 상환 1회 vs 3회를 «다른 수»로 낸다
10
+ # Q2 서수배제 「두 번째 …」 같은 **상환 문장**을 예고로 세지 않는다
11
+ # — 안 거르면 방향이 거꾸로 된다(상환을 미상환 후보로 계상)
12
+ # Q3 advisory findings 는 언제나 0 (종료코드 오염 금지)
13
+ # Q4 판정보류 «맞나» 로 사람에게 넘기지 «틀렸다» 고 단정하지 않는다
14
+ set -uo pipefail
15
+ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
16
+ SKILL="$HERE/plugins/fh-commons/skills/preprep"
17
+ PASS=0; FAIL=0
18
+ ok(){ echo " ✅ $1"; PASS=$((PASS+1)); }
19
+ ng(){ echo " ❌ $1"; FAIL=$((FAIL+1)); }
20
+ command -v python3 >/dev/null 2>&1 || {
21
+ echo " ⚠️ UNMEASURED — python3 unavailable; promise lanes NOT run (this is not a pass)"
22
+ echo "promise lanes: SKIPPED (not passed)"; exit 0; }
23
+
24
+ out=$(cd "$SKILL" && python3 - <<'PY' 2>&1
25
+ import sys, json, re
26
+ sys.path.insert(0, '.')
27
+ import lane_promise as L
28
+ r = {}
29
+ for k, f in (('pos', 'fixtures/promise_known_positive.md'),
30
+ ('neg', 'fixtures/promise_known_negative.md')):
31
+ t = open(f, encoding='utf-8').read()
32
+ fi, no = L.scan({'s': (t, 'markdown')}, {'s': {'spoken': True}})
33
+ rows = [x.strip() for x in no if x.strip().startswith('·')]
34
+ cnts = [int(m.group(1)) for x in rows for m in [re.search(r'»\s*([0-9]+)회', x)] if m]
35
+ r[k] = {'n_find': len(fi), 'n_rows': len(rows), 'counts': cnts,
36
+ 'body': ' '.join(rows)}
37
+ print(json.dumps(r, ensure_ascii=False))
38
+ PY
39
+ ); rc=$?
40
+ [ $rc -eq 0 ] || { echo " ❌ INSTRUMENT ERROR — lane_promise 실행 실패 (rc=$rc): $out"; exit 1; }
41
+ g(){ python3 -c "import json,sys;d=json.loads(sys.argv[1]);print(d[sys.argv[2]][sys.argv[3]])" "$out" "$1" "$2"; }
42
+
43
+ pc=$(g pos counts); nc=$(g neg counts)
44
+ { [ "$pc" = "[1]" ] && [ "$nc" = "[3]" ]; } \
45
+ && ok "Q1 판별력: 상환 1회 vs 3회를 «다른 수»로 낸다 (pos=$pc neg=$nc)" \
46
+ || ng "Q1 판별력 없음 — pos=$pc neg=$nc. 같으면 이 레인은 아무것도 안 가른다"
47
+ { [ "$(g pos n_rows)" = "1" ] && [ "$(g neg n_rows)" = "1" ]; } \
48
+ && ok "Q2 서수배제: 「N 번째 …」 상환 문장을 예고로 안 센다" \
49
+ || ng "Q2 실패 — pos=$(g pos n_rows) neg=$(g neg n_rows). 상환을 미상환 후보로 계상하면 방향이 거꾸로다"
50
+ { [ "$(g pos n_find)" = "0" ] && [ "$(g neg n_find)" = "0" ]; } \
51
+ && ok "Q3 advisory 불변: findings 0" || ng "Q3 깨짐 — 종료코드를 오염시킨다"
52
+ case "$(g pos body)" in *맞나*) ok "Q4 판정보류: «맞나» 로 사람에게 넘긴다" ;;
53
+ *) ng "Q4 실패 — 단정하면 결론을 코드로 굳히는 것이다: $(g pos body)" ;; esac
54
+
55
+ echo "promise lanes: $PASS passed, $FAIL failed"
56
+ [ "$FAIL" -eq 0 ] || exit 1