@chrono-meta/fh-gate 2.12.1 → 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.
- package/.claude/rules/fh_4axis_gate.md +35 -1
- package/.claude-plugin/marketplace.json +2 -2
- package/AGENTS.md +17 -0
- package/CHEATSHEET.md +19 -1
- package/CLAUDE.md +34 -9
- package/README.ja.md +186 -649
- package/README.ko.md +207 -698
- package/README.md +186 -698
- package/README.zh.md +167 -601
- package/docs/ETHOS.md +73 -1
- package/docs/IDENTITIES.md +83 -0
- package/docs/MODEL_SETUP.md +111 -0
- package/docs/OUTPUT_EVIDENCE.md +10 -2
- package/knowledge/shared/harness-core/fh_detail_protocols.md +131 -1
- package/knowledge/shared/harness-core/fh_three_layer_canon.md +15 -0
- package/knowledge/shared/harness-core/field_harness_diagnostic.md +30 -0
- package/knowledge/shared/harness-core/gate_locality_principle.md +29 -0
- package/knowledge/shared/harness-core/measurement-integrity-checklist.md +80 -0
- package/knowledge/shared/harness-core/ship_readiness_gate.md +103 -15
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +120 -0
- package/knowledge/shared/rules/multi_session_close_protocol.md +7 -1
- package/package.json +22 -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 +776 -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 +150 -0
- package/plugins/fh-meta/skills/install-wizard/SKILL.md +39 -0
- package/scripts/activity_log.sh +144 -0
- package/scripts/com.forge-harness.daily-report.plist +44 -0
- package/scripts/context_continuity_score.sh +435 -0
- package/scripts/daily_report.sh +208 -0
- package/scripts/digest_landing_check.sh +71 -0
- package/scripts/fh_session_load.sh +71 -2
- package/scripts/field_canon_preload.sh +44 -0
- package/scripts/gate_pathspec_check.sh +10 -4
- 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/package_coverage_check.sh +28 -11
- package/scripts/portability_lint.sh +30 -0
- package/scripts/selfcheck.sh +98 -1
- package/scripts/sim_isolated_run.sh +339 -0
- package/scripts/test_heavy_classifier_lanes.sh +4 -1
- package/scripts/test_lane_runner_lanes.sh +75 -0
- package/scripts/test_mapped_tracks_lanes.sh +58 -0
- package/scripts/test_marker_address_lanes.sh +78 -0
- package/scripts/test_marker_soul_check_lanes.sh +36 -0
- 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_sim_isolated_run_lanes.sh +219 -0
- package/scripts/test_skill_canon_preload_lanes.sh +58 -0
- package/scripts/universal_guard_check.sh +20 -8
- package/templates/.git-hooks/pre-commit +465 -8
- package/templates/regression_guard.sh +40 -1
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# sim_isolated_run.sh — run a blind floor-tier sim WITHOUT letting it become an agent fleet.
|
|
3
|
+
#
|
|
4
|
+
# WHY THIS EXISTS (measured 2026-08-29, twice):
|
|
5
|
+
# A blind sim of identity ④ was launched as 12 parallel `claude -p` calls in the LIVE repo cwd.
|
|
6
|
+
# Three things went wrong, and the third is the one that matters:
|
|
7
|
+
# 1. the arms wrote 6 files into the working tree and read each other's output — corpus
|
|
8
|
+
# self-contamination, the same defect as the 2026-08-23 probe's invalidated arm A3;
|
|
9
|
+
# 2. one arm registered a **launchd agent** in ~/Library/LaunchAgents — an unrequested,
|
|
10
|
+
# persistent change to the operator's machine, made by something called "a measurement";
|
|
11
|
+
# 3. 🟥 the contamination produced a FALSE POSITIVE POINTING AT THE DESIRED CONCLUSION.
|
|
12
|
+
# An arm answered "이미 돼있어" — found prior art, declined to rebuild — which is the
|
|
13
|
+
# textbook success scene for identity ④. The "prior art" was a file another arm had
|
|
14
|
+
# created two minutes earlier. Scored naively, ④ would have looked GREEN, on the same
|
|
15
|
+
# day the operator asked for ④ to be shown green.
|
|
16
|
+
# Isolation is therefore not "keep the answer word out of the prompt". It is "put the target
|
|
17
|
+
# where the arms cannot reach it".
|
|
18
|
+
#
|
|
19
|
+
# WHAT THIS GIVES YOU, and what it does NOT:
|
|
20
|
+
# ✅ PREVENTS repo-tree contamination — each arm gets its own disposable clone
|
|
21
|
+
# ✅ PREVENTS settings inheritance — `--restricted` ignores user/project/local settings
|
|
22
|
+
# ✅ DETECTS machine-level side effects — LaunchAgents / crontab / ~/.claude snapshot diff
|
|
23
|
+
# 🟥 DOES NOT PREVENT machine-level side effects in `act` mode. Full containment needs an OS
|
|
24
|
+
# sandbox, which this script does not provide. `observe` mode prevents them by removing the
|
|
25
|
+
# tools that could cause them; `act` mode trades that for behavioural fidelity and reports
|
|
26
|
+
# what happened. Saying "isolated" without this paragraph would be the lie this file exists
|
|
27
|
+
# to stop. A detector is not a gate (CLAUDE.md §Surface-Class Degrade Invariant).
|
|
28
|
+
#
|
|
29
|
+
# MODES
|
|
30
|
+
# observe (default) --tools "Read,Grep,Glob" → read-only. No writes possible.
|
|
31
|
+
# act write tools, inside a disposable clone. Machine surfaces are snapshotted
|
|
32
|
+
# before and after; any delta is printed LOUDLY and the run is CONTAMINATED.
|
|
33
|
+
# --no-harness adds `--restricted`, which DROPS the project CLAUDE.md. See below — this is
|
|
34
|
+
# a CONTROL arm generator, never the default.
|
|
35
|
+
#
|
|
36
|
+
# 🟥 WHY `--restricted` IS NOT THE DEFAULT — measured, one variable at a time, 2026-08-29.
|
|
37
|
+
# `--restricted` reads like the isolation flag you want ("ignores user, project and local
|
|
38
|
+
# settings files"). It also drops the project memory, so the harness under test is not loaded.
|
|
39
|
+
# The first build of this script used it, and the very first smoke run returned a bare
|
|
40
|
+
# "안녕하세요! 무엇을 도와드릴까요?" to a greeting — which would have been written up as
|
|
41
|
+
# **"the onboarding menu does not fire at floor tier"**, a large and false claim about FH.
|
|
42
|
+
# Worse, the first known-positive PASSED and hid it: the arm answered a CLAUDE.md question
|
|
43
|
+
# correctly *by grepping a file*, so "the harness is loaded" and "the model can search" were
|
|
44
|
+
# never separated. The discriminating pair needs `--tools ""` so search is impossible:
|
|
45
|
+
# same clone, --tools "", --restricted → "그런 규칙이 없어요" (memory ABSENT)
|
|
46
|
+
# same clone, --tools "", no --restricted → "🐿️" (memory PRESENT)
|
|
47
|
+
# One variable, opposite answers. ([[feedback_instrument_cannot_discriminate_hypotheses]])
|
|
48
|
+
#
|
|
49
|
+
# 🟢 AND THE DEFECT IS REUSABLE AS AN INSTRUMENT. `--no-harness` answers a question this repo
|
|
50
|
+
# asks constantly and usually by eye: **does this behaviour come from FH, or would the base
|
|
51
|
+
# model have done it anyway?** Run the same prompt with and without the flag; a behaviour that
|
|
52
|
+
# survives `--no-harness` was never the harness's doing. That is a control arm, and it is the
|
|
53
|
+
# cheapest honest one available here.
|
|
54
|
+
#
|
|
55
|
+
# USAGE
|
|
56
|
+
# bash scripts/sim_isolated_run.sh --arm cluster --reps 3 --prompt "이 프로젝트 가속화하고 싶어"
|
|
57
|
+
# bash scripts/sim_isolated_run.sh --arm build --mode act --reps 3 --prompt "..." --model sonnet
|
|
58
|
+
# bash scripts/sim_isolated_run.sh --arm door3 --reps 3 --prompt "..." \
|
|
59
|
+
# --setup 'mkdir -p tracks/demoproj' # build the precondition inside the clone
|
|
60
|
+
# Outputs land in a run dir printed at the end; each arm/rep is its own file.
|
|
61
|
+
#
|
|
62
|
+
# 🟥 OBSERVE MODE CANNOT SEE AN EMPTY DIRECTORY — and FH has machine signals that ARE empty
|
|
63
|
+
# directories. `fh_detail_protocols.md` §Branch test defines a mapped project as a
|
|
64
|
+
# `tracks/{name}/` **dir**, which is routinely empty; `Glob` matches files, so a read-only arm
|
|
65
|
+
# reports "no mapped projects" no matter what you created. Measured 2026-08-29: a `--setup` that
|
|
66
|
+
# ran `mkdir -p tracks/demoproj` succeeded, the directory existed in the clone, and all three
|
|
67
|
+
# arms still answered "매핑된 프로젝트가 하나도 없다". The fixture was real and invisible.
|
|
68
|
+
# ⇒ **A fixture for observe mode must contain a FILE.** This is an instrument constraint, not an
|
|
69
|
+
# FH defect (a normal session has Bash and can `ls`) — but scoring an arm without knowing it
|
|
70
|
+
# produces a confident zero from a fixture that was never observable.
|
|
71
|
+
#
|
|
72
|
+
# 🟥 PROJECT HOOKS DO NOT RUN IN A DISPOSABLE CLONE — so this runner cannot measure anything
|
|
73
|
+
# that depends on one. Measured 2026-08-30: an arm copied `.claude/settings.json` into its clone
|
|
74
|
+
# to make the PreToolUse PriorArt hook live; not one of the three clones grew
|
|
75
|
+
# `.claude/.prior_art_events.tsv`, while the live repo's copy carries entries from the same hour.
|
|
76
|
+
# The hook never fired, so the "hook vs no-hook" contrast was HOOK ≡ NOHOOK and either verdict
|
|
77
|
+
# would have been false. ⇒ Before claiming a hook-dependent result, check the hook's own
|
|
78
|
+
# evidence file INSIDE the clone; absence of that file invalidates the arm, not the hypothesis.
|
|
79
|
+
#
|
|
80
|
+
# 🟥 CONTROL IS NOT OPTIONAL. Always run at least one arm whose correct answer is "the thing
|
|
81
|
+
# being measured should NOT fire". An instrument that fires on everything measures nothing
|
|
82
|
+
# ([[feedback_control_presence_is_not_discrimination]]).
|
|
83
|
+
|
|
84
|
+
set -uo pipefail
|
|
85
|
+
|
|
86
|
+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
87
|
+
# ── 경로 격리 계산 (함수로 꺼냈다 — 레인이 «실행»해서 검증할 수 있게) ──────────────
|
|
88
|
+
# 🟥 처음엔 인라인이었고 레인이 `grep` 으로만 확인했다. new-code-anchor 게이트가 그것을
|
|
89
|
+
# **MENTION_ONLY** 로 잡았다: 「레인이 파일을 이름만 대고 실행하지 않는다」.
|
|
90
|
+
# 옳은 지적이다 — 그래서 함수로 꺼내 레인이 진짜로 부르게 한다.
|
|
91
|
+
fh_sim_write_path_isolation() { # $1=WORK $2=OUTDIR $3=REPO_ROOT $4=HOME → 0=썼다 1=격리없음(차단)
|
|
92
|
+
local _w="$1" _out="$2" _repo="$3" _home="$4"
|
|
93
|
+
# ── 🟥 경로 격리 (2026-08-30 — 이 러너는 이날까지 «격리»가 아니었다) ──────────────
|
|
94
|
+
# 헤더가 *"disposable clone 이라 오염 없음"* 이라 적어왔는데, **클론은 cwd 일 뿐이고
|
|
95
|
+
# 읽기는 어디든 갔다.** `--tools "Read,Grep,Glob"` 는 «쓰기»만 막지 «경로»를 안 막는다.
|
|
96
|
+
# 실측(같은 날, known-pair): observe 팔이 `/tmp` 파일을 출력했고, **채점용 qset 을
|
|
97
|
+
# 정답 토큰까지 통째로** 읽었고, 앞선 팔의 답변 디렉터리를 나열했다(159,050 파일).
|
|
98
|
+
# ⇒ 맥락유지 3개 회차가 전부 무효. 세 번의 VOID 는 «다른 증상 셋»이 아니라 **근인 하나**였다.
|
|
99
|
+
#
|
|
100
|
+
# 🟥 **첫 수리는 과차단이었다 — 클론 자신을 막았다.** `Read(//tmp/**)` 로 통째로 막았는데
|
|
101
|
+
# `WRAP="$_out/..."` 라서 `--out /tmp/...` 이면 **클론이 그 아래 산다.** ARM 이
|
|
102
|
+
# *"working directory 에 대한 read 권한이 모든 도구에서 거부"* 라고 답했다.
|
|
103
|
+
# ⇒ 광범위 차단 대신 **위험한 곳만 이름으로** 막는다: 실제 레포 · 홈 · 이 회차의 out 디렉터리.
|
|
104
|
+
# 그 셋이 «이 실험이 자기 답을 볼 수 있는» 전부다(소스·qset·앞선 팔의 답변).
|
|
105
|
+
# ⚠️ 완전 격리가 아니다 — 열거 안 한 절대경로는 여전히 읽힌다. 그렇게 적는다.
|
|
106
|
+
# 형태도 실측으로 골랐다: `Read(/x/**)`(슬래시 하나)는 **안 막힌다**. `Read(//x/**)` 라야 한다.
|
|
107
|
+
# `Glob(...)`/`Grep(...)` 을 섞으면 클론 안까지 과차단됐다 — 그래서 **Read 만** 둔다.
|
|
108
|
+
mkdir -p "$_w/.claude"
|
|
109
|
+
# 🟥 cross-family(agy #4): 여기가 **명백한 fail-open** 이었다 — 격리 규칙이 없는
|
|
110
|
+
# `settings.local.json` 이 클론에 있으면 주입을 건너뛰고 **비격리 상태로 측정을 강행**한다.
|
|
111
|
+
# 「SKIPPED 라고 알렸다」는 변명이 안 된다: 이 회차의 산출은 그래도 숫자로 쓰인다.
|
|
112
|
+
# ⇒ 격리 없이는 **회차를 시작하지 않는다**. 강행은 명시 플래그로만.
|
|
113
|
+
if [ -f "$_w/.claude/settings.local.json" ] && ! grep -q '"deny"' "$_w/.claude/settings.local.json" 2>/dev/null; then
|
|
114
|
+
if [ "${FH_SIM_NO_ISOLATION_OK:-}" = 1 ]; then
|
|
115
|
+
echo " ⚠️ arm 격리 없이 강행됨(FH_SIM_NO_ISOLATION_OK=1) — 이 회차는 오염 가능하다고 기록해라." >&2
|
|
116
|
+
else
|
|
117
|
+
echo " ❌ arm settings.local.json 이 이미 있는데 deny 규칙이 없다 — **격리 없이 재지 않는다.**" >&2
|
|
118
|
+
echo " 강행: FH_SIM_NO_ISOLATION_OK=1 (그러면 그 회차는 오염 가능으로 기록해라)" >&2
|
|
119
|
+
: # 오염 표기는 호출부가 한다(함수는 rc 로만 말한다)
|
|
120
|
+
return 1
|
|
121
|
+
fi
|
|
122
|
+
fi
|
|
123
|
+
if [ -f "$_w/.claude/settings.local.json" ]; then
|
|
124
|
+
:
|
|
125
|
+
else
|
|
126
|
+
# 🟥 **물리경로로 계산한다** (2026-08-30, 세 번째 수리). macOS 에서 `/tmp` 는
|
|
127
|
+
# `/private/tmp` 심링크라 **같은 자리가 두 이름**을 갖는다. 논리경로만 적으면
|
|
128
|
+
# 어떤 회차는 클론을 막고(과차단) 어떤 회차는 레포를 못 막는다(누출) — 즉 격리가
|
|
129
|
+
# **비결정적**이 된다. 실측: 같은 설정에서 한 팔은 «working directory 거부», 다른 팔은
|
|
130
|
+
# 레포의 qset 을 읽었다. 비결정적 격리는 격리가 아니다.
|
|
131
|
+
_phys(){ ( cd "$1" 2>/dev/null && pwd -P ) || printf '%s' "$1"; }
|
|
132
|
+
_p_repo=$(_phys "$_repo"); _p_home=$(_phys "$_home")
|
|
133
|
+
_p_out=$(_phys "$_out"); _p_work=$(_phys "$_w")
|
|
134
|
+
_deny_repo="//${_p_repo#/}"
|
|
135
|
+
_deny_home="//${_p_home#/}"
|
|
136
|
+
_deny_out="//${_p_out#/}"; _extra_out=""
|
|
137
|
+
# 🟥 클론이 out 아래 살면 out 을 통째로 막을 수 없다. 그 경우 «앞선 팔의 답변 파일»만 막는다.
|
|
138
|
+
# 클론이 out 아래 살면 out 을 통째로 못 막는다. 그때는 «다른 팔의 산출»만 막는다 —
|
|
139
|
+
# 🟥 `*.txt` 만으로는 부족했다: 다른 팔의 **클론 트리**(`w_*/repo/**`)에 주입된 봉인 원장을
|
|
140
|
+
# 읽을 수 있었다. 그것도 막고, **내 클론은 예외로 둔다**.
|
|
141
|
+
case "$_p_work" in
|
|
142
|
+
"$_p_out"/*) _deny_out="//${_p_out#/}/*.txt"; _extra_out=",\"Read(//${_p_out#/}/w_*/repo/tracks/**)\"" ;;
|
|
143
|
+
esac
|
|
144
|
+
# 🟥 cross-family(agy #1): 기본 `$TMPDIR`(macOS `/var/folders/**`)·공유 경로·마운트 볼륨이
|
|
145
|
+
# 빠져 있었다. 산출물이 기본 TMPDIR 에 생기면 앞선 팔의 결과가 그대로 읽힌다.
|
|
146
|
+
# 🟥 단 **클론이 사는 경로는 막으면 안 된다**(첫 수리가 그렇게 자기 발을 쐈다) —
|
|
147
|
+
# 그래서 `$_w` 를 품는 접두사는 목록에서 뺀다. 계산으로 하지, 손으로 고르지 않는다.
|
|
148
|
+
_extra=""
|
|
149
|
+
for d in /var/folders /private/var/folders /Users/Shared /Volumes /var/tmp /private/tmp /tmp; do
|
|
150
|
+
_pd=$(_phys "$d"); [ -n "$_pd" ] || continue
|
|
151
|
+
case "$_p_work" in "$_pd"/*) continue ;; esac # 내 클론이 그 아래면 막지 않는다(물리경로 비교)
|
|
152
|
+
case "$_p_out" in "$_pd"/*) continue ;; esac # out 도 마찬가지 — 위에서 정밀하게 다룬다
|
|
153
|
+
d="$_pd"
|
|
154
|
+
case "$_extra" in *"Read(//${d#/}/**)"*) continue ;; esac # 중복 금지(실행으로 드러났다)
|
|
155
|
+
_extra="$_extra,\"Read(//${d#/}/**)\""
|
|
156
|
+
done
|
|
157
|
+
# 🟥 함수로 꺼내 «실행»해보자마자 JSON 결함이 드러났다: 종전엔 `_deny_out` 안에 따옴표·괄호를
|
|
158
|
+
# 끼워넣어 `Read(...*.txt` 가 안 닫히고 `tracks/**))` 로 두 번 닫혔다. **grep 레인이었으면
|
|
159
|
+
# 영영 못 봤다** — new-code-anchor 게이트가 MENTION_ONLY 를 막은 것이 이걸 잡았다.
|
|
160
|
+
# ⇒ 조각을 문자열로 조립하지 말고 **필드별로 분리**한다. 그리고 중복도 제거한다.
|
|
161
|
+
printf '{"permissions":{"deny":["Read(%s/**)","Read(%s/**)","Read(%s)"%s%s]}}' \
|
|
162
|
+
"$_deny_repo" "$_deny_home" "$_deny_out" "$_extra_out" "$_extra" > "$_w/.claude/settings.local.json"
|
|
163
|
+
fi
|
|
164
|
+
|
|
165
|
+
return 0
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
ARM=""; REPS=1; PROMPT=""; MODE="observe"; MODEL="sonnet"; TIMEOUT=900; OUTDIR=""; NOHARNESS=0; SETUP=""; EXTRA=""
|
|
169
|
+
while [ $# -gt 0 ]; do
|
|
170
|
+
case "$1" in
|
|
171
|
+
--arm) ARM="${2:-}"; shift 2 ;;
|
|
172
|
+
--reps) REPS="${2:-1}"; shift 2 ;;
|
|
173
|
+
--prompt) PROMPT="${2:-}"; shift 2 ;;
|
|
174
|
+
--mode) MODE="${2:-observe}"; shift 2 ;;
|
|
175
|
+
--model) MODEL="${2:-sonnet}"; shift 2 ;;
|
|
176
|
+
--timeout) TIMEOUT="${2:-900}"; shift 2 ;;
|
|
177
|
+
--out) OUTDIR="${2:-}"; shift 2 ;;
|
|
178
|
+
--no-harness) NOHARNESS=1; shift ;; # CONTROL arm: drops project CLAUDE.md. Not isolation.
|
|
179
|
+
--setup) SETUP="${2:-}"; shift 2 ;; # shell run INSIDE each clone before the sim. See below.
|
|
180
|
+
--extra-tools) EXTRA="${2:-}"; shift 2 ;; # append tools to the mode's set. See TOOL VISIBILITY.
|
|
181
|
+
*) echo "unknown flag: $1" >&2; exit 2 ;;
|
|
182
|
+
esac
|
|
183
|
+
done
|
|
184
|
+
[ -n "$ARM" ] || { echo "FAIL: --arm required" >&2; exit 2; }
|
|
185
|
+
[ -n "$PROMPT" ] || { echo "FAIL: --prompt required" >&2; exit 2; }
|
|
186
|
+
case "$MODE" in observe|act) ;; *) echo "FAIL: --mode must be observe|act" >&2; exit 2 ;; esac
|
|
187
|
+
|
|
188
|
+
command -v claude >/dev/null 2>&1 || { echo "FAIL: claude CLI not on PATH" >&2; exit 2; }
|
|
189
|
+
|
|
190
|
+
OUTDIR="${OUTDIR:-$(mktemp -d "${TMPDIR:-/tmp}/fh-sim-XXXXXX")}"
|
|
191
|
+
mkdir -p "$OUTDIR"
|
|
192
|
+
|
|
193
|
+
# ── machine-surface snapshot ──────────────────────────────────────────────────────────────────
|
|
194
|
+
# Enumerated, not guessed. Each line is a surface a past run actually touched or plausibly could.
|
|
195
|
+
# `not found` is written as `ABSENT`, never as an empty string — an unreadable surface and an
|
|
196
|
+
# empty one must not collapse ([[feedback_not_found_is_not_zero_family]]).
|
|
197
|
+
snapshot() {
|
|
198
|
+
local f="$1"
|
|
199
|
+
{
|
|
200
|
+
echo "## LaunchAgents"
|
|
201
|
+
ls -1 "$HOME/Library/LaunchAgents" 2>/dev/null || echo "ABSENT"
|
|
202
|
+
echo "## crontab"
|
|
203
|
+
crontab -l 2>/dev/null || echo "ABSENT"
|
|
204
|
+
echo "## claude settings mtime"
|
|
205
|
+
# GNU-first on purpose: `stat -f` on GNU coreutils means "filesystem info" and SUCCEEDS,
|
|
206
|
+
# so a BSD-first chain never reaches the fallback and silently reports the wrong thing.
|
|
207
|
+
# Caught by this repo's own portability lint on the first commit attempt of this file.
|
|
208
|
+
stat -c '%Y %n' "$HOME/.claude/settings.json" 2>/dev/null \
|
|
209
|
+
|| stat -f '%m %N' "$HOME/.claude/settings.json" 2>/dev/null || echo "ABSENT"
|
|
210
|
+
} > "$f"
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
echo "── sim_isolated_run ──────────────────────────────────────────────"
|
|
214
|
+
echo "arm=$ARM mode=$MODE model=$MODEL reps=$REPS timeout=${TIMEOUT}s"
|
|
215
|
+
echo "out=$OUTDIR"
|
|
216
|
+
|
|
217
|
+
snapshot "$OUTDIR/_machine_before.txt"
|
|
218
|
+
|
|
219
|
+
CONTAMINATED=0
|
|
220
|
+
for r in $(seq 1 "$REPS"); do
|
|
221
|
+
# Each clone gets its OWN parent directory. Siblings under one parent are visible to `../`,
|
|
222
|
+
# and that is not hypothetical: an arm measured 2026-08-29 scanned its parent for mappable
|
|
223
|
+
# projects and reported finding "iso_A, door_CTRL" — the other arms' work dirs. Content stayed
|
|
224
|
+
# isolated, but their EXISTENCE leaked into the arm's reasoning, which is enough to change an
|
|
225
|
+
# answer about "what projects are around". Isolation has to hold for the parent too.
|
|
226
|
+
WRAP="$OUTDIR/w_${ARM}_r${r}"; mkdir -p "$WRAP"
|
|
227
|
+
WORK="$WRAP/repo"
|
|
228
|
+
# A disposable clone per REP, not per arm: two reps of the same arm contaminate each other
|
|
229
|
+
# exactly as two different arms do. That was the measured failure — reps 1 and 2 of build_cron.
|
|
230
|
+
if ! git clone --quiet --local --no-hardlinks "$REPO_ROOT" "$WORK" 2>"$OUTDIR/_clone_${ARM}_r${r}.err"; then
|
|
231
|
+
echo " ❌ r$r CLONE FAILED — see $OUTDIR/_clone_${ARM}_r${r}.err"
|
|
232
|
+
continue
|
|
233
|
+
fi
|
|
234
|
+
|
|
235
|
+
# --setup: build the PRECONDITION the measurement needs, inside the clone, before the sim.
|
|
236
|
+
# WHY THIS EXISTS: the first door-③ measurement (2026-08-29) scored 0/3 on both arms and the
|
|
237
|
+
# number meant nothing — a fresh clone has no mapped project tracks, so door ③ can never reach
|
|
238
|
+
# the follow-up proposal that was under test. Both arms correctly answered "there is nothing to
|
|
239
|
+
# accelerate" and the instrument never entered the state it was built to observe. A run whose
|
|
240
|
+
# precondition is unmet does not produce a negative result; it produces no result. Setting the
|
|
241
|
+
# fixture up INSIDE the disposable clone keeps that from being a reason to touch the live tree.
|
|
242
|
+
if [ -n "$SETUP" ]; then
|
|
243
|
+
if ! ( cd "$WORK" && eval "$SETUP" ) >"$WRAP/_setup.log" 2>&1; then
|
|
244
|
+
echo " ❌ r$r SETUP FAILED — precondition not built, arm is VOID (see $WRAP/_setup.log)"
|
|
245
|
+
CONTAMINATED=1
|
|
246
|
+
continue
|
|
247
|
+
fi
|
|
248
|
+
fi
|
|
249
|
+
# 🟥 기준선은 «클론 직후»가 아니라 «--setup 직후»다 (2026-08-30, 첫 실사용이 잡았다).
|
|
250
|
+
# 아래 :treediff 는 `git status --porcelain` 을 클론 시점 기준으로 읽었다. 그러면
|
|
251
|
+
# `--setup` 이 추적 파일을 건드리는 순간 그 팔은 **자동으로 CONTAMINATED** 가 된다 —
|
|
252
|
+
# 즉 «전제를 만드는 공식 수단»이 «판정을 무효로 만드는 수단»이었다.
|
|
253
|
+
# 실측: CTRL 3팔이 `rm -f .claude/soul_tenets.txt`(내가 시킨 그 삭제) 한 줄 때문에 전량 무효.
|
|
254
|
+
# ⇒ setup 이 만든 변화를 기준선으로 빼고, **팔이 만든 변화만** 본다.
|
|
255
|
+
# ⚠️ 이것은 오염 검사를 «약화»시키는 게 아니다: setup 은 내가 선언한 조작이고 로그에 남는다.
|
|
256
|
+
# 팔이 만든 변화는 여전히 한 줄도 허용 안 된다(observe 모드).
|
|
257
|
+
( cd "$WORK" && git status --porcelain ) > "$WRAP/_tree_baseline.txt" 2>/dev/null
|
|
258
|
+
|
|
259
|
+
fh_sim_write_path_isolation "$WORK" "$OUTDIR" "$REPO_ROOT" "$HOME" || { CONTAMINATED=1; continue; }
|
|
260
|
+
|
|
261
|
+
if [ "$MODE" = observe ]; then
|
|
262
|
+
TOOLS=(--tools "Read,Grep,Glob")
|
|
263
|
+
else
|
|
264
|
+
TOOLS=(--tools "Read,Grep,Glob,Bash,Write,Edit")
|
|
265
|
+
fi
|
|
266
|
+
# 🟥 TOOL VISIBILITY IS PART OF THE MEASUREMENT, NOT A DETAIL. `Glob` matches FILES; a
|
|
267
|
+
# directory with no file directly inside it is invisible to a Read/Grep/Glob arm. FH's branch
|
|
268
|
+
# test keys on `tracks/{name}/` DIRECTORIES, so an observe-mode arm can report "tracks/ has only
|
|
269
|
+
# .gitkeep" while `tracks/demoproj/` and `tracks/webshop/` both exist — measured 2026-08-29,
|
|
270
|
+
# verified by opening the clones. That looks exactly like a session misjudging, and it is not.
|
|
271
|
+
# ⇒ When the thing under test depends on ENUMERATION, add Bash and say so:
|
|
272
|
+
# --extra-tools Bash
|
|
273
|
+
# and treat the observe-only number as the "cannot enumerate" arm rather than as a defect rate.
|
|
274
|
+
[ -n "$EXTRA" ] && TOOLS[1]="${TOOLS[1]},$EXTRA"
|
|
275
|
+
# `--restricted` is opt-in ONLY, and opting in means you are measuring the BASE MODEL, not FH.
|
|
276
|
+
[ "$NOHARNESS" -eq 1 ] && TOOLS+=(--restricted)
|
|
277
|
+
|
|
278
|
+
# Blindness comes from the CLONE, not from a flag: `CLAUDE.local.md` is gitignored, so the
|
|
279
|
+
# operator's register pin and standing bindings are structurally absent from every arm. That is
|
|
280
|
+
# verifiable (`git ls-files | grep CLAUDE` returns CLAUDE.md alone) rather than asserted.
|
|
281
|
+
# `.claude/settings.json` is untracked too, so no hooks fire — which makes an arm resemble a
|
|
282
|
+
# CONSUMER install. State that when scoring: this measures the shipped surface, not this node.
|
|
283
|
+
( cd "$WORK" && timeout "$TIMEOUT" claude -p "$PROMPT" \
|
|
284
|
+
--model "$MODEL" "${TOOLS[@]}" 2>/dev/null ) > "$OUTDIR/${ARM}_r${r}.txt"
|
|
285
|
+
rc=$?
|
|
286
|
+
bytes=$(wc -c < "$OUTDIR/${ARM}_r${r}.txt" | tr -d ' ')
|
|
287
|
+
|
|
288
|
+
# 🟥 An empty output is NOT a "no" answer. The first version of tonight's runner used
|
|
289
|
+
# `timeout 300`, which killed exactly the heavy arms — the ones where the behaviour under test
|
|
290
|
+
# actually fired — and left 0-byte files that read as "the identity did not fire". A false RED
|
|
291
|
+
# generated by the instrument. So the verdict here is three-valued, never two.
|
|
292
|
+
if [ "$rc" -ne 0 ] && [ "$bytes" -eq 0 ]; then
|
|
293
|
+
echo " ⚠️ r$r UNMEASURED (rc=$rc, 0 bytes) — timeout or crash, NOT a negative result"
|
|
294
|
+
elif [ "$bytes" -eq 0 ]; then
|
|
295
|
+
echo " ⚠️ r$r EMPTY (rc=0) — the session said nothing; distinct from UNMEASURED"
|
|
296
|
+
else
|
|
297
|
+
echo " ✅ r$r captured ${bytes}B"
|
|
298
|
+
fi
|
|
299
|
+
|
|
300
|
+
# Report what the arm changed inside its own clone — in `act` mode this is the interesting part,
|
|
301
|
+
# and in `observe` mode a non-empty diff means --restricted did not hold and the run is void.
|
|
302
|
+
( cd "$WORK" && git status --porcelain ) > "$WRAP/_tree_final.txt" 2>/dev/null
|
|
303
|
+
# setup 기준선을 뺀다. 기준선 파일이 없으면(=setup 미사용) 빈 파일로 두어 종전과 동일하게 동작한다.
|
|
304
|
+
[ -f "$WRAP/_tree_baseline.txt" ] || : > "$WRAP/_tree_baseline.txt"
|
|
305
|
+
comm -13 <(sort "$WRAP/_tree_baseline.txt") <(sort "$WRAP/_tree_final.txt") \
|
|
306
|
+
> "$OUTDIR/${ARM}_r${r}.treediff.txt" 2>/dev/null
|
|
307
|
+
# 🟥 setup 이 만든 변화도 «버리지 말고» 별도로 남긴다 — 조용히 사라지면 다음 감사자가
|
|
308
|
+
# «CTRL 이 정말 등록부 없이 돌았나»를 확인할 방법이 없다.
|
|
309
|
+
cp "$WRAP/_tree_baseline.txt" "$OUTDIR/${ARM}_r${r}.setupdiff.txt" 2>/dev/null || true
|
|
310
|
+
tchanged=$(wc -l < "$OUTDIR/${ARM}_r${r}.treediff.txt" | tr -d ' ')
|
|
311
|
+
if [ "$MODE" = observe ] && [ "$tchanged" -gt 0 ]; then
|
|
312
|
+
echo " 🟥 r$r VOID — observe mode wrote $tchanged path(s); the read-only tool set did not hold"
|
|
313
|
+
CONTAMINATED=1
|
|
314
|
+
elif [ "$tchanged" -gt 0 ]; then
|
|
315
|
+
echo " ℹ️ r$r touched $tchanged path(s) inside its own clone (contained)"
|
|
316
|
+
fi
|
|
317
|
+
done
|
|
318
|
+
|
|
319
|
+
snapshot "$OUTDIR/_machine_after.txt"
|
|
320
|
+
if ! diff -q "$OUTDIR/_machine_before.txt" "$OUTDIR/_machine_after.txt" >/dev/null 2>&1; then
|
|
321
|
+
echo ""
|
|
322
|
+
echo "🟥🟥🟥 MACHINE SURFACE CHANGED DURING THIS RUN — the sim had side effects outside its clone."
|
|
323
|
+
diff "$OUTDIR/_machine_before.txt" "$OUTDIR/_machine_after.txt" | sed 's/^/ /'
|
|
324
|
+
echo " 이 실행은 CONTAMINATED 다. 채점하기 전에 되돌려라."
|
|
325
|
+
CONTAMINATED=1
|
|
326
|
+
fi
|
|
327
|
+
|
|
328
|
+
echo ""
|
|
329
|
+
echo "── scoring reminder (the part no script can do for you) ──────────"
|
|
330
|
+
echo " 🟥 «찾았다»는 답이 나오면 그것이 «언제 생겼는지»부터 봐라."
|
|
331
|
+
echo " tonight's false positive was an arm finding another arm's output and calling it prior art."
|
|
332
|
+
echo " 🟥 컨트롤 팔 없이 낸 숫자는 숫자가 아니다."
|
|
333
|
+
echo " 🟢 «이게 FH 때문인가»가 궁금하면 같은 프롬프트를 --no-harness 로 한 번 더 돌려라."
|
|
334
|
+
[ "$NOHARNESS" -eq 1 ] && echo " ⚠️ 이 실행은 --no-harness 다 — FH 를 잰 것이 아니라 «FH 없이도 그런가»를 잰 것이다."
|
|
335
|
+
echo ""
|
|
336
|
+
[ "$CONTAMINATED" -eq 1 ] && echo "RESULT: CONTAMINATED — do not score" || echo "RESULT: CLEAN"
|
|
337
|
+
echo "OUT: $OUTDIR"
|
|
338
|
+
# Detector, never a gate: always exit 0 so a caller cannot be trained to skip running it.
|
|
339
|
+
exit 0
|
|
@@ -99,7 +99,10 @@ check light "tracks/_meta/fh_completed.md" "session record"
|
|
|
99
99
|
check light "tracks/qasp/NEXT_ACTION.md" "field track record"
|
|
100
100
|
|
|
101
101
|
echo " ── honestly UNCOVERED — pinned so the residual cannot be believed closed ──"
|
|
102
|
-
check
|
|
102
|
+
check carveout "README.md" "npm-shipped surface — first-screen edits promote to HEAVY (2026-08-28)"
|
|
103
|
+
check carveout "README.ko.md" "language variants route the same way"
|
|
104
|
+
check carveout "README.zh-CN.md" "🟥 5-char locale forms too — cross-family caught [a-z]{2} missing these"
|
|
105
|
+
check uncovered ".claude/registry/README.md" "🟥 STILL UNCOVERED — in files[] but not root; named, not closed"
|
|
103
106
|
check uncovered "package.json" "files[] / version changes are unclassified"
|
|
104
107
|
check uncovered ".github/workflows/validate.yml" "🟥 CI definition — changing what CI runs is unclassified"
|
|
105
108
|
check uncovered "scripts/memory_link_check.py" "🟥 .py is not .sh — shipped python is unclassified"
|
|
@@ -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
|