@chrono-meta/fh-gate 3.26.2 → 3.28.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-plugin/marketplace.json +4 -4
- package/AGENTS.md +2 -1
- package/CLAUDE.md +84 -1329
- package/README.ja.md +2 -4
- package/README.ko.md +2 -4
- package/README.md +19 -19
- package/README.zh.md +2 -4
- package/knowledge/shared/dialogue/memory_intent_recall.md +35 -0
- package/knowledge/shared/harness-core/builtin_capability_map.md +70 -0
- package/knowledge/shared/harness-core/claude_md_full_reference.md +1277 -0
- package/knowledge/shared/harness-core/fh_module_contract.md +97 -0
- package/knowledge/shared/harness-core/multi_model_sidecar_strategy.md +64 -0
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +145 -0
- package/package.json +14 -1
- package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +84 -4
- package/plugins/fh-commons/skills/ko-tech-writer/fh-module.yaml +19 -0
- package/plugins/fh-commons/skills/ko-tech-writer/fixtures/known_negative.md +73 -1
- package/plugins/fh-commons/skills/ko-tech-writer/fixtures/known_positive.md +39 -1
- package/plugins/fh-commons/skills/ko-tech-writer/fixtures/known_unclosed.md +6 -0
- package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/CHANGELOG.md +23 -0
- package/plugins/fh-meta/skills/context-doctor/SKILL.md +1 -1
- package/plugins/fh-meta/skills/frontier-digest/SKILL.md +14 -10
- package/plugins/fh-meta/skills/frontier-digest/SKILL_detail.md +17 -1
- package/plugins/fh-meta/skills/install-doctor/SKILL.md +1 -1
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/fh_env_delta_scan.sh +20 -4
- package/scripts/fh_module_check.py +686 -0
- package/scripts/fixtures/frontier_digest_recall.tsv +5 -0
- package/scripts/ko_tech_writer_calibrate.py +288 -15
- package/scripts/memory_gc_report.py +270 -0
- package/scripts/probe_live_eval.sh +19 -1
- package/scripts/probe_live_eval_lib.py +174 -5
- package/scripts/resident_cost.py +1 -1
- package/scripts/selfcheck.sh +34 -1
- package/scripts/session_checklist.py +66 -0
- package/scripts/session_close_check.sh +44 -0
- package/scripts/sim_isolated_run.sh +31 -0
- package/scripts/test_claude_md_size_lanes.sh +22 -7
- package/scripts/test_env_delta_worktree_lanes.sh +61 -0
- package/scripts/test_fh_module_check_lanes.sh +581 -0
- package/scripts/test_frontier_digest_recall.sh +26 -0
- package/scripts/test_frontier_digest_recall_negctl.sh +15 -0
- package/scripts/test_ko_tech_writer_lanes.sh +1 -1
- package/scripts/test_memory_gc_report_lanes.sh +210 -0
- package/scripts/test_probe_live_eval_lanes.sh +116 -0
- package/scripts/test_regression_guard_sibling_lanes.sh +193 -0
- package/scripts/test_resident_cost_lanes.sh +1 -1
- package/scripts/test_session_checklist_lanes.sh +29 -0
- package/scripts/test_sim_isolated_run_lanes.sh +51 -0
- package/scripts/test_utterance_checklist_hook_lanes.sh +175 -0
- package/scripts/utterance_checklist_hook.py +193 -0
- package/scripts/utterance_checklist_hook.sh +31 -0
- package/templates/regression_guard.sh +30 -12
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Negative control for test_frontier_digest_recall.sh: remove channels from a COPY of SKILL.md and
|
|
3
|
+
# require the lane to go red; also require the unmodified file to be green (known pair).
|
|
4
|
+
set -uo pipefail
|
|
5
|
+
D="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
6
|
+
SK="$D/../plugins/fh-meta/skills/frontier-digest/SKILL.md"
|
|
7
|
+
T=$(mktemp -d); trap 'rm -rf "$T"' EXIT
|
|
8
|
+
bash "$D/test_frontier_digest_recall.sh" >/dev/null; [ $? -eq 0 ] || { echo "FAIL control: real file not green"; exit 1; }
|
|
9
|
+
# Aside needs launch-yc or product-hunt: drop both -> red. (apply check: rows really removed)
|
|
10
|
+
grep -v -E '^\| (Launch YC|Product Hunt) ' "$SK" > "$T/s.md"
|
|
11
|
+
[ "$(wc -l < "$T/s.md")" -lt "$(wc -l < "$SK")" ] || { echo "HARNESS-ERROR: mutation not applied"; exit 10; }
|
|
12
|
+
O1=$(FD_SKILL_FILE="$T/s.md" bash "$D/test_frontier_digest_recall.sh"); echo "$O1" | grep -q '^FAIL Aside' && echo "PASS negctl: removing Launch YC+Product Hunt turns Aside red" || { echo "FAIL negctl: lane stayed green"; exit 1; }
|
|
13
|
+
# Single removal must NOT turn Aside red (redundancy) but removing all of show-hn/PH/geeknews reds Orca.
|
|
14
|
+
grep -v -E '^\| (Show HN|Product Hunt|GeekNews) ' "$SK" > "$T/s2.md"
|
|
15
|
+
O2=$(FD_SKILL_FILE="$T/s2.md" bash "$D/test_frontier_digest_recall.sh"); echo "$O2" | grep -q '^FAIL Orca' && echo "PASS negctl: removing Show HN+PH+GeekNews turns Orca red" || { echo "FAIL negctl 2"; exit 1; }
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
# 세 허용 엔진 중 어디에나 있는 유일한 것이다.
|
|
28
28
|
#
|
|
29
29
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
30
|
-
# 무엇이 재어지는가 — Step 2
|
|
30
|
+
# 무엇이 재어지는가 — Step 2 클래스(C1-C5, C7-C12) + Step 4-b 두 패턴
|
|
31
31
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
32
32
|
# Step 2 C1 줄표 이어붙임 · C2 용어-머리 · C3 콜론 나열투 · C4 조각문 · C5 소유 직역
|
|
33
33
|
# Step 4-b C6 전칭 어휘 · C6b 부정형 전칭
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_memory_gc_report_lanes.sh — known-pair lanes for scripts/memory_gc_report.py
|
|
3
|
+
# Every lane asserts an EXACT value or an exact collection (codex R1 2026-10-15: prefix / presence
|
|
4
|
+
# checks stayed green under 4 mutants). Fixtures carry their own negative next to each positive.
|
|
5
|
+
set -u
|
|
6
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
+
PY="${PYTHON:-python3}"
|
|
8
|
+
T="$(mktemp -d)"; trap 'rm -rf "$T"' EXIT
|
|
9
|
+
pass=0; fail=0
|
|
10
|
+
eq(){ if [ "$2" = "$3" ]; then echo "PASS $1"; pass=$((pass+1)); else echo "FAIL $1 — got [$2] want [$3]"; fail=$((fail+1)); fi; }
|
|
11
|
+
|
|
12
|
+
M="$T/m"; mkdir -p "$M"
|
|
13
|
+
w(){ printf '%s\n' "$2" > "$M/$1"; }
|
|
14
|
+
hdr='---
|
|
15
|
+
name: x
|
|
16
|
+
description: fixture
|
|
17
|
+
metadata:'
|
|
18
|
+
w user_z.md "$hdr
|
|
19
|
+
type: user
|
|
20
|
+
---
|
|
21
|
+
body"
|
|
22
|
+
w user_a.md "$hdr
|
|
23
|
+
type: user
|
|
24
|
+
hits:
|
|
25
|
+
- 2026-01-01 | old founding, user entries never go cold
|
|
26
|
+
---
|
|
27
|
+
body"
|
|
28
|
+
w fb_promote.md "$hdr
|
|
29
|
+
type: feedback
|
|
30
|
+
hits:
|
|
31
|
+
- 2026-10-01 | first
|
|
32
|
+
|
|
33
|
+
# a comment inside the list must not end it
|
|
34
|
+
- 2026-10-01 | same day again
|
|
35
|
+
- 2026-10-05 | other day
|
|
36
|
+
---
|
|
37
|
+
body"
|
|
38
|
+
w fb_two_two.md "$hdr
|
|
39
|
+
type: feedback
|
|
40
|
+
hits:
|
|
41
|
+
- 2026-10-03 | a
|
|
42
|
+
- 2026-10-04 | b
|
|
43
|
+
---
|
|
44
|
+
body"
|
|
45
|
+
w fb_sameday.md "$hdr
|
|
46
|
+
type: feedback
|
|
47
|
+
hits:
|
|
48
|
+
- 2026-10-02 | a
|
|
49
|
+
- 2026-10-02 | b
|
|
50
|
+
- 2026-10-02 | c
|
|
51
|
+
---
|
|
52
|
+
body"
|
|
53
|
+
w fb_cold.md "$hdr
|
|
54
|
+
type: feedback
|
|
55
|
+
hits:
|
|
56
|
+
- 2026-09-15 | exactly 30 days before today
|
|
57
|
+
---
|
|
58
|
+
body"
|
|
59
|
+
w fb_fresh.md "$hdr
|
|
60
|
+
type: feedback
|
|
61
|
+
hits:
|
|
62
|
+
- 2026-09-16 | 29 days, not cold yet
|
|
63
|
+
---
|
|
64
|
+
body"
|
|
65
|
+
w fb_unmeasured.md "$hdr
|
|
66
|
+
type: feedback
|
|
67
|
+
---
|
|
68
|
+
body"
|
|
69
|
+
w fb_unlisted.md "$hdr
|
|
70
|
+
type: feedback
|
|
71
|
+
---
|
|
72
|
+
body"
|
|
73
|
+
w fb_baddate.md "$hdr
|
|
74
|
+
type: feedback
|
|
75
|
+
hits:
|
|
76
|
+
- 2026-99-99 | impossible
|
|
77
|
+
- 2026-99-98 | impossible
|
|
78
|
+
- 2026-99-97 | impossible
|
|
79
|
+
---
|
|
80
|
+
body"
|
|
81
|
+
w fb_future.md "$hdr
|
|
82
|
+
type: feedback
|
|
83
|
+
hits:
|
|
84
|
+
- 2027-01-01 | future
|
|
85
|
+
---
|
|
86
|
+
body"
|
|
87
|
+
w fb_inline.md "$hdr
|
|
88
|
+
type: feedback
|
|
89
|
+
hits: [bad]
|
|
90
|
+
---
|
|
91
|
+
body"
|
|
92
|
+
w fb_foreign.md "---
|
|
93
|
+
name: x
|
|
94
|
+
other:
|
|
95
|
+
hits:
|
|
96
|
+
- 2026-10-01 | not under metadata
|
|
97
|
+
metadata:
|
|
98
|
+
type: feedback
|
|
99
|
+
---
|
|
100
|
+
body"
|
|
101
|
+
w fb_unterm.md "---
|
|
102
|
+
name: x
|
|
103
|
+
metadata:
|
|
104
|
+
type: feedback
|
|
105
|
+
hits:
|
|
106
|
+
- 2026-10-01 | never closed"
|
|
107
|
+
mkdir "$M/fb_dir.md"
|
|
108
|
+
w MEMORY.md "# Memory Index
|
|
109
|
+
- [Z](user_z.md) — user listed first
|
|
110
|
+
- [A](user_a.md) — user listed second
|
|
111
|
+
- [S](fb_sameday.md \"titled\") — titled link
|
|
112
|
+
- [P](./fb_promote.md) — dot-slash link
|
|
113
|
+
- [T](fb_two_two.md#part) — fragment link
|
|
114
|
+
- [C](fb_cold.md)
|
|
115
|
+
- [F](fb_fresh.md)
|
|
116
|
+
- [N](fb_unmeasured.md)
|
|
117
|
+
- [B](fb_baddate.md)
|
|
118
|
+
- [U](fb_future.md)
|
|
119
|
+
- [I](fb_inline.md)
|
|
120
|
+
- [O](fb_foreign.md)
|
|
121
|
+
- [X](fb_unterm.md)
|
|
122
|
+
- [web](https://example.com/page.md) — external, not a local file
|
|
123
|
+
- [P again](fb_promote.md) — duplicate
|
|
124
|
+
- [gone](fb_missing.md#sec) — dangling with fragment"
|
|
125
|
+
|
|
126
|
+
J="$(python3 "$HERE/memory_gc_report.py" "$M" --today 2026-10-15 --json)"; rc=$?
|
|
127
|
+
q(){ printf '%s' "$J" | "$PY" -c "import json,sys;d=json.load(sys.stdin);E={e['file']:e for e in d['entries']};print($1)"; }
|
|
128
|
+
|
|
129
|
+
eq "L0 report runs" "$rc" 0
|
|
130
|
+
eq "L1 promote = exactly age≥3 over ≥2 days (2-hit/2-day and same-day x3 excluded)" "$(q "d['promote']")" "[['fb_promote.md', 3, 2]]"
|
|
131
|
+
eq "L2 blank line + comment inside hits do not truncate the list" "$(q "E['fb_promote.md']['age']")" 3
|
|
132
|
+
eq "L3 cold = non-user age 1 at ≥30 days (29 days and old user entry stay)" "$(q "d['cold']")" "['fb_cold.md']"
|
|
133
|
+
eq "L4 no hits = UNMEASURED (age None), not age 1" "$(q "E['fb_unmeasured.md']['age']")" None
|
|
134
|
+
eq "L5 hits outside metadata are ignored" "$(q "E['fb_foreign.md']['age']")" None
|
|
135
|
+
eq "L6 impossible dates never measure or promote" "$(q "(E['fb_baddate.md']['age'], E['fb_baddate.md']['status'], len(E['fb_baddate.md']['bad']))")" "(None, 'HITS_MALFORMED', 3)"
|
|
136
|
+
eq "L7 future date rejected" "$(q "(E['fb_future.md']['age'], E['fb_future.md']['status'])")" "(None, 'HITS_MALFORMED')"
|
|
137
|
+
eq "L8 inline hits flagged" "$(q "E['fb_inline.md']['status']")" HITS_MALFORMED
|
|
138
|
+
eq "L9 unterminated frontmatter flagged" "$(q "E['fb_unterm.md']['status']")" UNTERMINATED_FRONTMATTER
|
|
139
|
+
eq "L10 unreadable topic flagged, not folded into no-hits" "$(q "E['fb_dir.md']['status']")" READ_ERROR
|
|
140
|
+
eq "L11 errors list is exact" "$(q "sorted(x[0] for x in d['errors'])")" "['fb_baddate.md', 'fb_dir.md', 'fb_future.md', 'fb_inline.md', 'fb_unterm.md']"
|
|
141
|
+
eq "L12 ./ , titled and #fragment links resolve; only the real orphan is unlisted" "$(q "sorted(d['unlisted'])")" "['fb_dir.md', 'fb_unlisted.md']"
|
|
142
|
+
eq "L13 duplicate reported with both line numbers" "$(q "d['duplicates']")" "[['fb_promote.md', 5, 16]]"
|
|
143
|
+
eq "L14 dangling local link (fragment stripped); external https ignored" "$(q "d['dangling']")" "[['fb_missing.md', 17]]"
|
|
144
|
+
eq "L15 full order: users in index order, measured by age (ties index order), rest in index order, cold out" \
|
|
145
|
+
"$(q "d['order']")" \
|
|
146
|
+
"['user_z.md', 'user_a.md', 'fb_sameday.md', 'fb_promote.md', 'fb_two_two.md', 'fb_fresh.md', 'fb_unmeasured.md', 'fb_baddate.md', 'fb_future.md', 'fb_inline.md', 'fb_foreign.md', 'fb_unterm.md']"
|
|
147
|
+
eq "L16 every topic file has an entry" "$(q "len(d['entries'])")" 15
|
|
148
|
+
|
|
149
|
+
# cap boundary: an index that fits exactly is within cap; one char over names the line and the loaded prefix
|
|
150
|
+
C="$T/c"; mkdir -p "$C"; printf '[a](a.md)' > "$C/MEMORY.md"; printf -- '---\nmetadata:\n type: feedback\n---\n' > "$C/a.md"
|
|
151
|
+
eq "L17 exact-fit index is within cap" "$(python3 "$HERE/memory_gc_report.py" "$C" --cap 9 --json | "$PY" -c "import json,sys;print(json.load(sys.stdin)['cut'])")" None
|
|
152
|
+
printf 'line one\n[a](a.md)\n' > "$C/MEMORY.md"
|
|
153
|
+
eq "L18 cut names line 2 with 3 chars loaded" "$(python3 "$HERE/memory_gc_report.py" "$C" --cap 12 --json | "$PY" -c "import json,sys;c=json.load(sys.stdin)['cut'];print(c['line'],c['chars_loaded_in_line'])")" "2 3"
|
|
154
|
+
|
|
155
|
+
python3 "$HERE/memory_gc_report.py" "$T/nope" >/dev/null 2>&1; eq "L19 missing dir = HARNESS-ERROR rc=2, not an empty report" "$?" 2
|
|
156
|
+
before="$(cd "$M" && find . -type f -exec cksum {} + | sort)"; python3 "$HERE/memory_gc_report.py" "$M" >/dev/null 2>&1; after="$(cd "$M" && find . -type f -exec cksum {} + | sort)"
|
|
157
|
+
eq "L20 read-only: fixture bytes unchanged" "$before" "$after"
|
|
158
|
+
|
|
159
|
+
# R2 fixtures (codex R2): mixed validity never drives lifecycle · indentless list flagged ·
|
|
160
|
+
# <...> / %20 / balanced-paren destinations · past_cap by the link's own offset
|
|
161
|
+
R="$T/r"; mkdir -p "$R"
|
|
162
|
+
rw(){ printf '%s\n' "$2" > "$R/$1"; }
|
|
163
|
+
rw mix_cold.md "$hdr
|
|
164
|
+
type: feedback
|
|
165
|
+
hits:
|
|
166
|
+
- 2026-08-01 | valid old
|
|
167
|
+
- 2027-01-01 | future
|
|
168
|
+
---"
|
|
169
|
+
rw mix_prom.md "$hdr
|
|
170
|
+
type: feedback
|
|
171
|
+
hits:
|
|
172
|
+
- 2026-10-01 | a
|
|
173
|
+
- 2026-10-02 | b
|
|
174
|
+
- 2026-10-03 | c
|
|
175
|
+
- nonsense line
|
|
176
|
+
---"
|
|
177
|
+
rw flat.md "$hdr
|
|
178
|
+
type: feedback
|
|
179
|
+
hits:
|
|
180
|
+
- 2026-10-01 | indentless
|
|
181
|
+
---"
|
|
182
|
+
rw "my note.md" "$hdr
|
|
183
|
+
type: feedback
|
|
184
|
+
---"
|
|
185
|
+
rw "sp name.md" "$hdr
|
|
186
|
+
type: feedback
|
|
187
|
+
---"
|
|
188
|
+
rw "note(v2).md" "$hdr
|
|
189
|
+
type: feedback
|
|
190
|
+
---"
|
|
191
|
+
rw MEMORY.md "- [m](mix_cold.md) [p](mix_prom.md) [f](flat.md)
|
|
192
|
+
- [a](<my note.md>) [b](sp%20name.md) [c](note(v2).md) [x](<gone note.md>) [y](gone(v2).md)"
|
|
193
|
+
JR="$(python3 "$HERE/memory_gc_report.py" "$R" --today 2026-10-15 --json)"
|
|
194
|
+
qr(){ printf '%s' "$JR" | "$PY" -c "import json,sys;d=json.load(sys.stdin);E={e['file']:e for e in d['entries']};print($1)"; }
|
|
195
|
+
eq "L21 valid-old + future hit: flagged, not cold" "$(qr "(E['mix_cold.md']['status'], d['cold'])")" "('HITS_MALFORMED', [])"
|
|
196
|
+
eq "L22 three valid + one malformed: no promotion" "$(qr "d['promote']")" "[]"
|
|
197
|
+
eq "L23 indentless hits item flagged, not silently dropped" "$(qr "(E['flat.md']['status'], E['flat.md']['age'])")" "('HITS_MALFORMED', None)"
|
|
198
|
+
eq "L24 <...>, %20 and balanced-paren destinations resolve" "$(qr "sorted(d['unlisted'])")" "[]"
|
|
199
|
+
eq "L25 their missing twins are dangling" "$(qr "sorted(x[0] for x in d['dangling'])")" "['gone note.md', 'gone(v2).md']"
|
|
200
|
+
JP="$(python3 "$HERE/memory_gc_report.py" "$R" --today 2026-10-15 --cap 22 --json)"
|
|
201
|
+
eq "L26 past_cap follows the link's own offset on a shared line" \
|
|
202
|
+
"$(printf '%s' "$JP" | "$PY" -c "import json,sys;E={e['file']:e for e in json.load(sys.stdin)['entries']};print(E['mix_cold.md']['past_cap'],E['mix_prom.md']['past_cap'])")" "False True"
|
|
203
|
+
|
|
204
|
+
# R3 (codex): two links on ONE line keep their link order, not filename order
|
|
205
|
+
Q="$T/q"; mkdir -p "$Q"; for f in z a; do printf -- '---\nmetadata:\n type: user\n---\n' > "$Q/$f.md"; done
|
|
206
|
+
printf -- '- [z](z.md) [a](a.md)\n' > "$Q/MEMORY.md"
|
|
207
|
+
eq "L27 same-line links keep link order" "$(python3 "$HERE/memory_gc_report.py" "$Q" --json | "$PY" -c "import json,sys;print(json.load(sys.stdin)['order'])")" "['z.md', 'a.md']"
|
|
208
|
+
|
|
209
|
+
echo "memory_gc_report lanes: $pass pass · $fail fail"
|
|
210
|
+
[ $fail -eq 0 ]
|
|
@@ -723,6 +723,122 @@ _lane EV8 evidence "control — the LIVE evidence dir was not written by these l
|
|
|
723
723
|
"$LIVE_EV_BEFORE" "$([ -d "$LIVE_EV" ] && find "$LIVE_EV" -mindepth 1 -maxdepth 1 | wc -l | tr -d ' ' || echo ABSENT)"
|
|
724
724
|
|
|
725
725
|
fi
|
|
726
|
+
echo ""
|
|
727
|
+
echo "── budget line + --target split (2026-10-17) ─────────────────────"
|
|
728
|
+
# WHY. A FAIL that ended at a harness cap (timeout) reads identically to a real FAIL, and one pooled
|
|
729
|
+
# pass_rate cannot say whether a repair fixed its target or moved everything. These lanes pin that
|
|
730
|
+
# every row carries the cap and ended_at_cap (three-valued: a missing record is UNKNOWN, never no),
|
|
731
|
+
# and that --target splits the summary while the default output is untouched.
|
|
732
|
+
_budget() { # $1=ended value for primary_r1 meta, or MISSING -> "ended_at_cap|budget"
|
|
733
|
+
python3 - "$REPO_ROOT" "$1" <<'PY'
|
|
734
|
+
import sys, os, tempfile
|
|
735
|
+
sys.path.insert(0, os.path.join(sys.argv[1], 'scripts'))
|
|
736
|
+
from probe_live_eval_lib import score_run
|
|
737
|
+
root = tempfile.mkdtemp(); base = os.path.join(root, 'G-X'); os.makedirs(base)
|
|
738
|
+
open(os.path.join(base, 'primary_r1.txt'), 'w').write('nothing')
|
|
739
|
+
open(os.path.join(base, 'control_r1.txt'), 'w').write('weather')
|
|
740
|
+
for arm in ('primary', 'control'):
|
|
741
|
+
if sys.argv[2] == 'MISSING':
|
|
742
|
+
continue
|
|
743
|
+
if sys.argv[2] == 'PARTIAL' and arm == 'primary':
|
|
744
|
+
continue # transcript present, meta absent: ran but unmeasured
|
|
745
|
+
end = sys.argv[2] if arm == 'primary' else 'no'
|
|
746
|
+
open(os.path.join(base, arm + '_r1.meta.tsv'), 'w').write(
|
|
747
|
+
'rc\t0\ntimeout_s\t900\nmax_turns\tunset\ntoken_cap\tunset\nended_at_cap\t%s\n' % end)
|
|
748
|
+
r = score_run([{'id': 'G-X', 'polarity': 'present', 'expect_re': 'ZZZ'}], root, ['G-X'], 0.8, 'sonnet')['rows'][0]
|
|
749
|
+
print('%s|%s|%s' % (r['verdict'], r['ended_at_cap'], r['budget']))
|
|
750
|
+
PY
|
|
751
|
+
}
|
|
752
|
+
r="$(_budget yes)"
|
|
753
|
+
_lane BU1 budget "KNOWN-POSITIVE — a FAIL whose primary episode ended at the cap says so" \
|
|
754
|
+
"FAIL|yes|timeout=900s max_turns=unset tokens=unset ended_at_cap=yes (1/2 episodes)" "$r"
|
|
755
|
+
r="$(_budget no)"
|
|
756
|
+
_lane BU2 budget "KNOWN-NEGATIVE — a FAIL that ended on its own says ended_at_cap=no" \
|
|
757
|
+
"FAIL|no|timeout=900s max_turns=unset tokens=unset ended_at_cap=no" "$r"
|
|
758
|
+
r="$(_budget MISSING)"
|
|
759
|
+
_lane BU3 budget "no meta recorded -> UNKNOWN (not measured is not no)" \
|
|
760
|
+
"FAIL|UNKNOWN|no episode meta (cap not recorded)" "$r"
|
|
761
|
+
# BU5 (review B1): one episode's meta missing while its transcript exists must not let the other
|
|
762
|
+
# episode's `no` stand for the row — before the fix this printed `...|no|...`.
|
|
763
|
+
r="$(_budget PARTIAL)"
|
|
764
|
+
_lane BU5 budget "partial meta (transcript without meta) -> UNKNOWN, not the other episode's no" \
|
|
765
|
+
"FAIL|UNKNOWN|timeout=900s max_turns=unset tokens=unset ended_at_cap=UNKNOWN" "$r"
|
|
766
|
+
|
|
767
|
+
# BU4/TG*: end to end through the runner with a stub sim that writes the meta the real runner writes.
|
|
768
|
+
if [ "$NOPROBES" -eq 1 ]; then _skipblock "budget/target runner lanes BU4 TG3-TG5 (need probes.md)"; else
|
|
769
|
+
BSTUB="$T/bud_stub"; mkdir -p "$BSTUB"
|
|
770
|
+
cat > "$BSTUB/fake_sim_budget.sh" <<'FAKEBUD'
|
|
771
|
+
#!/usr/bin/env bash
|
|
772
|
+
arm=""; out=""
|
|
773
|
+
while [ $# -gt 0 ]; do case "$1" in --arm) arm="$2"; shift 2 ;; --out) out="$2"; shift 2 ;; *) shift ;; esac; done
|
|
774
|
+
mkdir -p "$out"
|
|
775
|
+
printf 'stub body %s\n' "$arm" > "$out/${arm}_r1.txt"
|
|
776
|
+
if [ "${FH_BUD_STUB_CAP:-no}" = yes ]; then rc=124; end=yes; else rc=0; end=no; fi
|
|
777
|
+
printf 'rc\t%s\ntimeout_s\t900\nmax_turns\tunset\ntoken_cap\tunset\nended_at_cap\t%s\n' "$rc" "$end" > "$out/${arm}_r1.meta.tsv"
|
|
778
|
+
echo "RESULT: CLEAN"; exit 0
|
|
779
|
+
FAKEBUD
|
|
780
|
+
chmod +x "$BSTUB/fake_sim_budget.sh"
|
|
781
|
+
( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$BSTUB/fake_sim_budget.sh" FH_BUD_STUB_CAP=yes \
|
|
782
|
+
bash "$RUNNER" --ids "G-GREET-01" --no-evidence --report-out "$T/bud_report.md" ) >"$T/bud.log" 2>&1
|
|
783
|
+
_lane BU4 budget "runner -> report row carries 'ended_at_cap=yes' when the stub hit its cap" \
|
|
784
|
+
"yes" "$(grep -E '^\| G-GREET-01 ' "$T/bud_report.md" | grep -q 'ended_at_cap=yes' && echo yes || echo no)"
|
|
785
|
+
|
|
786
|
+
# TG3 default output unchanged: no --target -> no split section anywhere.
|
|
787
|
+
_lane TG3 target "default (no --target): report has no 'Target split' section" \
|
|
788
|
+
"no" "$(grep -q 'Target split' "$T/bud_report.md" && echo yes || echo no)"
|
|
789
|
+
|
|
790
|
+
# TG4 a --target that is not in the run is refused BEFORE any live call (stub counter stays empty).
|
|
791
|
+
TGCOUNT="$T/tg_counter"; : > "$TGCOUNT"
|
|
792
|
+
( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$STUBROOT/fake_sim_ok.sh" FH_FAKESIM_COUNTER="$TGCOUNT" \
|
|
793
|
+
bash "$RUNNER" --ids "G-GREET-01" --target NOT-A-PROBE --no-evidence --report-out "$T/tg4.md" ) >/dev/null 2>&1
|
|
794
|
+
tg4_rc=$?
|
|
795
|
+
_lane TG4 target "unknown --target -> rc=2 and zero runner calls" "2/0" "$tg4_rc/$(wc -l < "$TGCOUNT" | tr -d ' ')"
|
|
796
|
+
|
|
797
|
+
# TG5 --target + --before through the runner: section present, before side filled in.
|
|
798
|
+
cat > "$T/prev.md" <<'PREV'
|
|
799
|
+
## Run — model=sonnet threshold=0.80
|
|
800
|
+
|
|
801
|
+
| Probe | Verdict | reps(pass/ran) | primary_hit | control_hit | polarity | Reason |
|
|
802
|
+
|---|---|---|---|---|---|---|
|
|
803
|
+
| G-GREET-01 | FAIL | 0/1 | False | False | present | |
|
|
804
|
+
PREV
|
|
805
|
+
( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$BSTUB/fake_sim_budget.sh" \
|
|
806
|
+
bash "$RUNNER" --ids "G-GREET-01,G-TRIG-07" --target G-GREET-01 --before "$T/prev.md" \
|
|
807
|
+
--no-evidence --report-out "$T/tg5.md" ) >"$T/tg5.log" 2>&1
|
|
808
|
+
_lane TG5 target "--target + --before: report has the split, target before=FAIL shown" \
|
|
809
|
+
"yes" "$(grep -q '^## Target split — G-GREET-01' "$T/tg5.md" && grep -q 'before=FAIL' "$T/tg5.md" && echo yes || echo no)"
|
|
810
|
+
fi
|
|
811
|
+
|
|
812
|
+
_target() { # $1=before verdicts "A:V,B:V,.." $2=after verdicts ; target=A -> prints summary tokens
|
|
813
|
+
python3 - "$REPO_ROOT" "$1" "$2" <<'PY'
|
|
814
|
+
import sys, os
|
|
815
|
+
sys.path.insert(0, os.path.join(sys.argv[1], 'scripts'))
|
|
816
|
+
from probe_live_eval_lib import split_by_target
|
|
817
|
+
parse = lambda s: dict(x.split(':') for x in s.split(','))
|
|
818
|
+
before, after = parse(sys.argv[2]), parse(sys.argv[3])
|
|
819
|
+
t = split_by_target([{'id': k, 'verdict': v, 'ended_at_cap': 'no'} for k, v in after.items()], 'A', before)
|
|
820
|
+
print('%s>%s | others %s>%s | moved=%s' % (t['before']['target'], t['after_target'],
|
|
821
|
+
t['before']['others']['passed'], t['after_others']['passed'], len(t['moved'])))
|
|
822
|
+
PY
|
|
823
|
+
}
|
|
824
|
+
r="$(_target 'A:FAIL,B:PASS,C:PASS' 'A:PASS,B:PASS,C:PASS')"
|
|
825
|
+
_lane TG1 target "target fixed, others untouched -> moved=0 (fixed the target, moved nothing else)" \
|
|
826
|
+
"FAIL>PASS | others 2>2 | moved=0" "$r"
|
|
827
|
+
r="$(_target 'A:FAIL,B:PASS,C:PASS' 'A:PASS,B:FAIL,C:PASS')"
|
|
828
|
+
_lane TG2 target "KNOWN-NEGATIVE pair — target fixed but a neighbour regressed -> moved=1, others 2>1" \
|
|
829
|
+
"FAIL>PASS | others 2>1 | moved=1" "$r"
|
|
830
|
+
# TG6 (review B4): a before-report that lacks the other probes must not render «others moved: none».
|
|
831
|
+
r="$(python3 - "$REPO_ROOT" <<'PY'
|
|
832
|
+
import sys, os
|
|
833
|
+
sys.path.insert(0, os.path.join(sys.argv[1], 'scripts'))
|
|
834
|
+
from probe_live_eval_lib import split_by_target, render_target_lines
|
|
835
|
+
t = split_by_target([{'id': k, 'verdict': 'PASS', 'ended_at_cap': 'no'} for k in 'ABC'], 'A', {'A': 'FAIL'})
|
|
836
|
+
print([l for l in render_target_lines(t) if 'others moved' in l][0].strip())
|
|
837
|
+
PY
|
|
838
|
+
)"
|
|
839
|
+
_lane TG6 target "narrower --before -> 'not comparable', never 'none'" \
|
|
840
|
+
"others moved: not comparable (2 others absent from before)" "$r"
|
|
841
|
+
|
|
726
842
|
echo ""
|
|
727
843
|
echo "── summary ──────────────────────────────────────────────────────"
|
|
728
844
|
echo "lanes: $N failed: $([ "$FAIL" -eq 0 ] && echo 0 || echo '>=1')"
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_regression_guard_sibling_lanes.sh — Axis 1's «moved is not lost» sibling lookup.
|
|
3
|
+
#
|
|
4
|
+
# WHY (2026-10-16): CLAUDE.md became a ~95-line resident core and the full ruleset moved to
|
|
5
|
+
# knowledge/shared/harness-core/claude_md_full_reference.md. The guard's sibling lookup only knew
|
|
6
|
+
# SKILL.md <-> SKILL_detail.md, so the move read as 100% token loss and hard-blocked the commit.
|
|
7
|
+
# The pair was added to the same symmetric lookup. No lane covered the lookup before — not even the
|
|
8
|
+
# SKILL pair — so these lanes cover both pairs and both directions:
|
|
9
|
+
# moved into the sibling -> no M-tier (exit != 2)
|
|
10
|
+
# dropped from both -> M-tier block (exit 2) <- the lookup must not become a free pass
|
|
11
|
+
# plus a REVERT PROBE: the CLAUDE.md case is deleted from a copy of the guard and lane S1 must turn red.
|
|
12
|
+
#
|
|
13
|
+
# Usage: bash scripts/test_regression_guard_sibling_lanes.sh Exit: 0 = all behave; 1 = regression.
|
|
14
|
+
|
|
15
|
+
set -uo pipefail
|
|
16
|
+
. "$(dirname "${BASH_SOURCE[0]}")/fixture_guard_lib.sh" # fixtures never write the real repo
|
|
17
|
+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
18
|
+
GUARD="$REPO_ROOT/templates/regression_guard.sh"
|
|
19
|
+
T="$(fh_fixture_root "$(mktemp -d)")"
|
|
20
|
+
: "${T:?fixture root unset — refusing to run git in cwd}"
|
|
21
|
+
trap 'rm -rf "$T"' EXIT
|
|
22
|
+
FAIL=0
|
|
23
|
+
REF=knowledge/shared/harness-core/claude_md_full_reference.md
|
|
24
|
+
|
|
25
|
+
BODY='## Execution Steps
|
|
26
|
+
Step 0 read. Step 1 scan. Step 2 propose. Step 3 run.
|
|
27
|
+
```bash
|
|
28
|
+
bash scripts/x.sh
|
|
29
|
+
```
|
|
30
|
+
```bash
|
|
31
|
+
bash scripts/y.sh
|
|
32
|
+
```
|
|
33
|
+
```bash
|
|
34
|
+
bash scripts/z.sh
|
|
35
|
+
```
|
|
36
|
+
## Done When
|
|
37
|
+
the gate says PASS or BLOCK.
|
|
38
|
+
M-tier and S-tier are defined in the guard.
|
|
39
|
+
'
|
|
40
|
+
|
|
41
|
+
# $1=dir — base commit: CLAUDE.md and a skill both carry the tokens, no siblings yet
|
|
42
|
+
mkrepo() {
|
|
43
|
+
local d=$1
|
|
44
|
+
mkdir -p "$d/plugins/p/skills/s" "$d/knowledge/shared/harness-core"
|
|
45
|
+
git -C "$d" init -q && git -C "$d" config user.email t@t && git -C "$d" config user.name t
|
|
46
|
+
printf '# hub\n%s' "$BODY" > "$d/CLAUDE.md"
|
|
47
|
+
printf -- '---\nname: s\ndescription: d\n---\n# s\n%s' "$BODY" > "$d/plugins/p/skills/s/SKILL.md"
|
|
48
|
+
git -C "$d" add -A && git -C "$d" commit -q -m base
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
# $1=id $2=dir $3=guard $4=expect(block|pass)
|
|
52
|
+
run_lane() {
|
|
53
|
+
local id=$1 d=$2 g=$3 want=$4 rc out
|
|
54
|
+
out=$(cd "$d" && bash "$g" --staged 2>&1); rc=$?
|
|
55
|
+
if [ -z "$out" ]; then echo " ❌ $id — guard printed nothing (instrument silence, not a pass)"; FAIL=1; return; fi
|
|
56
|
+
if [ "$rc" -ne 0 ] && [ "$rc" -ne 1 ] && [ "$rc" -ne 2 ]; then
|
|
57
|
+
echo " ❌ $id — guard rc=$rc (could not run)"; printf '%s\n' "$out" | tail -3 | sed 's/^/ /'; FAIL=1; return
|
|
58
|
+
fi
|
|
59
|
+
if [ "$want" = block ] && [ "$rc" -eq 2 ]; then echo " ✅ $id — M-tier block (rc=2)"
|
|
60
|
+
elif [ "$want" = pass ] && [ "$rc" -ne 2 ] && grep -q "moved to" <<<"$out"; then echo " ✅ $id — no M-tier, move recognised (rc=$rc)"
|
|
61
|
+
elif [ "$want" = pass ] && [ "$rc" -ne 2 ]; then echo " ❌ $id — rc=$rc but no «moved to» line: the pair was never examined (a SKIP is not a pass)"; FAIL=1
|
|
62
|
+
else echo " ❌ $id — expected $want, got rc=$rc"; printf '%s\n' "$out" | grep -E 'M-TIER|moved' | head -4 | sed 's/^/ /'; FAIL=1; fi
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
echo "── regression_guard sibling lanes ──"
|
|
66
|
+
|
|
67
|
+
# S1: CLAUDE.md slimmed, content moved to the reference file -> move, not loss
|
|
68
|
+
d=$T/s1; mkrepo "$d"
|
|
69
|
+
printf '# hub\nresident core only.\n' > "$d/CLAUDE.md"
|
|
70
|
+
printf '# full reference\n%s' "$BODY" > "$d/$REF"
|
|
71
|
+
git -C "$d" add -A
|
|
72
|
+
run_lane "S1 CLAUDE.md -> reference move" "$d" "$GUARD" pass
|
|
73
|
+
|
|
74
|
+
# S2: CLAUDE.md slimmed, reference file lacks the content -> real loss still blocks
|
|
75
|
+
d=$T/s2; mkrepo "$d"
|
|
76
|
+
printf '# hub\nresident core only.\n' > "$d/CLAUDE.md"
|
|
77
|
+
printf '# full reference\nunrelated.\n' > "$d/$REF"
|
|
78
|
+
git -C "$d" add -A
|
|
79
|
+
run_lane "S2 CLAUDE.md loss with empty reference" "$d" "$GUARD" block
|
|
80
|
+
|
|
81
|
+
# S3: CLAUDE.md slimmed, no reference file at all -> blocks
|
|
82
|
+
d=$T/s3; mkrepo "$d"
|
|
83
|
+
printf '# hub\nresident core only.\n' > "$d/CLAUDE.md"
|
|
84
|
+
git -C "$d" add -A
|
|
85
|
+
run_lane "S3 CLAUDE.md loss, reference absent" "$d" "$GUARD" block
|
|
86
|
+
|
|
87
|
+
# S4: the older pair still works — SKILL.md content moved to SKILL_detail.md
|
|
88
|
+
d=$T/s4; mkrepo "$d"
|
|
89
|
+
printf -- '---\nname: s\ndescription: d\n---\n# s\nsee detail.\n' > "$d/plugins/p/skills/s/SKILL.md"
|
|
90
|
+
printf '# detail\n%s' "$BODY" > "$d/plugins/p/skills/s/SKILL_detail.md"
|
|
91
|
+
git -C "$d" add -A
|
|
92
|
+
run_lane "S4 SKILL.md -> SKILL_detail.md move" "$d" "$GUARD" pass
|
|
93
|
+
|
|
94
|
+
# S5: a file that is NOT a pair member does not borrow the reference's content
|
|
95
|
+
d=$T/s5; mkrepo "$d"
|
|
96
|
+
printf '# agents\n%s' "$BODY" > "$d/AGENTS.md"; git -C "$d" add AGENTS.md; git -C "$d" commit -q -m agents
|
|
97
|
+
printf '# agents\nshort.\n' > "$d/AGENTS.md"
|
|
98
|
+
printf '# full reference\n%s' "$BODY" > "$d/$REF"
|
|
99
|
+
git -C "$d" add -A
|
|
100
|
+
out=$(cd "$d" && bash "$GUARD" --staged 2>&1)
|
|
101
|
+
if grep -q "AGENTS.md" <<<"$out" && ! grep -qE "moved to SKILL_detail.md.*" <<<"$out"; then
|
|
102
|
+
sec=$(grep -A30 "AGENTS.md" <<<"$out"); if [[ "$sec" == *"M-TIER"* ]]; then echo " ✅ S5 AGENTS.md loss is not excused by the reference file"
|
|
103
|
+
else echo " ❌ S5 AGENTS.md token loss produced no M-TIER line"; FAIL=1; fi
|
|
104
|
+
else echo " ❌ S5 AGENTS.md was not examined, or was treated as a move"; FAIL=1; fi
|
|
105
|
+
|
|
106
|
+
# S6: the sibling ALREADY held the content (unchanged this commit) -> deleting from CLAUDE.md still blocks
|
|
107
|
+
d=$T/s6; mkrepo "$d"
|
|
108
|
+
printf '# full reference\n%s' "$BODY" > "$d/$REF"; git -C "$d" add -A; git -C "$d" commit -q -m ref
|
|
109
|
+
printf '# hub\nresident core only.\n' > "$d/CLAUDE.md"
|
|
110
|
+
git -C "$d" add -A
|
|
111
|
+
run_lane "S6 unchanged sibling does not mask a CLAUDE.md loss" "$d" "$GUARD" block
|
|
112
|
+
|
|
113
|
+
# S7: both files lose the content in the same commit -> blocks
|
|
114
|
+
d=$T/s7; mkrepo "$d"
|
|
115
|
+
printf '# hub\n%s%s' "$BODY" "$BODY" > "$d/CLAUDE.md"; printf '# full reference\n%s%s' "$BODY" "$BODY" > "$d/$REF"; git -C "$d" add -A; git -C "$d" commit -q -m two
|
|
116
|
+
printf '# hub\n%s' "$BODY" > "$d/CLAUDE.md"; printf '# full reference\n%s' "$BODY" > "$d/$REF"
|
|
117
|
+
git -C "$d" add -A
|
|
118
|
+
run_lane "S7 simultaneous loss in both files" "$d" "$GUARD" block
|
|
119
|
+
|
|
120
|
+
# S8: reverse direction — reference content moved back into CLAUDE.md -> move (reference side examined)
|
|
121
|
+
d=$T/s8; mkrepo "$d"
|
|
122
|
+
printf '# hub\nresident core only.\n' > "$d/CLAUDE.md"; printf '# full reference\n%s' "$BODY" > "$d/$REF"
|
|
123
|
+
git -C "$d" add -A; git -C "$d" commit -q -m split
|
|
124
|
+
printf '# hub\n%s' "$BODY" > "$d/CLAUDE.md"; printf '# full reference\nmoved back.\n' > "$d/$REF"
|
|
125
|
+
git -C "$d" add -A
|
|
126
|
+
out=$(cd "$d" && bash "$GUARD" --staged 2>&1)
|
|
127
|
+
sec=$(grep -A60 "claude_md_full_reference.md" <<<"$out"); if [[ "$sec" == *"moved to"* ]] && [[ "$sec" != *"M-TIER"* ]]; then
|
|
128
|
+
echo " ✅ S8 reference -> CLAUDE.md reverse move recognised"
|
|
129
|
+
else echo " ❌ S8 reverse move not recognised on the reference side"; FAIL=1; fi
|
|
130
|
+
|
|
131
|
+
# S9 (F2 isolated): the sibling already holds a «## Trigger Phrases» heading, unchanged; CLAUDE.md drops
|
|
132
|
+
# its own. No F4 token is involved, so only the section check can catch it.
|
|
133
|
+
d=$T/s9; mkrepo "$d"
|
|
134
|
+
printf '# hub\n## Trigger Phrases\n- say hi\n' > "$d/CLAUDE.md"; printf '# full reference\n## Trigger Phrases\n- say hi\n' > "$d/$REF"
|
|
135
|
+
git -C "$d" add -A; git -C "$d" commit -q -m trig
|
|
136
|
+
printf '# hub\nno triggers.\n- say hi\n' > "$d/CLAUDE.md"; git -C "$d" add -A
|
|
137
|
+
out=$(cd "$d" && bash "$GUARD" --staged 2>&1)
|
|
138
|
+
if grep -q "'Triggers' section group dropped" <<<"$out"; then echo " ✅ S9 F2: unchanged sibling heading does not excuse a dropped section"
|
|
139
|
+
else echo " ❌ S9 F2: dropped section was excused (no «section group dropped» line)"; FAIL=1; fi
|
|
140
|
+
|
|
141
|
+
# S10 (F3 isolated): sibling already holds fences, unchanged; CLAUDE.md loses all of its fences
|
|
142
|
+
d=$T/s10; mkrepo "$d"
|
|
143
|
+
F6=$(printf '```bash\nx\n```\n```bash\ny\n```\n```bash\nz\n```\n')
|
|
144
|
+
printf '# hub\n%s\n' "$F6" > "$d/CLAUDE.md"; printf '# full reference\n%s\n' "$F6" > "$d/$REF"
|
|
145
|
+
git -C "$d" add -A; git -C "$d" commit -q -m fences
|
|
146
|
+
printf '# hub\nno code.\n' > "$d/CLAUDE.md"; git -C "$d" add -A
|
|
147
|
+
out=$(cd "$d" && bash "$GUARD" --staged 2>&1)
|
|
148
|
+
if grep -q "code blocks reduced" <<<"$out"; then echo " ✅ S10 F3: unchanged sibling fences do not excuse lost code blocks"
|
|
149
|
+
else echo " ❌ S10 F3: lost code blocks were excused"; FAIL=1; fi
|
|
150
|
+
|
|
151
|
+
# R1: revert probe — delete the CLAUDE.md case from a copy of the guard; S1 must now block
|
|
152
|
+
G2=$T/guard_reverted.sh
|
|
153
|
+
grep -v '^ CLAUDE.md) ' "$GUARD" > "$G2"
|
|
154
|
+
if cmp -s "$GUARD" "$G2"; then echo " ❌ R1 revert probe: the mutation did not apply (pattern drift) — HARNESS-ERROR"; FAIL=1
|
|
155
|
+
else
|
|
156
|
+
d=$T/r1; mkrepo "$d"
|
|
157
|
+
printf '# hub\nresident core only.\n' > "$d/CLAUDE.md"
|
|
158
|
+
printf '# full reference\n%s' "$BODY" > "$d/$REF"
|
|
159
|
+
git -C "$d" add -A
|
|
160
|
+
run_lane "R1 revert probe: without the pair, S1 blocks" "$d" "$G2" block
|
|
161
|
+
fi
|
|
162
|
+
|
|
163
|
+
# R2: revert probe — credit the sibling's whole total again (the old behaviour); S6 must turn green-wrong
|
|
164
|
+
G3=$T/guard_total.sh
|
|
165
|
+
sed 's/a=\${a:-0}; b=\${b:-0}; \[ "\$a" -gt "\$b" \] \&\& echo \$((a - b)) || echo 0/a=${a:-0}; echo "$a"/' "$GUARD" > "$G3"
|
|
166
|
+
if cmp -s "$GUARD" "$G3"; then echo " ❌ R2 revert probe: the mutation did not apply (pattern drift) — HARNESS-ERROR"; FAIL=1
|
|
167
|
+
else
|
|
168
|
+
d=$T/r2; mkrepo "$d"
|
|
169
|
+
printf '# full reference\n%s' "$BODY" > "$d/$REF"; git -C "$d" add -A; git -C "$d" commit -q -m ref
|
|
170
|
+
printf '# hub\nresident core only.\n' > "$d/CLAUDE.md"; git -C "$d" add -A
|
|
171
|
+
rc=0; out=$(cd "$d" && bash "$G3" --staged 2>&1) || rc=$?
|
|
172
|
+
if { [ "$rc" -eq 0 ] || [ "$rc" -eq 1 ]; } && grep -q "moved to" <<<"$out"; then echo " ✅ R2 revert probe: whole-total credit lets S6 through as a «move» (rc=$rc) — S6 is what catches it"
|
|
173
|
+
else echo " ❌ R2 revert probe: S6 still blocked with whole-total credit — S6 is not anchoring the gain rule"; FAIL=1; fi
|
|
174
|
+
fi
|
|
175
|
+
|
|
176
|
+
# R3: revert probe — drop the reverse arm; S8 must fail
|
|
177
|
+
G4=$T/guard_noreverse.sh
|
|
178
|
+
grep -v 'claude_md_full_reference.md) sib="CLAUDE.md"' "$GUARD" > "$G4"
|
|
179
|
+
if cmp -s "$GUARD" "$G4"; then echo " ❌ R3 revert probe: the mutation did not apply (pattern drift) — HARNESS-ERROR"; FAIL=1
|
|
180
|
+
else
|
|
181
|
+
d=$T/r3; mkrepo "$d"
|
|
182
|
+
printf '# hub\nresident core only.\n' > "$d/CLAUDE.md"; printf '# full reference\n%s' "$BODY" > "$d/$REF"
|
|
183
|
+
git -C "$d" add -A; git -C "$d" commit -q -m split
|
|
184
|
+
printf '# hub\n%s' "$BODY" > "$d/CLAUDE.md"; printf '# full reference\nmoved back.\n' > "$d/$REF"; git -C "$d" add -A
|
|
185
|
+
rc=0; out=$(cd "$d" && bash "$G4" --staged 2>&1) || rc=$?
|
|
186
|
+
if [ "$rc" -gt 2 ] || ! grep -q "claude_md_full_reference.md" <<<"$out"; then echo " ❌ R3 revert probe: mutated guard did not run or never examined the reference (rc=$rc) — HARNESS-ERROR"; FAIL=1
|
|
187
|
+
elif sec=$(grep -A60 "claude_md_full_reference.md" <<<"$out"); [[ "$sec" == *"moved to"* ]]; then echo " ❌ R3 revert probe: reverse move still recognised without the reverse arm"; FAIL=1
|
|
188
|
+
else echo " ✅ R3 revert probe: without the reverse arm the reference side no longer sees a move"; fi
|
|
189
|
+
fi
|
|
190
|
+
|
|
191
|
+
echo
|
|
192
|
+
if [ "$FAIL" -eq 0 ]; then echo "ALL regression_guard sibling lanes behave."; exit 0; fi
|
|
193
|
+
echo "regression_guard sibling lanes: FAIL"; exit 1
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
# R8 합계 = 측정된 칸의 합(MEMORY 는 적재분)
|
|
13
13
|
# R9 되돌림: nchars 를 바이트로 바꾼 변이체 → R1 이 빨개져야 한다(적용 확인 → 실행 → 판정)
|
|
14
14
|
# R10 실물: 이 레포 CLAUDE.md 줄이 독립 계산(len)과 같은 값
|
|
15
|
-
# CLAUDE.md 크기 «가드»(
|
|
15
|
+
# CLAUDE.md 크기 «가드»(18,000 한계)는 scripts/test_claude_md_size_lanes.sh 가 맡는다 — 여기서 다시 안 잰다.
|
|
16
16
|
set -uo pipefail
|
|
17
17
|
HERE="$(cd "$(dirname "$0")" && pwd)"; ROOT="$(cd "$HERE/.." && pwd)"
|
|
18
18
|
METER="${RESIDENT_COST_METER:-$HERE/resident_cost.py}" # R9 가 변이체를 넣을 때만 바뀐다
|
|
@@ -738,6 +738,35 @@ else
|
|
|
738
738
|
fail "L39 rc=$RC (see $TMPDIR_ROOT/l39.out)"
|
|
739
739
|
fi
|
|
740
740
|
|
|
741
|
+
# L40 — re-extracting into a filled sheet carries the judgements forward (2026-10-18: the mid-session nudge
|
|
742
|
+
# re-extracts into the SAME file; a plain overwrite erased 259 filled rows). Known pair: a filled row is carried,
|
|
743
|
+
# an empty row stays empty; a filled row whose utterance is gone is kept under the orphan heading; no file → plain write.
|
|
744
|
+
build_jsonl "$TMPDIR_ROOT/l40.jsonl" "[{'type':'user','timestamp':'2026-10-18T01:00:00.000Z','message':{'role':'user','content':'Please move the session bar a little higher than it is now.'}},{'type':'user','timestamp':'2026-10-18T01:05:00.000Z','message':{'role':'user','content':'Please also fix the badge that sits too far to the right.'}}]"
|
|
745
|
+
L40="$TMPDIR_ROOT/l40.md"
|
|
746
|
+
run "$TMPDIR_ROOT/l40a.out" extract --transcript "$TMPDIR_ROOT/l40.jsonl" --out "$L40"
|
|
747
|
+
L40A_RC=$RC
|
|
748
|
+
L40_PLAIN=$(grep -c '↩️' "$L40") # control: no prior file → no carry line
|
|
749
|
+
python3 - "$L40" <<'PYEOF'
|
|
750
|
+
import sys
|
|
751
|
+
p = sys.argv[1]; L = open(p, encoding="utf-8").read().split("\n")
|
|
752
|
+
for i, l in enumerate(L):
|
|
753
|
+
if l.startswith("| 1 |"):
|
|
754
|
+
L[i] = l.replace("| | | | |", "| ✅DONE | abc1234 (#99) | - | - |")
|
|
755
|
+
L.append("| 7 | 10-17 09:00 | an utterance no longer in the transcript | 🟡PARTIAL | - | half done | 이월: finish |")
|
|
756
|
+
open(p, "w", encoding="utf-8").write("\n".join(L))
|
|
757
|
+
PYEOF
|
|
758
|
+
run "$TMPDIR_ROOT/l40b.out" extract --transcript "$TMPDIR_ROOT/l40.jsonl" --out "$L40"
|
|
759
|
+
if [ "$L40A_RC" -eq 0 ] && [ "$RC" -eq 0 ] && [ "$L40_PLAIN" = 0 ] \
|
|
760
|
+
&& grep -q '^| 1 | .*session bar.* | ✅DONE | abc1234 (#99) | - | - |$' "$L40" \
|
|
761
|
+
&& grep -qE '^\| 2 \| .*badge.* \| \| \| \| \|$' "$L40" \
|
|
762
|
+
&& grep -q '^## 이전 결과서에서 이어받지 못한 판정' "$L40" \
|
|
763
|
+
&& grep -q 'an utterance no longer in the transcript | 🟡PARTIAL' "$L40" \
|
|
764
|
+
&& grep -q '판정 1줄 이어받음 · 못 맞춘 판정 1줄' "$L40"; then
|
|
765
|
+
pass "L40 extract into a filled sheet: judgement carried (row 1), empty row stays empty (row 2), unmatched judgement kept under the orphan heading, no-file run writes plainly"
|
|
766
|
+
else
|
|
767
|
+
fail "L40 rc=$L40A_RC/$RC plain=$L40_PLAIN (see $L40)"
|
|
768
|
+
fi
|
|
769
|
+
|
|
741
770
|
echo "── $PASS_COUNT passed, $FAIL_COUNT failed ──"
|
|
742
771
|
|
|
743
772
|
if [ "$FAIL_COUNT" -gt 0 ]; then
|