@chrono-meta/fh-gate 3.11.0 → 3.13.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/CLAUDE.md +8 -4
- package/bin/fh-codex-doctor.js +223 -25
- package/knowledge/shared/harness-core/claude_md_gate_details.md +8 -4
- package/knowledge/shared/harness-core/governance_engineering_definition.md +403 -7
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +99 -0
- package/package.json +268 -257
- package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/CHANGELOG.md +54 -0
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/citation_key_check.py +357 -0
- package/scripts/claim_propagation_scan.py +499 -0
- package/scripts/numeric_token_diff.py +389 -0
- package/scripts/outbound_pr_gate.sh +283 -0
- package/scripts/package_coverage_check.sh +10 -0
- package/scripts/section_ref_check.py +591 -0
- package/scripts/selfcheck.sh +111 -0
- package/scripts/session_checklist.py +704 -0
- package/scripts/test_claim_propagation_lanes.sh +573 -0
- package/scripts/test_codex_doctor_root_lanes.sh +384 -0
- package/scripts/test_outbound_pr_gate_lanes.sh +214 -0
- package/scripts/test_paper_integrity_lanes.sh +1473 -0
- package/scripts/test_session_checklist_lanes.sh +746 -0
- package/templates/predelete_check.sh +28 -4
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_codex_doctor_root_lanes.sh — regression lanes for bin/fh-codex-doctor.js's ROOT PREDICATE.
|
|
3
|
+
#
|
|
4
|
+
# WHY THIS FILE EXISTS (measured 2026-09-17): the doctor required `package.json` at the root — in
|
|
5
|
+
# `looksLikeFHRoot()` and again as a hard `process.exit(11)` gate in `main()`. Those were the only
|
|
6
|
+
# two references to it in the whole file; nothing downstream ever OPENED it. So the gate asserted a
|
|
7
|
+
# property no consumer of the report consumes, and it made a shipped npm binary structurally
|
|
8
|
+
# unusable for every non-npm consumer harness. Live repro before the fix:
|
|
9
|
+
# node bin/fh-codex-doctor.js --root <a consumer harness checkout> --strict
|
|
10
|
+
# → rc=11 "ERROR: root does not look like a package/repo root"
|
|
11
|
+
# while that consumer carries every surface the tool actually audits (AGENTS.md with 3 tier rows,
|
|
12
|
+
# plugins/ with 41 SKILL.md, 8 agent .md, .claude/registry/agent_cards.json — counts hand-verified
|
|
13
|
+
# with `find`, not inferred). After the fix that same command returns rc=0 with 41 skills / 8 agents.
|
|
14
|
+
#
|
|
15
|
+
# 🟥 THE LANE'S JOB IS BOTH DIRECTIONS. Loosening a fail-closed gate is only correct if the
|
|
16
|
+
# loosening cannot manufacture a confident empty report — "not found is not zero" is this repo's
|
|
17
|
+
# named failure family. So every POSITIVE arm below is paired with a NEGATIVE arm on the same axis,
|
|
18
|
+
# and two of the negatives (L4, L6) are arms that the UNFIXED code passed with rc=0.
|
|
19
|
+
#
|
|
20
|
+
# FAIL-BEFORE: the subject is injectable, so the whole suite can be run against the pre-fix file.
|
|
21
|
+
# FH_CODEX_DOCTOR=/path/to/fh-codex-doctor.ORIG.js bash scripts/test_codex_doctor_root_lanes.sh
|
|
22
|
+
# A lane suite that is green both ways is decorative.
|
|
23
|
+
#
|
|
24
|
+
# Usage: bash scripts/test_codex_doctor_root_lanes.sh
|
|
25
|
+
# Exit: 0 = all lanes pass; 1 = at least one lane failed (prints which and why).
|
|
26
|
+
|
|
27
|
+
set -uo pipefail
|
|
28
|
+
. "$(dirname "${BASH_SOURCE[0]}")/fixture_guard_lib.sh" # 픽스처는 실레포에 쓰지 않는다
|
|
29
|
+
|
|
30
|
+
FH_REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
31
|
+
DOCTOR="${FH_CODEX_DOCTOR:-$FH_REPO/bin/fh-codex-doctor.js}"
|
|
32
|
+
TMP="$(fh_fixture_root "$(mktemp -d)")"
|
|
33
|
+
: "${TMP:?fixture root unset — refusing to write fixtures in cwd}"
|
|
34
|
+
trap 'rm -rf "$TMP"' EXIT
|
|
35
|
+
|
|
36
|
+
PASS=0; FAIL=0
|
|
37
|
+
ok() { PASS=$((PASS+1)); printf ' ✅ %s\n' "$1"; }
|
|
38
|
+
bad() { FAIL=$((FAIL+1)); printf ' ❌ %s\n got: %s\n' "$1" "$(printf '%s' "$2" | tr '\n' '|' | cut -c1-260)"; }
|
|
39
|
+
|
|
40
|
+
if [ ! -f "$DOCTOR" ]; then
|
|
41
|
+
bad "subject missing: $DOCTOR (HARNESS-ERROR — nothing below was measured)" "absent"
|
|
42
|
+
printf '\ncodex-doctor root lanes: %d passed, %d failed\n' "$PASS" "$FAIL"; exit 1
|
|
43
|
+
fi
|
|
44
|
+
command -v node >/dev/null 2>&1 || {
|
|
45
|
+
bad "node unavailable (HARNESS-ERROR — SKIP is not PASS, so this is a failure)" "no node"
|
|
46
|
+
printf '\ncodex-doctor root lanes: %d passed, %d failed\n' "$PASS" "$FAIL"; exit 1
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
# run <root> → sets RC (exit code) and OUT (stdout+stderr).
|
|
50
|
+
# 🟥 NOT `out="$(run x)"`. Command substitution runs the function in a SUBSHELL, so an `RC=$?`
|
|
51
|
+
# assigned inside it is discarded and the caller keeps its stale RC — the first draft of this file
|
|
52
|
+
# did exactly that and four negative arms reported `rc=0` while node had actually exited 11,
|
|
53
|
+
# i.e. the lanes were grading a value the instrument never produced
|
|
54
|
+
# ([[feedback_broken_parser_reports_a_verdict]]). Redirect to a file and keep both in THIS shell.
|
|
55
|
+
RC=0
|
|
56
|
+
OUT=''
|
|
57
|
+
_RUN_OUT="$TMP/.lastrun"
|
|
58
|
+
run() {
|
|
59
|
+
node "$DOCTOR" --root "$1" --strict > "$_RUN_OUT" 2>&1
|
|
60
|
+
RC=$?
|
|
61
|
+
OUT="$(cat "$_RUN_OUT")"
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
# ── fixture builders ─────────────────────────────────────────────────────────────────────────
|
|
65
|
+
# The tier table's SHAPE is taken from the regex the subject actually uses
|
|
66
|
+
# (`/\|\s*\*\*(M[123])\b/` + a backtick-quoted lowercase name), not from a mental model of
|
|
67
|
+
# "an AGENTS.md" — a fixture whose row does not match would make every positive arm a false red.
|
|
68
|
+
mk_agents_md() { # $1 = dir, $2 = "table" | "no-table"
|
|
69
|
+
if [ "$2" = "table" ]; then
|
|
70
|
+
cat > "$1/AGENTS.md" <<'EOF'
|
|
71
|
+
# Fixture AGENTS.md
|
|
72
|
+
|
|
73
|
+
| Tier | Skill | Note |
|
|
74
|
+
|---|---|---|
|
|
75
|
+
| **M1** | `demo-native` | runs under codex exec directly |
|
|
76
|
+
| **M2** | `demo-adapter` | needs adapter substitution |
|
|
77
|
+
EOF
|
|
78
|
+
else
|
|
79
|
+
printf '# Fixture AGENTS.md\n\nNo tier table here on purpose.\n' > "$1/AGENTS.md"
|
|
80
|
+
fi
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
mk_skill() { # $1 = dir(root), $2 = plugin namespace, $3 = skill name
|
|
84
|
+
mkdir -p "$1/plugins/$2/skills/$3"
|
|
85
|
+
cat > "$1/plugins/$2/skills/$3/SKILL.md" <<EOF
|
|
86
|
+
---
|
|
87
|
+
name: $3
|
|
88
|
+
description: fixture skill for codex-doctor root lanes
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
Body. Nothing Claude-native here.
|
|
92
|
+
EOF
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
mk_agent() { # $1 = dir(root), $2 = plugin namespace, $3 = agent name
|
|
96
|
+
mkdir -p "$1/plugins/$2/agents"
|
|
97
|
+
printf -- '---\nname: %s\n---\n\nFixture agent.\n' "$3" > "$1/plugins/$2/agents/$3.md"
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
# The plugin MANIFEST is the shape discriminator pluginNamespaces() uses. Its path is taken from the
|
|
101
|
+
# real tree (all 4 FH plugins, and both plugins of a consumer harness measured off-tree, carry
|
|
102
|
+
# .claude-plugin/plugin.json — verified by
|
|
103
|
+
# `ls`, not assumed), because a fixture whose manifest sat anywhere else would make the shape lanes
|
|
104
|
+
# green for the wrong reason.
|
|
105
|
+
mk_plugin_manifest() { # $1 = dir(root), $2 = plugin namespace
|
|
106
|
+
mkdir -p "$1/plugins/$2/.claude-plugin"
|
|
107
|
+
printf '{"name":"%s","version":"0.0.0"}\n' "$2" > "$1/plugins/$2/.claude-plugin/plugin.json"
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
echo "── codex-doctor root lanes ── subject: $DOCTOR"
|
|
111
|
+
|
|
112
|
+
# ── LANE 1 — KNOWN POSITIVE. A non-npm consumer root that HAS every audited surface.
|
|
113
|
+
# This is that consumer shape reduced to its essentials: AGENTS.md tier table + plugins/**/SKILL.md,
|
|
114
|
+
# and deliberately NO package.json. It must produce a report, not exit 11.
|
|
115
|
+
# 🟥 rc alone is not the assertion. `rc != 11` is also satisfied by a crash, by usage output, or by
|
|
116
|
+
# a stub that prints nothing — so the arm pins the REPORT and a non-zero skill count too.
|
|
117
|
+
P1="$TMP/nonnpm"; mkdir -p "$P1"
|
|
118
|
+
mk_agents_md "$P1" table
|
|
119
|
+
mk_skill "$P1" xx-meta demo-native
|
|
120
|
+
mk_skill "$P1" xx-commons demo-adapter
|
|
121
|
+
run "$P1"; out="$OUT"
|
|
122
|
+
if [ "$RC" -eq 11 ]; then
|
|
123
|
+
bad "lane1 KNOWN-POSITIVE: non-npm root with every audited surface was still gated out" "rc=$RC | $out"
|
|
124
|
+
elif [ "$RC" -ne 0 ]; then
|
|
125
|
+
bad "lane1 KNOWN-POSITIVE: expected a clean report (rc=0), got another non-pass" "rc=$RC | $out"
|
|
126
|
+
else
|
|
127
|
+
case "$out" in
|
|
128
|
+
*"Skills scanned: 0"*) bad "lane1 KNOWN-POSITIVE: passed the gate but classified NOTHING — a confident empty report" "rc=$RC | $out" ;;
|
|
129
|
+
*"Skills scanned: "*) ok "lane1 KNOWN-POSITIVE: non-npm root (no package.json) audited, skills classified (rc=$RC)" ;;
|
|
130
|
+
*) bad "lane1 KNOWN-POSITIVE: rc=0 but no report on stdout — a stub would pass on rc alone" "rc=$RC | $out" ;;
|
|
131
|
+
esac
|
|
132
|
+
fi
|
|
133
|
+
|
|
134
|
+
# ── LANE 2 — KNOWN NEGATIVE. An empty directory. Genuinely nothing to audit → still rc=11.
|
|
135
|
+
# The message assertion is the positive control: `exit 11` with no explanation would pass on rc.
|
|
136
|
+
N2="$TMP/empty"; mkdir -p "$N2"
|
|
137
|
+
run "$N2"; out="$OUT"
|
|
138
|
+
if [ "$RC" -eq 11 ] && case "$out" in *"missing: AGENTS.md"*) true ;; *) false ;; esac \
|
|
139
|
+
&& case "$out" in *"missing: plugins/"*) true ;; *) false ;; esac; then
|
|
140
|
+
ok "lane2 KNOWN-NEGATIVE: empty dir → rc=11, and BOTH missing surfaces named"
|
|
141
|
+
else
|
|
142
|
+
bad "lane2 KNOWN-NEGATIVE: empty dir must fail closed at 11 naming each missing surface" "rc=$RC | $out"
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
# ── LANE 3 — one leg at a time, so lane2 cannot pass on the other's behalf.
|
|
146
|
+
# 3a: the skills exist, the instrument (AGENTS.md) does not.
|
|
147
|
+
N3A="$TMP/no_agents_md"; mkdir -p "$N3A"; mk_skill "$N3A" xx-meta demo-native
|
|
148
|
+
run "$N3A"; out="$OUT"
|
|
149
|
+
if [ "$RC" -eq 11 ] && case "$out" in *"missing: AGENTS.md"*) true ;; *) false ;; esac; then
|
|
150
|
+
ok "lane3a KNOWN-NEGATIVE: plugins present, AGENTS.md absent → rc=11 (no instrument, no report)"
|
|
151
|
+
else
|
|
152
|
+
bad "lane3a: AGENTS.md absence must gate at 11" "rc=$RC | $out"
|
|
153
|
+
fi
|
|
154
|
+
# 3b: the instrument exists, the subject does not.
|
|
155
|
+
N3B="$TMP/no_plugins"; mkdir -p "$N3B"; mk_agents_md "$N3B" table
|
|
156
|
+
run "$N3B"; out="$OUT"
|
|
157
|
+
if [ "$RC" -eq 11 ] && case "$out" in *"missing: plugins/"*) true ;; *) false ;; esac; then
|
|
158
|
+
ok "lane3b KNOWN-NEGATIVE: AGENTS.md present, plugins/ absent → rc=11"
|
|
159
|
+
else
|
|
160
|
+
bad "lane3b: plugins/ absence must gate at 11" "rc=$RC | $out"
|
|
161
|
+
fi
|
|
162
|
+
|
|
163
|
+
# ── LANE 4 — THE INVERSE ERROR, and the arm the UNFIXED code passed with rc=0.
|
|
164
|
+
# plugins/ EXISTS but holds no SKILL.md. Every surface-existence check says yes; there is still
|
|
165
|
+
# nothing to classify. Before the fix this root (package.json + plugins/ + AGENTS.md all present)
|
|
166
|
+
# sailed through and printed `Skills scanned: 0` / `Findings: none` / `Status: OK` / rc=0 —
|
|
167
|
+
# a measurement of nothing rendered as a clean bill of health.
|
|
168
|
+
# 🟥 package.json is PRESENT in this fixture on purpose: without it the unfixed code would gate on
|
|
169
|
+
# the old predicate and the arm would be green both ways, i.e. decorative about the axis it names.
|
|
170
|
+
N4="$TMP/empty_plugins"; mkdir -p "$N4/plugins"
|
|
171
|
+
mk_agents_md "$N4" table
|
|
172
|
+
printf '{"name":"fixture","version":"0.0.0"}\n' > "$N4/package.json"
|
|
173
|
+
run "$N4"; out="$OUT"
|
|
174
|
+
if [ "$RC" -eq 11 ] && case "$out" in *"missing: plugins/**/SKILL.md"*) true ;; *) false ;; esac; then
|
|
175
|
+
ok "lane4 INVERSE-ERROR: empty plugins/ → rc=11, not a confident empty report"
|
|
176
|
+
else
|
|
177
|
+
bad "lane4 INVERSE-ERROR: an empty plugins/ produced a report — not-found rendered as zero" "rc=$RC | $out"
|
|
178
|
+
fi
|
|
179
|
+
|
|
180
|
+
# ── LANE 5 — the pre-existing fail-closed channel must survive the gate rewrite.
|
|
181
|
+
# AGENTS.md is readable but has NO tier table → documentedTiers() yields 0 rows → INSTRUMENT_ERROR,
|
|
182
|
+
# exit 10 (harness error), distinct from 1 (drift) and 11 (wrong root). If the new predicate had
|
|
183
|
+
# been written as "AGENTS.md must contain a tier table", this arm would collapse into an 11 and the
|
|
184
|
+
# two failure classes — wrong root vs broken instrument — would stop being distinguishable.
|
|
185
|
+
N5="$TMP/no_tier_table"; mkdir -p "$N5"
|
|
186
|
+
mk_agents_md "$N5" no-table
|
|
187
|
+
mk_skill "$N5" xx-meta demo-native
|
|
188
|
+
run "$N5"; out="$OUT"
|
|
189
|
+
if [ "$RC" -eq 10 ] && case "$out" in *INSTRUMENT_ERROR*) true ;; *) false ;; esac; then
|
|
190
|
+
ok "lane5 INSTRUMENT-ERROR preserved: readable AGENTS.md with 0 tier rows → rc=10, not 11 and not 0"
|
|
191
|
+
else
|
|
192
|
+
bad "lane5: the instrument-failure channel changed class (expected rc=10 + INSTRUMENT_ERROR)" "rc=$RC | $out"
|
|
193
|
+
fi
|
|
194
|
+
|
|
195
|
+
# ── LANE 6 — the second silent zero, isolated from lane1.
|
|
196
|
+
# collectAgents() used to iterate a HARDCODED ['fh-meta','fh-commons'], so a consumer whose plugins
|
|
197
|
+
# carry any other prefix got `Agents scanned: 0` — the same not-found-is-zero family, and the first
|
|
198
|
+
# thing a newly-unblocked consumer would have seen. package.json is present here so the UNFIXED
|
|
199
|
+
# code reaches the report: it printed rc=0 with `Agents scanned: 0` while 2 agent files existed.
|
|
200
|
+
N6="$TMP/other_prefix"; mkdir -p "$N6"
|
|
201
|
+
mk_agents_md "$N6" table
|
|
202
|
+
mk_skill "$N6" zz-meta demo-native
|
|
203
|
+
mk_agent "$N6" zz-meta fixture-agent-one
|
|
204
|
+
mk_agent "$N6" zz-commons fixture-agent-two
|
|
205
|
+
# 🟥 Both namespaces are given a real plugin manifest so this lane exercises the SHAPE-FILTERED
|
|
206
|
+
# discovery path rather than the manifest-less fallback (lane10b owns that). The lane's axis is
|
|
207
|
+
# unchanged and in fact sharper: a non-`fh-` prefix must resolve THROUGH the filter, never by
|
|
208
|
+
# accident of the filter being bypassed. A name-based filter would redden exactly here.
|
|
209
|
+
mk_plugin_manifest "$N6" zz-meta
|
|
210
|
+
mk_plugin_manifest "$N6" zz-commons
|
|
211
|
+
printf '{"name":"fixture","version":"0.0.0"}\n' > "$N6/package.json"
|
|
212
|
+
run "$N6"; out="$OUT"
|
|
213
|
+
if [ "$RC" -ne 0 ]; then
|
|
214
|
+
bad "lane6: fixture root did not produce a report at all" "rc=$RC | $out"
|
|
215
|
+
else
|
|
216
|
+
case "$out" in
|
|
217
|
+
*"Agents scanned: 2"*) ok "lane6 NAMESPACE: agents under non-fh- plugin prefixes are discovered (2/2)" ;;
|
|
218
|
+
*"Agents scanned: 0"*) bad "lane6 NAMESPACE: 2 agent files on disk reported as 0 — hardcoded plugin list" "rc=$RC | $out" ;;
|
|
219
|
+
*) bad "lane6 NAMESPACE: unexpected agent count" "rc=$RC | $out" ;;
|
|
220
|
+
esac
|
|
221
|
+
fi
|
|
222
|
+
|
|
223
|
+
# ── LANE 7 — CONTROL, against the live repo. The suite must not be satisfiable by a subject that
|
|
224
|
+
# has simply stopped gating (lanes 1/6) or by one that gates everything (lanes 2/3/4). FH's own root
|
|
225
|
+
# is the known-good reference: it must still audit clean, with the counts the shipped tree has.
|
|
226
|
+
run "$FH_REPO"; out="$OUT"
|
|
227
|
+
if [ "$RC" -eq 0 ] \
|
|
228
|
+
&& case "$out" in *"Status: OK"*) true ;; *) false ;; esac \
|
|
229
|
+
&& case "$out" in *"Skills scanned: 0"*) false ;; *) true ;; esac \
|
|
230
|
+
&& case "$out" in *"Agents scanned: 0"*) false ;; *) true ;; esac; then
|
|
231
|
+
ok "lane7 CONTROL: the live FH root still audits clean and non-empty ($(printf '%s' "$out" | sed -n 's/^- \(Skills scanned: [0-9]*\)$/\1/p'), $(printf '%s' "$out" | sed -n 's/^- \(Agents scanned: [0-9]*\)$/\1/p'))"
|
|
232
|
+
else
|
|
233
|
+
bad "lane7 CONTROL: regression on the live FH root" "rc=$RC | $out"
|
|
234
|
+
fi
|
|
235
|
+
|
|
236
|
+
# ═══════════════════════════════════════════════════════════════════════════════════════════════
|
|
237
|
+
# LANES 8–11 — EXIT-CODE COLLAPSE. Added 2026-09-17 after a cross-family review of the lanes above.
|
|
238
|
+
# The gate rewrite stopped asserting several surface properties, and every property it stopped
|
|
239
|
+
# asserting reached raw fs calls that THROW. An uncaught node exception is rc=1 — the code already
|
|
240
|
+
# owned by "--strict found HIGH drift". So a caller could not distinguish "the harness broke" from
|
|
241
|
+
# "the harness found drift", which is the same class of defect as the silent zeros above, only
|
|
242
|
+
# wearing an exit code. The three non-zero classes must stay separable:
|
|
243
|
+
# 11 wrong root · 10 instrument/input error · 1 --strict with HIGH findings
|
|
244
|
+
# ═══════════════════════════════════════════════════════════════════════════════════════════════
|
|
245
|
+
|
|
246
|
+
# ── LANE 8 — `plugins` PRESENT BUT NOT A DIRECTORY. exists() says yes (it uses F_OK, which is
|
|
247
|
+
# blind to node type), then readdirSync threw ENOTDIR. Measured before the fix:
|
|
248
|
+
# Error: ENOTDIR: not a directory, scandir '.../plugins' → rc=1
|
|
249
|
+
# A wrong-shaped root surface belongs with an absent one: rc=11, naming it.
|
|
250
|
+
N8="$TMP/plugins_is_a_file"; mkdir -p "$N8"
|
|
251
|
+
mk_agents_md "$N8" table
|
|
252
|
+
printf 'this is a file, not a directory\n' > "$N8/plugins"
|
|
253
|
+
run "$N8"; out="$OUT"
|
|
254
|
+
if [ "$RC" -eq 11 ] && case "$out" in *"plugins/ — present but NOT a directory"*) true ;; *) false ;; esac; then
|
|
255
|
+
ok "lane8 SHAPE: plugins/ present as a FILE → rc=11 naming the shape fault (not an uncaught rc=1)"
|
|
256
|
+
else
|
|
257
|
+
bad "lane8 SHAPE: a non-directory plugins/ must exit 11, not collapse into 1" "rc=$RC | $out"
|
|
258
|
+
fi
|
|
259
|
+
|
|
260
|
+
# ── LANE 9 — UNREADABLE SUBJECT, deterministic arm. A broken symlink named SKILL.md: walk() lists
|
|
261
|
+
# it (readdirSync sees the link; exists() follows it and reports the TARGET absent), then readText()
|
|
262
|
+
# threw ENOENT out of collectSkills(). Measured before the fix:
|
|
263
|
+
# Error: ENOENT: no such file or directory, open '.../broken/SKILL.md' → rc=1
|
|
264
|
+
# The subject being unusable is an INPUT fault: rc=10 + INSTRUMENT_ERROR + the path named.
|
|
265
|
+
N9="$TMP/broken_symlink_skill"; mkdir -p "$N9"
|
|
266
|
+
mk_agents_md "$N9" table
|
|
267
|
+
mk_skill "$N9" xx-meta demo-native
|
|
268
|
+
mkdir -p "$N9/plugins/xx-meta/skills/broken"
|
|
269
|
+
ln -s /nonexistent/definitely-not-here.md "$N9/plugins/xx-meta/skills/broken/SKILL.md"
|
|
270
|
+
run "$N9"; out="$OUT"
|
|
271
|
+
if [ "$RC" -eq 10 ] \
|
|
272
|
+
&& case "$out" in *INSTRUMENT_ERROR*) true ;; *) false ;; esac \
|
|
273
|
+
&& case "$out" in *"skills/broken/SKILL.md"*) true ;; *) false ;; esac; then
|
|
274
|
+
ok "lane9 INPUT-ERROR: broken-symlink SKILL.md → rc=10 + INSTRUMENT_ERROR + path named"
|
|
275
|
+
else
|
|
276
|
+
bad "lane9 INPUT-ERROR: an unreadable skill input must be 10, not an uncaught 1 and not 0" "rc=$RC | $out"
|
|
277
|
+
fi
|
|
278
|
+
|
|
279
|
+
# ── LANE 9b — the permissions arm of the same axis. Kept SEPARATE from lane9 because it is the only
|
|
280
|
+
# arm in this suite whose fixture can be silently defeated by the environment: a user who can read a
|
|
281
|
+
# chmod 000 file (root, or some CI images) makes the fixture non-potent. That is a SKIP with a stated
|
|
282
|
+
# reason — 🟥 SKIP IS NOT PASS, so it increments neither counter and says so out loud.
|
|
283
|
+
N9B="$TMP/eacces_skill"; mkdir -p "$N9B"
|
|
284
|
+
mk_agents_md "$N9B" table
|
|
285
|
+
mk_skill "$N9B" xx-meta demo-native
|
|
286
|
+
mk_skill "$N9B" xx-meta locked
|
|
287
|
+
chmod 000 "$N9B/plugins/xx-meta/skills/locked/SKILL.md"
|
|
288
|
+
if cat "$N9B/plugins/xx-meta/skills/locked/SKILL.md" >/dev/null 2>&1; then
|
|
289
|
+
printf ' ⚠️ lane9b SKIPPED (not PASS, not counted): this user (%s) can read a chmod 000 file, so the EACCES fixture is not potent here. The same code path is covered deterministically by lane9.\n' "$(id -un)"
|
|
290
|
+
else
|
|
291
|
+
run "$N9B"; out="$OUT"
|
|
292
|
+
if [ "$RC" -eq 10 ] \
|
|
293
|
+
&& case "$out" in *INSTRUMENT_ERROR*) true ;; *) false ;; esac \
|
|
294
|
+
&& case "$out" in *"skills/locked/SKILL.md"*) true ;; *) false ;; esac; then
|
|
295
|
+
ok "lane9b INPUT-ERROR: chmod 000 SKILL.md (EACCES) → rc=10 + INSTRUMENT_ERROR + path named"
|
|
296
|
+
else
|
|
297
|
+
bad "lane9b INPUT-ERROR: an EACCES skill input must be 10, not an uncaught 1" "rc=$RC | $out"
|
|
298
|
+
fi
|
|
299
|
+
fi
|
|
300
|
+
|
|
301
|
+
# ── LANE 10 — NAMESPACE OVER-COLLECTION. pluginNamespaces() accepted every directory under
|
|
302
|
+
# plugins/, so a stray dir (a stale copy, node_modules, a scratch tree) INFLATED `Agents scanned`.
|
|
303
|
+
# Measured before the fix, with one real plugin plus plugins/not-a-plugin/agents/ghost.md:
|
|
304
|
+
# Status: OK · Skills scanned: 1 · Agents scanned: 1 · Findings: none
|
|
305
|
+
# The ghost is now excluded by plugin SHAPE — and 🟥 the exclusion is asserted to be VISIBLE, not
|
|
306
|
+
# silent: a quiet drop and a quiet over-count are the same defect pointing opposite ways.
|
|
307
|
+
N10="$TMP/ghost_namespace"; mkdir -p "$N10"
|
|
308
|
+
mk_agents_md "$N10" table
|
|
309
|
+
mk_skill "$N10" real demo-native
|
|
310
|
+
mk_agent "$N10" real fixture-real-agent
|
|
311
|
+
mk_plugin_manifest "$N10" real
|
|
312
|
+
mkdir -p "$N10/plugins/not-a-plugin/agents"
|
|
313
|
+
printf -- '---\nname: ghost\n---\n\nGhost agent in a directory that is not a plugin.\n' > "$N10/plugins/not-a-plugin/agents/ghost.md"
|
|
314
|
+
run "$N10"; out="$OUT"
|
|
315
|
+
if [ "$RC" -ne 0 ]; then
|
|
316
|
+
bad "lane10 NAMESPACE-SHAPE: fixture root did not produce a report at all" "rc=$RC | $out"
|
|
317
|
+
elif case "$out" in *"Agents scanned: 1"*) false ;; *) true ;; esac; then
|
|
318
|
+
bad "lane10 NAMESPACE-SHAPE: expected exactly the 1 real agent (the ghost must not be counted)" "rc=$RC | $out"
|
|
319
|
+
elif case "$out" in *PLUGIN_NAMESPACE_NOT_PLUGIN_SHAPED*) true ;; *) false ;; esac; then
|
|
320
|
+
ok "lane10 NAMESPACE-SHAPE: unshaped plugins/not-a-plugin/ excluded (Agents scanned: 1) AND the drop is named in a WARN"
|
|
321
|
+
else
|
|
322
|
+
bad "lane10 NAMESPACE-SHAPE: count is right but the exclusion is SILENT — a drop must be visible" "rc=$RC | $out"
|
|
323
|
+
fi
|
|
324
|
+
|
|
325
|
+
# ── LANE 10b — THE PAIRED NEGATIVE for lane10, and the reason the shape filter is not absolute.
|
|
326
|
+
# A consumer whose plugins/ carries NO manifest anywhere has no shape signal at all. Filtering
|
|
327
|
+
# strictly there would report `Agents scanned: 0` for a tree that visibly holds agents — the exact
|
|
328
|
+
# not-found-is-zero failure this whole suite was built around, re-introduced by the fix for lane10.
|
|
329
|
+
# So discovery falls back to an UNFILTERED scan and says so. Both halves are asserted: the agent is
|
|
330
|
+
# found, and the report admits the count is unfiltered.
|
|
331
|
+
# 🟥 Honest scope: on such a root lane10's ghost WOULD still be counted. That residual is structural
|
|
332
|
+
# (with zero manifests nothing distinguishes a plugin from a stray dir) and it is LABELLED, not silent.
|
|
333
|
+
N10B="$TMP/no_manifest_anywhere"; mkdir -p "$N10B"
|
|
334
|
+
mk_agents_md "$N10B" table
|
|
335
|
+
mk_skill "$N10B" qq-meta demo-native
|
|
336
|
+
mk_agent "$N10B" qq-meta fixture-agent-one
|
|
337
|
+
run "$N10B"; out="$OUT"
|
|
338
|
+
if [ "$RC" -ne 0 ]; then
|
|
339
|
+
bad "lane10b FALLBACK: manifest-less root did not produce a report" "rc=$RC | $out"
|
|
340
|
+
elif case "$out" in *"Agents scanned: 1"*) false ;; *) true ;; esac; then
|
|
341
|
+
bad "lane10b FALLBACK: the shape filter manufactured a silent zero on a manifest-less root" "rc=$RC | $out"
|
|
342
|
+
elif case "$out" in *PLUGIN_SHAPE_UNDETECTABLE*) true ;; *) false ;; esac; then
|
|
343
|
+
ok "lane10b FALLBACK: manifest-less root still discovers agents (1/1) AND labels the count unfiltered"
|
|
344
|
+
else
|
|
345
|
+
bad "lane10b FALLBACK: fell back correctly but did not LABEL the count as unfiltered" "rc=$RC | $out"
|
|
346
|
+
fi
|
|
347
|
+
|
|
348
|
+
# ── LANE 11 — EMPTY SKILL.md. A zero-byte SKILL.md was counted as a skill and the report said
|
|
349
|
+
# `Status: OK · Findings: none`; the only trace was `unclassified=1`, which is also where a
|
|
350
|
+
# merely-undocumented-but-real skill lands, so the two were indistinguishable.
|
|
351
|
+
# 🟥 Strength is deliberately WARN. The run DID measure the surface — it measured an empty one — so
|
|
352
|
+
# escalating to 10 or HIGH would fix one exit-code collapse by creating another. rc must stay 0.
|
|
353
|
+
N11="$TMP/empty_skill_md"; mkdir -p "$N11"
|
|
354
|
+
mk_agents_md "$N11" table
|
|
355
|
+
mk_skill "$N11" ee-meta demo-native
|
|
356
|
+
mk_plugin_manifest "$N11" ee-meta
|
|
357
|
+
mkdir -p "$N11/plugins/ee-meta/skills/emptyskill"
|
|
358
|
+
: > "$N11/plugins/ee-meta/skills/emptyskill/SKILL.md"
|
|
359
|
+
run "$N11"; out="$OUT"
|
|
360
|
+
if [ "$RC" -ne 0 ]; then
|
|
361
|
+
bad "lane11 EMPTY-SKILL: a WARN-class observation must NOT change the exit class (expected rc=0)" "rc=$RC | $out"
|
|
362
|
+
elif case "$out" in *SKILL_MD_HAS_NO_CLASSIFIABLE_CONTENT*) true ;; *) false ;; esac; then
|
|
363
|
+
ok "lane11 EMPTY-SKILL: empty SKILL.md is named in a WARN, and rc stays 0 (no new exit-code collapse)"
|
|
364
|
+
else
|
|
365
|
+
bad "lane11 EMPTY-SKILL: an empty SKILL.md still reports a clean bill of health" "rc=$RC | $out"
|
|
366
|
+
fi
|
|
367
|
+
|
|
368
|
+
# ── LANE 11b — CONTROL for lane11. The WARN must fire on the empty input, not on every skill.
|
|
369
|
+
# Without this, a rule that warned unconditionally would pass lane11 while making the signal useless.
|
|
370
|
+
N11B="$TMP/normal_skills_only"; mkdir -p "$N11B"
|
|
371
|
+
mk_agents_md "$N11B" table
|
|
372
|
+
mk_skill "$N11B" ee-meta demo-native
|
|
373
|
+
mk_skill "$N11B" ee-meta demo-adapter
|
|
374
|
+
mk_plugin_manifest "$N11B" ee-meta
|
|
375
|
+
run "$N11B"; out="$OUT"
|
|
376
|
+
if [ "$RC" -eq 0 ] && case "$out" in *SKILL_MD_HAS_NO_CLASSIFIABLE_CONTENT*) false ;; *) true ;; esac; then
|
|
377
|
+
ok "lane11b CONTROL: two well-formed SKILL.md files raise NO empty-input WARN"
|
|
378
|
+
else
|
|
379
|
+
bad "lane11b CONTROL: the empty-input WARN fires on well-formed skills — the signal is worthless" "rc=$RC | $out"
|
|
380
|
+
fi
|
|
381
|
+
|
|
382
|
+
printf '\ncodex-doctor root lanes: %d passed, %d failed\n' "$PASS" "$FAIL"
|
|
383
|
+
[ "$FAIL" -eq 0 ] || exit 1
|
|
384
|
+
exit 0
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_outbound_pr_gate_lanes.sh — known pairs for scripts/outbound_pr_gate.sh.
|
|
3
|
+
#
|
|
4
|
+
# Both directions on every axis: the applicability test (owned vs non-owned), the record test
|
|
5
|
+
# (strong rung vs weak rung, present vs absent, grounded vs vacuous), and the delivery test
|
|
6
|
+
# (deny = exit 2, advisory = exit 0 with output, silent = exit 0 with none).
|
|
7
|
+
# L8 is the CLASS-CLOSING arm: it reads the `standpoint:` closed enum out of
|
|
8
|
+
# templates/.git-hooks/pre-commit and fails if the gate classifies neither strong nor weak — so a
|
|
9
|
+
# new enum member cannot be added without deciding what it means on the outbound surface.
|
|
10
|
+
# L9 is the REVERT probe: neuter the strong-rung allow-list and L1 must go red.
|
|
11
|
+
set -uo pipefail
|
|
12
|
+
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
13
|
+
REPO="$(cd "$HERE/.." && pwd)"
|
|
14
|
+
GATE="$HERE/outbound_pr_gate.sh"
|
|
15
|
+
PRECOMMIT="${FH_PRECOMMIT_FILE:-$REPO/templates/.git-hooks/pre-commit}"
|
|
16
|
+
fail=0; n=0
|
|
17
|
+
TMP=$(mktemp -d) || { echo "FAIL mktemp"; exit 1; }
|
|
18
|
+
trap 'rm -rf "$TMP"' EXIT
|
|
19
|
+
|
|
20
|
+
# ── fixture world ─────────────────────────────────────────────────────────────────────────────
|
|
21
|
+
FHROOT="$TMP/fh"; mkdir -p "$FHROOT/scripts" "$FHROOT/tracks/_meta"
|
|
22
|
+
: > "$FHROOT/scripts/session_close_check.sh" # the applicability anchor
|
|
23
|
+
git init -q "$FHROOT" 2>/dev/null
|
|
24
|
+
git -C "$FHROOT" remote add origin https://github.com/ownerco/forge-harness.git 2>/dev/null
|
|
25
|
+
mkfork() { # $1 = dir, $2 = origin spec, $3 = upstream spec (empty = none)
|
|
26
|
+
mkdir -p "$1"; git init -q "$1" 2>/dev/null
|
|
27
|
+
git -C "$1" remote add origin "https://github.com/$2.git" 2>/dev/null
|
|
28
|
+
[ -n "${3:-}" ] && git -C "$1" remote add upstream "https://github.com/$3.git" 2>/dev/null
|
|
29
|
+
return 0
|
|
30
|
+
}
|
|
31
|
+
mkfork "$TMP/foreignfork" "ownerco/archify" "tt-a1i/archify" # fork of a repo we do NOT own
|
|
32
|
+
mkfork "$TMP/ourclone" "ownerco/forge-harness" "" # our own repo, no fork parent
|
|
33
|
+
mkfork "$TMP/directclone" "someoneelse/tool" "" # DIRECT clone of a foreign repo
|
|
34
|
+
|
|
35
|
+
TODAY="2026-01-01"
|
|
36
|
+
rec() { # $1 = standpoint value, $2 = generated-path, $3 = fixture-carries ("" = omit the line)
|
|
37
|
+
rm -f "$FHROOT/tracks/_meta"/outbound_pr_*.md
|
|
38
|
+
local f="$FHROOT/tracks/_meta/outbound_pr_${TODAY}_fixture.md"
|
|
39
|
+
: > "$f"
|
|
40
|
+
[ -n "${1:-}" ] && printf 'standpoint: %s\n' "$1" >> "$f"
|
|
41
|
+
[ -n "${2:-}" ] && printf 'generated-path: %s\n' "$2" >> "$f"
|
|
42
|
+
[ -n "${3:-}" ] && printf 'fixture-carries: %s\n' "$3" >> "$f"
|
|
43
|
+
return 0
|
|
44
|
+
}
|
|
45
|
+
FULL_SP='tier2(archify) — ran `node scripts/export.mjs` there, output: wrote 3 files, input intact'
|
|
46
|
+
FULL_GP='none-found(grepped package.json scripts and every *.mjs for a writer of that path)'
|
|
47
|
+
FULL_AR='asserted(`node t.mjs` with dest symlinked to the input, output: input bytes unchanged)'
|
|
48
|
+
|
|
49
|
+
run() { # $1 = label, $2 = expected verdict deny|advisory|silent, $3 = command string, $4 = cwd
|
|
50
|
+
n=$((n+1))
|
|
51
|
+
local out rc
|
|
52
|
+
out=$(printf '{"tool_name":"Bash","cwd":"%s","tool_input":{"command":"%s"}}' "${4:-}" "$3" \
|
|
53
|
+
| CLAUDE_PROJECT_DIR="$FHROOT" FH_OUTBOUND_TODAY="$TODAY" \
|
|
54
|
+
FH_OUTBOUND_RECDIR="$FHROOT/tracks/_meta" bash "$GATE" 2>&1); rc=$?
|
|
55
|
+
local got="silent"
|
|
56
|
+
[ "$rc" -eq 2 ] && got="deny"
|
|
57
|
+
[ "$rc" -eq 0 ] && [ -n "$out" ] && got="advisory"
|
|
58
|
+
if [ "$got" = "$2" ]; then
|
|
59
|
+
echo "PASS $1 ($got)"
|
|
60
|
+
else
|
|
61
|
+
echo "FAIL $1: expected $2, got $got (rc=$rc)"
|
|
62
|
+
printf '%s\n' "$out" | sed 's/^/ /' | head -6
|
|
63
|
+
fail=1
|
|
64
|
+
fi
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
# ── L1 known-POSITIVE: non-owned target, weak rung -> deny ────────────────────────────────────
|
|
68
|
+
rec 'tier1b(archify) — read their export path end to end' "$FULL_GP" "$FULL_AR"
|
|
69
|
+
run "L1 non-owned + standpoint tier1b" deny "gh pr create -R tt-a1i/archify --title x"
|
|
70
|
+
|
|
71
|
+
# ── L2 known-NEGATIVE: same target, full record -> silent ─────────────────────────────────────
|
|
72
|
+
rec "$FULL_SP" "$FULL_GP" "$FULL_AR"
|
|
73
|
+
run "L2 non-owned + full record" silent "gh pr create -R tt-a1i/archify --title x"
|
|
74
|
+
|
|
75
|
+
# ── L3 our own repo: never blocked, record or not ─────────────────────────────────────────────
|
|
76
|
+
rec "" "" ""
|
|
77
|
+
run "L3 owned target, no record" silent "gh pr create -R ownerco/forge-harness --title x"
|
|
78
|
+
|
|
79
|
+
# ── L4 applicability undetermined -> advisory, NEVER deny ─────────────────────────────────────
|
|
80
|
+
rec "" "" ""
|
|
81
|
+
run "L4 bare gh pr create, no cwd" advisory "gh pr create --title x"
|
|
82
|
+
|
|
83
|
+
# ── L5 not the outbound act ───────────────────────────────────────────────────────────────────
|
|
84
|
+
run "L5 unrelated command" silent "gh pr list --state open"
|
|
85
|
+
run "L5b gh pr merge is not create" silent "gh pr merge 12 --squash"
|
|
86
|
+
|
|
87
|
+
# ── L6 record absent entirely on a non-owned target ───────────────────────────────────────────
|
|
88
|
+
rec "" "" ""
|
|
89
|
+
run "L6 non-owned + no record at all" deny "gh pr create -R tt-a1i/archify --title x"
|
|
90
|
+
|
|
91
|
+
# ── L7 vacuous grounds ────────────────────────────────────────────────────────────────────────
|
|
92
|
+
rec "$FULL_SP" 'none-found()' "$FULL_AR"
|
|
93
|
+
run "L7 generated-path with empty grounds" deny "gh pr create -R tt-a1i/archify --title x"
|
|
94
|
+
rec 'tier2(archify) — looked' "$FULL_GP" "$FULL_AR"
|
|
95
|
+
run "L7b standpoint tier2 naming no execution" deny "gh pr create -R tt-a1i/archify --title x"
|
|
96
|
+
|
|
97
|
+
# ── L10 DEGRADED_NOT_RUN is an honest record AND a not-ready verdict ──────────────────────────
|
|
98
|
+
rec "$FULL_SP" "$FULL_GP" 'DEGRADED_NOT_RUN(no local chromium on this machine, nothing was run)'
|
|
99
|
+
run "L10 fixture-carries DEGRADED_NOT_RUN" deny "gh pr create -R tt-a1i/archify --title x"
|
|
100
|
+
|
|
101
|
+
# ── L10b spelling C (composition / first-match-only) is an accepted answer on the SAME field ──
|
|
102
|
+
# Rationale for folding rather than adding a 4th field is in the gate header. This lane pins that
|
|
103
|
+
# the C answer clears the gate, so the folding is real and not just documentation.
|
|
104
|
+
rec "$FULL_SP" "$FULL_GP" 'asserted(`node t.mjs "npm publish --dry-run && rm -rf /"` — 2 effective decisions, first excepted; saw hold:false, expected hold:true)'
|
|
105
|
+
run "L10b fixture-carries answered with spelling C" silent "gh pr create -R tt-a1i/archify --title x"
|
|
106
|
+
|
|
107
|
+
# ── L11 fork detection, both directions, via cwd (no -R in the command) ───────────────────────
|
|
108
|
+
rec 'tier1b(archify) — read only' "$FULL_GP" "$FULL_AR"
|
|
109
|
+
run "L11a cwd is a fork of a foreign repo" deny "gh pr create --title x" "$TMP/foreignfork"
|
|
110
|
+
run "L11b cwd is our own clone" silent "gh pr create --title x" "$TMP/ourclone"
|
|
111
|
+
run "L11c cwd is a DIRECT clone of a foreign repo" deny "gh pr create --title x" "$TMP/directclone"
|
|
112
|
+
|
|
113
|
+
# ── L12 override is acknowledged, recorded in the command, and does not satisfy ───────────────
|
|
114
|
+
rec "" "" ""
|
|
115
|
+
run "L12 FH_OUTBOUND_PR_OK=1 in the command" advisory "FH_OUTBOUND_PR_OK=1 gh pr create -R tt-a1i/archify --title x"
|
|
116
|
+
|
|
117
|
+
# ── L13 not an FH checkout -> silent, and we create nothing there ─────────────────────────────
|
|
118
|
+
n=$((n+1))
|
|
119
|
+
_out=$(printf '{"tool_name":"Bash","tool_input":{"command":"gh pr create -R tt-a1i/archify"}}' \
|
|
120
|
+
| CLAUDE_PROJECT_DIR="$TMP/notfh" FH_OUTBOUND_ANCHOR="$TMP/notfh/nope" bash "$GATE" 2>&1); _rc=$?
|
|
121
|
+
if [ "$_rc" -eq 0 ] && [ -z "$_out" ]; then echo "PASS L13 non-FH checkout is silent"
|
|
122
|
+
else echo "FAIL L13 non-FH checkout: rc=$_rc out='$_out'"; fail=1; fi
|
|
123
|
+
|
|
124
|
+
# ── L8 CLASS-CLOSING: every standpoint: enum member must be classified by this gate ───────────
|
|
125
|
+
n=$((n+1))
|
|
126
|
+
# Scope the read to validate_standpoint_leg()'s own body first — an unscoped grep for the enum
|
|
127
|
+
# text picked up three unrelated lines elsewhere in the hook and reported them as members
|
|
128
|
+
# (first run of this lane, 2026-09-18: the instrument had to be calibrated before it measured).
|
|
129
|
+
ENUM=$(awk '/^validate_standpoint_leg\(\)/{f=1} f&&/^}/{f=0} f' "$PRECOMMIT" 2>/dev/null \
|
|
130
|
+
| awk '/Closed enum:/{print; getline; print}' \
|
|
131
|
+
| tr '·' '\n' | sed -E 's/^[[:space:]]*echo[[:space:]]+"//; s/.*Closed enum:[[:space:]]*//; s/\(<h>\)//g; s/[^A-Za-z0-9_-]//g' \
|
|
132
|
+
| grep -E '^[A-Za-z]' | sort -u)
|
|
133
|
+
if [ -z "$ENUM" ]; then
|
|
134
|
+
echo "FAIL L8 INSTRUMENT ERROR — could not extract the standpoint enum from $PRECOMMIT"
|
|
135
|
+
fail=1
|
|
136
|
+
else
|
|
137
|
+
DECLARED=$( { grep -m1 '^STRONG_RUNGS=' "$GATE"; grep -m1 '^WEAK_RUNGS=' "$GATE"; } \
|
|
138
|
+
| sed -E 's/^[A-Z_]+="//; s/"$//' | tr ' ' '\n' | grep -E '^[A-Za-z]' | sort -u)
|
|
139
|
+
missing=$(comm -23 <(printf '%s\n' "$ENUM") <(printf '%s\n' "$DECLARED"))
|
|
140
|
+
if [ -n "$missing" ]; then
|
|
141
|
+
echo "FAIL L8 standpoint enum member(s) unclassified by outbound_pr_gate.sh:"
|
|
142
|
+
printf '%s\n' "$missing" | sed 's/^/ /'
|
|
143
|
+
echo " Classify each as STRONG_RUNGS (clears the outbound gate) or WEAK_RUNGS (blocks it)."
|
|
144
|
+
fail=1
|
|
145
|
+
else
|
|
146
|
+
echo "PASS L8 class-closing: all $(printf '%s\n' "$ENUM" | wc -l | tr -d ' ') enum members classified"
|
|
147
|
+
fi
|
|
148
|
+
fi
|
|
149
|
+
|
|
150
|
+
# ── L8b known-POSITIVE for the class-closing arm: add a member, L8's comparison must name it ──
|
|
151
|
+
n=$((n+1))
|
|
152
|
+
FAKEPC="$TMP/pre-commit-with-new-member"
|
|
153
|
+
sed -E 's/(Closed enum: tier1 )/\1· tier4(<h>) /' "$PRECOMMIT" > "$FAKEPC" 2>/dev/null
|
|
154
|
+
ENUM2=$(awk '/^validate_standpoint_leg\(\)/{f=1} f&&/^}/{f=0} f' "$FAKEPC" 2>/dev/null \
|
|
155
|
+
| awk '/Closed enum:/{print; getline; print}' \
|
|
156
|
+
| tr '·' '\n' | sed -E 's/^[[:space:]]*echo[[:space:]]+"//; s/.*Closed enum:[[:space:]]*//; s/\(<h>\)//g; s/[^A-Za-z0-9_-]//g' \
|
|
157
|
+
| grep -E '^[A-Za-z]' | sort -u)
|
|
158
|
+
DECLARED2=$( { grep -m1 '^STRONG_RUNGS=' "$GATE"; grep -m1 '^WEAK_RUNGS=' "$GATE"; } \
|
|
159
|
+
| sed -E 's/^[A-Z_]+="//; s/"$//' | tr ' ' '\n' | grep -E '^[A-Za-z]' | sort -u)
|
|
160
|
+
if printf '%s\n' "$(comm -23 <(printf '%s\n' "$ENUM2") <(printf '%s\n' "$DECLARED2"))" | grep -qx 'tier4'; then
|
|
161
|
+
echo "PASS L8b class-closing arm goes RED when an enum member is added"
|
|
162
|
+
else
|
|
163
|
+
echo "FAIL L8b class-closing arm did NOT notice an added enum member — L8 green means nothing"
|
|
164
|
+
fail=1
|
|
165
|
+
fi
|
|
166
|
+
|
|
167
|
+
# ── L9 REVERT PROBE: neuter the allow-list; L1 must go red ────────────────────────────────────
|
|
168
|
+
n=$((n+1))
|
|
169
|
+
MUT="$TMP/mutant.sh"
|
|
170
|
+
sed -E 's/^([[:space:]]*)tier2\\\(\*\\\)\|tier2b\\\(\*\\\)\|tier3\\\(\*\\\)\)/\1*)/' "$GATE" > "$MUT"
|
|
171
|
+
if ! grep -qE '^[[:space:]]*\*\)$' "$MUT"; then
|
|
172
|
+
echo "FAIL L9 INSTRUMENT ERROR — the mutation did not apply; the probe would pass vacuously"
|
|
173
|
+
fail=1
|
|
174
|
+
else
|
|
175
|
+
rec 'tier1b(archify) — read their export path end to end' "$FULL_GP" "$FULL_AR"
|
|
176
|
+
_o=$(printf '{"tool_name":"Bash","tool_input":{"command":"gh pr create -R tt-a1i/archify"}}' \
|
|
177
|
+
| CLAUDE_PROJECT_DIR="$FHROOT" FH_OUTBOUND_TODAY="$TODAY" \
|
|
178
|
+
FH_OUTBOUND_RECDIR="$FHROOT/tracks/_meta" bash "$MUT" 2>&1); _r=$?
|
|
179
|
+
if [ "$_r" -eq 2 ]; then
|
|
180
|
+
echo "FAIL L9 revert probe: the neutered allow-list STILL denied — L1 is not anchored to it"
|
|
181
|
+
fail=1
|
|
182
|
+
else
|
|
183
|
+
echo "PASS L9 revert probe: neutering the allow-list turns L1's deny off (rc=$_r)"
|
|
184
|
+
fi
|
|
185
|
+
fi
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
# ── L14 트리거 형태 — cross-family(codex 2026-09-18)가 공격한 자리 ───────────────────────────
|
|
189
|
+
# 🟥 그 지적 7건 중 5건은 실측에서 **틀렸다**(`command gh`·`env X=1 gh`·`time gh`·`noglob gh`·
|
|
190
|
+
# 인용 repo 는 종전 식으로도 잡혔다). 아래 셋만 진짜였고, 앞의 둘을 수리로 닫았다.
|
|
191
|
+
# 이 레인들은 그 수리의 회귀 앵커다 — 정규식이 좁아지면 여기가 적색이 된다.
|
|
192
|
+
rec 'tier1b(archify) — read their export path end to end' "$FULL_GP" "$FULL_AR"
|
|
193
|
+
run "L14a 절대경로 gh 도 잡힌다" deny "/opt/homebrew/bin/gh pr create -R tt-a1i/archify --title x"
|
|
194
|
+
rec 'tier1b(archify) — read their export path end to end' "$FULL_GP" "$FULL_AR"
|
|
195
|
+
run "L14b 상대경로 ./gh 도 잡힌다" deny "./gh pr create -R tt-a1i/archify --title x"
|
|
196
|
+
rec 'tier1b(archify) — read their export path end to end' "$FULL_GP" "$FULL_AR"
|
|
197
|
+
run "L14c 인용 안쪽 sh -c 도 잡힌다" deny "sh -c 'gh pr create -R tt-a1i/archify --title x'"
|
|
198
|
+
|
|
199
|
+
# ── L15 구조적 잔여를 «핀» 으로 박는다 (커버리지 주장이 아니라 잔여 선언) ────────────────────
|
|
200
|
+
# 🟥 변수 간접은 정규식으로 닫히지 않는다. 이 레인은 그 사실을 **고정**한다 — 누가 「닫혔다」고
|
|
201
|
+
# 적으면 여기가 적색이 되어 거짓 주장을 막는다. silent 를 기대하는 것이 의도다.
|
|
202
|
+
rec 'tier1b(archify) — read their export path end to end' "$FULL_GP" "$FULL_AR"
|
|
203
|
+
# 🟥 `$GH_CMD` 는 **리터럴로 가야 한다** — 초판이 이중인용에 그대로 써서 레인 셸이 확장했고
|
|
204
|
+
# `set -u` 에서 그 자리에서 죽었다(L14 까지만 돌고 스위트 중단). 단일인용으로 고정한다.
|
|
205
|
+
run "L15 변수 간접은 NAMED GAP 이다 (silent 가 기대값)" silent 'GH_CMD=gh; $GH_CMD pr create -R tt-a1i/archify'
|
|
206
|
+
|
|
207
|
+
# ── L16 known-NEGATIVE: 넓힌 문자류가 관계없는 명령을 잡지 않는가 ─────────────────────────────
|
|
208
|
+
rec "$FULL_SP" "$FULL_GP" "$FULL_AR"
|
|
209
|
+
run "L16 gh pr edit 는 여전히 NAMED GAP" silent "gh pr edit --body x -R tt-a1i/archify"
|
|
210
|
+
rec "$FULL_SP" "$FULL_GP" "$FULL_AR"
|
|
211
|
+
run "L16b gh pr list 는 트리거 아님" silent "gh pr list -R tt-a1i/archify"
|
|
212
|
+
|
|
213
|
+
echo "── $n lanes, $( [ $fail -eq 0 ] && echo 'all green' || echo 'FAILURES above' ) ──"
|
|
214
|
+
exit $fail
|