@chrono-meta/fh-gate 2.8.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.
Files changed (38) hide show
  1. package/.claude/rules/fh_4axis_gate.md +33 -5
  2. package/.claude-plugin/marketplace.json +2 -2
  3. package/CLAUDE.md +47 -12
  4. package/README.ja.md +39 -31
  5. package/README.ko.md +38 -30
  6. package/README.md +41 -35
  7. package/README.zh.md +36 -30
  8. package/docs/ETHOS.md +13 -8
  9. package/docs/GATE_DAY.md +235 -0
  10. package/docs/OUTPUT_EVIDENCE.md +13 -2
  11. package/docs/codex-compat.md +10 -2
  12. package/knowledge/shared/harness-core/agents_md_runtime_details.md +10 -3
  13. package/knowledge/shared/harness-core/fh_three_layer_canon.md +20 -2
  14. package/knowledge/shared/harness-core/field_verdict_crossfamily_gate.md +23 -5
  15. package/knowledge/shared/harness-core/harness_incubator_doctrine.md +6 -1
  16. package/knowledge/shared/harness-core/ship_readiness_gate.md +2 -2
  17. package/knowledge/shared/learnings/subagent_invocations_log.yaml +31 -0
  18. package/knowledge/shared/rules/multi_session_close_protocol.md +8 -1
  19. package/package.json +10 -2
  20. package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
  21. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  22. package/plugins/fh-meta/CHANGELOG.md +70 -0
  23. package/plugins/fh-meta/skills/cross-ecosystem-synergy-detection/SKILL.md +93 -3
  24. package/scripts/chamber_candidate_collect.sh +71 -13
  25. package/scripts/mapped_tracks.sh +113 -0
  26. package/scripts/package_coverage_check.sh +54 -0
  27. package/scripts/prior_art_prompt.sh +49 -2
  28. package/scripts/selfcheck.sh +30 -2
  29. package/scripts/session_close_check.sh +56 -3
  30. package/scripts/test_chamber_sig_lanes.sh +151 -0
  31. package/scripts/test_leak_scan_control_lanes.sh +163 -0
  32. package/scripts/test_mapped_tracks_lanes.sh +162 -0
  33. package/scripts/test_peer_worktree_detect_lanes.sh +138 -0
  34. package/scripts/test_prepush_destructive_lanes.sh +366 -0
  35. package/scripts/test_prior_art_prompt_lanes.sh +48 -0
  36. package/scripts/test_regression_guard_ci_lanes.sh +124 -0
  37. package/templates/predelete_check.test.sh +56 -0
  38. package/templates/regression_guard.sh +75 -3
@@ -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
- # Skip if file deleted (deletion is intentional, not regression)
264
- read_after "$f" > /dev/null 2>&1 || continue
265
- [ -z "$(read_after "$f")" ] && continue
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 ==="