@chrono-meta/fh-gate 3.44.0 → 3.46.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 +50 -608
- package/.claude-plugin/marketplace.json +4 -4
- package/CATALOG.md +21 -0
- package/CHEATSHEET.md +13 -3
- package/docs/codex-compat.md +1 -1
- package/knowledge/shared/harness-core/fh_4axis_gate_detail.md +679 -0
- package/knowledge/shared/harness-core/fh_detail_protocols.md +1 -0
- package/knowledge/shared/harness-core/fh_integration_contract.md +1 -1
- package/knowledge/shared/harness-core/fh_module_contract.md +106 -3
- package/knowledge/shared/harness-core/heavy_skill_to_cartridge.md +185 -0
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +209 -0
- package/package.json +19 -1
- package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +9 -8
- package/plugins/fh-commons/skills/ko-tech-writer/SKILL_detail.md +20 -0
- package/plugins/fh-commons/skills/mcp-circuit-breaker/SKILL.md +12 -6
- package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/CHANGELOG.md +122 -0
- package/plugins/fh-meta/skills/auto-decorrelation/SKILL.md +13 -0
- package/plugins/fh-meta/skills/context-doctor/SKILL.md +1 -0
- package/plugins/fh-meta/skills/deep-clarify/SKILL.md +76 -22
- package/plugins/fh-meta/skills/harvest-loop/SKILL.md +2 -2
- package/plugins/fh-meta/skills/install-wizard/SKILL_detail.md +4 -0
- package/plugins/fh-meta/skills/memory-hygiene/SKILL.md +6 -0
- package/plugins/fh-meta/skills/steel-quench/SKILL_detail.md +2 -1
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/agy_launch_guard.sh +117 -1
- package/scripts/below_floor_scan.sh +30 -0
- package/scripts/codex_launch_guard.sh +38 -2
- package/scripts/correction_moments.py +23 -2
- package/scripts/fh-gate.sh +612 -14
- package/scripts/fh-goal.sh +56 -12
- package/scripts/fh-run.sh +1 -1
- package/scripts/fh_gate_exec.sh +272 -0
- package/scripts/fh_session_load.sh +17 -0
- package/scripts/finding_fleet.sh +2 -1
- package/scripts/finding_verifier.sh +2 -1
- package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/README.md +16 -0
- package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/scripts/check_refs.py +12 -0
- package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/scripts/test_check_refs.py +24 -0
- package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/skills/tidy-notes/SKILL.md +16 -0
- package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/skills/tidy-notes/fh-module.yaml +20 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/SKILL.md +25 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/hooks/hooks.json +7 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/check_links.py +25 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/publish.sh +9 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/publish_guard.py +6 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/setup.sh +5 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/SKILL.md +25 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/hooks/hooks.json +10 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/check_refs.py +12 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/guard_push.py +9 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/install.sh +6 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/ship.sh +9 -0
- package/scripts/heavy_skill_smell.py +311 -0
- package/scripts/job_heartbeat.py +186 -0
- package/scripts/live_eval_matrix.py +128 -0
- package/scripts/live_eval_trace.py +197 -4
- package/scripts/package_coverage_check.sh +18 -0
- package/scripts/pr_merge_verified.sh +14 -4
- package/scripts/prepush_guard_check.sh +8 -0
- package/scripts/probe_live_eval.sh +32 -0
- package/scripts/probe_live_eval_lib.py +8 -2
- package/scripts/selfcheck.sh +113 -0
- package/scripts/selfcheck_shard_weights.txt +2 -0
- package/scripts/sidecar_calibrate.sh +7 -5
- package/scripts/sim_isolated_run.sh +20 -0
- package/scripts/test_agy_launch_guard_lanes.sh +120 -0
- package/scripts/test_below_floor_scan_lanes.sh +85 -0
- package/scripts/test_codex_launch_guard_lanes.sh +45 -0
- package/scripts/test_correction_moments_lanes.sh +37 -0
- package/scripts/test_deep_clarify_interview_lanes.sh +108 -0
- package/scripts/test_deep_clarify_spec_path_lanes.sh +91 -0
- package/scripts/test_fh_gate_absorb_lanes.sh +255 -0
- package/scripts/test_fh_gate_defaults_lanes.sh +188 -0
- package/scripts/test_fh_gate_exec_lanes.sh +244 -0
- package/scripts/test_fh_gate_fusion_lanes.sh +202 -0
- package/scripts/test_fh_gate_regressions.sh +92 -1
- package/scripts/test_fh_goal_change_detection_lanes.sh +103 -3
- package/scripts/test_finding_pipeline_lanes.sh +35 -1
- package/scripts/test_guard_anchor_override_env_lanes.sh +84 -0
- package/scripts/test_heavy_skill_smell_lanes.sh +160 -0
- package/scripts/test_job_heartbeat_lanes.sh +96 -0
- package/scripts/test_live_eval_construct_lanes.sh +29 -6
- package/scripts/test_live_eval_matrix_lanes.sh +53 -0
- package/scripts/test_live_eval_trace_lanes.sh +132 -5
- package/scripts/test_name_boundary_locale_lanes.sh +36 -5
- package/scripts/test_pr_merge_verified_lanes.sh +15 -2
- package/scripts/test_prepush_marker_lookup_lanes.sh +143 -0
- package/scripts/test_probe_live_eval_lanes.sh +44 -0
- package/scripts/test_regression_guard_sibling_lanes.sh +52 -1
- package/scripts/test_sidecar_calibrate_lanes.sh +1 -1
- package/scripts/test_sim_isolated_run_lanes.sh +43 -0
- package/scripts/universal_guard_check.sh +8 -0
- package/scripts/worktree_reclaim.sh +1 -1
- package/templates/.claude/rules/mcp_tool_gating.md +27 -0
- package/templates/.git-hooks/pre-push +60 -3
- package/templates/PRE-PUBLISH-CHECKLIST.md +22 -0
- package/templates/regression_guard.sh +8 -4
- package/templates/settings.LaneGap.snippet.json +27 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_deep_clarify_interview_lanes.sh — the shape of deep-clarify's interview after the four 2026-11-21 additions.
|
|
3
|
+
#
|
|
4
|
+
# WHY. A public «interview me» talk (2026-11-21, used as an idea source only — its numbers are unverified) and
|
|
5
|
+
# deep-clarify differed in four places: deep-clarify folded the upper goal (Why) into the one-line Goal, wrote
|
|
6
|
+
# textbook phrases («make it scalable») straight into the spec, never tested whether it had understood, and
|
|
7
|
+
# offered «start implementation directly» in the same window as an equal next step.
|
|
8
|
+
#
|
|
9
|
+
# WHAT IS CHECKED (structure of SKILL.md — the round templates are what a session copies):
|
|
10
|
+
# I1 Round 1 asks the Why as its own question, separate from the completion-criteria question
|
|
11
|
+
# I2 a textbook-phrase rule: such a phrase is not recorded as a requirement; ask once what is needed
|
|
12
|
+
# I3 the last round tests understanding with an option the user has not mentioned, checks the pick
|
|
13
|
+
# against the Why, re-asks once on a contradiction, then records an open question
|
|
14
|
+
# I4 Step 4's first (default) row is a new session that reads only the saved spec; «Start
|
|
15
|
+
# implementation directly» is still there and marked not the default
|
|
16
|
+
# I5 the spec format carries `## Why` and `## Understanding check`
|
|
17
|
+
# K1 kept: «maximum 3 rounds, maximum 2 questions per round», `(inferred:`, `Excluded:`, `specs/{slug}.md`
|
|
18
|
+
# K2 no round template holds more than 2 numbered questions (the cap holds after adding the Why)
|
|
19
|
+
# C controls: a copy with each of I1–I4 removed goes red on that case alone
|
|
20
|
+
# NOT CHECKED: whether a real session asks these questions — that is the blind Sonnet sim recorded in the
|
|
21
|
+
# PR, not this lane. A green run here means the template says it, not that a model does it.
|
|
22
|
+
#
|
|
23
|
+
# Usage: bash scripts/test_deep_clarify_interview_lanes.sh [<skill file>] Exit: 0 all pass · 1 any fail
|
|
24
|
+
set -uo pipefail
|
|
25
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
26
|
+
SKILL="${1:-$HERE/../plugins/fh-meta/skills/deep-clarify/SKILL.md}"
|
|
27
|
+
TMPROOT=$(mktemp -d "${TMPDIR:-/tmp}/deep_clarify_iv_XXXXXX")
|
|
28
|
+
trap 'rm -rf "$TMPROOT"' EXIT
|
|
29
|
+
pass=0; fail=0
|
|
30
|
+
ok() { printf 'PASS %s\n' "$1"; pass=$((pass + 1)); }
|
|
31
|
+
bad() { printf 'FAIL %s — %s\n' "$1" "$2"; fail=$((fail + 1)); }
|
|
32
|
+
|
|
33
|
+
# probe <skill file> — prints one line per case: «<id> ok» or «<id> <problem>»
|
|
34
|
+
probe() {
|
|
35
|
+
python3 - "$1" <<'PY'
|
|
36
|
+
import re, sys
|
|
37
|
+
t = open(sys.argv[1], encoding="utf-8").read()
|
|
38
|
+
def sec(start, end):
|
|
39
|
+
a = t.find(start)
|
|
40
|
+
if a < 0: return ""
|
|
41
|
+
b = t.find(end, a + len(start)) if end else -1
|
|
42
|
+
return t[a:b] if b > a else t[a:]
|
|
43
|
+
def say(i, ok, why): print(f"{i} ok" if ok else f"{i} {why}")
|
|
44
|
+
r1 = sec("### Round 1", "### Round 2")
|
|
45
|
+
blk = re.findall(r"```\n(.*?)```", r1, re.S)
|
|
46
|
+
qs = re.findall(r"^\s*(\d+)\.\s+(.*)$", blk[0], re.M) if blk else []
|
|
47
|
+
why_q = [n for n, q in qs if re.search(r"\bWhy\b", q)]
|
|
48
|
+
cc_q = [n for n, q in qs if re.search(r"[Cc]ompletion criteria", q)]
|
|
49
|
+
say("I1", why_q and cc_q and set(why_q).isdisjoint(cc_q),
|
|
50
|
+
f"Round 1 template: Why question {why_q or 'missing'}, completion-criteria question {cc_q or 'missing'} (must be separate)")
|
|
51
|
+
tb = sec("### Textbook phrases", "\n## ") or sec("Textbook phrase", "\n### ")
|
|
52
|
+
say("I2", bool(tb) and re.search(r"not (be )?record", tb) and re.search(r"[Aa]sk once", tb),
|
|
53
|
+
"no textbook-phrase rule that says «not recorded as a requirement» and «ask once»")
|
|
54
|
+
r3 = sec("### Round 3", "\n## ")
|
|
55
|
+
say("I3", bool(r3) and re.search(r"not (yet )?(mentioned|discussed)", r3) and re.search(r"\bWhy\b", r3)
|
|
56
|
+
and re.search(r"[Oo]pen question", r3),
|
|
57
|
+
"Round 3 lacks the unmentioned-option test against the Why with an open-question fallback")
|
|
58
|
+
s4 = sec("## Step 4.", "\n## Done When")
|
|
59
|
+
rows = [l for l in s4.splitlines() if l.startswith("|") and not re.match(r"\|\s*-", l)][1:]
|
|
60
|
+
first = rows[0] if rows else ""
|
|
61
|
+
direct = [l for l in rows if "Start implementation directly" in l]
|
|
62
|
+
say("I4", re.search(r"new session", first, re.I) and re.search(r"only the saved spec", first, re.I)
|
|
63
|
+
and direct and re.search(r"not the default", direct[0], re.I),
|
|
64
|
+
f"Step 4 first row «{first[:60]}» is not the new-session default, or «Start implementation directly» is gone / not marked")
|
|
65
|
+
fmt = sec("### Spec Document Format", "\n## Step 4")
|
|
66
|
+
say("I5", "## Why" in fmt and "## Understanding check" in fmt, "spec format lacks ## Why or ## Understanding check")
|
|
67
|
+
keep = ["maximum 3 rounds, maximum 2 questions per round", "(inferred:", "Excluded:", "specs/{slug}.md"]
|
|
68
|
+
miss = [k for k in keep if k not in t]
|
|
69
|
+
say("K1", not miss, f"missing kept text: {miss}")
|
|
70
|
+
over = []
|
|
71
|
+
for name in ("### Round 1", "### Round 2", "### Round 3"):
|
|
72
|
+
s = sec(name, "\n### ") if name != "### Round 3" else r3
|
|
73
|
+
for b in re.findall(r"```\n(.*?)```", s, re.S):
|
|
74
|
+
n = len(re.findall(r"^\s*\d+\.\s", b, re.M))
|
|
75
|
+
if n > 2: over.append(f"{name.strip('# ')}={n}")
|
|
76
|
+
say("K2", not over, f"round template over 2 questions: {over}")
|
|
77
|
+
PY
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
[ -r "$SKILL" ] || { echo "HARNESS: $SKILL not readable — not measured"; exit 1; }
|
|
81
|
+
out=$(probe "$SKILL") || { echo "HARNESS: probe failed"; exit 1; }
|
|
82
|
+
while read -r id rest; do
|
|
83
|
+
[ "$rest" = ok ] && ok "$id" || bad "$id" "$rest"
|
|
84
|
+
done <<< "$out"
|
|
85
|
+
|
|
86
|
+
# C — controls: remove one addition at a time from a copy; exactly that case must go red
|
|
87
|
+
control() { # control <id> <python that edits text t>
|
|
88
|
+
local f="$TMPROOT/ctl_$1.md" got
|
|
89
|
+
python3 - "$SKILL" "$f" "$2" <<'PY'
|
|
90
|
+
import re, sys
|
|
91
|
+
t = open(sys.argv[1], encoding="utf-8").read()
|
|
92
|
+
exec(sys.argv[3])
|
|
93
|
+
open(sys.argv[2], "w", encoding="utf-8").write(t)
|
|
94
|
+
PY
|
|
95
|
+
got=$(probe "$f" | awk '$2 != "ok" {print $1}' | tr '\n' ' ')
|
|
96
|
+
[ "$got" = "$1 " ] && ok "C-$1 control: removing it turns only $1 red" || bad "C-$1 control" "red cases «${got}», expected «$1 »"
|
|
97
|
+
}
|
|
98
|
+
if [ "$fail" -eq 0 ]; then
|
|
99
|
+
control I1 't = re.sub(r"(### Round 1.*?```\n)(.*?)(```)", lambda m: m.group(1) + re.sub(r"^.*\bWhy\b.*\n(?:\s+\(.*\n)?", "", m.group(2), flags=re.M) + m.group(3), t, count=1, flags=re.S)'
|
|
100
|
+
control I2 't = t.replace("### Textbook phrases", "### Plain phrases").replace("Textbook phrase", "Plain phrase")'
|
|
101
|
+
control I3 't = re.sub(r"(### Round 3)(.*?)(\n## )", lambda m: m.group(1) + "\n\nDraft the spec, then confirm once.\n" + m.group(3), t, count=1, flags=re.S)'
|
|
102
|
+
control I4 't = re.sub(r"(## Step 4\..*?\|---\|---\|\n)\|[^\n]*\n", r"\1", t, count=1, flags=re.S)'
|
|
103
|
+
else
|
|
104
|
+
echo "SKIP controls — the shipped skill is already red (a control on a red subject proves nothing)"
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
echo "PASS $pass · FAIL $fail"
|
|
108
|
+
[ "$fail" -eq 0 ]
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_deep_clarify_spec_path_lanes.sh — where deep-clarify's own Step 3 commands put the spec.
|
|
3
|
+
#
|
|
4
|
+
# WHY. deep-clarify wrote `.claude/specs/{slug}.md`. Claude Code treats `.claude/` as sensitive: a headless
|
|
5
|
+
# run gets the write refused, and an interactive non-developer gets a «modify sensitive file» prompt
|
|
6
|
+
# (FoD O2, 2026-11-21). The spec belongs in a plain work-folder path.
|
|
7
|
+
#
|
|
8
|
+
# WHAT IS CHECKED, by running the commands the skill tells the session to run (not by reading prose):
|
|
9
|
+
# P1 Step 3's mkdir block, a write to the «Write →» path and Step 3's `test -f` line, run in an empty
|
|
10
|
+
# folder, save the spec, print «SPEC SAVED», and create nothing under `.claude/`
|
|
11
|
+
# P2 the four places that name the path agree: the ABORT-if-exists check, the Write target, the
|
|
12
|
+
# `test -f` line, and the Done-When row
|
|
13
|
+
# P3 the gitignore advice for company projects is still there
|
|
14
|
+
# P4 control: the same checks on a planted copy that saves under `.claude/specs/` go red
|
|
15
|
+
# NOT CHECKED: whether a real session follows Step 3 (that is a behaviour sim, not this lane).
|
|
16
|
+
#
|
|
17
|
+
# Usage: bash scripts/test_deep_clarify_spec_path_lanes.sh Exit: 0 all pass · 1 any fail
|
|
18
|
+
set -uo pipefail
|
|
19
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
20
|
+
SKILL="$HERE/../plugins/fh-meta/skills/deep-clarify/SKILL.md"
|
|
21
|
+
TMPROOT=$(mktemp -d "${TMPDIR:-/tmp}/deep_clarify_spec_XXXXXX")
|
|
22
|
+
trap 'rm -rf "$TMPROOT"' EXIT
|
|
23
|
+
pass=0; fail=0
|
|
24
|
+
ok() { printf 'PASS %s\n' "$1"; pass=$((pass + 1)); }
|
|
25
|
+
bad() { printf 'FAIL %s — %s\n' "$1" "$2"; fail=$((fail + 1)); }
|
|
26
|
+
|
|
27
|
+
# extract <skill file> <out dir> — writes mkdir.sh, write_path, test.sh, abort_path, done_path, has_ignore
|
|
28
|
+
extract() {
|
|
29
|
+
python3 - "$1" "$2" <<'PY'
|
|
30
|
+
import re, sys, os
|
|
31
|
+
src, out = sys.argv[1], sys.argv[2]
|
|
32
|
+
t = open(src, encoding="utf-8").read()
|
|
33
|
+
a = t.find("## Step 3."); b = t.find("### Spec Document Format", a)
|
|
34
|
+
step = t[a:b] if a >= 0 and b > a else ""
|
|
35
|
+
blocks = re.findall(r"```bash\n(.*?)```", step, re.S)
|
|
36
|
+
mk = next((x for x in blocks if "mkdir" in x), "")
|
|
37
|
+
ts = next((x for x in blocks if "test -f" in x), "")
|
|
38
|
+
w = re.search(r"`Write`\s*→\s*`([^`]+)`", step)
|
|
39
|
+
ab = re.search(r"If `([^`]+)` \*\*already exists", step)
|
|
40
|
+
dw = t[t.find("## Done When"):]
|
|
41
|
+
dn = re.search(r"`test -f ([^`]+)` exits 0", dw)
|
|
42
|
+
ign = "gitignore" in step
|
|
43
|
+
def put(name, val): open(os.path.join(out, name), "w", encoding="utf-8").write(val)
|
|
44
|
+
put("mkdir.sh", mk); put("test.sh", ts)
|
|
45
|
+
put("write_path", w.group(1) if w else ""); put("abort_path", ab.group(1) if ab else "")
|
|
46
|
+
put("done_path", dn.group(1) if dn else ""); put("has_ignore", "1" if ign else "0")
|
|
47
|
+
PY
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
# check <label> <skill file> — prints the problems, nothing when the skill saves outside .claude/
|
|
51
|
+
check() {
|
|
52
|
+
local d="$TMPROOT/$1" wp tp out
|
|
53
|
+
mkdir -p "$d/x" "$d/work"; extract "$2" "$d/x" || { echo "extract failed"; return; }
|
|
54
|
+
wp=$(sed 's/{slug}/demo-spec-20261121/' "$d/x/write_path")
|
|
55
|
+
[ -s "$d/x/mkdir.sh" ] || echo "no mkdir block in Step 3"
|
|
56
|
+
[ -s "$d/x/test.sh" ] || echo "no test -f block in Step 3"
|
|
57
|
+
[ -n "$wp" ] || echo "no «Write → path» in Step 3"
|
|
58
|
+
[ -n "$wp" ] || return
|
|
59
|
+
( cd "$d/work" && bash "$d/x/mkdir.sh" ) > /dev/null 2>&1 || echo "mkdir block failed"
|
|
60
|
+
( cd "$d/work" && printf '# Spec: demo\n' > "$wp" ) 2>/dev/null || echo "write to $wp failed (directory missing?)"
|
|
61
|
+
sed 's/{slug}/demo-spec-20261121/g' "$d/x/test.sh" > "$d/x/test_run.sh"
|
|
62
|
+
out=$(cd "$d/work" && bash "$d/x/test_run.sh" 2>&1) || echo "test -f block failed: $out"
|
|
63
|
+
[[ "$out" == *"SPEC SAVED"* ]] || echo "no «SPEC SAVED» line"
|
|
64
|
+
case "$wp" in .claude/*|*/.claude/*) echo "spec path is under .claude/ ($wp)" ;; esac
|
|
65
|
+
[ -e "$d/work/.claude" ] && echo "the commands created .claude/ in the work folder"
|
|
66
|
+
for f in abort_path done_path; do
|
|
67
|
+
[ "$(cat "$d/x/$f")" = "$(cat "$d/x/write_path")" ] || echo "$f «$(cat "$d/x/$f")» ≠ write path «$(cat "$d/x/write_path")»"
|
|
68
|
+
done
|
|
69
|
+
tp=$(sed -n '/test -f /{s/.*test -f \([^ &]*\).*/\1/p;q;}' "$d/x/test.sh")
|
|
70
|
+
[ "$tp" = "$(cat "$d/x/write_path")" ] || echo "test -f path «${tp}» ≠ write path"
|
|
71
|
+
[ "$(cat "$d/x/has_ignore")" = 1 ] || echo "the gitignore advice is gone from Step 3"
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
[ -r "$SKILL" ] || { echo "HARNESS: $SKILL not readable — not measured"; exit 1; }
|
|
75
|
+
|
|
76
|
+
probs=$(check shipped "$SKILL")
|
|
77
|
+
if [ -z "$probs" ]; then ok "P1–P3 the skill's own Step 3 commands save the spec outside .claude/, four path mentions agree, gitignore advice kept"
|
|
78
|
+
else bad "P1–P3 shipped SKILL.md" "$(printf '%s' "$probs" | tr '\n' '|')"; fi
|
|
79
|
+
|
|
80
|
+
# P4 — control: a planted copy that saves under .claude/specs/ must be caught (the instrument is alive)
|
|
81
|
+
sed -E 's#(`|mkdir -p |test -f |SPEC SAVED: )specs/#\1.claude/specs/#g' "$SKILL" > "$TMPROOT/planted.md"
|
|
82
|
+
if grep -q '\.claude/specs/{slug}' "$TMPROOT/planted.md"; then
|
|
83
|
+
probs=$(check planted "$TMPROOT/planted.md")
|
|
84
|
+
[[ "$probs" == *"under .claude/"* ]] && ok "P4 control: a copy saving under .claude/specs/ is caught" \
|
|
85
|
+
|| bad "P4 control blind" "planted .claude/ path not reported: $(printf '%s' "$probs" | tr '\n' '|')"
|
|
86
|
+
else
|
|
87
|
+
bad "P4 control not planted" "no .claude/specs/{slug} in the planted copy — the substitution did not apply"
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
echo "deep-clarify spec path lanes: $pass passed, $fail failed"
|
|
91
|
+
[ "$fail" -eq 0 ]
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_fh_gate_absorb_lanes.sh — lanes for fh-gate's own review when /code-review is absent (the «goldfish» pass that
|
|
3
|
+
# absorbs /code-review's method) and for the «elephant» pass (repo history). Token-free: `claude`/`codex` are stubs.
|
|
4
|
+
#
|
|
5
|
+
# A1 FH_REVIEWER=fh sends the absorbed method: 8 named angles, candidates per angle, 1-vote 3-state verify,
|
|
6
|
+
# severity order, a cap (10 at full / 8 at quick) — and its schema carries the cap
|
|
7
|
+
# A2 goldfish: FH_TASK_DESCRIPTION never reaches the absorbed pass; it does reach the elephant pass
|
|
8
|
+
# A3 absorbed important + nit → PENDING, B + C, source review, summary verbatim
|
|
9
|
+
# A4 a finding the verifier refuted (verify REFUTED) in the output → 10
|
|
10
|
+
# A5 more findings than the cap → 10
|
|
11
|
+
# A6 no structured object from the absorbed pass → 10
|
|
12
|
+
# A7 elephant: on at full, off at quick, FH_GATE_ELEPHANT=off/on overrides, its line says which
|
|
13
|
+
# A8 the elephant prompt carries the touched file's history, including a past fix commit
|
|
14
|
+
# A9 an elephant finding (important) → PENDING, source elephant; an elephant with no structured object → 10
|
|
15
|
+
# A10 with /code-review as reviewer (FH_REVIEWER=code-review) the elephant pass still runs at full
|
|
16
|
+
# A11 codex backend with FH_REVIEWER=fh → the absorbed pass; its call is read-only
|
|
17
|
+
# A12 FH_REVIEWER=fh-legacy → the older steel-quench prompt
|
|
18
|
+
# A13 not a git repository → elephant NOT RUN (not applicable), no finding
|
|
19
|
+
# A14 FH_GATE_ELEPHANT outside its set → 11 · FH_REVIEWER outside its set → 11
|
|
20
|
+
# A15 no fence check reads a variable through a pipe into grep -q (shape; planted known positive)
|
|
21
|
+
# A16 the goldfish process does not inherit FH_TASK_DESCRIPTION (the elephant's does)
|
|
22
|
+
# A17 the change's diff cannot be computed → a B finding, said on the reviewer line
|
|
23
|
+
# A18 a diff past 80000 bytes is truncated aloud (prompt and reviewer line)
|
|
24
|
+
# A19 codex output with more than one JSON value → 10
|
|
25
|
+
# A20 CI-shaped checkout (detached, no local base branch): base falls back to origin/<base>; with no base at all
|
|
26
|
+
# the missing diff is named, not graded, only for fh-legacy with the elephant off
|
|
27
|
+
#
|
|
28
|
+
# Run: bash scripts/test_fh_gate_absorb_lanes.sh
|
|
29
|
+
set -uo pipefail
|
|
30
|
+
. "$(dirname "${BASH_SOURCE[0]}")/fixture_guard_lib.sh" # scrub inherited GIT_* env first (#1088)
|
|
31
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
32
|
+
GATE="$HERE/fh-gate.sh"
|
|
33
|
+
TMPROOT=$(mktemp -d "${TMPDIR:-/tmp}/fh_gate_absorb_XXXXXX")
|
|
34
|
+
trap 'rm -rf "$TMPROOT"' EXIT
|
|
35
|
+
export FH_RECORD_BASE="$TMPROOT/records"; mkdir -p "$FH_RECORD_BASE"
|
|
36
|
+
export FH_GATE_EXEC=off
|
|
37
|
+
# The elephant is opt-in since 3.45.0 (default off — pinned by test_fh_gate_defaults_lanes.sh); these lanes test it
|
|
38
|
+
# at its «auto» setting (on at level full). Lanes that test another setting pass their own.
|
|
39
|
+
export FH_GATE_ELEPHANT=auto
|
|
40
|
+
pass=0; fail=0
|
|
41
|
+
ok() { printf 'PASS %s\n' "$1"; pass=$((pass + 1)); }
|
|
42
|
+
bad() { printf 'FAIL %s — %s\n' "$1" "$2"; fail=$((fail + 1)); }
|
|
43
|
+
g() { git -c user.name=t -c user.email=t@t -c commit.gpgsign=false -c core.hooksPath=/dev/null "$@"; }
|
|
44
|
+
|
|
45
|
+
# Stubs pick their answer by what they were asked: the absorbed pass, the elephant pass, /code-review, or the legacy pass.
|
|
46
|
+
FAKEBIN="$TMPROOT/bin"; mkdir -p "$FAKEBIN"
|
|
47
|
+
cat > "$FAKEBIN/claude" <<'FAKE'
|
|
48
|
+
#!/usr/bin/env bash
|
|
49
|
+
in=$(cat); args=" $* "
|
|
50
|
+
kind=legacy
|
|
51
|
+
case "$args" in *"/code-review "*) kind=cr ;; esac
|
|
52
|
+
case "$in" in *"FH ELEPHANT PASS"*) kind=ele ;; *"FH REVIEW PASS"*) kind=abs ;; esac
|
|
53
|
+
printf '%s\n' "$in" > "${LOGDIR:-/tmp}/claude_${kind}.stdin" 2>/dev/null
|
|
54
|
+
printf '%s\n' "$@" > "${LOGDIR:-/tmp}/claude_${kind}.argv" 2>/dev/null
|
|
55
|
+
printf '%s\n' "${FH_TASK_DESCRIPTION:-<unset>}" > "${LOGDIR:-/tmp}/claude_${kind}.env" 2>/dev/null
|
|
56
|
+
empty='{"status":"SUCCESS","findings":[]}'
|
|
57
|
+
case "$kind" in
|
|
58
|
+
cr) p="${FAKE_CR:-$empty}" ;;
|
|
59
|
+
abs) p="${FAKE_ABS:-$empty}" ;;
|
|
60
|
+
ele) p="${FAKE_ELE:-$empty}" ;;
|
|
61
|
+
*) p="${FAKE_PAYLOAD}" ;;
|
|
62
|
+
esac
|
|
63
|
+
[ "$p" = NONE ] && { printf '{"is_error":false,"subtype":"success","result":"prose only"}\n'; exit 0; }
|
|
64
|
+
printf '{"is_error":false,"subtype":"success","structured_output":%s}\n' "$p"
|
|
65
|
+
FAKE
|
|
66
|
+
cat > "$FAKEBIN/codex" <<'FAKE'
|
|
67
|
+
#!/usr/bin/env bash
|
|
68
|
+
out=""; args=" $* "
|
|
69
|
+
while [ $# -gt 0 ]; do case "$1" in -o) out="$2"; shift 2 ;; *) shift ;; esac; done
|
|
70
|
+
in=$(cat); kind=legacy
|
|
71
|
+
case "$in" in *"FH ELEPHANT PASS"*) kind=ele ;; *"FH REVIEW PASS"*) kind=abs ;; esac
|
|
72
|
+
printf '%s\n' "$in" > "${LOGDIR:-/tmp}/codex_${kind}.stdin" 2>/dev/null
|
|
73
|
+
printf '%s\n' "$args" > "${LOGDIR:-/tmp}/codex_${kind}.argv" 2>/dev/null
|
|
74
|
+
empty='{"status":"SUCCESS","findings":[]}'
|
|
75
|
+
case "$kind" in abs) p="${FAKE_ABS:-$empty}" ;; ele) p="${FAKE_ELE:-$empty}" ;; *) p="$FAKE_PAYLOAD" ;; esac
|
|
76
|
+
[ -n "$out" ] && printf '%s' "$p" > "$out"
|
|
77
|
+
[ -n "$out" ] && [ -n "${FAKE_CODEX_TWICE:-}" ] && printf '%s' "$p" >> "$out"
|
|
78
|
+
exit 0
|
|
79
|
+
FAKE
|
|
80
|
+
chmod +x "$FAKEBIN/claude" "$FAKEBIN/codex"
|
|
81
|
+
export PATH="$FAKEBIN:$PATH"
|
|
82
|
+
export FAKE_PAYLOAD='{"status":"SUCCESS","verdict":"PASS","findings_count":0,"findings_a":0,"findings_b":0,"findings":[]}'
|
|
83
|
+
|
|
84
|
+
REPO="$TMPROOT/repo"; mkdir -p "$REPO/scripts"
|
|
85
|
+
g -C "$REPO" init -q -b main
|
|
86
|
+
printf '#!/usr/bin/env bash\necho ok\n' > "$REPO/scripts/foo.sh"; g -C "$REPO" add -A; g -C "$REPO" commit -qm "add foo"
|
|
87
|
+
printf '#!/usr/bin/env bash\n[ -n "$1" ] || exit 2\necho ok\n' > "$REPO/scripts/foo.sh"; g -C "$REPO" commit -qam "fix: guard empty input in foo (PAST-FIX-MARK)"
|
|
88
|
+
g -C "$REPO" checkout -qb feat
|
|
89
|
+
printf '#!/usr/bin/env bash\necho ok\n' > "$REPO/scripts/foo.sh"; g -C "$REPO" commit -qam "simplify foo"
|
|
90
|
+
|
|
91
|
+
# gate <name> [env...] → stdout/err files, rc in $RC, stub logs in $TMPROOT/<name>/
|
|
92
|
+
gate() {
|
|
93
|
+
local name="$1"; shift
|
|
94
|
+
mkdir -p "$TMPROOT/$name"
|
|
95
|
+
( cd "${RUN_DIR:-$REPO}" && env LOGDIR="$TMPROOT/$name" "$@" bash "$GATE" ) > "$TMPROOT/$name.out" 2> "$TMPROOT/$name.err" < /dev/null
|
|
96
|
+
RC=$?
|
|
97
|
+
}
|
|
98
|
+
has() { grep -qF -- "$2" "$TMPROOT/$1.out"; }
|
|
99
|
+
logh() { grep -qF -- "$3" "$TMPROOT/$1/$2" 2>/dev/null; } # logh <name> <logfile> <text>
|
|
100
|
+
|
|
101
|
+
ABS_IMP_NIT='{"status":"SUCCESS","findings":[{"file":"scripts/foo.sh","line":2,"severity":"important","verify":"CONFIRMED","angle":"removed-behavior","summary":"The empty-input guard is gone «exact» $x","failure_scenario":"foo with no argument prints ok"},{"file":"scripts/foo.sh","line":0,"severity":"nit","verify":"PLAUSIBLE","angle":"simplification","summary":"n","failure_scenario":""}]}'
|
|
102
|
+
|
|
103
|
+
# A1
|
|
104
|
+
gate a1 FH_REVIEWER=fh FH_GATE_LEVEL=full FH_GATE_ELEPHANT=off
|
|
105
|
+
gate a1q FH_REVIEWER=fh FH_GATE_ELEPHANT=off
|
|
106
|
+
if [ "$RC" -eq 0 ] && logh a1 claude_abs.stdin 'FH REVIEW PASS' && logh a1 claude_abs.stdin 'line-by-line' \
|
|
107
|
+
&& logh a1 claude_abs.stdin 'removed-behavior' && logh a1 claude_abs.stdin 'cross-file' && logh a1 claude_abs.stdin 'CONFIRMED / PLAUSIBLE / REFUTED' \
|
|
108
|
+
&& logh a1 claude_abs.stdin 'at most 10' && logh a1q claude_abs.stdin 'at most 8' && logh a1 claude_abs.argv '"maxItems":10' \
|
|
109
|
+
&& has a1 'FH_GATE_REVIEWER: fh — goldfish pass'; then
|
|
110
|
+
ok "A1 FH_REVIEWER=fh sends the absorbed method (angles · verify · cap 10/8, cap in the schema)"
|
|
111
|
+
else bad "A1 absorbed method" "rc=$RC $(grep REVIEWER "$TMPROOT/a1.out")"; fi
|
|
112
|
+
|
|
113
|
+
# A2
|
|
114
|
+
gate a2 FH_REVIEWER=fh FH_GATE_LEVEL=full FH_TASK_DESCRIPTION='AUTHOR-INTENT-7Q'
|
|
115
|
+
if ! logh a2 claude_abs.stdin 'AUTHOR-INTENT-7Q' && logh a2 claude_ele.stdin 'AUTHOR-INTENT-7Q'; then
|
|
116
|
+
ok "A2 goldfish never sees the author's description; the elephant does"
|
|
117
|
+
else bad "A2 goldfish isolation" "abs_has=$(logh a2 claude_abs.stdin AUTHOR-INTENT-7Q && echo yes || echo no) ele_has=$(logh a2 claude_ele.stdin AUTHOR-INTENT-7Q && echo yes || echo no)"; fi
|
|
118
|
+
|
|
119
|
+
# A3
|
|
120
|
+
gate a3 FH_REVIEWER=fh FAKE_ABS="$ABS_IMP_NIT"
|
|
121
|
+
if [ "$RC" -eq 1 ] && has a3 'FH_FINDINGS_B: 1' && has a3 'FH_FINDINGS_COUNT: 2' && has a3 'title: "The empty-input guard is gone «exact» $x"' && has a3 'source: "review"'; then
|
|
122
|
+
ok "A3 absorbed important + nit → PENDING, B + C, verbatim"
|
|
123
|
+
else bad "A3 absorbed mapping" "rc=$RC $(head -c 500 "$TMPROOT/a3.out")"; fi
|
|
124
|
+
|
|
125
|
+
# A4
|
|
126
|
+
gate a4 FH_REVIEWER=fh FAKE_ABS='{"status":"SUCCESS","findings":[{"file":"a","line":1,"severity":"nit","verify":"REFUTED","angle":"x","summary":"s","failure_scenario":""}]}'
|
|
127
|
+
if [ "$RC" -eq 10 ]; then ok "A4 a refuted finding in the output → 10"; else bad "A4 REFUTED → 10" "rc=$RC"; fi
|
|
128
|
+
|
|
129
|
+
# A5 — 9 findings at quick (cap 8)
|
|
130
|
+
NINE=$(python3 -c 'import json;print(json.dumps({"status":"SUCCESS","findings":[{"file":"a","line":i,"severity":"nit","verify":"PLAUSIBLE","angle":"x","summary":"s","failure_scenario":""} for i in range(1,10)]}))')
|
|
131
|
+
gate a5 FH_REVIEWER=fh FAKE_ABS="$NINE"
|
|
132
|
+
if [ "$RC" -eq 10 ]; then ok "A5 more findings than the cap → 10"; else bad "A5 cap → 10" "rc=$RC"; fi
|
|
133
|
+
|
|
134
|
+
# A6
|
|
135
|
+
gate a6 FH_REVIEWER=fh FAKE_ABS=NONE
|
|
136
|
+
if [ "$RC" -eq 10 ]; then ok "A6 absorbed pass with no structured object → 10"; else bad "A6 no structured → 10" "rc=$RC"; fi
|
|
137
|
+
|
|
138
|
+
# A7
|
|
139
|
+
gate a7f FH_REVIEWER=fh FH_GATE_LEVEL=full
|
|
140
|
+
gate a7q FH_REVIEWER=fh
|
|
141
|
+
gate a7off FH_REVIEWER=fh FH_GATE_LEVEL=full FH_GATE_ELEPHANT=off
|
|
142
|
+
gate a7on FH_REVIEWER=fh FH_GATE_ELEPHANT=on
|
|
143
|
+
if has a7f 'FH_GATE_ELEPHANT: ran' && [ -e "$TMPROOT/a7f/claude_ele.stdin" ] \
|
|
144
|
+
&& has a7q 'FH_GATE_ELEPHANT: not-run — NOT RUN (level quick' && [ ! -e "$TMPROOT/a7q/claude_ele.stdin" ] \
|
|
145
|
+
&& has a7off 'NOT RUN (FH_GATE_ELEPHANT=off)' && [ ! -e "$TMPROOT/a7off/claude_ele.stdin" ] \
|
|
146
|
+
&& has a7on 'FH_GATE_ELEPHANT: ran' && [ -e "$TMPROOT/a7on/claude_ele.stdin" ]; then
|
|
147
|
+
ok "A7 elephant: on at full, off at quick, overrides honoured, the line says which"
|
|
148
|
+
else bad "A7 elephant switch" "$(grep -h ELEPHANT "$TMPROOT"/a7*.out | tr '\n' '|')"; fi
|
|
149
|
+
|
|
150
|
+
# A8
|
|
151
|
+
if logh a7f claude_ele.stdin 'PAST-FIX-MARK' && logh a7f claude_ele.stdin 'scripts/foo.sh' && logh a7f claude_ele.stdin 'FH ELEPHANT PASS'; then
|
|
152
|
+
ok "A8 the elephant prompt carries the touched file's history and its past fix"
|
|
153
|
+
else bad "A8 elephant history" "$(head -c 300 "$TMPROOT/a7f/claude_ele.stdin" 2>/dev/null)"; fi
|
|
154
|
+
|
|
155
|
+
# A9
|
|
156
|
+
ELE_IMP='{"status":"SUCCESS","findings":[{"file":"scripts/foo.sh","line":2,"severity":"important","verify":"CONFIRMED","angle":"past-fix-reverted","summary":"undoes PAST-FIX-MARK","failure_scenario":"empty input accepted again"}]}'
|
|
157
|
+
gate a9 FH_REVIEWER=fh FH_GATE_LEVEL=full FAKE_ELE="$ELE_IMP"; r1=$RC
|
|
158
|
+
gate a9b FH_REVIEWER=fh FH_GATE_LEVEL=full FAKE_ELE=NONE; r2=$RC
|
|
159
|
+
if [ "$r1" -eq 1 ] && has a9 'source: "elephant"' && has a9 'FH_GATE_VERDICT: PENDING' && [ "$r2" -eq 10 ]; then
|
|
160
|
+
ok "A9 elephant finding → PENDING (source elephant); elephant without a structured object → 10"
|
|
161
|
+
else bad "A9 elephant mapping / fail-closed" "found=$r1 none=$r2"; fi
|
|
162
|
+
|
|
163
|
+
# A10
|
|
164
|
+
gate a10 FH_REVIEWER=code-review FH_GATE_LEVEL=full
|
|
165
|
+
if [ -e "$TMPROOT/a10/claude_cr.argv" ] && [ -e "$TMPROOT/a10/claude_ele.stdin" ] && has a10 'FH_GATE_REVIEWER: /code-review high'; then
|
|
166
|
+
ok "A10 /code-review reviewer + elephant both run at full"
|
|
167
|
+
else bad "A10 cr + elephant" "cr=$([ -e "$TMPROOT/a10/claude_cr.argv" ] && echo y || echo n) ele=$([ -e "$TMPROOT/a10/claude_ele.stdin" ] && echo y || echo n)"; fi
|
|
168
|
+
|
|
169
|
+
# A11
|
|
170
|
+
gate a11 FH_BACKEND=codex FH_REVIEWER=fh
|
|
171
|
+
if [ "$RC" -eq 0 ] && has a11 'FH_GATE_REVIEWER: fh — goldfish pass' && logh a11 codex_abs.stdin 'FH REVIEW PASS' && logh a11 codex_abs.argv 'read-only'; then
|
|
172
|
+
ok "A11 codex + FH_REVIEWER=fh → absorbed pass, read-only"
|
|
173
|
+
else bad "A11 codex absorbed" "rc=$RC $(grep REVIEWER "$TMPROOT/a11.out")"; fi
|
|
174
|
+
|
|
175
|
+
# A12
|
|
176
|
+
gate a12 FH_REVIEWER=fh-legacy
|
|
177
|
+
if [ "$RC" -eq 0 ] && logh a12 claude_legacy.stdin 'FH GOVERNANCE GATE' && has a12 'FH_GATE_REVIEWER: fh-legacy'; then ok "A12 fh-legacy keeps the older pass"
|
|
178
|
+
else bad "A12 legacy" "rc=$RC"; fi
|
|
179
|
+
|
|
180
|
+
# A13
|
|
181
|
+
NG="$TMPROOT/nogit"; mkdir -p "$NG"; printf 'x\n' > "$NG/f.txt"
|
|
182
|
+
RUN_DIR="$NG" gate a13 FH_REVIEWER=fh FH_GATE_LEVEL=full FH_TARGET_FILES=f.txt
|
|
183
|
+
if [ "$RC" -eq 0 ] && has a13 'FH_GATE_ELEPHANT: not-run — NOT RUN (not a git repository)'; then ok "A13 not a git repository → elephant not applicable"
|
|
184
|
+
else bad "A13 no git" "rc=$RC $(grep ELEPHANT "$TMPROOT/a13.out")"; fi
|
|
185
|
+
|
|
186
|
+
# A14
|
|
187
|
+
gate a14 FH_GATE_ELEPHANT=sometimes; r1=$RC
|
|
188
|
+
gate a14b FH_REVIEWER=steel; r2=$RC
|
|
189
|
+
if [ "$r1" -eq 11 ] && [ "$r2" -eq 11 ]; then ok "A14 FH_GATE_ELEPHANT / FH_REVIEWER outside their sets → 11"
|
|
190
|
+
else bad "A14 bad values" "ele=$r1 rev=$r2"; fi
|
|
191
|
+
|
|
192
|
+
# A15 — the fence check never reads a variable through a pipe into grep -q. Under pipefail a match makes grep exit
|
|
193
|
+
# early, the writer fails on the closed pipe, and the `if` reads «no match»: measured 2026-11-20 on a 400 KB value
|
|
194
|
+
# (pipe form missed the nonce, here-string found it). The nonce is random per run, so this lane checks the shape,
|
|
195
|
+
# with a planted line as its known positive.
|
|
196
|
+
FENCE_PIPE_RE='printf .%s. "[$][A-Za-z_]+" [|] grep -qF "[$]FENCE"'
|
|
197
|
+
n_gate=$(grep -cE "$FENCE_PIPE_RE" "$GATE" || true)
|
|
198
|
+
printf ' if printf %s "$X" | grep -qF "$FENCE"; then\n' "'%s'" > "$TMPROOT/planted.sh"
|
|
199
|
+
n_plant=$(grep -cE "$FENCE_PIPE_RE" "$TMPROOT/planted.sh" || true)
|
|
200
|
+
if [ "${n_gate:-x}" = 0 ] && [ "${n_plant:-0}" = 1 ]; then ok "A15 no fence check reads a variable through a pipe (planted line caught)"
|
|
201
|
+
else bad "A15 pipe-form fence check" "gate=$n_gate planted=$n_plant"; fi
|
|
202
|
+
|
|
203
|
+
# A16 — the goldfish PROCESS does not inherit the description either (not only its prompt); the elephant's does
|
|
204
|
+
gate a16 FH_REVIEWER=fh FH_GATE_LEVEL=full FH_TASK_DESCRIPTION='AUTHOR-INTENT-7Q'
|
|
205
|
+
if [ "$(cat "$TMPROOT/a16/claude_abs.env" 2>/dev/null)" = '<unset>' ] && [ "$(cat "$TMPROOT/a16/claude_ele.env" 2>/dev/null)" = 'AUTHOR-INTENT-7Q' ]; then
|
|
206
|
+
ok "A16 the goldfish process does not inherit FH_TASK_DESCRIPTION; the elephant's does"
|
|
207
|
+
else bad "A16 goldfish env" "abs=$(cat "$TMPROOT/a16/claude_abs.env" 2>/dev/null) ele=$(cat "$TMPROOT/a16/claude_ele.env" 2>/dev/null)"; fi
|
|
208
|
+
|
|
209
|
+
# A17 — the change's diff cannot be computed (base missing) → a B, so the review cannot come back PASS
|
|
210
|
+
gate a17 FH_REVIEWER=fh FH_GATE_BASE=no-such-ref
|
|
211
|
+
if [ "$RC" -eq 1 ] && has a17 'NO CHANGE DIFF' && has a17 'location: "(diff)"'; then ok "A17 no change diff → B and said on the reviewer line"
|
|
212
|
+
else bad "A17 diff failure" "rc=$RC $(grep -E 'REVIEWER|VERDICT' "$TMPROOT/a17.out" | tr '\n' '|')"; fi
|
|
213
|
+
|
|
214
|
+
# A18 — a diff past 80000 bytes is truncated in the prompt, and both the prompt and the reviewer line say so
|
|
215
|
+
g -C "$REPO" checkout -q -b big feat
|
|
216
|
+
python3 -c 'import sys;sys.stdout.write("".join("line %d of a large change\n" % i for i in range(6000)))' > "$REPO/scripts/big.txt"
|
|
217
|
+
g -C "$REPO" add scripts/big.txt; g -C "$REPO" commit -qm "big change"
|
|
218
|
+
gate a18 FH_REVIEWER=fh FH_TARGET_FILES=scripts/foo.sh
|
|
219
|
+
g -C "$REPO" checkout -q feat
|
|
220
|
+
if logh a18 claude_abs.stdin 'TRUNCATED: 80000 of' && has a18 'diff truncated in the prompt'; then ok "A18 an oversized diff is truncated aloud (prompt + reviewer line)"
|
|
221
|
+
else bad "A18 truncation note" "$(grep REVIEWER "$TMPROOT/a18.out")"; fi
|
|
222
|
+
|
|
223
|
+
# A19 — codex writes two JSON values → not exactly one object → 10
|
|
224
|
+
gate a19 FH_BACKEND=codex FH_REVIEWER=fh FAKE_CODEX_TWICE=1
|
|
225
|
+
# (the ERR trap would also turn the later merge crash into 10 — check that the single-value guard is what fired)
|
|
226
|
+
if [ "$RC" -eq 10 ] && grep -qF 'not exactly one' "$TMPROOT/a19.err"; then ok "A19 codex output with two JSON values → 10, by the single-value guard"
|
|
227
|
+
else bad "A19 two values → 10 by the guard" "rc=$RC"; fi
|
|
228
|
+
|
|
229
|
+
# A20 — a CI-shaped checkout: a detached HEAD with no local base branch (actions/checkout on a pull request).
|
|
230
|
+
# Found 2026-11-20 on #1147: CI ran the regression lanes in such a checkout, `merge-base main HEAD` failed, the
|
|
231
|
+
# missing change diff became a B, and five clean-PASS lanes came back PENDING. Two rules are pinned:
|
|
232
|
+
# (a) the base falls back to the remote-tracking branch (origin/<base>) when the local branch is absent
|
|
233
|
+
# (b) when no base resolves at all, the missing diff is named, not graded, only for fh-legacy with the elephant
|
|
234
|
+
# off (that pass never reads it). The FH pass and /code-review stay graded B: they review the change.
|
|
235
|
+
C1="$TMPROOT/ci_with_remote"; g clone -q --no-local "$REPO" "$C1"; g -C "$C1" checkout -q --detach
|
|
236
|
+
C2="$TMPROOT/ci_single_branch"; g clone -q --no-local --single-branch --branch feat "$REPO" "$C2"; g -C "$C2" checkout -q --detach
|
|
237
|
+
RUN_DIR="$C1" gate a20a FH_REVIEWER=fh FH_TARGET_FILES=scripts/foo.sh
|
|
238
|
+
RUN_DIR="$C2" gate a20b FH_REVIEWER=fh-legacy FH_TARGET_FILES=scripts/foo.sh; rc_b=$RC
|
|
239
|
+
RUN_DIR="$C2" gate a20c FH_REVIEWER=code-review FH_TARGET_FILES=scripts/foo.sh; rc_c=$RC # /code-review, quick: no elephant
|
|
240
|
+
RUN_DIR="$C2" gate a20d FH_REVIEWER=fh FH_TARGET_FILES=scripts/foo.sh; rc_d=$RC
|
|
241
|
+
if grep -qF 'The change (git diff against' "$TMPROOT/a20a/claude_abs.stdin" 2>/dev/null \
|
|
242
|
+
&& grep -qF -- '-[ -n "$1" ] || exit 2' "$TMPROOT/a20a/claude_abs.stdin" 2>/dev/null \
|
|
243
|
+
&& ! has a20a 'NO CHANGE DIFF' && has a20a 'FH_GATE_VERDICT: PASS'; then
|
|
244
|
+
ok "A20a no local base branch → the change is diffed against origin/main, clean PASS stays PASS"
|
|
245
|
+
else bad "A20a origin/<base> fallback" "$(grep -E 'REVIEWER|VERDICT' "$TMPROOT/a20a.out" | tr '\n' '|')"; fi
|
|
246
|
+
if [ "$rc_b" -eq 0 ] && has a20b 'no change diff' && ! has a20b 'location: "(diff)"' \
|
|
247
|
+
&& [ "$rc_c" -eq 1 ] && has a20c 'NO CHANGE DIFF' && has a20c 'location: "(diff)"'; then
|
|
248
|
+
ok "A20b no base at all → fh-legacy keeps a clean PASS and names the gap; /code-review stays B"
|
|
249
|
+
else bad "A20b no base: legacy named, /code-review graded" "legacy rc=$rc_b cr rc=$rc_c $(grep REVIEWER "$TMPROOT/a20b.out" "$TMPROOT/a20c.out" | tr '\n' '|')"; fi
|
|
250
|
+
if [ "$rc_d" -eq 1 ] && has a20d 'NO CHANGE DIFF' && has a20d 'location: "(diff)"'; then
|
|
251
|
+
ok "A20c no base at all → the FH pass (which reads the diff) still cannot come back PASS"
|
|
252
|
+
else bad "A20c FH pass without its diff" "rc=$rc_d $(grep -E 'REVIEWER|VERDICT' "$TMPROOT/a20d.out" | tr '\n' '|')"; fi
|
|
253
|
+
|
|
254
|
+
echo "absorb lanes: $pass passed, $fail failed"
|
|
255
|
+
[ "$fail" -eq 0 ]
|