@chrono-meta/fh-gate 2.15.1 → 3.1.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/regression/probes_live.yaml +137 -0
- package/.claude/rules/.residency-patterns.defaults +7 -0
- package/.claude/rules/fh_4axis_gate.md +88 -1
- package/.claude-plugin/marketplace.json +8 -2
- package/AGENTS.md +27 -0
- package/CATALOG.md +17 -0
- package/CLAUDE.md +13 -3
- package/README.ja.md +51 -7
- package/README.ko.md +48 -7
- package/README.md +43 -6
- package/README.zh.md +45 -8
- package/docs/STANDARDS_ALIGNMENT.md +61 -0
- package/docs/USER_GUIDE.md +3 -0
- package/docs/USE_CASES.md +50 -0
- package/docs/model_tier_expectations.md +60 -0
- package/knowledge/shared/harness-core/fh_three_layer_canon.md +77 -10
- package/knowledge/shared/harness-core/field_verdict_crossfamily_gate.md +18 -0
- package/knowledge/shared/harness-core/harness_incubator_doctrine.md +9 -0
- package/knowledge/shared/harness-core/iso_ai_standards_crosswalk.md +139 -0
- package/knowledge/shared/harness-core/measurement-integrity-checklist.md +35 -1
- package/knowledge/shared/harness-core/ship_readiness_gate.md +19 -2
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +489 -3
- package/package.json +48 -2
- package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-commons/skills/preprep/README.md +4 -1
- package/plugins/fh-commons/skills/preprep/SKILL.md +99 -3
- package/plugins/fh-commons/skills/preprep/diagram_from_json.py +154 -0
- package/plugins/fh-commons/skills/preprep/fixtures/fixture_R3_negative.pptx +0 -0
- package/plugins/fh-commons/skills/preprep/fixtures/fixture_R3_positive.pptx +0 -0
- package/plugins/fh-commons/skills/preprep/fixtures/mk_slide_fixtures.py +179 -0
- package/plugins/fh-commons/skills/preprep/interslide_deps.py +98 -9
- package/plugins/fh-commons/skills/preprep/lane_adjacent_dup.py +4 -1
- package/plugins/fh-commons/skills/preprep/lane_diagram.py +95 -0
- package/plugins/fh-commons/skills/preprep/lane_geometry.py +181 -0
- package/plugins/fh-commons/skills/preprep/lane_promise.py +4 -1
- package/plugins/fh-commons/skills/preprep/lane_slide_refs.py +134 -0
- package/plugins/fh-commons/skills/preprep/lane_slide_relations.py +300 -0
- package/plugins/fh-commons/skills/preprep/preprep.py +129 -8
- package/plugins/fh-commons/skills/preprep/preprep_wire.py +210 -0
- package/plugins/fh-commons/skills/preprep/presentation_checklist.md +4 -0
- package/plugins/fh-commons/skills/preprep/surfaces.example.yaml +18 -0
- package/plugins/fh-commons/skills/preprep/test_preprep_lanes_rp.py +184 -0
- package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/CHANGELOG.md +67 -0
- package/plugins/fh-meta/skills/auto-decorrelation/SKILL.md +87 -2
- package/plugins/fh-meta/skills/frontier-digest/SKILL.md +2 -2
- package/plugins/fh-meta/skills/frontier-digest/SKILL_detail.md +25 -5
- package/plugins/fh-meta/skills/hub-cc-pr-reviewer/SKILL.md +11 -0
- package/plugins/fh-meta/skills/hub-cc-pr-reviewer/SKILL_detail.md +3 -0
- package/plugins/fh-qp/.claude-plugin/plugin.json +22 -0
- package/plugins/fh-qp/README.md +71 -0
- package/plugins/fh-qp/fixtures/evidence_known_clean.txt +3 -0
- package/plugins/fh-qp/fixtures/evidence_known_dirty.txt +6 -0
- package/plugins/fh-qp/fixtures/reach_known_partial.tsv +4 -0
- package/plugins/fh-qp/fixtures/reach_known_reached.tsv +4 -0
- package/plugins/fh-qp/fixtures/reach_known_wall.tsv +3 -0
- package/plugins/fh-qp/fixtures/verdicts_known_bad_branch.tsv +2 -0
- package/plugins/fh-qp/fixtures/verdicts_known_bad_vacuous_machine.tsv +2 -0
- package/plugins/fh-qp/fixtures/verdicts_known_good.tsv +4 -0
- package/plugins/fh-qp/fixtures/verdicts_verify_only.tsv +3 -0
- package/plugins/fh-qp/qp_profile.example.yaml +29 -0
- package/plugins/fh-qp/scripts/qp_tools.sh +216 -0
- package/plugins/fh-qp/skills/qp/SKILL.md +65 -0
- package/plugins/fh-qp/skills/qp-plan/SKILL.md +42 -0
- package/plugins/fh-qp/skills/qp-regress/SKILL.md +45 -0
- package/plugins/fh-qp/skills/qp-run/SKILL.md +49 -0
- package/scripts/backtick_guard.sh +194 -0
- package/scripts/chamber_run.sh +14 -5
- package/scripts/com.forge-harness.live-eval.plist +84 -0
- package/scripts/compaction_probe.sh +9 -35
- package/scripts/context_continuity_score.sh +49 -7
- package/scripts/directional_diff_gate.sh +14 -2
- package/scripts/fh-gate.sh +3 -3
- package/scripts/files_manifest_shipping_check.sh +19 -0
- package/scripts/frontier_digest_autopilot.sh +4 -1
- package/scripts/gate_pathspec_check.sh +1 -1
- package/scripts/map_postprocess.py +90 -0
- package/scripts/outbound_query_guard.sh +131 -0
- package/scripts/outbound_query_hook.sh +373 -0
- package/scripts/package_coverage_check.sh +79 -18
- package/scripts/pipe_verdict_guard.sh +41 -1
- package/scripts/probe_live_eval.sh +240 -0
- package/scripts/probe_live_eval_lib.py +579 -0
- package/scripts/proposal_hook.sh +192 -0
- package/scripts/public_surface_scan_files.sh +11 -2
- package/scripts/push_zone_check.sh +78 -0
- package/scripts/residency_closure_scan.py +252 -0
- package/scripts/revert_probe.sh +250 -0
- package/scripts/selfcheck.sh +106 -3
- package/scripts/session_close_check.sh +100 -0
- package/scripts/sim_isolated_run.sh +195 -9
- package/scripts/test_action_yml_lanes.sh +97 -0
- package/scripts/test_backtick_guard_lanes.sh +115 -0
- package/scripts/test_degrade_scan_shell_probes.sh +7 -7
- package/scripts/test_fh_qp_lanes.sh +105 -0
- package/scripts/test_files_manifest_shipping_lanes.sh +5 -5
- package/scripts/test_gate_two_verdicts_lanes.sh +139 -0
- package/scripts/test_heavy_classifier_lanes.sh +1 -1
- package/scripts/test_lane_runner_lanes.sh +59 -33
- package/scripts/test_map_postprocess_lanes.sh +143 -0
- package/scripts/test_mapped_tracks_lanes.sh +1 -1
- package/scripts/test_marker_affected_lanes.sh +93 -0
- package/scripts/test_marker_crossfamily_lanes.sh +90 -6
- package/scripts/test_marker_oracle_lanes.sh +136 -0
- package/scripts/test_marker_soul_check_lanes.sh +24 -0
- package/scripts/test_node_check_lanes.sh +34 -34
- package/scripts/test_outbound_query_hook_lanes.sh +433 -0
- package/scripts/test_outbound_query_lanes.sh +87 -0
- package/scripts/test_package_coverage_lanes.sh +53 -27
- package/scripts/test_pipe_verdict_guard_lanes.sh +31 -5
- package/scripts/test_precommit_pointer_index_lanes.sh +33 -0
- package/scripts/test_preprep_diagram_lanes.sh +87 -0
- package/scripts/test_preprep_drift_anchor.sh +16 -7
- package/scripts/test_preprep_drift_anchor_lanes.sh +23 -0
- package/scripts/test_preprep_slide_refs_lanes.sh +169 -0
- package/scripts/test_probe_live_eval_lanes.sh +437 -0
- package/scripts/test_proposal_hook_lanes.sh +57 -0
- package/scripts/test_push_zone_lanes.sh +304 -0
- package/scripts/test_residency_closure_lanes.sh +70 -0
- package/scripts/test_revert_probe_lanes.sh +146 -0
- package/scripts/test_session_close_lanes.sh +3 -5
- package/scripts/test_sim_isolated_run_lanes.sh +136 -0
- package/scripts/test_utterance_intake_lanes.sh +414 -0
- package/scripts/test_worktree_reclaim_lanes.sh +70 -0
- package/scripts/transcript_utterances.py +222 -0
- package/scripts/utterance_intake.sh +424 -0
- package/scripts/utterance_landing_check.sh +2 -2
- package/scripts/validate_yaml.sh +27 -0
- package/scripts/worktree_reclaim.sh +95 -0
- package/templates/.git-hooks/pre-commit +380 -5
- package/templates/.git-hooks/pre-push +91 -0
- package/templates/RED_TEAM_REPORT.md +49 -0
- package/templates/settings.PreToolUse.snippet.json +101 -1
- package/plugins/fh-commons/README.md +0 -38
|
@@ -36,7 +36,9 @@ trap 'rm -rf "$TMP"' EXIT
|
|
|
36
36
|
|
|
37
37
|
pass=0; fail=0; skipped=0
|
|
38
38
|
ok() { printf ' ✅ %s\n' "$1"; pass=$((pass+1)); }
|
|
39
|
-
|
|
39
|
+
# $2 (optional) = the actual stdout/stderr/rc this case caught — printed so a red lane in CI is
|
|
40
|
+
# diagnosable without re-running it by hand. Truncated/flattened like the node-check lanes' bad().
|
|
41
|
+
bad() { printf ' ❌ %s\n' "$1"; [ -n "${2:-}" ] && printf ' got: %s\n' "$(printf '%s' "$2" | tr '\n' '|' | cut -c1-220)"; fail=$((fail+1)); }
|
|
40
42
|
# A skip is COUNTED and reported. An uncounted skip is how "could not run" becomes indistinguishable
|
|
41
43
|
# from "ran and passed" in the summary line — measured on this very suite in review round 2, where a
|
|
42
44
|
# broken git produced "7 passed, 0 failed" and exit 0 while the real-worktree claim went untested.
|
|
@@ -70,23 +72,30 @@ make_tree() { # make_tree <dir> <git_shape> <cover_target:yes|no> [omit_manifest
|
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
run_tree() { bash "$1/scripts/package_coverage_check.sh" 2>&1; }
|
|
73
|
-
rc_tree()
|
|
75
|
+
# 🟥 no more rc_tree(): it used to re-run the subject a SECOND time just to get $? (`out=$(run_tree
|
|
76
|
+
# ...); rc=$(rc_tree ...)` — two executions of the same script, so a nondeterministic subject could
|
|
77
|
+
# report an (out, rc) pair that never co-occurred in either real run). Every call site below now
|
|
78
|
+
# does `out=$(run_tree ...); rc=$?` — one execution, $? read off THAT command substitution.
|
|
74
79
|
|
|
75
80
|
# Assert a POSITIVE outcome, never merely the absence of the SKIP line. Cross-family review caught
|
|
76
81
|
# the first draft here: it checked only that `SKIP package-coverage` was missing, so a checker that
|
|
77
82
|
# exited 1 on every worktree — the opposite defect, equally broken — would have passed the lane that
|
|
78
83
|
# exists to prove the worktree path works. "Did not say the wrong thing" is not "did the right
|
|
79
84
|
# thing"; a lane phrased as a negative can only ever fail one way.
|
|
85
|
+
# Both functions below stash their single execution's output/rc in _LAST_OUT/_LAST_RC (not `local`,
|
|
86
|
+
# deliberately — the caller reads them straight off the one run instead of re-invoking the subject a
|
|
87
|
+
# second time just to build a diagnostic string, which would be the same two-executions-for-one-
|
|
88
|
+
# verdict shape the L3–L7 dual-execution fix below removes).
|
|
80
89
|
ran_clean() { # ran_clean <dir> -> 0 iff the check actually ran AND reported a clean scan
|
|
81
|
-
local d="$1"
|
|
82
|
-
|
|
83
|
-
[ "$
|
|
84
|
-
&& ! printf '%s' "$
|
|
90
|
+
local d="$1"
|
|
91
|
+
_LAST_OUT=$(bash "$d/scripts/package_coverage_check.sh" 2>&1); _LAST_RC=$?
|
|
92
|
+
[ "$_LAST_RC" -eq 0 ] && printf '%s' "$_LAST_OUT" | grep -q 'PASS package-coverage' \
|
|
93
|
+
&& ! printf '%s' "$_LAST_OUT" | grep -q 'SKIP package-coverage'
|
|
85
94
|
}
|
|
86
95
|
caught_defect() { # caught_defect <dir> -> 0 iff the check FOUND the planted omission
|
|
87
|
-
local d="$1"
|
|
88
|
-
|
|
89
|
-
[ "$
|
|
96
|
+
local d="$1"
|
|
97
|
+
_LAST_OUT=$(bash "$d/scripts/package_coverage_check.sh" 2>&1); _LAST_RC=$?
|
|
98
|
+
[ "$_LAST_RC" -eq 1 ] && printf '%s' "$_LAST_OUT" | grep -q 'scripts/helper.sh'
|
|
90
99
|
}
|
|
91
100
|
# A CLEAN LANE ALONE PROVES NOTHING ABOUT THE WORKTREE PATH. Cross-family review round 2 demonstrated
|
|
92
101
|
# this by EXECUTION: it replaced the subject with a mutant that printed `PASS package-coverage`
|
|
@@ -99,11 +108,11 @@ wt_pair() { # wt_pair <label> <dir> <git_shape>
|
|
|
99
108
|
local label="$1" d="$2" shape="$3"
|
|
100
109
|
make_tree "$d" "$shape" yes
|
|
101
110
|
if ! ran_clean "$d"; then
|
|
102
|
-
bad "$label — clean leg: did not run to a PASS (
|
|
111
|
+
bad "$label — clean leg: did not run to a PASS (rc=$_LAST_RC)" "$_LAST_OUT"; return
|
|
103
112
|
fi
|
|
104
113
|
make_tree "$d" "$shape" no # identical tree, files[] no longer covers the referenced path
|
|
105
114
|
if ! caught_defect "$d"; then
|
|
106
|
-
bad "$label — DEFECT leg: planted omission not caught, so the clean PASS proved nothing"; return
|
|
115
|
+
bad "$label — DEFECT leg: planted omission not caught, so the clean PASS proved nothing (rc=$_LAST_RC)" "$_LAST_OUT"; return
|
|
107
116
|
fi
|
|
108
117
|
ok "$label"
|
|
109
118
|
}
|
|
@@ -171,15 +180,20 @@ else
|
|
|
171
180
|
esac
|
|
172
181
|
}
|
|
173
182
|
mkdir -p "$TMP/emptytpl"
|
|
174
|
-
|
|
183
|
+
# The whole fixture-build chain runs as ONE group so its combined stdout+stderr lands in one
|
|
184
|
+
# variable instead of /dev/null — a failed build used to report only "could not be built", with
|
|
185
|
+
# no way to tell which of the four steps broke or why.
|
|
186
|
+
_l1b_ok=1
|
|
187
|
+
_l1b_out="$( { git "${GIT_ISO[@]}" -C "$TMP/realrepo" init -q --template="$TMP/emptytpl" . \
|
|
175
188
|
&& _gitdir_ok \
|
|
176
|
-
&& git "${GIT_ISO[@]}" -C "$TMP/realrepo" commit -q --allow-empty -m init
|
|
177
|
-
&& git "${GIT_ISO[@]}" -C "$TMP/realrepo" worktree add -q --detach "$TMP/realwt"
|
|
178
|
-
&& [ -f "$TMP/realwt/.git" ];
|
|
189
|
+
&& git "${GIT_ISO[@]}" -C "$TMP/realrepo" commit -q --allow-empty -m init \
|
|
190
|
+
&& git "${GIT_ISO[@]}" -C "$TMP/realrepo" worktree add -q --detach "$TMP/realwt" \
|
|
191
|
+
&& [ -f "$TMP/realwt/.git" ]; } 2>&1 )" || _l1b_ok=0
|
|
192
|
+
if [ "$_l1b_ok" -eq 1 ]; then
|
|
179
193
|
wt_pair "L1-b real \`git worktree add\` (.git is a genuine gitdir pointer): scans for real" \
|
|
180
194
|
"$TMP/realwt" none # the REAL .git file is already in place; do not overwrite it
|
|
181
195
|
else
|
|
182
|
-
bad "L1-b git IS installed but the real-worktree fixture could not be built — the claim was testable and was not tested"
|
|
196
|
+
bad "L1-b git IS installed but the real-worktree fixture could not be built — the claim was testable and was not tested" "$_l1b_out"
|
|
183
197
|
fi
|
|
184
198
|
fi
|
|
185
199
|
|
|
@@ -190,11 +204,11 @@ wt_pair "L2 ordinary checkout (.git is a DIR): scans for real — both legs" "$T
|
|
|
190
204
|
# The widening from -d to -e must not cost the legitimate skip. An installed npm package has no
|
|
191
205
|
# .git of either kind; making it fail there would fire on every consumer running `npm test`.
|
|
192
206
|
make_tree "$TMP/l3" none yes
|
|
193
|
-
out=$(run_tree "$TMP/l3"); rc
|
|
207
|
+
out=$(run_tree "$TMP/l3"); rc=$?
|
|
194
208
|
if printf '%s' "$out" | grep -q 'SKIP package-coverage' && [ "$rc" -eq 0 ]; then
|
|
195
209
|
ok "L3 package mode (no .git): still skips, exit 0"
|
|
196
210
|
else
|
|
197
|
-
bad "L3 package mode (no .git): expected SKIP+0, got rc=$rc
|
|
211
|
+
bad "L3 package mode (no .git): expected SKIP+0, got rc=$rc" "$out"
|
|
198
212
|
fi
|
|
199
213
|
|
|
200
214
|
# ── L4 · a checkout with no manifest is UNMEASURED, not clean ────────────────────────
|
|
@@ -203,48 +217,60 @@ fi
|
|
|
203
217
|
# file list cannot be read, which is "cannot measure", not "nothing to measure". An anchor that
|
|
204
218
|
# pins the wrong direction is worse than no anchor — it makes the hole look deliberate.
|
|
205
219
|
make_tree "$TMP/l4" dir yes omit
|
|
206
|
-
out=$(run_tree "$TMP/l4"); rc
|
|
220
|
+
out=$(run_tree "$TMP/l4"); rc=$?
|
|
207
221
|
if [ "$rc" -eq 1 ] && printf '%s' "$out" | grep -q 'UNMEASURED, not clean'; then
|
|
208
222
|
ok "L4 .git present but no package.json: FAILS as unmeasured, not a clean skip"
|
|
209
223
|
else
|
|
210
|
-
bad "L4 no package.json: expected exit 1 (unmeasured), got rc=$rc
|
|
224
|
+
bad "L4 no package.json: expected exit 1 (unmeasured), got rc=$rc" "$out"
|
|
211
225
|
fi
|
|
212
226
|
|
|
213
227
|
# ── L5/L6 · KNOWN PAIR ───────────────────────────────────────────────────────────────
|
|
214
228
|
# Same tree twice; the ONLY difference is whether files[] covers the referenced path.
|
|
215
229
|
# L5 known-POSITIVE: referenced, exists, not shipped -> must FAIL.
|
|
216
230
|
make_tree "$TMP/l5" dir no
|
|
217
|
-
out=$(run_tree "$TMP/l5"); rc
|
|
231
|
+
out=$(run_tree "$TMP/l5"); rc=$?
|
|
218
232
|
if [ "$rc" -eq 1 ] && printf '%s' "$out" | grep -q 'scripts/helper.sh'; then
|
|
219
233
|
ok "L5 known-positive (referenced ∧ exists ∧ ¬shipped): FAIL, names the path"
|
|
220
234
|
else
|
|
221
|
-
bad "L5 known-positive: expected exit 1 naming scripts/helper.sh, got rc=$rc"
|
|
235
|
+
bad "L5 known-positive: expected exit 1 naming scripts/helper.sh, got rc=$rc" "$out"
|
|
222
236
|
fi
|
|
223
237
|
|
|
224
238
|
# L6 known-NEGATIVE: identical, but the path is in files[] -> must PASS.
|
|
225
239
|
make_tree "$TMP/l6" dir yes
|
|
226
|
-
out=$(run_tree "$TMP/l6"); rc
|
|
240
|
+
out=$(run_tree "$TMP/l6"); rc=$?
|
|
227
241
|
if [ "$rc" -eq 0 ] && printf '%s' "$out" | grep -q 'PASS package-coverage'; then
|
|
228
242
|
ok "L6 known-negative (same tree, path shipped): PASS"
|
|
229
243
|
else
|
|
230
|
-
bad "L6 known-negative: expected exit 0 PASS, got rc=$rc"
|
|
244
|
+
bad "L6 known-negative: expected exit 0 PASS, got rc=$rc" "$out"
|
|
231
245
|
fi
|
|
232
246
|
|
|
233
247
|
# ── L7 · the impossible-zero guard is not reachable by an empty files[] ──────────────
|
|
234
248
|
# A manifest with no shipped docs must report the extractor as broken, not print a pass.
|
|
235
249
|
mkdir -p "$TMP/l7/scripts"; cp "$SUBJECT" "$TMP/l7/scripts/"; mkdir -p "$TMP/l7/.git"
|
|
236
250
|
printf '{"files":[]}\n' > "$TMP/l7/package.json"
|
|
237
|
-
out=$(run_tree "$TMP/l7"); rc
|
|
251
|
+
out=$(run_tree "$TMP/l7"); rc=$?
|
|
238
252
|
if [ "$rc" -eq 1 ] && printf '%s' "$out" | grep -q 'the check broke, it did not pass'; then
|
|
239
253
|
ok "L7 zero shipped docs: reported as broken extractor, not as a pass"
|
|
240
254
|
else
|
|
241
|
-
bad "L7 zero shipped docs: expected exit 1 'check broke', got rc=$rc"
|
|
255
|
+
bad "L7 zero shipped docs: expected exit 1 'check broke', got rc=$rc" "$out"
|
|
242
256
|
fi
|
|
243
257
|
|
|
244
258
|
echo
|
|
245
259
|
if [ "$skipped" -gt 0 ]; then
|
|
246
260
|
echo "package-coverage lanes: ${pass} passed, ${fail} failed, ${skipped} UNCALIBRATED (not verified here)"
|
|
247
261
|
else
|
|
248
|
-
|
|
262
|
+
|
|
263
|
+
# ── lane 7: tarball oracle JSON without files[] → text-listing fallback (CI 2026-09-04, v3.0.0) ──
|
|
264
|
+
# Known-pair: stub npm returns JSON lacking files[] but delegates the text `pack --dry-run` to the
|
|
265
|
+
# real npm → PASS (7a). Stub returns the same JSON and an EMPTY text listing → ORACLE_UNAVAILABLE rc=2 (7b).
|
|
266
|
+
cd "$REPO_ROOT" || exit 10; _REAL_NPM=$(command -v npm); _ST=$(mktemp -d) # earlier lanes cd into fixtures — the subject reads .git/package.json from cwd
|
|
267
|
+
printf '#!/bin/bash\nif [ "$*" = "pack --dry-run --json" ]; then echo "[{\\"id\\":\\"x\\"}]"; else exec %s "$@"; fi\n' "$_REAL_NPM" > "$_ST/npm"; chmod +x "$_ST/npm"
|
|
268
|
+
o=$(PATH="$_ST:$PATH" bash "$SUBJECT" --vs-tarball 2>&1); rc=$?
|
|
269
|
+
if [ "$rc" = 0 ] && printf '%s' "$o" | grep -q "^PASS package-coverage"; then echo " ✅ lane 7a: JSON without files[] → text listing fallback PASSes"; pass=$((pass+1)); else echo " ❌ lane 7a: fallback did not PASS (rc=$rc)"; printf "%s\n" "$o" | grep -E "UNAVAILABLE|head:" | cut -c1-220; fail=$((fail+1)); fi
|
|
270
|
+
printf '#!/bin/bash\nif [ "$*" = "pack --dry-run --json" ]; then echo "[{\\"id\\":\\"x\\"}]"; elif [ "$*" = "pack --dry-run" ]; then exit 0; else exec %s "$@"; fi\n' "$_REAL_NPM" > "$_ST/npm"
|
|
271
|
+
o=$(PATH="$_ST:$PATH" bash "$SUBJECT" --vs-tarball 2>&1); rc=$?
|
|
272
|
+
if [ "$rc" = 2 ] && printf '%s' "$o" | grep -q "UNAVAILABLE"; then echo " ✅ lane 7b: JSON without files[] AND empty text listing → UNAVAILABLE rc=2 (fail-closed)"; pass=$((pass+1)); else echo " ❌ lane 7b: expected rc=2 UNAVAILABLE, got rc=$rc"; fail=$((fail+1)); fi
|
|
273
|
+
rm -rf "$_ST"
|
|
274
|
+
echo "package-coverage lanes: ${pass} passed, ${fail} failed"
|
|
249
275
|
fi
|
|
250
276
|
[ "$fail" -eq 0 ] || exit 1
|
|
@@ -45,9 +45,9 @@ expect() {
|
|
|
45
45
|
echo "[pipe-verdict-guard] known pairs"
|
|
46
46
|
echo "-- R1: PIPESTATUS under zsh (deterministic) --"
|
|
47
47
|
# The exact shape emitted 6× in this project, including twice on 2026-07-31.
|
|
48
|
-
expect "R1 the measured shape" HIT 'bash x.sh | tail -5; echo "exit=${PIPESTATUS[0]}"'
|
|
49
|
-
expect "R1 any index" HIT 'a | b; rc=${PIPESTATUS[1]}'
|
|
50
|
-
expect "R1 inside a larger command" HIT 'cd /r && npm t | tail; E=${PIPESTATUS[0]}; echo $E'
|
|
48
|
+
expect "R1 the measured shape" HIT 'bash x.sh | tail -5; echo "exit=${PIPESTATUS[0]}"' # portability-noqa: fixture string fed to pipe_verdict_guard.sh for static analysis, never executed by this shell
|
|
49
|
+
expect "R1 any index" HIT 'a | b; rc=${PIPESTATUS[1]}' # portability-noqa: same as above
|
|
50
|
+
expect "R1 inside a larger command" HIT 'cd /r && npm t | tail; E=${PIPESTATUS[0]}; echo $E' # portability-noqa: same as above
|
|
51
51
|
# zsh's own spelling is correct here and must never be flagged.
|
|
52
52
|
expect "R1 zsh spelling is CLEAN" CLEAN 'a | b; rc=$pipestatus[1]'
|
|
53
53
|
|
|
@@ -56,6 +56,22 @@ expect "R2 tail then \$?" HIT 'bash gate.sh | tail -20; echo
|
|
|
56
56
|
expect "R2 head then \$?" HIT 'make test | head -40; rc=$?'
|
|
57
57
|
expect "R2 cat then \$?" HIT 'run.sh | cat; if [ $? -ne 0 ]; then echo bad; fi'
|
|
58
58
|
|
|
59
|
+
echo "-- R2 «바로 다음 문장» 좁힘 (2026-09-06, 운영자 실사용 신고) --"
|
|
60
|
+
# 🟥 종전 꼬리 `[;&].*\$\?` 는 파이프 뒤 **어디든** `$?` 가 있으면 잡았다 — 그게 다른
|
|
61
|
+
# 명령의 것이어도. 한 호출에 문장이 여럿인 실사용 커맨드는 거의 항상 걸렸고, 그건
|
|
62
|
+
# «100% FP 는 정작 중요한 한 건을 무시하도록 훈련시킨다» 는 이 훅 자신의 경고 그대로다.
|
|
63
|
+
expect "R2 좁힘: 사이에 다른 명령이 끼면 그 \$? 는 그 명령의 것" CLEAN \
|
|
64
|
+
'out=$(a 2>&1); rc=$?; echo "$out" | tail -1; b; echo $?'
|
|
65
|
+
expect "R2 좁힘: 두 문장 뒤의 \$? 도 아니다" CLEAN \
|
|
66
|
+
'pytest | tail -2; echo done; echo $?'
|
|
67
|
+
expect "R2 좁힘: 파이프 앞에서 잡은 rc 는 원래 정상" CLEAN \
|
|
68
|
+
'out=$(pytest 2>&1); rc=$?; echo "$out" | tail -2 | head -1; echo "rc=$rc"'
|
|
69
|
+
# 짝 — 좁히다가 진짜 결함을 죽이면 그게 과교정이다
|
|
70
|
+
expect "R2 좁힘 짝: 직후 문장의 \$? 는 여전히 잡는다" HIT \
|
|
71
|
+
'pytest 2>&1 | tail -2; echo "rc=$?"'
|
|
72
|
+
expect "R2 좁힘 짝: && 로 이어진 직후 읽기도 잡는다" HIT \
|
|
73
|
+
'make test | head -5 && echo $?'
|
|
74
|
+
|
|
59
75
|
echo "-- R2 false-positive lanes: the 7 shapes this repo actually ships --"
|
|
60
76
|
# Every one of these was hand-verified on 2026-07-31 as CORRECT: the final stage IS the command
|
|
61
77
|
# whose status is wanted. A detector that flags these is noise, and noise trains dismissal.
|
|
@@ -83,7 +99,7 @@ echo x | grep -q y
|
|
|
83
99
|
rc=$?'
|
|
84
100
|
# B: zsh accepts `$PIPESTATUS[0]` without braces; the brace-anchored regex missed it.
|
|
85
101
|
expect "B PIPESTATUS without braces" HIT 'a | b; rc=$PIPESTATUS[0]'
|
|
86
|
-
expect "B braced form still caught" HIT 'a | b; rc=${PIPESTATUS[0]}'
|
|
102
|
+
expect "B braced form still caught" HIT 'a | b; rc=${PIPESTATUS[0]}' # portability-noqa: fixture string fed to pipe_verdict_guard.sh for static analysis, never executed by this shell
|
|
87
103
|
|
|
88
104
|
echo "-- D: statement-continuation flatten + wrapped filter (leg-C MED round, 2026-08-01) --"
|
|
89
105
|
# The blanket newline→`;` rewrite broke the CONTINUATION shapes: a newline after `|`/`&&` or a
|
|
@@ -167,7 +183,7 @@ echo "-- C: delivery channel (closes N=8 — detection without delivery is decor
|
|
|
167
183
|
# NAMED RESIDUAL (cross-family LOW, accepted): $(…) capture strips NUL bytes, so a mutant emitting
|
|
168
184
|
# NUL+JSON would pass C1. The producer's hits text is static ASCII+⚠️ with no NUL source, so the
|
|
169
185
|
# lane does not pay for a byte-exact harness; revisit only if the producer ever emits dynamic bytes.
|
|
170
|
-
HIT_CMD='bash x.sh | tail -5; echo "exit=${PIPESTATUS[0]}"'
|
|
186
|
+
HIT_CMD='bash x.sh | tail -5; echo "exit=${PIPESTATUS[0]}"' # portability-noqa: fixture string fed to the guard for static analysis, never executed by this shell
|
|
171
187
|
payload() { python3 -c 'import json,sys; print(json.dumps({"tool_name":"Bash","tool_input":{"command":sys.argv[1]}}))' "$1"; }
|
|
172
188
|
|
|
173
189
|
# All C lanes measure ONE invocation: stdout, stderr, and exit code from the same run (a pair of
|
|
@@ -226,6 +242,16 @@ else
|
|
|
226
242
|
printf ' ❌ %-52s rc=%s out=%s\n' "C4 ascii-codec env: JSON still delivered" "$c_rc" "$c_out"; fail=$((fail+1))
|
|
227
243
|
fi
|
|
228
244
|
|
|
245
|
+
# ── R3 — redirection-only statement (zsh NULLCMD=cat reads an open-pipe stdin). Measured 2026-09-04:
|
|
246
|
+
# nine `git commit -q -F - <<'CEOF' … CEOF ⏎ 2>&1)` tasks in two sessions hung after the commit landed.
|
|
247
|
+
# Fixtures are the measured shape verbatim (P), the same shape with the redirect moved onto the
|
|
248
|
+
# command line (N1 — the one-token fix), and a one-word markdown blockquote INSIDE the heredoc body
|
|
249
|
+
# (N2 — data, not a redirection; must stay CLEAN or the guard fires on every quoted commit message).
|
|
250
|
+
expect "R3 measured shape: bare 2>&1 line closes \$( )" HIT $'out=$(git commit -q -F - <<\'CEOF\'\nfix: x\n\nbody\nCEOF\n2>&1); rc=$?; echo "commit rc=$rc"'
|
|
251
|
+
expect "R3 bare > file line after a heredoc" HIT $'cat <<\'EOF\'\nhello\nEOF\n> out.txt\necho done'
|
|
252
|
+
expect "R3 fixed: 2>&1 on the command line" CLEAN $'out=$(git commit -q -F - 2>&1 <<\'CEOF\'\nfix: x\n\nbody\nCEOF\n); rc=$?; echo "commit rc=$rc"'
|
|
253
|
+
expect "R3 blockquote inside heredoc body is data" CLEAN $'out=$(git commit -q -F - 2>&1 <<\'CEOF\'\nfix: x\n\n> 정본\n> see also)\nCEOF\n); rc=$?'
|
|
254
|
+
|
|
229
255
|
echo
|
|
230
256
|
if [ "$fail" -eq 0 ]; then
|
|
231
257
|
echo "[pipe-verdict-guard] ✅ all $pass known pairs hold"; exit 0
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_precommit_pointer_index_lanes.sh — known pair for templates/.git-hooks/pre-commit [Pointers]:
|
|
3
|
+
# the Detail-pointer gate must read the STAGED blob, not the working tree. Found 2026-09-03 (arm C
|
|
4
|
+
# wt2, A3 triage): `[ -f "$REPO_ROOT/$f" ] || continue` let a staged .md with a broken
|
|
5
|
+
# `**Detail**: See §X` pointer land silently when the file was rm'd from disk after staging
|
|
6
|
+
# (git commits the INDEX). Runs in a disposable shallow clone — never touches this checkout.
|
|
7
|
+
# P1 staged broken pointer, file rm'd from disk → commit BLOCKED (❌ pointer line printed)
|
|
8
|
+
# N1 staged VALID pointer, file rm'd from disk → [Pointers] block runs with no ❌ (control: index read works)
|
|
9
|
+
# N2 staged broken pointer, file still on disk → BLOCKED (the pre-fix path also caught this — control)
|
|
10
|
+
# Usage: bash scripts/test_precommit_pointer_index_lanes.sh [--hook <path>] (default = templates/.git-hooks/pre-commit)
|
|
11
|
+
set -u; ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"; HOOK="$ROOT/templates/.git-hooks/pre-commit"
|
|
12
|
+
[ "${1:-}" = "--hook" ] && HOOK="$2"
|
|
13
|
+
T=$(mktemp -d); trap 'rm -rf "$T"' EXIT; pass=0; fail=0
|
|
14
|
+
git clone -q --depth 1 "file://$ROOT" "$T/r" 2>/dev/null || { echo "❌ clone failed"; exit 10; }
|
|
15
|
+
cd "$T/r" && git config user.email t@t && git config user.name t && mkdir -p .git/hooks && cp "$HOOK" .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit
|
|
16
|
+
mkdir -p docs/lanefix; printf '## §Alive\ntext\n' > docs/lanefix/target.md; git add docs/lanefix/target.md; git -c core.hooksPath=/dev/null commit -qm base 2>/dev/null
|
|
17
|
+
run_case(){ local label="$1" want="$2" ptr="$3" rm_after="$4"
|
|
18
|
+
printf '# probe\n\n> **Detail**: See `docs/lanefix/target.md §%s`\n' "$ptr" > docs/lanefix/probe.md
|
|
19
|
+
git add docs/lanefix/probe.md; [ "$rm_after" = 1 ] && rm -f docs/lanefix/probe.md
|
|
20
|
+
out=$(FH_SKIP_GATE_AXES=1 git commit -qm probe 2>&1); rc=$?
|
|
21
|
+
# Discriminate on the [Pointers] block itself, not on commit rc: the fixture clone carries no
|
|
22
|
+
# marker/manifest, so OTHER axes block every commit here — rc is not this lane's signal.
|
|
23
|
+
if printf '%s' "$out" | grep -q "Detail pointer §"; then got=BLOCK_PTR
|
|
24
|
+
elif printf '%s' "$out" | grep -q "unreadable from the index"; then got=BLOCK_INDEX
|
|
25
|
+
elif printf '%s' "$out" | grep -q "\[Pointers\]"; then got=PTR_OK
|
|
26
|
+
else got=PTR_NOT_RUN; fi
|
|
27
|
+
git reset -q --hard HEAD 2>/dev/null; # noqa: destructive-op — disposable clone under mktemp git rm -q --cached docs/lanefix/probe.md 2>/dev/null; rm -f docs/lanefix/probe.md
|
|
28
|
+
if [ "$got" = "$want" ]; then printf ' ✅ %-48s %s\n' "$label" "$got"; pass=$((pass+1)); else printf ' ❌ %-48s %s (expected %s)\n' "$label" "$got" "$want"; fail=$((fail+1)); printf '%s\n' "$out" | grep -E "Pointers|❌" | head -4 | sed 's/^/ /'; fi; }
|
|
29
|
+
echo "[precommit-pointer-index] hook=$HOOK"
|
|
30
|
+
run_case "P1 broken pointer, staged then rm'd from disk" BLOCK_PTR Ghost 1
|
|
31
|
+
run_case "N1 valid pointer, staged then rm'd (index read)" PTR_OK Alive 1
|
|
32
|
+
run_case "N2 broken pointer, still on disk (old path too)" BLOCK_PTR Ghost 0
|
|
33
|
+
echo "[precommit-pointer-index] $pass passed, $fail failed"; [ "$fail" -eq 0 ]
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_preprep_diagram_lanes.sh — L12 diagram 레인 + diagram_from_json.py 거부 경로의 known-pair.
|
|
3
|
+
#
|
|
4
|
+
# 재는 것:
|
|
5
|
+
# K1 known-negative 영수증·지문·validate·폭·viewBox·pad 전부 맞으면 findings 0
|
|
6
|
+
# K2 stale JSON 을 한 글자 고치면 «지문 다름» 1건을 이름으로 짚나
|
|
7
|
+
# K3 resolution PNG 실제 폭(IHDR)이 하한 미달이면 1건 — 영수증 자기신고(png_size)가 아니라 헤더를 읽나
|
|
8
|
+
# K4 viewbox viewBox 폭 > 상한이면 1건(글자 배율)
|
|
9
|
+
# K5 unmeasured 영수증 없는 PNG 는 findings 0 + UNMEASURED 노트(0 으로 안 접나)
|
|
10
|
+
# K6 not-configured diagram_source 표면이 없으면 NOT_CONFIGURED(통과 아님)
|
|
11
|
+
# K7 refuse diagram_from_json.py 가 validate 실패 JSON 을 **굽지 않나** — archify 는 스텁으로 대체
|
|
12
|
+
# (실물 archify·Chrome 없이 도는 레인이어야 CI 에서 앵커다)
|
|
13
|
+
# 🟥 archify·Chrome 이 없어도 돌아야 한다 — 그래서 K7 은 스텁 archify(ok:false)로 «거부»만 잰다.
|
|
14
|
+
# «굽힘» 쪽 실사용은 tracks-meta/dispatch/2026-09-05_archify-preprep/REPORT.md 가 기록한다.
|
|
15
|
+
set -uo pipefail
|
|
16
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
17
|
+
SKILL="$HERE/plugins/fh-commons/skills/preprep"
|
|
18
|
+
PASS=0; FAIL=0
|
|
19
|
+
ok(){ echo " ✅ $1"; PASS=$((PASS+1)); }
|
|
20
|
+
ng(){ echo " ❌ $1"; FAIL=$((FAIL+1)); }
|
|
21
|
+
command -v python3 >/dev/null 2>&1 || { echo " ⚠️ UNMEASURED — python3 unavailable (not a pass)"; echo "diagram lanes: SKIPPED (not passed)"; exit 0; }
|
|
22
|
+
|
|
23
|
+
out=$(cd "$SKILL" && python3 - <<'PY' 2>&1
|
|
24
|
+
import sys, os, json, hashlib, struct, zlib, tempfile, subprocess
|
|
25
|
+
sys.path.insert(0, '.')
|
|
26
|
+
import lane_diagram as LD
|
|
27
|
+
def sha(p): return hashlib.sha256(open(p,'rb').read()).hexdigest()
|
|
28
|
+
def png(path, w, h=2):
|
|
29
|
+
# 순수 표준 라이브러리 PNG(회색 1바이트/픽셀) — 폭만 의미 있다
|
|
30
|
+
raw = b''.join(b'\x00' + b'\x80'*w for _ in range(h))
|
|
31
|
+
def chunk(t, d): return struct.pack('>I', len(d)) + t + d + struct.pack('>I', zlib.crc32(t+d) & 0xffffffff)
|
|
32
|
+
open(path,'wb').write(b'\x89PNG\r\n\x1a\n' + chunk(b'IHDR', struct.pack('>IIBBBBB', w, h, 8, 0, 0, 0, 0)) + chunk(b'IDAT', zlib.compress(raw)) + chunk(b'IEND', b''))
|
|
33
|
+
d = tempfile.mkdtemp(prefix='l12_')
|
|
34
|
+
spec = os.path.join(d, 'fig.workflow.json'); json.dump({'diagram_type':'workflow','nodes':[{'id':'a','label':'개발'}]}, open(spec,'w'))
|
|
35
|
+
def receipt(pngp, **kw):
|
|
36
|
+
r = {'spec_sha256': sha(spec), 'validate': {'ok': True, 'profile': 'showcase'}, 'viewbox_w': 720, 'pad': 0.03, 'png_size': [3840, 2]}
|
|
37
|
+
r.update(kw); json.dump(r, open(pngp[:-4] + '.receipt.json', 'w'))
|
|
38
|
+
def run(surfs, extra=None):
|
|
39
|
+
cfg = {'surfaces': surfs, 'diagram': {'min_px': 3840, 'max_viewbox_w': 720, 'min_pad': 0.02}}
|
|
40
|
+
return LD.scan(cfg, d)
|
|
41
|
+
R = {}
|
|
42
|
+
# K1 negative
|
|
43
|
+
p1 = os.path.join(d, 'ok.png'); png(p1, 3840); receipt(p1)
|
|
44
|
+
f, n = run([{'id':'fig','path':'fig.workflow.json','kind':'diagram_source','render':'ok.png'}]); R['K1'] = len(f)
|
|
45
|
+
# K2 stale: JSON 고침
|
|
46
|
+
open(spec,'a').write('\n'); f, n = run([{'id':'fig','path':'fig.workflow.json','kind':'diagram_source','render':'ok.png'}])
|
|
47
|
+
R['K2'] = [x[2] for x in f]
|
|
48
|
+
receipt(p1) # 다시 맞춤
|
|
49
|
+
# K3 resolution: 영수증은 3840 이라 «말하지만» 실제 헤더는 1000
|
|
50
|
+
p3 = os.path.join(d, 'small.png'); png(p3, 1000); receipt(p3, png_size=[3840, 2])
|
|
51
|
+
f, n = run([{'id':'fig','path':'fig.workflow.json','kind':'diagram_source','render':'small.png'}]); R['K3'] = [x[2] for x in f]
|
|
52
|
+
# K4 viewbox
|
|
53
|
+
p4 = os.path.join(d, 'wide.png'); png(p4, 3840); receipt(p4, viewbox_w=1137)
|
|
54
|
+
f, n = run([{'id':'fig','path':'fig.workflow.json','kind':'diagram_source','render':'wide.png'}]); R['K4'] = [x[2] for x in f]
|
|
55
|
+
# K5 unmeasured (영수증 없음)
|
|
56
|
+
p5 = os.path.join(d, 'hand.png'); png(p5, 3840)
|
|
57
|
+
f, n = run([{'id':'fig','path':'fig.workflow.json','kind':'diagram_source','render':'hand.png'}]); R['K5'] = {'n': len(f), 'unm': any('UNMEASURED' in s for s in n)}
|
|
58
|
+
# K6 not configured
|
|
59
|
+
f, n = run([]); R['K6'] = {'n': len(f), 'nc': any('NOT_CONFIGURED' in s for s in n)}
|
|
60
|
+
# K7 refuse — 스텁 archify(항상 ok:false) + 가짜 chrome. PNG 가 «안 생겨야» 한다
|
|
61
|
+
stub = os.path.join(d, 'archify_stub.mjs'); open(stub,'w').write('console.log(JSON.stringify({ok:false,diagnostics:[{code:"stub/fail",message:"stub"}]}))')
|
|
62
|
+
fake_chrome = os.path.join(d, 'chrome'); open(fake_chrome,'w').write('#!/bin/sh\nexit 0\n'); os.chmod(fake_chrome, 0o755)
|
|
63
|
+
outp = os.path.join(d, 'refused.png')
|
|
64
|
+
import shutil
|
|
65
|
+
if shutil.which('node'):
|
|
66
|
+
r = subprocess.run([sys.executable, 'diagram_from_json.py', spec, '--out', outp, '--archify', stub, '--chrome', fake_chrome], capture_output=True, text=True)
|
|
67
|
+
R['K7'] = {'rc': r.returncode, 'png': os.path.exists(outp), 'msg': 'REFUSE' in r.stdout}
|
|
68
|
+
else:
|
|
69
|
+
R['K7'] = {'rc': 'NO_NODE'}
|
|
70
|
+
print(json.dumps(R, ensure_ascii=False))
|
|
71
|
+
PY
|
|
72
|
+
); rc=$?
|
|
73
|
+
[ $rc -eq 0 ] || { echo " ❌ INSTRUMENT ERROR — lane_diagram 실행 실패 (rc=$rc): $out"; exit 1; }
|
|
74
|
+
g(){ python3 -c "import json,sys;v=json.loads(sys.argv[1]);exec('r=v'+sys.argv[2]);print(r)" "$out" "$1"; }
|
|
75
|
+
[ "$(g "['K1']")" = "0" ] && ok "K1 known-negative: 다 맞으면 0건" || ng "K1 오탐 $(g "['K1']")건"
|
|
76
|
+
[ "$(g "['K2']")" = "['stale']" ] && ok "K2 stale: JSON 고치면 «stale» 1건을 이름으로" || ng "K2 실패: $(g "['K2']")"
|
|
77
|
+
[ "$(g "['K3']")" = "['resolution']" ] && ok "K3 resolution: 영수증이 3840 이라 해도 IHDR 1000 을 잡는다(자기신고 아님)" || ng "K3 실패: $(g "['K3']")"
|
|
78
|
+
[ "$(g "['K4']")" = "['viewbox']" ] && ok "K4 viewbox: 1137 > 720 을 잡는다(글자 배율)" || ng "K4 실패: $(g "['K4']")"
|
|
79
|
+
[ "$(g "['K5']['n']")" = "0" ] && [ "$(g "['K5']['unm']")" = "True" ] && ok "K5 영수증 없는 손그림 = UNMEASURED(0 아님·통과 아님)" || ng "K5 실패: $(g "['K5']")"
|
|
80
|
+
[ "$(g "['K6']['n']")" = "0" ] && [ "$(g "['K6']['nc']")" = "True" ] && ok "K6 표면 없음 = NOT_CONFIGURED" || ng "K6 실패: $(g "['K6']")"
|
|
81
|
+
k7=$(g "['K7']")
|
|
82
|
+
case "$k7" in
|
|
83
|
+
*NO_NODE*) echo " ⏭ K7 거부 경로 — node 부재라 UNMEASURED (통과 아님)";;
|
|
84
|
+
*) [ "$(g "['K7']['rc']")" = "1" ] && [ "$(g "['K7']['png']")" = "False" ] && [ "$(g "['K7']['msg']")" = "True" ] && ok "K7 refuse: validate 실패면 exit 1 + PNG 미생성 + REFUSE 표기" || ng "K7 실패: $k7";;
|
|
85
|
+
esac
|
|
86
|
+
echo "diagram lanes: $PASS passed, $FAIL failed"
|
|
87
|
+
[ "$FAIL" -eq 0 ] || exit 1
|
|
@@ -16,7 +16,16 @@ set -uo pipefail
|
|
|
16
16
|
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
17
17
|
SRC="$HERE/plugins/fh-commons/skills/preprep"
|
|
18
18
|
# standalone 배포 위치는 환경변수로 받는다. 기본값을 박으면 다른 머신에서 거짓 SKIP 이 된다.
|
|
19
|
-
|
|
19
|
+
# 🟥 2026-09-03 — 그런데 «아무도 그 변수를 안 걸어서» D2 가 여태 SKIP 이었고, 그 사이 컴패니언
|
|
20
|
+
# 저장소의 fork(724줄)가 정본(789줄)과 갈라져 L9~L11 을 안 부르고 있었다 — 정본 주석이 이미
|
|
21
|
+
# 한 번 적어 둔 사고의 2회째(fh_signal_2026-09-03_preprep-standalone-anchor-skip.md). 슬롯은
|
|
22
|
+
# 있고 소비처가 0 인 형태. 처방: 명시 변수가 없으면 운영자 로컬 바인딩이 이미 export 하는
|
|
23
|
+
# FH_COMPANION_STORE 아래 preprep/ 을 «자동 후보»로 쓴다 — 기본값을 박는 게 아니라 이미
|
|
24
|
+
# 선언된 경로를 읽는 것이라 다른 머신에서 거짓 SKIP 을 만들지 않는다(없으면 여전히 SKIP).
|
|
25
|
+
DIST="${PREPREP_STANDALONE_DIR:-}"; DIST_SRC="PREPREP_STANDALONE_DIR"
|
|
26
|
+
if [ -z "$DIST" ] && [ -n "${FH_COMPANION_STORE:-}" ] && [ -d "${FH_COMPANION_STORE}/preprep" ]; then
|
|
27
|
+
DIST="${FH_COMPANION_STORE}/preprep"; DIST_SRC="FH_COMPANION_STORE/preprep (자동 후보)"
|
|
28
|
+
fi
|
|
20
29
|
PASS=0; FAIL=0; SKIP=0
|
|
21
30
|
ok(){ echo " ✅ $1"; PASS=$((PASS+1)); }
|
|
22
31
|
ng(){ echo " ❌ $1"; FAIL=$((FAIL+1)); }
|
|
@@ -24,7 +33,7 @@ sk(){ echo " ⏭ $1 — SKIPPED (**통과 아님**)"; SKIP=$((SKIP+1)); }
|
|
|
24
33
|
|
|
25
34
|
# D1 — 단일 소스
|
|
26
35
|
missing=""
|
|
27
|
-
for f in preprep.py interslide_deps.py lane_progression.py lane_adjacent_dup.py lane_promise.py SKILL.md README.md surfaces.example.yaml; do
|
|
36
|
+
for f in preprep.py interslide_deps.py lane_progression.py lane_adjacent_dup.py lane_promise.py lane_diagram.py diagram_from_json.py SKILL.md README.md surfaces.example.yaml; do
|
|
28
37
|
[ -f "$SRC/$f" ] || missing="$missing $f"
|
|
29
38
|
done
|
|
30
39
|
if [ -n "$missing" ]; then ng "D1 단일 소스 결손:$missing"
|
|
@@ -32,25 +41,25 @@ elif ! command -v python3 >/dev/null 2>&1; then
|
|
|
32
41
|
sk "D1 구문 검사 — python3 부재라 «돌 수 있나»를 못 쟀다(UNMEASURED)"
|
|
33
42
|
else
|
|
34
43
|
synerr=""
|
|
35
|
-
for f in preprep.py interslide_deps.py lane_progression.py lane_adjacent_dup.py lane_promise.py; do
|
|
44
|
+
for f in preprep.py interslide_deps.py lane_progression.py lane_adjacent_dup.py lane_promise.py lane_diagram.py diagram_from_json.py; do
|
|
36
45
|
python3 -c "import ast,sys;ast.parse(open(sys.argv[1],encoding='utf-8').read())" "$SRC/$f" 2>/dev/null || synerr="$synerr $f"
|
|
37
46
|
done
|
|
38
|
-
[ -z "$synerr" ] && ok "D1 단일 소스
|
|
47
|
+
[ -z "$synerr" ] && ok "D1 단일 소스 10파일 실재 + python 7파일 구문 통과" \
|
|
39
48
|
|| ng "D1 구문 실패:$synerr"
|
|
40
49
|
fi
|
|
41
50
|
|
|
42
51
|
# D2 — standalone 대조
|
|
43
52
|
if [ -z "$DIST" ]; then
|
|
44
|
-
sk "D2 standalone 대조 — PREPREP_STANDALONE_DIR
|
|
53
|
+
sk "D2 standalone 대조 — PREPREP_STANDALONE_DIR 미설정이고 FH_COMPANION_STORE/preprep 도 없어 배포본을 못 찾았다. UNCHECKED — 배포본이 있는 머신이면 둘 중 하나를 export 해라"
|
|
45
54
|
elif [ ! -d "$DIST" ]; then
|
|
46
|
-
ng "D2
|
|
55
|
+
ng "D2 $DIST_SRC 이 가리키는 곳이 없다: $DIST (설정됐는데 부재 = 드리프트 아니라 배선 결함)"
|
|
47
56
|
else
|
|
48
57
|
drift=""
|
|
49
58
|
for f in preprep.py interslide_deps.py lane_progression.py lane_adjacent_dup.py; do
|
|
50
59
|
if [ ! -f "$DIST/$f" ]; then drift="$drift $f(부재)"
|
|
51
60
|
elif ! cmp -s "$SRC/$f" "$DIST/$f"; then drift="$drift $f(갈림)"; fi
|
|
52
61
|
done
|
|
53
|
-
[ -z "$drift" ] && ok "D2 standalone 코드 5파일이 단일 소스와 바이트 동일" \
|
|
62
|
+
[ -z "$drift" ] && ok "D2 standalone 코드 5파일이 단일 소스와 바이트 동일 ($DIST_SRC)" \
|
|
54
63
|
|| ng "D2 드리프트:$drift ⇒ 사본이 둘이 됐다. 단일 소스에서 다시 뽑아라"
|
|
55
64
|
fi
|
|
56
65
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_preprep_drift_anchor_lanes.sh — known pairs for the D2 leg of scripts/test_preprep_drift_anchor.sh
|
|
3
|
+
# WHY (2026-09-03): D2 compared the standalone copy only when PREPREP_STANDALONE_DIR was set. Nobody
|
|
4
|
+
# set it, so the leg SKIPPED for weeks while the companion-store fork drifted (724 vs 789 lines, L9-L11
|
|
5
|
+
# never called) — the second occurrence of the exact accident the canon's own comment records.
|
|
6
|
+
# Fix under test: with the env var unset, the anchor falls back to $FH_COMPANION_STORE/preprep when it
|
|
7
|
+
# exists. These lanes pin: fallback used · fallback discriminates (identical PASS / drifted FAIL) ·
|
|
8
|
+
# explicit var still wins · nothing set → SKIP (never a silent PASS).
|
|
9
|
+
set -u
|
|
10
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"; A="$HERE/scripts/test_preprep_drift_anchor.sh"
|
|
11
|
+
SRC="$HERE/plugins/fh-commons/skills/preprep"; T=$(mktemp -d); pass=0; fail=0
|
|
12
|
+
chk(){ if [ "$1" = 0 ]; then echo " ✅ $2"; pass=$((pass+1)); else echo " ❌ $2"; fail=$((fail+1)); fi; }
|
|
13
|
+
mk(){ mkdir -p "$1"; for f in preprep.py interslide_deps.py lane_progression.py lane_adjacent_dup.py lane_promise.py; do cp "$SRC/$f" "$1/$f"; done; }
|
|
14
|
+
echo "[preprep-drift-anchor] D2 known pairs"
|
|
15
|
+
# L1 nothing set → D2 SKIP (skip != pass), rc 0 (D2 is not a FAIL)
|
|
16
|
+
out=$(env -u PREPREP_STANDALONE_DIR FH_COMPANION_STORE="$T/nostore" bash "$A" 2>&1); printf '%s' "$out" | grep -q "D2 .*SKIPPED"; chk $? "L1 var unset + no companion preprep → D2 SKIPPED (not PASS)"
|
|
17
|
+
# L2 companion copy identical → fallback used, D2 PASS
|
|
18
|
+
mk "$T/be/preprep"; out=$(env -u PREPREP_STANDALONE_DIR FH_COMPANION_STORE="$T/be" bash "$A" 2>&1); printf '%s' "$out" | grep -q "✅ D2 .*자동 후보"; chk $? "L2 fallback FH_COMPANION_STORE/preprep identical → D2 PASS via 자동 후보"
|
|
19
|
+
# L3 companion copy drifted → D2 FAIL, rc 1 (the accident class)
|
|
20
|
+
printf '\n# drift\n' >> "$T/be/preprep/preprep.py"; env -u PREPREP_STANDALONE_DIR FH_COMPANION_STORE="$T/be" bash "$A" >"$T/l3.out" 2>&1; rc=$?; [ "$rc" -ne 0 ] && grep -q "D2 드리프트.*preprep.py(갈림)" "$T/l3.out"; chk $? "L3 fallback copy drifted → D2 FAIL rc=$rc (known-positive)"
|
|
21
|
+
# L4 explicit var wins over companion
|
|
22
|
+
mk "$T/explicit"; out=$(PREPREP_STANDALONE_DIR="$T/explicit" FH_COMPANION_STORE="$T/be" bash "$A" 2>&1); printf '%s' "$out" | grep -q "✅ D2 .*(PREPREP_STANDALONE_DIR)"; chk $? "L4 explicit PREPREP_STANDALONE_DIR wins over drifted companion copy"
|
|
23
|
+
rm -rf "$T"; echo "[preprep-drift-anchor] $pass passed, $fail failed"; [ "$fail" -eq 0 ]
|