@chrono-meta/fh-gate 2.13.0 → 2.15.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.
- package/.claude/rules/fh_4axis_gate.md +35 -1
- package/.claude-plugin/marketplace.json +2 -2
- package/AGENTS.md +50 -0
- package/CLAUDE.md +14 -1
- package/README.ja.md +3 -3
- package/README.ko.md +3 -3
- package/README.md +4 -4
- package/README.zh.md +3 -3
- package/docs/ETHOS.md +21 -0
- package/docs/IDENTITIES.md +83 -0
- package/knowledge/shared/harness-core/fh_detail_protocols.md +77 -1
- package/knowledge/shared/harness-core/measurement-integrity-checklist.md +80 -0
- package/knowledge/shared/harness-core/ship_readiness_gate.md +199 -5
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +173 -0
- package/knowledge/shared/rules/multi_session_close_protocol.md +7 -1
- package/package.json +23 -2
- package/plugins/fh-commons/.claude-plugin/plugin.json +2 -2
- package/plugins/fh-commons/skills/preprep/README.md +45 -0
- package/plugins/fh-commons/skills/preprep/SKILL.md +214 -0
- package/plugins/fh-commons/skills/preprep/canon_terms.example.yaml +36 -0
- package/plugins/fh-commons/skills/preprep/fixtures/adjdup_known_negative.md +7 -0
- package/plugins/fh-commons/skills/preprep/fixtures/adjdup_known_positive.md +8 -0
- package/plugins/fh-commons/skills/preprep/fixtures/progression_known_negative.md +13 -0
- package/plugins/fh-commons/skills/preprep/fixtures/progression_known_positive.md +13 -0
- package/plugins/fh-commons/skills/preprep/fixtures/promise_known_negative.md +9 -0
- package/plugins/fh-commons/skills/preprep/fixtures/promise_known_positive.md +7 -0
- package/plugins/fh-commons/skills/preprep/interslide_deps.py +223 -0
- package/plugins/fh-commons/skills/preprep/jargon_terms.example.yaml +40 -0
- package/plugins/fh-commons/skills/preprep/lane_adjacent_dup.py +86 -0
- package/plugins/fh-commons/skills/preprep/lane_progression.py +81 -0
- package/plugins/fh-commons/skills/preprep/lane_promise.py +121 -0
- package/plugins/fh-commons/skills/preprep/ooxml/c1_baseline.txt +12 -0
- package/plugins/fh-commons/skills/preprep/ooxml/gate.py +164 -0
- package/plugins/fh-commons/skills/preprep/preprep.py +789 -0
- package/plugins/fh-commons/skills/preprep/presentation_checklist.md +310 -0
- package/plugins/fh-commons/skills/preprep/surfaces.example.yaml +148 -0
- package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/CHANGELOG.md +140 -0
- package/plugins/fh-meta/skills/install-wizard/SKILL.md +39 -0
- package/scripts/com.forge-harness.daily-report.plist +44 -0
- package/scripts/context_continuity_score.sh +894 -0
- package/scripts/daily_report.sh +208 -0
- package/scripts/digest_landing_check.sh +71 -0
- package/scripts/directional_diff_gate.sh +11 -4
- package/scripts/fh_session_load.sh +19 -0
- package/scripts/field_canon_preload.sh +44 -0
- package/scripts/fixture_guard_lib.sh +55 -0
- package/scripts/lane_runner_check.sh +34 -1
- package/scripts/launchd_wiring_check.sh +182 -0
- package/scripts/mapped_tracks.sh +69 -0
- package/scripts/novelty_claim_check.sh +5 -1
- package/scripts/package_coverage_check.sh +39 -0
- package/scripts/portability_lint.sh +117 -0
- package/scripts/prepush_guard_check.sh +2 -2
- package/scripts/public_surface_scan_files.sh +36 -1
- package/scripts/selfcheck.sh +171 -1
- package/scripts/session_close_check.sh +17 -0
- package/scripts/shell_name_boundary_scan.sh +30 -0
- package/scripts/sim_isolated_run.sh +484 -0
- package/scripts/test_branch_claim_lanes.sh +8 -3
- package/scripts/test_env_purity_lanes.sh +4 -1
- package/scripts/test_lane_runner_lanes.sh +75 -0
- package/scripts/test_mapped_tracks_lanes.sh +64 -2
- package/scripts/test_marker_address_lanes.sh +78 -0
- package/scripts/test_marker_soul_check_lanes.sh +36 -0
- package/scripts/test_memory_link_check.sh +3 -1
- package/scripts/test_node_check_lanes.sh +5 -2
- package/scripts/test_node_infra_delta_lanes.sh +3 -1
- package/scripts/test_peer_worktree_detect_lanes.sh +3 -1
- package/scripts/test_precommit_staged_drift_lanes.sh +91 -0
- package/scripts/test_preprep_adjacent_dup_lanes.sh +57 -0
- package/scripts/test_preprep_drift_anchor.sh +65 -0
- package/scripts/test_preprep_progression_lanes.sh +53 -0
- package/scripts/test_preprep_promise_lanes.sh +56 -0
- package/scripts/test_preprep_retired_lanes.sh +54 -0
- package/scripts/test_prepush_destructive_lanes.sh +5 -2
- package/scripts/test_prepush_stdin_integrity.sh +2 -2
- package/scripts/test_regression_guard_ci_lanes.sh +4 -1
- package/scripts/test_selfcheck_state_lanes.sh +19 -4
- package/scripts/test_session_close_lanes.sh +5 -5
- package/scripts/test_sim_isolated_run_lanes.sh +265 -0
- package/scripts/test_skill_canon_preload_lanes.sh +58 -0
- package/scripts/test_target_freeze_lanes.sh +3 -1
- package/scripts/test_verdict_watermark_lanes.sh +427 -0
- package/scripts/test_wizard_snippet_merge_lanes.sh +4 -1
- package/scripts/universal_guard_check.sh +1 -1
- package/templates/.git-hooks/pre-commit +426 -8
- package/templates/.git-hooks/pre-push +8 -3
- package/templates/predelete_check.sh +4 -2
- package/templates/regression_guard.sh +7 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_preprep_retired_lanes.sh — L1-c 폐어(retired) 갈래의 회귀 앵커.
|
|
3
|
+
#
|
|
4
|
+
# 실사고: 리뷰가 명시적으로 걷어낸 「재다」가 4개월 뒤 재유입됐고 **아무 검사도 안 울렸다**
|
|
5
|
+
# (운영자가 잡았다). jargon_terms=조어→풀이, banned=수치 인용 금지라 «걷어낸 말» 자리가 없었다.
|
|
6
|
+
#
|
|
7
|
+
# 재는 것 넷:
|
|
8
|
+
# R1 판별력 폐어가 산출물에 «쓰이면» RETIRED 로 잡나
|
|
9
|
+
# R2 오탐 0 대체어로 바꾸면 조용한가
|
|
10
|
+
# R3 자기신고 🟥 «「재다」는 걷어낸 낱말이다» 라고 «적은» 줄은 위반이 아니라 mention 인가
|
|
11
|
+
# — 이게 없으면 폐어 원장이 자기를 위반으로 신고한다
|
|
12
|
+
# R4 처방 대체어를 finding 에 싣나 (처방 없는 판정은 절반이다)
|
|
13
|
+
set -uo pipefail
|
|
14
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
15
|
+
SKILL="$HERE/plugins/fh-commons/skills/preprep"
|
|
16
|
+
PASS=0; FAIL=0
|
|
17
|
+
ok(){ echo " ✅ $1"; PASS=$((PASS+1)); }
|
|
18
|
+
ng(){ echo " ❌ $1"; FAIL=$((FAIL+1)); }
|
|
19
|
+
command -v python3 >/dev/null 2>&1 || {
|
|
20
|
+
echo " ⚠️ UNMEASURED — python3 unavailable; retired lanes NOT run (this is not a pass)"
|
|
21
|
+
echo "retired lanes: SKIPPED (not passed)"; exit 0; }
|
|
22
|
+
|
|
23
|
+
out=$(cd "$SKILL" && python3 - <<'PY' 2>&1
|
|
24
|
+
import sys, os, json, yaml, tempfile
|
|
25
|
+
sys.path.insert(0, '.')
|
|
26
|
+
import preprep as P
|
|
27
|
+
spec = {'banned': [], 'conditional': [], 'retired': [
|
|
28
|
+
{'id': 'measure-verb', 'literals': ['재다'], 'replacement': '측정하다',
|
|
29
|
+
'why': '리뷰가 걷어낸 어휘', 'retired_by': 'review', 'retired_at': '2026-08-25'}]}
|
|
30
|
+
d = tempfile.mkdtemp(); sp = os.path.join(d, 't.yaml')
|
|
31
|
+
yaml.safe_dump(spec, open(sp, 'w', encoding='utf-8'), allow_unicode=True)
|
|
32
|
+
cfg = {'canon_terms': sp, 'canon_ledger': os.path.join(d, 'absent.md')}
|
|
33
|
+
r = {}
|
|
34
|
+
for k, body in (('use', '🗣\n> 그것을 재다 보면 압니다.\n'),
|
|
35
|
+
('repl', '🗣\n> 그것을 측정하다 보면 압니다.\n'),
|
|
36
|
+
('ment', '> 🚫 「재다」는 걷어낸 낱말이다. 쓰지 마라.\n')):
|
|
37
|
+
f, _ = P.lane_canon(cfg, '.', {'s': (body, 'markdown')}, {'s': {'spoken': True}})
|
|
38
|
+
r[k] = {'tags': [x[1] for x in f], 'msg': ' '.join(x[4] for x in f if x[1] == 'RETIRED')}
|
|
39
|
+
print(json.dumps(r, ensure_ascii=False))
|
|
40
|
+
PY
|
|
41
|
+
); rc=$?
|
|
42
|
+
[ $rc -eq 0 ] || { echo " ❌ INSTRUMENT ERROR — lane_canon 실행 실패 (rc=$rc): $out"; exit 1; }
|
|
43
|
+
g(){ python3 -c "import json,sys;d=json.loads(sys.argv[1]);print(d[sys.argv[2]][sys.argv[3]])" "$out" "$1" "$2"; }
|
|
44
|
+
|
|
45
|
+
[ "$(g use tags)" = "['RETIRED']" ] && ok "R1 판별력: 폐어 재유입을 RETIRED 로 잡는다" \
|
|
46
|
+
|| ng "R1 판별력 없음: $(g use tags)"
|
|
47
|
+
[ "$(g repl tags)" = "[]" ] && ok "R2 오탐 0: 대체어로 바꾸면 조용" || ng "R2 오탐: $(g repl tags)"
|
|
48
|
+
[ "$(g ment tags)" = "['mention']" ] && ok "R3 자기신고 방지: 폐어를 «적은» 줄은 mention" \
|
|
49
|
+
|| ng "R3 실패: $(g ment tags) — 폐어 원장이 자기를 위반으로 신고한다"
|
|
50
|
+
case "$(g use msg)" in *측정하다*) ok "R4 처방: 대체어를 finding 에 싣는다" ;;
|
|
51
|
+
*) ng "R4 실패 — 처방 없는 판정이다: $(g use msg)" ;; esac
|
|
52
|
+
|
|
53
|
+
echo "retired lanes: $PASS passed, $FAIL failed"
|
|
54
|
+
[ "$FAIL" -eq 0 ] || exit 1
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
#
|
|
64
64
|
# Usage: bash scripts/test_prepush_destructive_lanes.sh → exit 0 all pairs hold, 1 otherwise.
|
|
65
65
|
set -uo pipefail
|
|
66
|
+
. "$(dirname "${BASH_SOURCE[0]}")/fixture_guard_lib.sh" # 픽스처는 실레포에 쓰지 않는다
|
|
66
67
|
|
|
67
68
|
# FH_TEST_SUBJECT_ROOT points the suite at a COPY of the tree. It exists for the revert probe
|
|
68
69
|
# ("disable the gate on a copy — does exactly this suite go red?"), which is the only way to tell a
|
|
@@ -81,7 +82,8 @@ fi
|
|
|
81
82
|
|
|
82
83
|
# Test the STAGED blob when the hook is staged, same reasoning as the sibling anchor: an anchor that
|
|
83
84
|
# reads the worktree is bypassed by staging a regression and restoring the worktree.
|
|
84
|
-
WORK
|
|
85
|
+
WORK="$(fh_fixture_root "$(mktemp -d)")" || exit 1
|
|
86
|
+
: "${WORK:?fixture root unset — refusing to run git in cwd}"
|
|
85
87
|
trap 'rm -rf "$WORK"' EXIT
|
|
86
88
|
_status=$(git -C "$REPO_ROOT" -c core.quotePath=false diff --cached --name-status --no-renames 2>/dev/null \
|
|
87
89
|
| awk -F'\t' '$2 == "templates/.git-hooks/pre-push" { print $1; exit }')
|
|
@@ -100,7 +102,8 @@ PASSED=0; FAILED=0
|
|
|
100
102
|
# and an unresolvable base is itself one of the lanes — it must be resolvable everywhere else, or
|
|
101
103
|
# every delete lane would block for the WRONG reason and the suite would be green for nothing).
|
|
102
104
|
newrepo() {
|
|
103
|
-
local d; d
|
|
105
|
+
local d; d="$(fh_fixture_root "$(mktemp -d)")" || return 1
|
|
106
|
+
: "${d:?fixture root unset — refusing to run git in cwd}"
|
|
104
107
|
mkdir -p "$d/.claude/rules" "$d/templates/.git-hooks" "$d/tracks/_meta" "$d/scripts" || return 1
|
|
105
108
|
[ -f "$DEF_SRC" ] && cp "$DEF_SRC" "$d/.claude/rules/.public-surface-patterns.defaults"
|
|
106
109
|
[ -f "$REPO_ROOT/scripts/psa_scan_lib.sh" ] && cp "$REPO_ROOT/scripts/psa_scan_lib.sh" "$d/scripts/psa_scan_lib.sh"
|
|
@@ -50,7 +50,7 @@ fi
|
|
|
50
50
|
# T5 — END-TO-END (the anchor a cross-family audit required): a helper that ACTUALLY reads stdin,
|
|
51
51
|
# plus a synthetic DESTRUCTIVE ref, must still BLOCK. This is what T1-T4 cannot prove on their own —
|
|
52
52
|
# they test the mechanism and the source layout; this tests the shipped hook's real behavior.
|
|
53
|
-
T5_TMP=$(mktemp -d 2>/dev/null || echo "/tmp/fh_t5_$$") ; mkdir -p "$T5_TMP"
|
|
53
|
+
T5_TMP=$(mktemp -d 2>/dev/null || echo "/tmp/fh_t5_$$"); : "${T5_TMP:?fixture root unset — refusing to run git in cwd}" ; mkdir -p "$T5_TMP"
|
|
54
54
|
(
|
|
55
55
|
cd "$T5_TMP" || exit 1
|
|
56
56
|
git init -q . 2>/dev/null
|
|
@@ -83,7 +83,7 @@ fi
|
|
|
83
83
|
# never fires — over-blocking trains MAIN_PUSH_OK=1 into muscle memory, which disarms it.
|
|
84
84
|
_pp_run() { # _pp_run <refline> [env...] -> echoes exit code
|
|
85
85
|
local refline="$1"; shift
|
|
86
|
-
local d; d=$(mktemp -d 2>/dev/null || echo "/tmp/fh_pp_$$"); mkdir -p "$d/scripts"
|
|
86
|
+
local d; d=$(mktemp -d 2>/dev/null || echo "/tmp/fh_pp_$$"); : "${d:?fixture root unset — refusing to run git in cwd}"; mkdir -p "$d/scripts"
|
|
87
87
|
( cd "$d" && git init -q . 2>/dev/null
|
|
88
88
|
printf '#!/usr/bin/env bash\nexit 0\n' > scripts/session_close_check.sh
|
|
89
89
|
chmod +x scripts/session_close_check.sh
|
|
@@ -23,10 +23,13 @@
|
|
|
23
23
|
# Usage: bash scripts/test_regression_guard_ci_lanes.sh Exit: 0 = all behave; 1 = regression.
|
|
24
24
|
|
|
25
25
|
set -uo pipefail
|
|
26
|
+
. "$(dirname "${BASH_SOURCE[0]}")/fixture_guard_lib.sh" # 픽스처는 실레포에 쓰지 않는다
|
|
26
27
|
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
27
28
|
WF="$REPO_ROOT/.github/workflows/regression-guard.yml"
|
|
28
29
|
GUARD="$REPO_ROOT/templates/regression_guard.sh"
|
|
29
|
-
T
|
|
30
|
+
T="$(fh_fixture_root "$(mktemp -d)")"
|
|
31
|
+
: "${T:?fixture root unset — refusing to run git in cwd}"
|
|
32
|
+
trap 'rm -rf "$T"' EXIT
|
|
30
33
|
FAIL=0
|
|
31
34
|
|
|
32
35
|
# ── instrument calibration ───────────────────────────────────────────────────
|
|
@@ -153,16 +153,31 @@ done
|
|
|
153
153
|
# once-only invariant above (this one IS evadable by renaming), kept because it names the intent.
|
|
154
154
|
_CALLS=$(grep -c '_show_failure "\$_out"' "$SELFCHECK")
|
|
155
155
|
[ "$_CALLS" -ge 4 ]; chk $? "every lane block routes failure output through _show_failure (found $_CALLS, expected ≥4)"
|
|
156
|
-
|
|
157
|
-
[ "
|
|
156
|
+
# 🟥 2026-08-31 — 「0 히트」가 «대상이 고쳐졌다»와 «내 패턴이 낡았다»를 못 가른다. 파일 부재는
|
|
157
|
+
# `[ "" -eq 0 ]` 이 rc=2 를 내서 시끄럽지만, **리팩터로 표기가 바뀐 경우는 조용히 PASS** 다.
|
|
158
|
+
# ⇒ ⓐ 같은 실행에 «패턴 언어가 아직 산다»는 컨트롤을 둔다 ⓑ 절단 어휘를 «동사 부류»로 넓힌다.
|
|
159
|
+
_OUT_LIVE=$(grep -c '_out' "$SELFCHECK" || true); _OUT_LIVE="${_OUT_LIVE//[!0-9]/}"
|
|
160
|
+
[ -n "$_OUT_LIVE" ] && [ "$_OUT_LIVE" -ge 1 ]
|
|
161
|
+
chk $? "CONTROL — the \$_out vocabulary still exists in the target (found ${_OUT_LIVE:-<none>}); without this, the next assertion is vacuous"
|
|
162
|
+
# 절단은 `tail` 하나가 아니다. head/cut/sed 도 같은 손실을 낸다.
|
|
163
|
+
_TAILS=$(grep -cE '\$_out" *\| *(tail|head|cut|sed)' "$SELFCHECK" || true); _TAILS="${_TAILS//[!0-9]/}"
|
|
164
|
+
[ -n "$_TAILS" ] && [ "$_TAILS" -eq 0 ]
|
|
165
|
+
chk $? "no lane block still truncates its captured output (tail/head/cut/sed) (found ${_TAILS:-<unmeasured>}, expected 0)"
|
|
166
|
+
# 🟥 남은 잔여, 이름으로: «내가 생각 못 한 절단 표기»는 여전히 통과한다. 컨트롤은 «어휘가 산다»를
|
|
167
|
+
# 보증하지 «내 목록이 완전하다»를 보증하지 않는다.
|
|
158
168
|
|
|
159
169
|
# The one non-lane caller that also destroys its evidence at the CALL SITE (not inside check()).
|
|
160
170
|
# `check "..." bash -c '... >/dev/null'` discards the subject's stdout, and fh-codex-doctor writes
|
|
161
171
|
# 100% of its diagnostics to stdout (measured: 686 B stdout / 0 B stderr) — so a strict-mode failure
|
|
162
172
|
# would print a bare FAIL line with zero diagnosis. Anchored here because the fix is one line at the
|
|
163
173
|
# call site and does NOT require touching check() itself.
|
|
164
|
-
|
|
165
|
-
|
|
174
|
+
# 🟥 같은 축 — 호출자가 사라지거나 이름이 바뀌면 이 부재 단언이 공허해진다.
|
|
175
|
+
_CD_LIVE=$(grep -c "fh-codex-doctor" "$SELFCHECK" || true); _CD_LIVE="${_CD_LIVE//[!0-9]/}"
|
|
176
|
+
[ -n "$_CD_LIVE" ] && [ "$_CD_LIVE" -ge 1 ]
|
|
177
|
+
chk $? "CONTROL — fh-codex-doctor is still invoked from the target (found ${_CD_LIVE:-<none>}); without this, the next assertion is vacuous"
|
|
178
|
+
_CD=$(grep -c "fh-codex-doctor.js --strict >/dev/null" "$SELFCHECK" || true); _CD="${_CD//[!0-9]/}"
|
|
179
|
+
[ -n "$_CD" ] && [ "$_CD" -eq 0 ]
|
|
180
|
+
chk $? "fh-codex-doctor's stdout is not discarded at the call site (found ${_CD:-<unmeasured>}, expected 0)"
|
|
166
181
|
|
|
167
182
|
# Byte-hostile input: a lane emitting invalid UTF-8 must not be reported as "no output". The
|
|
168
183
|
# `tr -d '[:space:]'` form this guard originally used aborts on BSD with "Illegal byte sequence"
|
|
@@ -49,7 +49,7 @@ fi
|
|
|
49
49
|
# Builds a throwaway repo whose HEAD commit touches (or does not touch) an FH asset path.
|
|
50
50
|
_fixture() { # $1=touch_fh_asset(0/1) $2=completed-file body (empty = no file)
|
|
51
51
|
local touch_fh="$1" body="$2" T
|
|
52
|
-
T=$(mktemp -d)
|
|
52
|
+
T=$(mktemp -d); : "${T:?fixture root unset — refusing to run git in cwd}"
|
|
53
53
|
( cd "$T" \
|
|
54
54
|
&& git init -q . \
|
|
55
55
|
&& git config user.email anchor@local && git config user.name anchor \
|
|
@@ -182,7 +182,7 @@ _probe_control() { # $1=dir — returns 0 iff find -newer can separate a delibe
|
|
|
182
182
|
}
|
|
183
183
|
_granularity_probe() {
|
|
184
184
|
local reps=200 ties=0 i P a b
|
|
185
|
-
P=$(mktemp -d) || { echo " ↳ mtime granularity probe: UNCALIBRATED (mktemp -d failed) — no count reported"; return 0; }
|
|
185
|
+
P=$(mktemp -d) || { echo " ↳ mtime granularity probe: UNCALIBRATED (mktemp -d failed) — no count reported"; return 0; }; : "${P:?fixture root unset — refusing to run git in cwd}"
|
|
186
186
|
if ! _probe_control "$P"; then
|
|
187
187
|
rm -rf "$P"
|
|
188
188
|
echo " ↳ mtime granularity probe: UNCALIBRATED (find -newer could not separate a deliberately separated pair) — no count reported"
|
|
@@ -291,7 +291,7 @@ rm -rf "$T"
|
|
|
291
291
|
# 잡는 반쪽 구현은 ⑤-C-N 에서 통과해버린다 — 실제 카드가 「08-26 미팅」처럼 축약형을 쓴다.
|
|
292
292
|
_carry_fixture() { # $1=오늘카드 본문 $2=fh_completed 본문(빈 문자열=파일 없음) → "REPO|STORE"
|
|
293
293
|
local card_body="$1" done_body="$2" T S FUT
|
|
294
|
-
T=$(mktemp -d); S=$(mktemp -d)
|
|
294
|
+
T=$(mktemp -d); : "${T:?fixture root unset — refusing to run git in cwd}"; S=$(mktemp -d); : "${S:?fixture root unset — refusing to run git in cwd}"
|
|
295
295
|
( cd "$T" && git init -q . && git config user.email a@l && git config user.name a \
|
|
296
296
|
&& echo x > unrelated.txt && git add -A && git commit -qm fixture ) >/dev/null 2>&1
|
|
297
297
|
mkdir -p "$T/tracks/_meta"
|
|
@@ -342,7 +342,7 @@ _carry_lane "⑤-C-L 완료로그에 있음 → 통과" "❌ ⑤-C carry-over
|
|
|
342
342
|
"$(_carry_fixture '# card' "- ✅ $_CF 미팅 — 취소 확정")"
|
|
343
343
|
|
|
344
344
|
# ⑤-C-S: companion store 부재는 SKIPPED 여야 하고 **✅ 여서는 안 된다**.
|
|
345
|
-
_T4=$(mktemp -d)
|
|
345
|
+
_T4=$(mktemp -d); : "${_T4:?fixture root unset — refusing to run git in cwd}"
|
|
346
346
|
( cd "$_T4" && git init -q . && git config user.email a@l && git config user.name a \
|
|
347
347
|
&& echo x > u.txt && git add -A && git commit -qm f ) >/dev/null 2>&1
|
|
348
348
|
mkdir -p "$_T4/tracks/_meta"; printf '# card\n' > "$_T4/tracks/_meta/reference_next_session_starter.md"
|
|
@@ -367,7 +367,7 @@ rm -rf "$_T4"
|
|
|
367
367
|
# known-pair: a hostile store that WOULD trigger ⑤-C (its prior card carries a future date the
|
|
368
368
|
# fixture card lacks) must produce SKIPPED, not a carry-over FAIL. POS arm first: prove the
|
|
369
369
|
# hostile store really is hostile by feeding it to $CHECK ON PURPOSE.
|
|
370
|
-
_ei=$(mktemp -d)
|
|
370
|
+
_ei=$(mktemp -d); : "${_ei:?fixture root unset — refusing to run git in cwd}"
|
|
371
371
|
mkdir -p "$_ei/store/tracks-meta" "$_ei/work/tracks/_meta"
|
|
372
372
|
( cd "$_ei/store" && git init -q . && git config user.email l@l && git config user.name l
|
|
373
373
|
printf 'prior card\n- 2099-12-31 기한\n' > tracks-meta/reference_next_session_starter.md
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_sim_isolated_run_lanes.sh — behavioural known-pair lanes for scripts/sim_isolated_run.sh
|
|
3
|
+
#
|
|
4
|
+
# WHY THESE LANES AND NOT OTHERS. The runner exists because a sim became an agent fleet
|
|
5
|
+
# (2026-08-29: corpus self-contamination + a launchd agent written to the operator's machine +
|
|
6
|
+
# a false positive pointing at the desired conclusion). So the lanes pin the properties that
|
|
7
|
+
# failure would have needed, not the ones that are easy to assert:
|
|
8
|
+
# L1–L3 usage guards — a runner that silently accepts a bad mode runs the wrong thing
|
|
9
|
+
# L4 ABSENT, never empty — a missing surface and an empty one must not collapse
|
|
10
|
+
# L5 THREE-valued verdict — the first runner's `timeout 300` killed exactly the heavy arms
|
|
11
|
+
# and left 0-byte files that read as "the identity did not fire".
|
|
12
|
+
# A false RED manufactured by the instrument. `UNMEASURED` and
|
|
13
|
+
# `EMPTY` must stay distinguishable from each other AND from a no.
|
|
14
|
+
# L6 observe-mode VOID — if the read-only tool set leaks, the run is void, not "clean"
|
|
15
|
+
# L7 machine-surface diff — the launchd class. Detector, not gate — but it must FIRE.
|
|
16
|
+
# L8 --no-harness is opt-in — `--restricted` drops the project CLAUDE.md, i.e. it measures
|
|
17
|
+
# the BASE MODEL. If it ever became the default again, every
|
|
18
|
+
# salience measurement would silently be of the wrong thing.
|
|
19
|
+
# L9 always exit 0 — a detector that can block gets skipped; then it detects nothing
|
|
20
|
+
#
|
|
21
|
+
# The `claude` CLI is STUBBED. That is deliberate and it is the only way these lanes can carry a
|
|
22
|
+
# known pair: a real call is nondeterministic and costs money, so its output could never be a
|
|
23
|
+
# fixture. What is under test here is the runner's OWN logic — verdict classification, isolation
|
|
24
|
+
# bookkeeping, flag plumbing — never the model's answer.
|
|
25
|
+
#
|
|
26
|
+
# Usage: bash scripts/test_sim_isolated_run_lanes.sh
|
|
27
|
+
|
|
28
|
+
set -uo pipefail
|
|
29
|
+
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
30
|
+
SUT="${FH_SIM_RUNNER_BIN:-$ROOT/scripts/sim_isolated_run.sh}"
|
|
31
|
+
pass=0; fail=0
|
|
32
|
+
ok() { printf ' ✅ %s\n' "$1"; pass=$((pass+1)); }
|
|
33
|
+
no() { printf ' ❌ %s\n' "$1"; fail=$((fail+1)); }
|
|
34
|
+
|
|
35
|
+
if [ ! -f "$SUT" ]; then
|
|
36
|
+
echo "FAIL test_sim_isolated_run_lanes.sh: subject absent ($SUT) — skipped is not passed"
|
|
37
|
+
exit 1
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
WORKROOT="$(mktemp -d "${TMPDIR:-/tmp}/simlane-XXXXXX")"
|
|
41
|
+
trap 'rm -rf "$WORKROOT"' EXIT
|
|
42
|
+
|
|
43
|
+
# ── stub `claude` — behaviour selected by FH_STUB_MODE, read at call time ─────────────────────
|
|
44
|
+
STUBBIN="$WORKROOT/bin"; mkdir -p "$STUBBIN"
|
|
45
|
+
cat > "$STUBBIN/claude" <<'STUB'
|
|
46
|
+
#!/usr/bin/env bash
|
|
47
|
+
# Records the argv it was handed so a lane can assert on flag plumbing.
|
|
48
|
+
printf '%s\n' "$*" >> "${FH_STUB_ARGV_LOG:-/dev/null}"
|
|
49
|
+
case "${FH_STUB_MODE:-say}" in
|
|
50
|
+
say) echo "stub answer" ;;
|
|
51
|
+
silent) : ;; # rc 0, no output → EMPTY
|
|
52
|
+
die) exit 7 ;; # rc!=0, no output → UNMEASURED
|
|
53
|
+
write) echo "wrote"; : > "./LANE_SIDE_EFFECT.txt" ;; # dirties its own clone
|
|
54
|
+
machine) echo "ok"; mkdir -p "$HOME/Library/LaunchAgents"
|
|
55
|
+
: > "$HOME/Library/LaunchAgents/com.lane.probe.plist" ;;
|
|
56
|
+
# 🟥 stdin 을 그대로 받아 적는다 — 실물 `claude -p` 가 하는 짓을 재현한다.
|
|
57
|
+
# 진짜 CLI 는 stdin 이 TTY 가 아니면 그것을 «읽어 프롬프트 뒤에 붙인다».
|
|
58
|
+
stdin) echo "stub answer"; cat >> "${FH_STUB_STDIN_LOG:-/dev/null}" ;;
|
|
59
|
+
esac
|
|
60
|
+
exit 0
|
|
61
|
+
STUB
|
|
62
|
+
chmod +x "$STUBBIN/claude"
|
|
63
|
+
|
|
64
|
+
# A throwaway git repo for the runner to clone. `--local` needs a real repo with a commit.
|
|
65
|
+
SRC="$WORKROOT/src"; mkdir -p "$SRC"
|
|
66
|
+
( cd "$SRC" && git init -q . && git config user.email l@l && git config user.name l \
|
|
67
|
+
&& echo hi > f.txt && git add f.txt && git commit -qm init ) >/dev/null 2>&1
|
|
68
|
+
|
|
69
|
+
run_sut() { # env is set by the caller; echoes combined output, sets RC
|
|
70
|
+
OUT="$( cd "$SRC" && PATH="$STUBBIN:$PATH" bash "$SUT" "$@" 2>&1 )"; RC=$?
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
echo "── sim_isolated_run known-pair lanes ─────────────────────────────────"
|
|
74
|
+
|
|
75
|
+
# L1/L2/L3 — usage guards (known-negative: a bad invocation must NOT proceed)
|
|
76
|
+
run_sut --reps 1 --prompt p
|
|
77
|
+
[ "$RC" -eq 2 ] && ok "L1 missing --arm → exit 2" || no "L1 missing --arm: rc=$RC"
|
|
78
|
+
run_sut --arm a --reps 1
|
|
79
|
+
[ "$RC" -eq 2 ] && ok "L2 missing --prompt → exit 2" || no "L2 missing --prompt: rc=$RC"
|
|
80
|
+
run_sut --arm a --prompt p --mode bogus
|
|
81
|
+
[ "$RC" -eq 2 ] && ok "L3 bogus --mode → exit 2" || no "L3 bogus --mode: rc=$RC"
|
|
82
|
+
|
|
83
|
+
# L4 — ABSENT, never an empty line, for a surface that does not exist
|
|
84
|
+
FAKEHOME="$WORKROOT/home"; mkdir -p "$FAKEHOME"
|
|
85
|
+
OUTDIR="$WORKROOT/o4"
|
|
86
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say \
|
|
87
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$OUTDIR" ) >/dev/null 2>&1
|
|
88
|
+
if grep -q '^ABSENT$' "$OUTDIR/_machine_before.txt" 2>/dev/null; then
|
|
89
|
+
ok "L4 missing surface recorded as ABSENT (not an empty line)"
|
|
90
|
+
else no "L4 ABSENT token missing from snapshot"; fi
|
|
91
|
+
|
|
92
|
+
# L5 — THREE-valued verdict. This is the lane the false-RED incident bought.
|
|
93
|
+
OUTDIR="$WORKROOT/o5a"
|
|
94
|
+
OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=die \
|
|
95
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$OUTDIR" 2>&1 )
|
|
96
|
+
printf '%s' "$OUT" | grep -q "UNMEASURED" \
|
|
97
|
+
&& ok "L5a rc!=0 + 0 bytes → UNMEASURED (not a negative result)" \
|
|
98
|
+
|| no "L5a expected UNMEASURED, got: $(printf '%s' "$OUT" | grep -E 'r1' | head -1)"
|
|
99
|
+
OUTDIR="$WORKROOT/o5b"
|
|
100
|
+
OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=silent \
|
|
101
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$OUTDIR" 2>&1 )
|
|
102
|
+
printf '%s' "$OUT" | grep -q "EMPTY" \
|
|
103
|
+
&& ok "L5b rc=0 + 0 bytes → EMPTY (distinct from UNMEASURED)" \
|
|
104
|
+
|| no "L5b expected EMPTY"
|
|
105
|
+
# known-POSITIVE for the pair: a normal answer must be neither
|
|
106
|
+
OUTDIR="$WORKROOT/o5c"
|
|
107
|
+
OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say \
|
|
108
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$OUTDIR" 2>&1 )
|
|
109
|
+
if printf '%s' "$OUT" | grep -q "captured" && ! printf '%s' "$OUT" | grep -qE "EMPTY|UNMEASURED"; then
|
|
110
|
+
ok "L5c control — a real answer is captured, not classified as empty/unmeasured"
|
|
111
|
+
else no "L5c control failed (the three-way split does not discriminate)"; fi
|
|
112
|
+
|
|
113
|
+
# L6 — observe mode must call a write VOID, not clean
|
|
114
|
+
OUTDIR="$WORKROOT/o6"
|
|
115
|
+
OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=write \
|
|
116
|
+
bash "$SUT" --arm a --reps 1 --prompt p --mode observe --out "$OUTDIR" 2>&1 )
|
|
117
|
+
printf '%s' "$OUT" | grep -q "VOID" && printf '%s' "$OUT" | grep -q "CONTAMINATED" \
|
|
118
|
+
&& ok "L6 observe-mode write → VOID + CONTAMINATED" || no "L6 write in observe not caught"
|
|
119
|
+
# control: the same write in act mode is CONTAINED, not VOID
|
|
120
|
+
OUTDIR="$WORKROOT/o6b"
|
|
121
|
+
OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=write \
|
|
122
|
+
bash "$SUT" --arm a --reps 1 --prompt p --mode act --out "$OUTDIR" 2>&1 )
|
|
123
|
+
printf '%s' "$OUT" | grep -q "VOID" \
|
|
124
|
+
&& no "L6b control — act mode wrongly called VOID (the two modes are not separated)" \
|
|
125
|
+
|| ok "L6b control — same write in act mode is contained, not VOID"
|
|
126
|
+
|
|
127
|
+
# L7 — the launchd class. The detector must FIRE on a machine-surface delta.
|
|
128
|
+
OUTDIR="$WORKROOT/o7"
|
|
129
|
+
OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=machine \
|
|
130
|
+
bash "$SUT" --arm a --reps 1 --prompt p --mode act --out "$OUTDIR" 2>&1 )
|
|
131
|
+
printf '%s' "$OUT" | grep -q "MACHINE SURFACE CHANGED" \
|
|
132
|
+
&& ok "L7 machine-surface delta → detected + CONTAMINATED" \
|
|
133
|
+
|| no "L7 launchd-class side effect NOT detected"
|
|
134
|
+
rm -f "$FAKEHOME/Library/LaunchAgents/com.lane.probe.plist"
|
|
135
|
+
|
|
136
|
+
# L8 — --restricted is opt-in only. Both directions, because only the pair proves the plumbing.
|
|
137
|
+
OUTDIR="$WORKROOT/o8"; LOG="$WORKROOT/argv8.log"; : > "$LOG"
|
|
138
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG" \
|
|
139
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$OUTDIR" ) >/dev/null 2>&1
|
|
140
|
+
grep -q -- "--restricted" "$LOG" \
|
|
141
|
+
&& no "L8a DEFAULT passed --restricted — the harness under test would not be loaded" \
|
|
142
|
+
|| ok "L8a default does NOT pass --restricted (project CLAUDE.md stays resident)"
|
|
143
|
+
OUTDIR="$WORKROOT/o8b"; LOG2="$WORKROOT/argv8b.log"; : > "$LOG2"
|
|
144
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG2" \
|
|
145
|
+
bash "$SUT" --arm a --reps 1 --prompt p --no-harness --out "$OUTDIR" ) >/dev/null 2>&1
|
|
146
|
+
grep -q -- "--restricted" "$LOG2" \
|
|
147
|
+
&& ok "L8b --no-harness DOES pass --restricted (control-arm generator works)" \
|
|
148
|
+
|| no "L8b --no-harness did not reach the CLI"
|
|
149
|
+
|
|
150
|
+
# L9 — detector, never a gate: even a contaminated run exits 0
|
|
151
|
+
OUTDIR="$WORKROOT/o9"
|
|
152
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=write \
|
|
153
|
+
bash "$SUT" --arm a --reps 1 --prompt p --mode observe --out "$OUTDIR" ) >/dev/null 2>&1
|
|
154
|
+
[ $? -eq 0 ] && ok "L9 always exit 0 (a detector that can block gets skipped)" \
|
|
155
|
+
|| no "L9 non-zero exit — callers will learn to skip it"
|
|
156
|
+
|
|
157
|
+
# L10 — the clone's PARENT must not expose sibling arms. Measured leak: an arm scanning `../`
|
|
158
|
+
# for mappable projects reported the other reps' work dirs by name.
|
|
159
|
+
OUTDIR="$WORKROOT/o10"
|
|
160
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say \
|
|
161
|
+
bash "$SUT" --arm a --reps 2 --prompt p --out "$OUTDIR" ) >/dev/null 2>&1
|
|
162
|
+
# 🟥 PROPERTY-BASED ON PURPOSE. A first draft asserted on the literal path
|
|
163
|
+
# `<out>/w_a_r1/...`; a revert probe then "failed" it for the wrong reason — the path simply no
|
|
164
|
+
# longer existed, so the lane detected a rename rather than the leak. Locate the clones by what
|
|
165
|
+
# they ARE (directories containing .git under the out dir) and ask the actual question:
|
|
166
|
+
# does any clone's PARENT contain another clone?
|
|
167
|
+
CLONES=$(find "$OUTDIR" -maxdepth 3 -type d -name .git 2>/dev/null | sed 's|/.git$||' | sort)
|
|
168
|
+
nclone=$(printf '%s\n' "$CLONES" | grep -c . )
|
|
169
|
+
leak=0
|
|
170
|
+
for c in $CLONES; do
|
|
171
|
+
par=$(dirname "$c")
|
|
172
|
+
# count OTHER clones that share this parent
|
|
173
|
+
others=$(printf '%s\n' "$CLONES" | grep -v "^$c$" | while read -r o; do
|
|
174
|
+
[ "$(dirname "$o")" = "$par" ] && echo x; done | grep -c x)
|
|
175
|
+
[ "$others" -gt 0 ] && leak=$((leak+1))
|
|
176
|
+
done
|
|
177
|
+
if [ "$nclone" -ge 2 ] && [ "$leak" -eq 0 ]; then
|
|
178
|
+
ok "L10 no clone shares a parent with another ($nclone clones, 0 co-parented)"
|
|
179
|
+
else no "L10 sibling clones share a parent (clones=$nclone co-parented=$leak)"; fi
|
|
180
|
+
# control: the lane must be able to SEE two clones, else L10 passes on an empty set
|
|
181
|
+
[ "$nclone" -ge 2 ] \
|
|
182
|
+
&& ok "L10b control — $nclone clones found (L10 did not pass on an empty set)" \
|
|
183
|
+
|| no "L10b control — found $nclone clone(s); L10 proves nothing"
|
|
184
|
+
|
|
185
|
+
# L11 — --setup builds the precondition INSIDE the clone, and a failing setup VOIDs the arm
|
|
186
|
+
# rather than letting the sim run in a state it was not meant to observe.
|
|
187
|
+
OUTDIR="$WORKROOT/o11"
|
|
188
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say \
|
|
189
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$OUTDIR" \
|
|
190
|
+
--setup 'mkdir -p tracks/demoproj' ) >/dev/null 2>&1
|
|
191
|
+
[ -d "$OUTDIR/w_a_r1/repo/tracks/demoproj" ] \
|
|
192
|
+
&& ok "L11 --setup ran inside the clone (precondition built)" \
|
|
193
|
+
|| no "L11 --setup did not take effect in the clone"
|
|
194
|
+
# and it must NOT have touched the source tree — the whole point of doing it in the clone
|
|
195
|
+
[ -d "$SRC/tracks/demoproj" ] \
|
|
196
|
+
&& no "L11b --setup leaked into the SOURCE tree" \
|
|
197
|
+
|| ok "L11b control — source tree untouched by --setup"
|
|
198
|
+
OUTDIR="$WORKROOT/o11c"
|
|
199
|
+
OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say \
|
|
200
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$OUTDIR" --setup 'exit 3' 2>&1 )
|
|
201
|
+
printf '%s' "$OUT" | grep -q "SETUP FAILED" && printf '%s' "$OUT" | grep -q "CONTAMINATED" \
|
|
202
|
+
&& ok "L11c failing --setup → arm VOID, not a silent negative result" \
|
|
203
|
+
|| no "L11c failing setup did not void the arm"
|
|
204
|
+
|
|
205
|
+
# L12 — --extra-tools must reach the CLI, and must NOT be there by default. Both directions,
|
|
206
|
+
# because this flag decides what the arm can SEE, and a silently-dropped tool turns an
|
|
207
|
+
# enumeration failure into what looks like a session misjudging.
|
|
208
|
+
OUTDIR="$WORKROOT/o12"; LOG12="$WORKROOT/argv12.log"; : > "$LOG12"
|
|
209
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG12" \
|
|
210
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$OUTDIR" --extra-tools Bash ) >/dev/null 2>&1
|
|
211
|
+
grep -q "Read,Grep,Glob,Bash" "$LOG12" \
|
|
212
|
+
&& ok "L12 --extra-tools appended to the tool set" \
|
|
213
|
+
|| no "L12 --extra-tools did not reach the CLI ($(head -1 "$LOG12" 2>/dev/null))"
|
|
214
|
+
OUTDIR="$WORKROOT/o12b"; LOG12B="$WORKROOT/argv12b.log"; : > "$LOG12B"
|
|
215
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say FH_STUB_ARGV_LOG="$LOG12B" \
|
|
216
|
+
bash "$SUT" --arm a --reps 1 --prompt p --out "$OUTDIR" ) >/dev/null 2>&1
|
|
217
|
+
grep -q "Read,Grep,Glob,Bash" "$LOG12B" \
|
|
218
|
+
&& no "L12b control — Bash present WITHOUT --extra-tools (observe mode is not read-only)" \
|
|
219
|
+
|| ok "L12b control — no Bash without --extra-tools"
|
|
220
|
+
|
|
221
|
+
# ── L13 stdin 격리 (2026-08-31) — 🟥 이 레인이 없으면 근인이 조용히 재발한다 ────────────
|
|
222
|
+
# 실측: `claude -p` 는 **stdin 이 TTY 가 아니면 그것을 읽어 프롬프트 뒤에 붙인다.**
|
|
223
|
+
# 호출부(`context_continuity_score.sh`)가 `while … done < "$QSET"` 루프 «안»에서 이 러너를
|
|
224
|
+
# 부르므로, 러너도 claude 도 **stdin = 채점용 qset(정답 열 포함)** 을 상속했다.
|
|
225
|
+
# ⇒ 회차 1~3 과 probe1~4 의 모든 팔이 정답키 전체를 받았다. ARM 도 CTRL 도.
|
|
226
|
+
# 🟥 경로 deny·코퍼스 마스킹은 **원리적으로 못 막는다** — 도구 읽기가 아니라 프롬프트 조립이다.
|
|
227
|
+
# 🟥 그리고 «팔에게 물어보면» 안 잡힌다: 팔은 그것을 「프롬프트 인젝션」이라 부르며 정직하게
|
|
228
|
+
# 거부하면서 **거부문 안에서 정답을 말하고**, 채점기는 그 문장을 토큰으로 센다.
|
|
229
|
+
# 라이브 확인은 이미 났다(같은 문항 q2, 변수는 stdin 하나: 수리 전 3/3 → 수리 후 0/3).
|
|
230
|
+
# 여기서는 **모델 없이 결함 자체**를 잰다 — 스텁이 자기가 받은 stdin 을 적는다.
|
|
231
|
+
BAIT="ZZSTDINBAIT$(printf '%s' 7731)"
|
|
232
|
+
OUTDIR="$WORKROOT/o13"; SLOG="$WORKROOT/stdin13.log"; : > "$SLOG"
|
|
233
|
+
printf 'q1\tpositive\t질문\t%s\n' "$BAIT" > "$WORKROOT/bait.tsv"
|
|
234
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=stdin FH_STUB_STDIN_LOG="$SLOG" bash "$SUT" --arm a --reps 1 --prompt p --out "$OUTDIR" < "$WORKROOT/bait.tsv" ) >/dev/null 2>&1
|
|
235
|
+
# 🟥 컨트롤 먼저 — 스텁이 실제로 돌았나. 안 돌았으면 「미끼 0」은 통과가 아니라 계기 사망이다
|
|
236
|
+
# ([[feedback_absence_measurement_needs_control]] · 부재를 0 으로 렌더하지 않는다).
|
|
237
|
+
if [ ! -s "$OUTDIR/a_r1.txt" ]; then
|
|
238
|
+
no "L13-CTRL 팔이 산출을 냈나 (미끼 0 이 계기 사망이 아님을 보증)"
|
|
239
|
+
else
|
|
240
|
+
ok "L13-CTRL 팔이 산출을 냈다 ($(wc -c < "$OUTDIR/a_r1.txt" | tr -d ' ')B)"
|
|
241
|
+
fi
|
|
242
|
+
grep -qF "$BAIT" "$SLOG" 2>/dev/null \
|
|
243
|
+
&& no "L13 stdin 이 claude 까지 샜다 — 미끼가 프롬프트 채널에 도달했다" \
|
|
244
|
+
|| ok "L13 stdin 격리 — 미끼가 claude 에 도달하지 않는다"
|
|
245
|
+
# 🟥 known-positive: 같은 스텁·같은 미끼가 «막지 않으면» 실제로 잡히는가.
|
|
246
|
+
# 이게 없으면 위 레인은 「미끼가 원래 안 새는 것」과 구분되지 않는다
|
|
247
|
+
# ([[feedback_control_presence_is_not_discrimination]]).
|
|
248
|
+
SLOG2="$WORKROOT/stdin13b.log"; : > "$SLOG2"
|
|
249
|
+
( cd "$SRC" && PATH="$STUBBIN:$PATH" FH_STUB_MODE=stdin FH_STUB_STDIN_LOG="$SLOG2" \
|
|
250
|
+
claude -p p < "$WORKROOT/bait.tsv" ) >/dev/null 2>&1
|
|
251
|
+
grep -qF "$BAIT" "$SLOG2" 2>/dev/null \
|
|
252
|
+
&& ok "L13b known-positive — 차단 없이 부르면 미끼가 실제로 도달한다 (레인이 판별한다)" \
|
|
253
|
+
|| no "L13b known-positive 실패 — 스텁이 stdin 을 못 읽는다. L13 의 초록은 무의미하다"
|
|
254
|
+
|
|
255
|
+
# ── L24 🟥 «팔 눈가림» 자산이 클론에서 실제로 사라지나 ─────────────────────────────
|
|
256
|
+
# 얼린 정답지가 tracked 가 되면서 모든 팔의 클론에 들어갔다(실측: negative 명사구 히트 6~7).
|
|
257
|
+
# deny 가 아니라 «제거»인 이유 — 없는 파일은 어떤 도구로도 못 읽는다.
|
|
258
|
+
if [ -x "$ROOT/scripts/round/arm_blind_probe.sh" ]; then
|
|
259
|
+
bash "$ROOT/scripts/round/arm_blind_probe.sh" >/dev/null 2>&1 \
|
|
260
|
+
&& ok "L24 팔 눈가림 자산이 클론에서 제거된다 (히트 >0 → 0)" \
|
|
261
|
+
|| no "L24 눈가림 실패 — 팔이 정답지를 읽을 수 있다"
|
|
262
|
+
else no "L24 프로브 없음 — 검사 못 함(스킵 아님)"; fi
|
|
263
|
+
|
|
264
|
+
echo "sim_isolated_run lanes: $pass passed, $fail failed"
|
|
265
|
+
[ "$fail" -eq 0 ] || exit 1
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_skill_canon_preload_lanes.sh — field_canon_preload.sh 의 «스킬-정본» 분기 앵커.
|
|
3
|
+
#
|
|
4
|
+
# 이 분기가 존재하는 이유(실측 2026-08-28): 어느 세션이 preprep 의 정본 파일을 **하나도 안
|
|
5
|
+
# 열고 44판을 구웠고**, 선 굵기 토큰 위반이 388/907(43%) 났다. 자산이 없어서가 아니라
|
|
6
|
+
# **안 읽혀서**다. 훅은 이미 있었고 preprep 이 커버리지 경계 밖이었다.
|
|
7
|
+
#
|
|
8
|
+
# 재는 것 넷:
|
|
9
|
+
# S1 발화 발표 어휘가 오면 preprep 정본을 띄우나
|
|
10
|
+
# S2 오탐 0 무관한 프롬프트에는 조용한가
|
|
11
|
+
# S3 파일 이름 «정본을 읽어라» 훈계가 아니라 **파일 이름 + 줄 수**를 내나
|
|
12
|
+
# 🟥 이게 없으면 원 훅이 자기 헤더에서 금지한 «일반 훈계»가 된다
|
|
13
|
+
# S4 세션 1회 두 번째 호출은 조용한가 (반복 알림은 무시를 학습시킨다)
|
|
14
|
+
set -uo pipefail
|
|
15
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
16
|
+
HOOK="$HERE/scripts/field_canon_preload.sh"
|
|
17
|
+
PASS=0; FAIL=0
|
|
18
|
+
ok(){ echo " ✅ $1"; PASS=$((PASS+1)); }
|
|
19
|
+
ng(){ echo " ❌ $1"; FAIL=$((FAIL+1)); }
|
|
20
|
+
[ -f "$HOOK" ] || { echo " ❌ INSTRUMENT ERROR — 훅 부재: $HOOK"; exit 1; }
|
|
21
|
+
|
|
22
|
+
SD=$(mktemp -d); trap 'rm -rf "$SD"' EXIT
|
|
23
|
+
# 🟥 `CLAUDE_PROJECT_DIR` 을 «반드시» 준다. 안 주면 훅이 `$HOME/projects/forge-harness` 로
|
|
24
|
+
# 떨어지는데 CI 러너엔 그 경로가 없어 **조용히 침묵**한다 — 로컬 4/4 · CI 2/4 가 그렇게 났다.
|
|
25
|
+
# S2·S4 는 아무것도 안 나와도 통과하는 검사라, 그 조합이 «훅이 통째로 안 돈다»의 서명이다.
|
|
26
|
+
run(){ rm -rf "$SD/s"; mkdir -p "$SD/s"
|
|
27
|
+
CLAUDE_PROJECT_DIR="$HERE" FIELD_CANON_SENTINEL_DIR="$SD/s" bash "$HOOK" <<EOF 2>&1
|
|
28
|
+
{"prompt":"$1"}
|
|
29
|
+
EOF
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
pos=$(run "발표 자료 만들어줘")
|
|
33
|
+
neg=$(run "오늘 날씨 어때")
|
|
34
|
+
echo "$pos" | grep -q "skill-canon" && ok "S1 발화: 발표 어휘 → preprep 정본 안내" \
|
|
35
|
+
|| ng "S1 미발화 — 배선 안 된 코드는 산문이다"
|
|
36
|
+
# 🟥 S0 먼저 — «훅이 아예 안 돈다» 를 S2·S4 가 조용히 통과시키는 구멍을 막는다.
|
|
37
|
+
# 둘은 «아무 출력도 없음» 에서도 초록이라, 그 조합만으로는 침묵과 정상을 못 가른다.
|
|
38
|
+
[ -n "$pos" ] && ok "S0 훅이 출력을 냈다 (침묵을 통과로 안 읽는다)" \
|
|
39
|
+
|| ng "S0 훅이 아무것도 안 냈다 — 환경(CLAUDE_PROJECT_DIR)이나 배선을 봐라"
|
|
40
|
+
echo "$neg" | grep -q "skill-canon" && ng "S2 오탐: 무관한 프롬프트에도 뜬다" \
|
|
41
|
+
|| ok "S2 오탐 0"
|
|
42
|
+
echo "$pos" | grep -qE "presentation_checklist\.md \([0-9]+줄\)" \
|
|
43
|
+
&& ok "S3 파일 이름 + 줄 수를 낸다 (일반 훈계가 아니다)" \
|
|
44
|
+
|| ng "S3 실패 — 파일을 안 짚으면 «정본을 읽어라» 훈계이고, 그건 이 훅이 금지한 형태다"
|
|
45
|
+
|
|
46
|
+
rm -rf "$SD/t"; mkdir -p "$SD/t"
|
|
47
|
+
CLAUDE_PROJECT_DIR="$HERE" FIELD_CANON_SENTINEL_DIR="$SD/t" bash "$HOOK" <<'EOF' >/dev/null 2>&1
|
|
48
|
+
{"prompt":"발표 준비"}
|
|
49
|
+
EOF
|
|
50
|
+
again=$(CLAUDE_PROJECT_DIR="$HERE" FIELD_CANON_SENTINEL_DIR="$SD/t" bash "$HOOK" <<'EOF' 2>&1
|
|
51
|
+
{"prompt":"발표 준비"}
|
|
52
|
+
EOF
|
|
53
|
+
)
|
|
54
|
+
echo "$again" | grep -q "skill-canon" && ng "S4 재나그: 두 번째도 뜬다 — 무시를 학습시킨다" \
|
|
55
|
+
|| ok "S4 세션당 1회"
|
|
56
|
+
|
|
57
|
+
echo "skill-canon lanes: $PASS passed, $FAIL failed"
|
|
58
|
+
[ "$FAIL" -eq 0 ] || exit 1
|
|
@@ -11,9 +11,11 @@
|
|
|
11
11
|
# 이 둘이 빠지면 3번째 시도도 같은 자리에서 무너진다.
|
|
12
12
|
|
|
13
13
|
set -u
|
|
14
|
+
. "$(dirname "${BASH_SOURCE[0]}")/fixture_guard_lib.sh" # 픽스처는 실레포에 쓰지 않는다
|
|
14
15
|
T="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/target_freeze.sh"
|
|
15
16
|
pass=0; fail=0
|
|
16
|
-
WORK
|
|
17
|
+
WORK="$(fh_fixture_root "$(mktemp -d)")"
|
|
18
|
+
: "${WORK:?fixture root unset — refusing to run git in cwd}"
|
|
17
19
|
trap 'rm -rf "$WORK"' EXIT
|
|
18
20
|
R="$WORK/repo"
|
|
19
21
|
|