@chrono-meta/fh-gate 2.7.0 → 2.9.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 +33 -5
- package/.claude-plugin/marketplace.json +2 -2
- package/AGENTS.md +4 -0
- package/CLAUDE.md +169 -183
- package/README.ja.md +157 -53
- package/README.ko.md +147 -50
- package/README.md +136 -50
- package/README.zh.md +137 -46
- package/docs/ETHOS.md +20 -8
- package/docs/GATE_DAY.md +235 -0
- package/docs/OUTPUT_EVIDENCE.md +13 -2
- package/docs/codex-compat.md +10 -2
- package/knowledge/shared/dialogue/ai_dialogue_playbook.md +131 -0
- package/knowledge/shared/harness-core/agents_md_runtime_details.md +10 -3
- package/knowledge/shared/harness-core/claude_md_gate_details.md +90 -0
- package/knowledge/shared/harness-core/dispatch_conditional_prohibition.md +75 -0
- package/knowledge/shared/harness-core/fh_three_layer_canon.md +97 -5
- package/knowledge/shared/harness-core/field_verdict_crossfamily_gate.md +96 -5
- package/knowledge/shared/harness-core/harness_incubator_doctrine.md +6 -1
- package/knowledge/shared/harness-core/ship_readiness_gate.md +2 -2
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +137 -0
- package/knowledge/shared/rules/multi_session_close_protocol.md +15 -4
- package/package.json +12 -2
- 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 +116 -0
- package/plugins/fh-meta/skills/cross-ecosystem-synergy-detection/SKILL.md +127 -0
- package/scripts/branch_claim.sh +3 -1
- package/scripts/chamber_candidate_collect.sh +71 -13
- package/scripts/listing_watch.sh +187 -0
- package/scripts/mapped_tracks.sh +113 -0
- package/scripts/package_coverage_check.sh +54 -0
- package/scripts/prior_art_prompt.sh +49 -2
- package/scripts/selfcheck.sh +44 -1
- package/scripts/session_close_check.sh +56 -3
- package/scripts/test_chamber_sig_lanes.sh +151 -0
- package/scripts/test_leak_scan_control_lanes.sh +163 -0
- package/scripts/test_listing_watch_lanes.sh +162 -0
- package/scripts/test_mapped_tracks_lanes.sh +162 -0
- package/scripts/test_peer_worktree_detect_lanes.sh +138 -0
- package/scripts/test_prepush_destructive_lanes.sh +366 -0
- package/scripts/test_prior_art_prompt_lanes.sh +48 -0
- package/scripts/test_regression_guard_ci_lanes.sh +124 -0
- package/scripts/test_wizard_snippet_merge_lanes.sh +40 -0
- package/templates/predelete_check.test.sh +56 -0
- package/templates/regression_guard.sh +75 -3
- package/templates/settings.PriorArt.snippet.json +41 -12
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Regression test for predelete_check.sh — the mechanical anchor for the 2026-07-03 fail-closed fix
|
|
3
|
+
# (cross-family default-toward-PASS sweep). Reproduces each closed degrade-OPEN hole. bash-3.2 safe.
|
|
4
|
+
# Run: bash templates/predelete_check.test.sh (exit 0 = all pass)
|
|
5
|
+
set -u
|
|
6
|
+
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
7
|
+
SCRIPT="$HERE/predelete_check.sh"
|
|
8
|
+
TMP="$(mktemp -d)"
|
|
9
|
+
trap 'rm -rf "$TMP"' EXIT
|
|
10
|
+
pass=0; fail=0
|
|
11
|
+
ok(){ pass=$((pass+1)); echo " ok: $1"; }
|
|
12
|
+
no(){ fail=$((fail+1)); echo " FAIL: $1"; }
|
|
13
|
+
|
|
14
|
+
# helper: make a bare "origin" + a working clone with main
|
|
15
|
+
mkrepo(){
|
|
16
|
+
local d="$1"
|
|
17
|
+
( git init -q --bare "$d/origin.git"
|
|
18
|
+
git clone -q "$d/origin.git" "$d/wc" 2>/dev/null
|
|
19
|
+
cd "$d/wc"
|
|
20
|
+
git config user.email t@t; git config user.name t
|
|
21
|
+
echo base > a.txt; git add a.txt; git commit -qm base
|
|
22
|
+
git push -q origin HEAD:main 2>/dev/null
|
|
23
|
+
git branch -q -m main 2>/dev/null || true ) >/dev/null 2>&1
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
# 1. non-existent repo path → exit 2 (fail-closed, not 0)
|
|
27
|
+
"$SCRIPT" "$TMP/nope" >/dev/null 2>&1; rc=$?
|
|
28
|
+
[ "$rc" -eq 2 ] && ok "non-existent repo → exit 2" || no "non-existent repo exit=$rc (want 2)"
|
|
29
|
+
|
|
30
|
+
# 2. a dir that is not a git repo → exit 2
|
|
31
|
+
mkdir -p "$TMP/plain"; "$SCRIPT" "$TMP/plain" >/dev/null 2>&1; rc=$?
|
|
32
|
+
[ "$rc" -eq 2 ] && ok "non-git dir → exit 2" || no "non-git dir exit=$rc (want 2)"
|
|
33
|
+
|
|
34
|
+
# 3. unresolvable base ref → exit 2 (was: misclassified SAFE, exit 0)
|
|
35
|
+
D3="$TMP/r3"; mkrepo "$D3"
|
|
36
|
+
"$SCRIPT" "$D3/wc" origin/does-not-exist >/dev/null 2>&1; rc=$?
|
|
37
|
+
[ "$rc" -eq 2 ] && ok "bad base ref → exit 2" || no "bad base ref exit=$rc (want 2)"
|
|
38
|
+
|
|
39
|
+
# 4. a branch named 'main-backup' must NOT be substring-excluded — it must be enumerated
|
|
40
|
+
D4="$TMP/r4"; mkrepo "$D4"
|
|
41
|
+
( cd "$D4/wc"; git checkout -q -b main-backup; echo x > uniquefile.txt; git add uniquefile.txt
|
|
42
|
+
git commit -qm x; git push -q origin main-backup ) >/dev/null 2>&1
|
|
43
|
+
out=$("$SCRIPT" "$D4/wc" origin/main 2>/dev/null); rc=$?
|
|
44
|
+
echo "$out" | grep -q "main-backup" && ok "main-backup enumerated (not substring-skipped)" \
|
|
45
|
+
|| no "main-backup was NOT enumerated (substring-exclusion regression)"
|
|
46
|
+
[ "$rc" -eq 1 ] && ok "main-backup w/ unique path → REVIEW exit 1" || no "main-backup exit=$rc (want 1)"
|
|
47
|
+
|
|
48
|
+
# 5. a fully-merged branch → SAFE, exit 0
|
|
49
|
+
D5="$TMP/r5"; mkrepo "$D5"
|
|
50
|
+
( cd "$D5/wc"; git checkout -q -b merged; git push -q origin merged ) >/dev/null 2>&1
|
|
51
|
+
out=$("$SCRIPT" "$D5/wc" origin/main 2>/dev/null); rc=$?
|
|
52
|
+
{ echo "$out" | grep -q "SAFE merged" && [ "$rc" -eq 0 ]; } \
|
|
53
|
+
&& ok "merged branch → SAFE exit 0" || no "merged branch: $out (exit $rc)"
|
|
54
|
+
|
|
55
|
+
echo "---- predelete_check.test: $pass passed, $fail failed ----"
|
|
56
|
+
[ "$fail" -eq 0 ]
|
|
@@ -216,6 +216,44 @@ echo "REGRESSION_GUARD vs $BASE_REF${HEAD_REF:+ ($HEAD_REF)}"
|
|
|
216
216
|
echo "Files changed: $(echo "$CHANGED" | wc -l | tr -d ' ')"
|
|
217
217
|
echo "----"
|
|
218
218
|
|
|
219
|
+
# ── deleted-file set, asked of git DIRECTLY (2026-08-22) ────────────────────────────────────
|
|
220
|
+
# This guard used to infer "deleted" from a FAILED READ (`read_after "$f" >/dev/null || continue`
|
|
221
|
+
# plus `[ -z "$(read_after "$f")" ] && continue`). That is the absence-assertion idiom this repo
|
|
222
|
+
# keeps closing: three different states — *deleted* (intentional), *emptied to 0 bytes* (the
|
|
223
|
+
# strongest possible content loss), and *unreadable* (instrument error) — were folded into ONE
|
|
224
|
+
# branch, and the folded direction was PASS.
|
|
225
|
+
#
|
|
226
|
+
# Measured 2026-08-22 in a disposable repo, `--staged`, one variable at a time:
|
|
227
|
+
# CONTROL harmless addition to a SKILL.md rc=0 M-tier 0 ✅ PASS
|
|
228
|
+
# POSITIVE its `## Done When` section deleted rc=2 M-tier 2 ❌ BLOCK (instrument discriminates)
|
|
229
|
+
# 🟥 the SAME file truncated to 0 bytes rc=0 M-tier 0 ✅ PASS (everything lost, green)
|
|
230
|
+
# CLAUDE.md classifies a skill with no `Done When` as harness-doctor L2 M-tier; a skill with
|
|
231
|
+
# NOTHING passed.
|
|
232
|
+
#
|
|
233
|
+
# The prescription is not new — it is this file's OWN header (lines 12-19): exit 0 means PASS *or*
|
|
234
|
+
# not-checked, and the two are separated by a typed channel, never by silence. Line 263 was
|
|
235
|
+
# violating the contract printed at the top of the file it lives in.
|
|
236
|
+
#
|
|
237
|
+
# So deletion is now decided by `--diff-filter=D` — git's own answer to "was this deleted?" — and
|
|
238
|
+
# the other two states get their own verdicts. The original comment's intent is preserved exactly:
|
|
239
|
+
# a real deletion is still skipped, because a real deletion is still intentional.
|
|
240
|
+
if [ "$STAGED_MODE" -eq 1 ]; then
|
|
241
|
+
DELETED=$(git diff --cached --name-only --diff-filter=D -- "${GUARD_PATHSPEC[@]}" 2>/dev/null)
|
|
242
|
+
elif [ -z "$HEAD_REF" ]; then
|
|
243
|
+
DELETED=$(git diff --name-only --diff-filter=D "$BASE_REF" -- "${GUARD_PATHSPEC[@]}" 2>/dev/null)
|
|
244
|
+
else
|
|
245
|
+
DELETED=$(git diff --name-only --diff-filter=D "$BASE_REF" "$HEAD_REF" -- "${GUARD_PATHSPEC[@]}" 2>/dev/null)
|
|
246
|
+
fi
|
|
247
|
+
# Empty-input behaviour, asked explicitly rather than inherited: DELETED="" means "nothing was
|
|
248
|
+
# deleted", so is_deleted returns 1 for every path — no file is silently exempted by an empty set.
|
|
249
|
+
# The failure direction of a broken DELETED computation is therefore fail-CLOSED: real deletions
|
|
250
|
+
# stop matching, their after-side read fails, and they surface as loud instrument errors instead of
|
|
251
|
+
# quietly passing.
|
|
252
|
+
is_deleted() {
|
|
253
|
+
[ -n "$DELETED" ] || return 1
|
|
254
|
+
printf '%s\n' "$DELETED" | grep -qxF -- "$1"
|
|
255
|
+
}
|
|
256
|
+
|
|
219
257
|
read_before() { git show "$BASE_REF:$1" 2>/dev/null; }
|
|
220
258
|
read_after() {
|
|
221
259
|
if [ "$STAGED_MODE" -eq 1 ]; then git show ":$1" 2>/dev/null # staged blob from the index
|
|
@@ -260,9 +298,43 @@ resolve_tombstone_target() {
|
|
|
260
298
|
}
|
|
261
299
|
|
|
262
300
|
for f in $CHANGED; do
|
|
263
|
-
#
|
|
264
|
-
|
|
265
|
-
|
|
301
|
+
# ① Deletion is intentional, not regression — and it is now git that says so (see is_deleted).
|
|
302
|
+
if is_deleted "$f"; then
|
|
303
|
+
verbose "skipped '$f': git reports it DELETED in this diff — intentional removal, not content loss"
|
|
304
|
+
continue
|
|
305
|
+
fi
|
|
306
|
+
|
|
307
|
+
after_probe=$(read_after "$f"); read_rc=$?
|
|
308
|
+
|
|
309
|
+
# ② Not deleted, yet unreadable → the instrument failed on this file. NOT a pass.
|
|
310
|
+
if [ "$read_rc" -ne 0 ]; then
|
|
311
|
+
echo
|
|
312
|
+
echo "=== $f ==="
|
|
313
|
+
echo " ❌ M-TIER instrument error: file is in the diff, git does NOT report it deleted, and its"
|
|
314
|
+
echo " after-side blob could not be read (rc=$read_rc). NOT CHECKED — an unchecked file"
|
|
315
|
+
echo " is not a passing file."
|
|
316
|
+
M_TIER=$((M_TIER + 1))
|
|
317
|
+
continue
|
|
318
|
+
fi
|
|
319
|
+
|
|
320
|
+
# ③ Not deleted, readable, and EMPTY. Split by direction so an over-block is not traded for the
|
|
321
|
+
# fail-open: content that existed and is now gone is the regression this guard is for; a file
|
|
322
|
+
# that was already empty is suspicious but is not a *loss*, so it warns instead of blocking.
|
|
323
|
+
if [ -z "$after_probe" ]; then
|
|
324
|
+
echo
|
|
325
|
+
echo "=== $f ==="
|
|
326
|
+
if [ -n "$(read_before "$f")" ]; then
|
|
327
|
+
echo " ❌ M-TIER emptied: after-side content is 0 bytes while the before side had content."
|
|
328
|
+
echo " Total content loss is the strongest regression this guard exists to catch."
|
|
329
|
+
echo " If removal is the intent, DELETE the file — a real deletion is skipped."
|
|
330
|
+
M_TIER=$((M_TIER + 1))
|
|
331
|
+
else
|
|
332
|
+
echo " ⚠️ S-TIER empty file in a gated path (before side was empty/absent too) — not content"
|
|
333
|
+
echo " loss, so it does not block, but an empty gated asset is rarely intended."
|
|
334
|
+
S_TIER=$((S_TIER + 1))
|
|
335
|
+
fi
|
|
336
|
+
continue
|
|
337
|
+
fi
|
|
266
338
|
|
|
267
339
|
echo
|
|
268
340
|
echo "=== $f ==="
|
|
@@ -1,15 +1,44 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
"_README": [
|
|
3
|
+
"prior-art 프롬프트 훅 스니펫 — install-wizard 가 사용자 로컬 .claude/settings.json 에 머지하는",
|
|
4
|
+
"tracked SOURCE 다. 이 레포의 .claude/settings*.json 은 전부 gitignored 라 **훅 등록 자체를",
|
|
5
|
+
"tracked 로 둘 수 없다.** 머지 단계가 없으면 훅은 돌지 않는다 —",
|
|
6
|
+
"**스크립트를 출하하는 것과 배선하는 것은 같은 명제가 아니다.**",
|
|
7
|
+
"",
|
|
8
|
+
"🟥 왜 이 래퍼가 뒤늦게 생겼나 (2026-08-22 실측, 컨트롤 동반):",
|
|
9
|
+
" 이 파일은 형제 스니펫 넷과 달리 `project_settings_json` 래퍼 **없이** 출하되고 있었다.",
|
|
10
|
+
" install-wizard 의 실제 머지 코드(install-wizard/SKILL_detail.md:642-645)는 그 키가 없으면",
|
|
11
|
+
" print(\"SKIP (no project_settings_json)\", ...); continue",
|
|
12
|
+
" 로 **조용히 건너뛴다.** 즉 이 훅은 「아직 안 돌렸다」가 아니라",
|
|
13
|
+
" **「install-wizard 를 돌려도 항상 스킵돼서 한 번도 등록된 적이 없다」** 였다.",
|
|
14
|
+
" 전수 실측: Compaction·FieldCanon·PreToolUse·SessionStart = 래퍼 O · PriorArt = 혼자 부재.",
|
|
15
|
+
" 머지 코드를 그대로 복사해 실행한 수리 전/후 대조로 SKIP→등록 전이를 확인했다.",
|
|
16
|
+
" ⇒ built_but_not_wired 보다 나쁘다. **설치기가 자기 출하물을 조용히 건너뛰는** 형태다.",
|
|
17
|
+
" 회귀 앵커: scripts/test_wizard_snippet_merge_lanes.sh 의 전수 래퍼 검사(이 수리와 같이 들어갔다).",
|
|
18
|
+
"",
|
|
19
|
+
"무엇을 하나: 새 메커니즘을 짓기 직전에 «책장 먼저, 없으면 도서관» 을 띄운다.",
|
|
20
|
+
"정체성 ④(프런티어 답습)의 **빌드 시점 격발 표면**이다.",
|
|
21
|
+
"🟥 명시된 잔여: matcher 가 `Write|Bash` 라도 **auto-mode 세션이 heredoc 으로 파일을 만드는",
|
|
22
|
+
"경로는 Bash 로 잡히지만**, 그 안에서 실제로 새 메커니즘을 짓는지까지는 훅이 모른다.",
|
|
23
|
+
"표면화까지가 훅의 몫이고 판정은 사람/세션이 한다 — 판정하는 훅을 만들면",
|
|
24
|
+
"§Mechanization Boundary 가 금하는 «결론을 단언하는 체크»가 된다.",
|
|
25
|
+
"",
|
|
26
|
+
"PRIVATE PATH 없음 → .claude/settings.json(프로젝트 로컬)에 속한다.",
|
|
27
|
+
"머지하되 덮어쓰지 마라: 기존 PreToolUse 엔트리를 보존하고 스크립트 이름을 키로 FH 것만 교체."
|
|
28
|
+
],
|
|
29
|
+
"project_settings_json": {
|
|
30
|
+
"hooks": {
|
|
31
|
+
"PreToolUse": [
|
|
32
|
+
{
|
|
33
|
+
"matcher": "Write|Bash",
|
|
34
|
+
"hooks": [
|
|
35
|
+
{
|
|
36
|
+
"type": "command",
|
|
37
|
+
"command": "bash \"$CLAUDE_PROJECT_DIR/scripts/prior_art_prompt.sh\""
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
14
43
|
}
|
|
15
44
|
}
|