@chrono-meta/fh-gate 2.9.0 → 2.10.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 +2 -2
- package/AGENTS.md +5 -0
- package/README.ja.md +10 -3
- package/README.ko.md +11 -4
- package/README.md +12 -3
- package/README.zh.md +10 -3
- package/docs/ETHOS.md +40 -0
- package/knowledge/shared/harness-core/measurement-integrity-checklist.md +31 -0
- package/knowledge/shared/harness-core/ship_readiness_gate.md +1 -1
- package/package.json +8 -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 +87 -0
- package/scripts/compaction_probe.sh +17 -2
- package/scripts/fh-gate.sh +58 -0
- package/scripts/files_manifest_shipping_check.sh +314 -0
- package/scripts/lane_runner_check.sh +257 -9
- package/scripts/package_coverage_check.sh +6 -0
- package/scripts/postinstall_notice.js +9 -2
- package/scripts/selfcheck.sh +29 -0
- package/scripts/test_files_manifest_shipping_lanes.sh +260 -0
|
@@ -270,8 +270,97 @@ fi
|
|
|
270
270
|
# treats an EMPTY array's expansion as an unbound variable and aborts. DEBT is now empty by design,
|
|
271
271
|
# which is exactly the state the plain form cannot survive — measured here 2026-08-13, and it
|
|
272
272
|
# aborted so early that the script still printed PASS (see the rc routing further down).
|
|
273
|
+
# -- RUNNER SURFACE = THE GIT INDEX, NOT THE WORKING TREE (D-5, 2026-08-24) --------------------
|
|
274
|
+
# An UNTRACKED file must never certify anything as WIRED. Until this fix the RUNNER globs below
|
|
275
|
+
# were resolved against the DISK, so a workflow / hook / script that existed only in this working
|
|
276
|
+
# copy counted as a caller -- and the tree read green on wiring that disappears on `git clone`.
|
|
277
|
+
#
|
|
278
|
+
# The POPULATION globs (what gets CHECKED) stay on DISK on purpose. There an untracked file must
|
|
279
|
+
# be SEEN, so a new uncommitted script goes red instead of slipping through. Only the RUNNER
|
|
280
|
+
# surface moves to the index; moving both would trade one silent pass for another.
|
|
281
|
+
#
|
|
282
|
+
# 🟥 "NOT A REPOSITORY" AND "GIT FAILED" ARE DIFFERENT FACTS AND MUST NOT SHARE A BRANCH.
|
|
283
|
+
# The first draft of this block folded EVERY non-zero `git ls-files` exit into "no index here, use
|
|
284
|
+
# the disk". Cross-family review (codex/gpt-5.5, 2026-08-24) executed the consequence: a fake `git`
|
|
285
|
+
# that exits 1 for everything produced a warning line and then a PASS. A missing binary, a locked
|
|
286
|
+
# or corrupt index, and a permission failure all landed on the SAME branch as an unpacked npm
|
|
287
|
+
# tarball -- so the repair against "green that a clone deletes" had installed a fresh green of its
|
|
288
|
+
# own. That is [[feedback_not_found_is_not_zero_family]] wearing this file's colours, and the
|
|
289
|
+
# asymmetry was backwards: an EMPTY result was routed to UNMEASURED while a FAILED one was routed
|
|
290
|
+
# to a pass.
|
|
291
|
+
#
|
|
292
|
+
# So the state is resolved by POSITIVE questions, in order, and only the answers that are actually
|
|
293
|
+
# established are allowed to reach the disk fallback:
|
|
294
|
+
# git absent / `git --version` non-zero -> UNMEASURED (the instrument, not the tree)
|
|
295
|
+
# rev-parse fails AND a .git exists up-chain -> UNMEASURED (git broke inside a repo)
|
|
296
|
+
# rev-parse fails AND no .git anywhere up-chain-> nongit (an unpacked tarball: disk is right)
|
|
297
|
+
# inside a git dir with no work tree -> nongit
|
|
298
|
+
# in a work tree, `git ls-files` non-zero -> UNMEASURED (locked/corrupt index, permissions)
|
|
299
|
+
# in a work tree, ls-files empty, cwd ignored -> outside-index (a package unpacked INSIDE some
|
|
300
|
+
# other repo -- the index cannot answer for it,
|
|
301
|
+
# and blocking every such install would just
|
|
302
|
+
# train the override)
|
|
303
|
+
# in a work tree, ls-files empty, cwd tracked -> UNMEASURED (an empty index is not zero runners)
|
|
304
|
+
# otherwise -> index
|
|
305
|
+
# 🟥 The discriminator can itself fail, and when it does the answer is UNMEASURED -- never "not a
|
|
306
|
+
# repository". That is why the .git walk-up exists: it is a filesystem fact that needs no working
|
|
307
|
+
# git, so "git could not tell us" and "there is genuinely nothing here" stay separable.
|
|
308
|
+
#
|
|
309
|
+
# 🟥 `git ls-files` into a file, then `$?` on its OWN line. No pipe, no `|| true`: a fallback would
|
|
310
|
+
# hand an empty list to the scan and the scan would render it as "no runners".
|
|
311
|
+
_fh_has_dotgit_upchain() {
|
|
312
|
+
local _d; _d="$(pwd -P)"
|
|
313
|
+
while : ; do
|
|
314
|
+
[ -e "$_d/.git" ] && return 0
|
|
315
|
+
[ "$_d" = "/" ] && return 1
|
|
316
|
+
_d="$(dirname "$_d")"
|
|
317
|
+
done
|
|
318
|
+
}
|
|
319
|
+
FH_INDEX_STATE="UNMEASURED"; FH_INDEX_WHY="not determined"; FH_INDEX_FILE_LIST=""
|
|
320
|
+
if ! command -v git >/dev/null 2>&1; then
|
|
321
|
+
FH_INDEX_WHY="git is not on PATH -- the index could not be read at all"
|
|
322
|
+
else
|
|
323
|
+
_fh_gv="$(git --version 2>/dev/null)"; _fh_gvrc=$?
|
|
324
|
+
if [ "$_fh_gvrc" -ne 0 ] || [ -z "$_fh_gv" ]; then
|
|
325
|
+
FH_INDEX_WHY="\`git --version\` exited $_fh_gvrc -- the git binary is unusable, so nothing below was measured"
|
|
326
|
+
else
|
|
327
|
+
_fh_wt="$(git rev-parse --is-inside-work-tree 2>/dev/null)"; _fh_wtrc=$?
|
|
328
|
+
if [ "$_fh_wtrc" -ne 0 ]; then
|
|
329
|
+
if _fh_has_dotgit_upchain; then
|
|
330
|
+
FH_INDEX_WHY="git works but \`rev-parse --is-inside-work-tree\` exited $_fh_wtrc while a .git exists above this directory -- git failed, this is not a plain directory"
|
|
331
|
+
else
|
|
332
|
+
FH_INDEX_STATE="nongit"; FH_INDEX_WHY="no repository here and no .git anywhere above -- an unpacked tarball"
|
|
333
|
+
fi
|
|
334
|
+
elif [ "$_fh_wt" != "true" ]; then
|
|
335
|
+
FH_INDEX_STATE="nongit"; FH_INDEX_WHY="inside a git dir with no work tree (bare repository)"
|
|
336
|
+
else
|
|
337
|
+
# 🟥 NUL ALL THE WAY. An earlier draft piped this through `tr '\0' '\n'` into an env var,
|
|
338
|
+
# which un-did the whole point of `-z`: a path containing a NEWLINE was split into two paths
|
|
339
|
+
# before python ever saw it. Env vars cannot carry NUL, so the list travels as a FILE and the
|
|
340
|
+
# separator is never translated. Cross-family review, 2026-08-24, round 3.
|
|
341
|
+
_fh_tmp="$(mktemp)"
|
|
342
|
+
git ls-files -z >"$_fh_tmp" 2>/dev/null
|
|
343
|
+
_fh_lrc=$?
|
|
344
|
+
FH_INDEX_FILE_LIST="$_fh_tmp"
|
|
345
|
+
if [ "$_fh_lrc" -ne 0 ]; then
|
|
346
|
+
FH_INDEX_WHY="inside a work tree, but \`git ls-files\` exited $_fh_lrc -- a locked or corrupt index, or a permission failure. NOT an absence of runners"
|
|
347
|
+
elif [ -s "$_fh_tmp" ]; then
|
|
348
|
+
FH_INDEX_STATE="index"; FH_INDEX_WHY="the git index"
|
|
349
|
+
else
|
|
350
|
+
git check-ignore -q . 2>/dev/null; _fh_ci=$?
|
|
351
|
+
if [ "$_fh_ci" -eq 0 ]; then
|
|
352
|
+
FH_INDEX_STATE="outside-index"; FH_INDEX_WHY="this directory is IGNORED by the surrounding repository, so its index cannot answer for these files"
|
|
353
|
+
else
|
|
354
|
+
FH_INDEX_WHY="\`git ls-files\` exited 0 and returned NOTHING while this directory is tracked territory -- an empty index is not zero runners"
|
|
355
|
+
fi
|
|
356
|
+
fi
|
|
357
|
+
fi
|
|
358
|
+
fi
|
|
359
|
+
fi
|
|
360
|
+
export FH_INDEX_STATE FH_INDEX_WHY FH_INDEX_FILE_LIST
|
|
361
|
+
|
|
273
362
|
out=$(python3 - "${#EXEMPT[@]}" "${EXEMPT[@]+"${EXEMPT[@]}"}" "${DEBT[@]+"${DEBT[@]}"}" <<'PY'
|
|
274
|
-
import os, re, sys, glob, json
|
|
363
|
+
import os, re, sys, glob, json, subprocess
|
|
275
364
|
|
|
276
365
|
n_exempt = int(sys.argv[1])
|
|
277
366
|
exempt = set(sys.argv[2:2 + n_exempt])
|
|
@@ -287,14 +376,161 @@ suites = sorted({os.path.basename(f) for f in glob.glob('scripts/*.sh')
|
|
|
287
376
|
# Runner surfaces, enumerated rather than assumed. All three were checked by hand when this file was
|
|
288
377
|
# written: CI runs `bash scripts/selfcheck.sh` + count_check + the plugin validators and nothing else.
|
|
289
378
|
SELF = os.path.basename(__file__) if '__file__' in dir() else 'lane_runner_check.sh'
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
379
|
+
RUNNER_GLOBS = ('scripts/*.sh', 'templates/.git-hooks/*', '.github/workflows/*.yml')
|
|
380
|
+
|
|
381
|
+
# -- INDEX-vs-DISK enumeration, RUNNER surfaces ONLY. State resolved in the bash preamble above. -
|
|
382
|
+
INDEX_MODE = os.environ.get('FH_INDEX_STATE', '')
|
|
383
|
+
INDEX_WHY = os.environ.get('FH_INDEX_WHY', 'the preamble did not run')
|
|
384
|
+
_idx_path = os.environ.get('FH_INDEX_FILE_LIST', '')
|
|
385
|
+
_idx_raw = b''
|
|
386
|
+
if _idx_path:
|
|
387
|
+
try:
|
|
388
|
+
_idx_raw = open(_idx_path, 'rb').read()
|
|
389
|
+
except OSError:
|
|
390
|
+
_idx_raw = b''
|
|
391
|
+
INDEX_FILES = [_b.decode('utf-8', 'replace') for _b in _idx_raw.split(b'\0') if _b]
|
|
392
|
+
# Fail-closed on anything this file does not recognise, including the empty string a caller that
|
|
393
|
+
# skipped the preamble would leave behind. A mode nobody set is not a mode that means "use disk".
|
|
394
|
+
if INDEX_MODE not in ('index', 'nongit', 'outside-index'):
|
|
395
|
+
INDEX_MODE = 'UNMEASURED'
|
|
396
|
+
if INDEX_MODE == 'index' and not INDEX_FILES:
|
|
397
|
+
INDEX_MODE = 'UNMEASURED'
|
|
398
|
+
INDEX_WHY = 'state said index and the file list is empty -- the two disagree'
|
|
399
|
+
|
|
400
|
+
def _glob_rx(pat):
|
|
401
|
+
# glob semantics, NOT fnmatch, and that includes the DOTFILE rule.
|
|
402
|
+
# `*` -> `[^/]*` alone is WIDER than the `glob.glob()` it replaced: fnmatch translates `*` to
|
|
403
|
+
# `.*`, which also crosses `/`, and neither form hides dotfiles. `glob.glob('scripts/*.sh')`
|
|
404
|
+
# does NOT return `scripts/.x.sh`; a regex without the guard below DOES, so a hidden tracked
|
|
405
|
+
# file would certify a caller that the old surface never contained. Cross-family review,
|
|
406
|
+
# 2026-08-24. The guard is per SEGMENT and keys on a leading `*`/`?` in that segment -- a dot
|
|
407
|
+
# in a literal segment (`templates/.git-hooks/`) is a directory name and is unaffected; what
|
|
408
|
+
# glob hides is a leading dot in the matched BASENAME.
|
|
409
|
+
_segs = []
|
|
410
|
+
for _seg in pat.split('/'):
|
|
411
|
+
_s = ''
|
|
412
|
+
if _seg[:1] in ('*', '?'):
|
|
413
|
+
_s += '(?!\\.)'
|
|
414
|
+
for _c in _seg:
|
|
415
|
+
_s += '[^/]*' if _c == '*' else '[^/]' if _c == '?' else re.escape(_c)
|
|
416
|
+
_segs.append(_s)
|
|
417
|
+
return re.compile('^' + '/'.join(_segs) + '$')
|
|
418
|
+
|
|
419
|
+
def enumerate_runners(patterns):
|
|
420
|
+
# index: the candidate runners are what `git ls-files` says is TRACKED.
|
|
421
|
+
# nongit / outside-index: no index can answer here, so disk is the correct surface -- and the
|
|
422
|
+
# run says which of the two it is out loud. UNMEASURED never reaches this function.
|
|
423
|
+
if INDEX_MODE == 'index':
|
|
424
|
+
# 🟥 NO os.path.isfile HERE. Filtering the INDEX list by what happens to be on disk lets the
|
|
425
|
+
# working tree decide the population of an index-grounded judgment -- a tracked runner the
|
|
426
|
+
# worktree has deleted would silently become "not a runner" instead of "read its blob",
|
|
427
|
+
# which also skips the completeness check below. The index blob exists regardless of the
|
|
428
|
+
# working tree; that is the whole reason to read it. Cross-family review, round 3.
|
|
429
|
+
# The disk branch on the next line KEEPS isfile, and so do LOCAL_ONLY_SURFACES: there the
|
|
430
|
+
# working tree IS the surface, and a name with no file behind it is genuinely nothing.
|
|
431
|
+
_rx = [_glob_rx(_p) for _p in patterns]
|
|
432
|
+
return [_p for _p in INDEX_FILES if any(_r.match(_p) for _r in _rx)]
|
|
433
|
+
return [_p for _pat in patterns for _p in glob.glob(_pat) if os.path.isfile(_p)]
|
|
434
|
+
|
|
435
|
+
if INDEX_MODE == 'UNMEASURED':
|
|
436
|
+
print('CONTROL_FAILED\tthe runner surface is UNMEASURED, not zero runners: ' + INDEX_WHY)
|
|
437
|
+
raise SystemExit(2)
|
|
438
|
+
print('INDEX_MODE\t' + INDEX_MODE + '\t' + INDEX_WHY)
|
|
439
|
+
|
|
440
|
+
runners = enumerate_runners(RUNNER_GLOBS)
|
|
293
441
|
# This file names every DEBT and EXEMPT suite in its own arrays. Scanning itself would read each of
|
|
294
442
|
# those declarations as evidence the suite is run — the check would certify its own todo list as
|
|
295
443
|
# done. Caught by the known-negative control below on the first execution.
|
|
296
444
|
runners = [r for r in runners if os.path.basename(r) != 'lane_runner_check.sh']
|
|
297
445
|
|
|
446
|
+
# -- RUNNER CONTENT = THE INDEX BLOB, NOT THE WORKING TREE FILE -------------------------------
|
|
447
|
+
# 🟥 THE OTHER HALF OF D-5. Moving the runner FILE LIST to the index closed "is this runner in the
|
|
448
|
+
# clone"; it did NOT close "does that runner call this lane in the clone". The names came from
|
|
449
|
+
# `git ls-files` while the bodies were still read with `open()`, so ONE UNSTAGED LINE added to an
|
|
450
|
+
# already-tracked runner certified a wiring that exists in nobody's checkout but this one -- the
|
|
451
|
+
# same defect wearing the other half of its face. Cross-family review, 2026-08-24, round 2.
|
|
452
|
+
# Claiming "the surface is index-grounded" while half of it was not is exactly
|
|
453
|
+
# [[feedback_half_fix_propagation_boundary]] / "measured scope != claimed scope".
|
|
454
|
+
#
|
|
455
|
+
# ONE process, not one per runner: there are ~185 runner surfaces here, and `git show` per file
|
|
456
|
+
# would be ~185 forks. `git cat-file --batch` reads them all from one stdin stream.
|
|
457
|
+
#
|
|
458
|
+
# 🟥 EVERY FAILURE PATH IS UNMEASURED, NEVER AN EMPTY BODY. A missing blob, a short read, a
|
|
459
|
+
# non-blob object, a git that will not start -- each of them, read as "" , renders the runner as
|
|
460
|
+
# calling nothing, which is the fold this whole file exists to refuse. They collect in _BLOB_ERR
|
|
461
|
+
# and route to the same UNMEASURED exit as a broken index does.
|
|
462
|
+
# In `nongit` / `outside-index` there is no blob to read and that is already decided policy
|
|
463
|
+
# (protection off, labelled) -- the loader is simply not run, and the disk reader stays in place.
|
|
464
|
+
# No new state value.
|
|
465
|
+
_BLOBS = {}
|
|
466
|
+
_BLOB_ERR = []
|
|
467
|
+
|
|
468
|
+
def _load_index_blobs(paths):
|
|
469
|
+
if INDEX_MODE != 'index' or not paths:
|
|
470
|
+
return
|
|
471
|
+
# `git cat-file --batch` reads NEWLINE-delimited input, so a path containing one cannot be
|
|
472
|
+
# asked for safely. Refuse to guess: that is UNMEASURED, not "this runner calls nothing".
|
|
473
|
+
for _p in paths:
|
|
474
|
+
if '\n' in _p:
|
|
475
|
+
_BLOB_ERR.append('a runner path contains a newline and cannot be batched: ' + repr(_p))
|
|
476
|
+
if _BLOB_ERR:
|
|
477
|
+
return
|
|
478
|
+
_inp = ''.join(':' + _p + '\n' for _p in paths)
|
|
479
|
+
try:
|
|
480
|
+
_pr = subprocess.run(['git', 'cat-file', '--batch'], input=_inp.encode('utf-8'), stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
|
|
481
|
+
except OSError as _e:
|
|
482
|
+
_BLOB_ERR.append('git cat-file could not be started: ' + str(_e))
|
|
483
|
+
return
|
|
484
|
+
if _pr.returncode != 0:
|
|
485
|
+
_BLOB_ERR.append('git cat-file --batch exited ' + str(_pr.returncode))
|
|
486
|
+
return
|
|
487
|
+
_buf = _pr.stdout
|
|
488
|
+
_pos = 0
|
|
489
|
+
for _p in paths:
|
|
490
|
+
_nl = _buf.find(b'\n', _pos)
|
|
491
|
+
if _nl < 0:
|
|
492
|
+
_BLOB_ERR.append('git cat-file output ended early at ' + _p)
|
|
493
|
+
return
|
|
494
|
+
_hdr = _buf[_pos:_nl].decode('utf-8', 'replace').split()
|
|
495
|
+
_pos = _nl + 1
|
|
496
|
+
if len(_hdr) != 3 or _hdr[1] != 'blob':
|
|
497
|
+
_BLOB_ERR.append('no blob in the index for ' + _p + ': ' + ' '.join(_hdr))
|
|
498
|
+
return
|
|
499
|
+
_sz = int(_hdr[2])
|
|
500
|
+
_end = _pos + _sz
|
|
501
|
+
if _end > len(_buf):
|
|
502
|
+
_BLOB_ERR.append('git cat-file returned a short body for ' + _p)
|
|
503
|
+
return
|
|
504
|
+
_BLOBS[_p] = _buf[_pos:_end].decode('utf-8', 'replace')
|
|
505
|
+
_pos = _end + 1
|
|
506
|
+
# Completeness, checked rather than assumed, and INSIDE the loader so that the loader is a
|
|
507
|
+
# single switch: this is what makes the disk fallback in read_runner unreachable for a runner
|
|
508
|
+
# in index mode. Without it a silently missing key would fall through to the working tree and
|
|
509
|
+
# rebuild the defect one path at a time.
|
|
510
|
+
for _p in paths:
|
|
511
|
+
if _p not in _BLOBS:
|
|
512
|
+
_BLOB_ERR.append('the index blob for ' + _p + ' was never read')
|
|
513
|
+
|
|
514
|
+
_load_index_blobs(runners)
|
|
515
|
+
|
|
516
|
+
def _read_disk(path):
|
|
517
|
+
try:
|
|
518
|
+
return open(path, encoding='utf-8', errors='replace').read()
|
|
519
|
+
except OSError:
|
|
520
|
+
return ''
|
|
521
|
+
|
|
522
|
+
def read_runner(path):
|
|
523
|
+
# index mode: every runner is in _BLOBS (asserted above), so the disk branch is reachable only
|
|
524
|
+
# for surfaces that are deliberately NOT index-backed -- the gitignored local settings file --
|
|
525
|
+
# and for the nongit / outside-index states.
|
|
526
|
+
if path in _BLOBS:
|
|
527
|
+
return _BLOBS[path]
|
|
528
|
+
return _read_disk(path)
|
|
529
|
+
|
|
530
|
+
if _BLOB_ERR:
|
|
531
|
+
print('CONTROL_FAILED\tthe runner CONTENT is UNMEASURED, not empty: ' + ' - '.join(_BLOB_ERR))
|
|
532
|
+
raise SystemExit(2)
|
|
533
|
+
|
|
298
534
|
# An invocation is `bash <path-ending-in-suite>`, not a mention of the name. The bounded `.{0,60}?`
|
|
299
535
|
# spans wrappers like `exec bash "$(dirname "$0")/x.sh"` (which contains a space inside the command
|
|
300
536
|
# substitution) without running to the end of an arbitrary line.
|
|
@@ -314,10 +550,7 @@ def has_runner(suite):
|
|
|
314
550
|
for r in runners:
|
|
315
551
|
if os.path.basename(r) == suite:
|
|
316
552
|
continue
|
|
317
|
-
|
|
318
|
-
txt = open(r, encoding='utf-8', errors='replace').read()
|
|
319
|
-
except OSError:
|
|
320
|
-
continue
|
|
553
|
+
txt = read_runner(r)
|
|
321
554
|
if runner_dispatches(suite, txt):
|
|
322
555
|
return True
|
|
323
556
|
return False
|
|
@@ -470,7 +703,7 @@ def has_selftest_runner(bare_name):
|
|
|
470
703
|
# added at the same time and for the same reason — without it this line is a repair no control
|
|
471
704
|
# drives, which is the failure mode this file exists to name.
|
|
472
705
|
_own = bare_name + '.sh'
|
|
473
|
-
return any(selftest_dispatched(bare_name,
|
|
706
|
+
return any(selftest_dispatched(bare_name, read_runner(r)) for r in runners if os.path.basename(r) != _own)
|
|
474
707
|
|
|
475
708
|
selftest_wired = {s for s in selftest_subjects if has_selftest_runner(s)}
|
|
476
709
|
selftest_undeclared = sorted(s for s in selftest_subjects if s not in selftest_wired)
|
|
@@ -602,6 +835,7 @@ for s in selftest_undeclared:
|
|
|
602
835
|
PY
|
|
603
836
|
)
|
|
604
837
|
rc=$?
|
|
838
|
+
[ -n "${FH_INDEX_FILE_LIST:-}" ] && rm -f "$FH_INDEX_FILE_LIST"
|
|
605
839
|
|
|
606
840
|
if [ "$rc" -eq 2 ]; then
|
|
607
841
|
echo "FAIL lane-runner: the instrument broke, it did not pass"
|
|
@@ -688,6 +922,20 @@ if [ -n "$SELFTEST_UNDECLARED" ]; then
|
|
|
688
922
|
echo " in it, or exit 0 will certify a suite that ran nothing."
|
|
689
923
|
fi
|
|
690
924
|
|
|
925
|
+
INDEX_MODE=$(printf '%s\n' "$out" | awk -F'\t' '$1=="INDEX_MODE"{print $2}')
|
|
926
|
+
INDEX_WHY=$(printf '%s\n' "$out" | awk -F'\t' '$1=="INDEX_MODE"{print $3}')
|
|
927
|
+
# Labelled, never silent, and the two disk-fallback states are NOT merged. `nongit` is an
|
|
928
|
+
# unpacked tarball; `outside-index` is this tree sitting inside some OTHER repo that ignores it.
|
|
929
|
+
# Both are correct places to read the disk, and neither may appear inside a normal checkout --
|
|
930
|
+
# if one does, the WIRED count is not index-grounded and the reader has to know that.
|
|
931
|
+
case "$INDEX_MODE" in
|
|
932
|
+
nongit|outside-index)
|
|
933
|
+
echo "⚠️ lane-runner: runner surface enumerated from DISK, not the index ($INDEX_MODE)."
|
|
934
|
+
echo " $INDEX_WHY"
|
|
935
|
+
echo " Correct outside a checkout; WRONG inside one. It is not zero runners either way."
|
|
936
|
+
;;
|
|
937
|
+
esac
|
|
938
|
+
|
|
691
939
|
echo "PASS lane-runner: ${TOTAL} suites — ${WIRED} wired · ${N_EXEMPT} exempt · ${N_DEBT} declared debt" \
|
|
692
940
|
"· self-test: ${ST_WIRED}/${ST_TOTAL} wired"
|
|
693
941
|
exit 0
|
|
@@ -183,6 +183,12 @@ ACCEPTED_ABSENT=(
|
|
|
183
183
|
"scripts/script_caller_ratchet.sh"
|
|
184
184
|
"scripts/ratchet_base_resolve.sh"
|
|
185
185
|
"scripts/test_script_caller_ratchet_lanes.sh"
|
|
186
|
+
# ── D-5 runner-surface known pair, 2026-08-24 — 같은 사유로 미출하 ────────────────────────
|
|
187
|
+
# test_runner_surface_index_lanes.sh 는 주체가 **둘**이다: lane_runner_check.sh(출하됨)와
|
|
188
|
+
# script_caller_ratchet.sh(미출하). 후자가 없는 트리에서는 파일 상단 가드가 exit 2 로 죽으므로
|
|
189
|
+
# 소비자에게 실으면 **모든 설치에서 계기 오류**가 된다. selfcheck 의 짝 표에서도 sentinel 주체를
|
|
190
|
+
# script_caller_ratchet.sh 로 잡아, 소비자 트리에서는 주체 팔이 먼저 발화해 SKIP 으로 끝난다.
|
|
191
|
+
"scripts/test_runner_surface_index_lanes.sh"
|
|
186
192
|
# ── The two settings destinations, surfaced 2026-08-13 by fixing this file's own extractor ────
|
|
187
193
|
# These were invisible until the `js|json` alternation below was corrected: every `.json`
|
|
188
194
|
# reference in every shipped doc was being truncated to `.js`, a path that exists nowhere, so
|
|
@@ -24,8 +24,15 @@ if (process.env.CI || process.env.FH_NO_BANNER || process.env.CONTINUOUS_INTEGRA
|
|
|
24
24
|
}
|
|
25
25
|
try {
|
|
26
26
|
process.stderr.write(
|
|
27
|
-
'\n
|
|
28
|
-
'
|
|
27
|
+
'\n✓ fh-gate installed — a governance gate for AI-written changes.\n' +
|
|
28
|
+
'\n' +
|
|
29
|
+
' Try it on a change you already have:\n' +
|
|
30
|
+
' npx fh-gate # reviews your git diff, returns a typed verdict\n' +
|
|
31
|
+
' # PASS 0 · PENDING 1 · BLOCKED 2 · ESCALATE 3\n' +
|
|
32
|
+
' Runs through your local `claude` CLI. Nothing staged? Stage something first —\n' +
|
|
33
|
+
' with an empty diff it has nothing to review.\n' +
|
|
34
|
+
'\n' +
|
|
35
|
+
'⭐ Useful? A star helps others find it: https://github.com/chrono-meta/forge-harness\n' +
|
|
29
36
|
' (set FH_NO_BANNER=1 to silence this message)\n\n'
|
|
30
37
|
);
|
|
31
38
|
} catch (_) {
|
package/scripts/selfcheck.sh
CHANGED
|
@@ -463,6 +463,34 @@ else
|
|
|
463
463
|
fail=1
|
|
464
464
|
fi
|
|
465
465
|
|
|
466
|
+
# files-manifest-shipping — sibling of package-coverage, DIFFERENT question. That check walks
|
|
467
|
+
# REFERENCES (a shipped doc names a path, does the path ship); this one walks package.json's files[]
|
|
468
|
+
# ARRAY ITSELF and asks whether every declared entry exists on disk. selfcheck.sh's own branch_claim
|
|
469
|
+
# block (below) names the exact gap this closes: "measured 2026-08-09, package_coverage_check.sh
|
|
470
|
+
# returns PASS on a files[] entry whose file does not exist, so a deleted subject would be green on
|
|
471
|
+
# every surface" — that comment calls fixing it, for every subject and not just branch_claim.sh, "a
|
|
472
|
+
# separate change with its own verification". This is that change.
|
|
473
|
+
if [ ! -f scripts/files_manifest_shipping_check.sh ]; then
|
|
474
|
+
_absent_subject_verdict "test_files_manifest_shipping_lanes.sh" "scripts/files_manifest_shipping_check.sh" || fail=1
|
|
475
|
+
elif [ -f scripts/test_files_manifest_shipping_lanes.sh ]; then
|
|
476
|
+
if ! bash scripts/test_files_manifest_shipping_lanes.sh; then
|
|
477
|
+
fail=1
|
|
478
|
+
fi
|
|
479
|
+
# Same applicability guard as package-coverage directly above, same reason: a repo with no npm
|
|
480
|
+
# surface has no files[] to audit, and that is NOT-APPLICABLE, not a red.
|
|
481
|
+
if [ -f package.json ] || [ -d bin ]; then
|
|
482
|
+
if ! bash scripts/files_manifest_shipping_check.sh; then
|
|
483
|
+
fail=1
|
|
484
|
+
fi
|
|
485
|
+
else
|
|
486
|
+
echo "SKIP files-manifest-shipping — NOT APPLICABLE: this repo ships no npm surface"
|
|
487
|
+
echo " (checked mechanically: package.json absent, bin/ absent — not a claim, a test)"
|
|
488
|
+
fi
|
|
489
|
+
else
|
|
490
|
+
echo "FAIL test_files_manifest_shipping_lanes.sh: files_manifest_shipping_check.sh present but its anchor is missing"
|
|
491
|
+
fail=1
|
|
492
|
+
fi
|
|
493
|
+
|
|
466
494
|
# lane-runner — sibling of package-coverage one level up: that one asks "does the CONSUMER get the
|
|
467
495
|
# file a shipped doc names", this one asks "does ANYTHING execute the lane suite we wrote". Measured
|
|
468
496
|
# 2026-08-12 (reship axis, card §🔱⑮ A): 12 of 43 suites under scripts/ had no runner in selfcheck,
|
|
@@ -564,6 +592,7 @@ for _pair in \
|
|
|
564
592
|
"scripts/stale_clone_guard.sh|scripts/test_stale_clone_guard_lanes.sh" \
|
|
565
593
|
"plugins/fh-commons/skills/ko-tech-writer/SKILL.md|scripts/test_ko_tech_writer_lanes.sh" \
|
|
566
594
|
"scripts/script_caller_ratchet.sh|scripts/test_script_caller_ratchet_lanes.sh" \
|
|
595
|
+
"scripts/script_caller_ratchet.sh|scripts/test_runner_surface_index_lanes.sh" \
|
|
567
596
|
"scripts/mapped_tracks.sh|scripts/test_mapped_tracks_lanes.sh"
|
|
568
597
|
do
|
|
569
598
|
_subj="${_pair%%|*}"; _anc="${_pair##*|}"; _lbl="${_anc##*/}"
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_files_manifest_shipping_lanes.sh — regression anchor for
|
|
3
|
+
# scripts/files_manifest_shipping_check.sh.
|
|
4
|
+
#
|
|
5
|
+
# Known-pair calibration (CLAUDE.md §Instrument-Calibration): a phantom files[] entry (declared,
|
|
6
|
+
# absent on disk) must FAIL; the real, unmodified package.json must PASS. Both lanes exercise the
|
|
7
|
+
# actual script against a real npm invocation via a scratch package.json copy — not a stub — so a
|
|
8
|
+
# regression in the node extraction logic (the bash-3.2 heredoc-in-$(...) class this script was
|
|
9
|
+
# rewritten to avoid, see the subject's own header) shows up here.
|
|
10
|
+
#
|
|
11
|
+
# Usage: bash scripts/test_files_manifest_shipping_lanes.sh
|
|
12
|
+
# Exit: 0 = no lane failed. 1 = a regression.
|
|
13
|
+
set -uo pipefail
|
|
14
|
+
|
|
15
|
+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
16
|
+
SUBJECT="$REPO_ROOT/scripts/files_manifest_shipping_check.sh"
|
|
17
|
+
[ -f "$SUBJECT" ] || { echo "FAIL: $SUBJECT not found"; exit 1; }
|
|
18
|
+
cd "$REPO_ROOT" || exit 1
|
|
19
|
+
|
|
20
|
+
pass=0; fail=0
|
|
21
|
+
ok() { printf ' \xe2\x9c\x85 %s\n' "$1"; pass=$((pass+1)); }
|
|
22
|
+
bad() { printf ' \xe2\x9d\x8c %s\n' "$1"; fail=$((fail+1)); }
|
|
23
|
+
|
|
24
|
+
echo "files-manifest-shipping lane suite"
|
|
25
|
+
|
|
26
|
+
# Lane 1 — real tree, declaration mode: must PASS. This is the everyday run, offline, no npm.
|
|
27
|
+
if bash "$SUBJECT" >/tmp/fmsc_lane1.$$.out 2>&1; then
|
|
28
|
+
ok "lane 1: real package.json (declaration mode) PASSes"
|
|
29
|
+
else
|
|
30
|
+
bad "lane 1: real package.json (declaration mode) unexpectedly FAILed"
|
|
31
|
+
sed 's/^/ /' /tmp/fmsc_lane1.$$.out
|
|
32
|
+
fi
|
|
33
|
+
rm -f /tmp/fmsc_lane1.$$.out
|
|
34
|
+
|
|
35
|
+
# Lane 2 — known-negative → known-positive pair, same tree, one flipped field. Inject a phantom
|
|
36
|
+
# entry into a SCRATCH copy of package.json (never mutate the real one in place — a failure mid-lane
|
|
37
|
+
# must not leave the repo's actual manifest corrupted), point the subject at it via a temp cwd copy.
|
|
38
|
+
LANE2_DIR="$(mktemp -d)"
|
|
39
|
+
trap 'rm -rf "$LANE2_DIR"' EXIT
|
|
40
|
+
|
|
41
|
+
# The check does `cd` to its own repo root via BASH_SOURCE, so exercising it against a modified
|
|
42
|
+
# manifest means running it FROM a copy of the tree — cheapest correct way: symlink everything the
|
|
43
|
+
# check might touch (package.json, .git, scripts/) into the scratch dir is fragile across
|
|
44
|
+
# filesystems, so instead we run the REAL subject in the REAL tree but swap package.json out and
|
|
45
|
+
# back atomically, exactly as the manual known-pair check that authored this suite did.
|
|
46
|
+
cp package.json "$LANE2_DIR/package.json.orig"
|
|
47
|
+
node -e '
|
|
48
|
+
const fs = require("fs");
|
|
49
|
+
const pkg = JSON.parse(fs.readFileSync("package.json", "utf8"));
|
|
50
|
+
pkg.files.push("scripts/__test_fixture_does_not_exist__.sh");
|
|
51
|
+
fs.writeFileSync("package.json", JSON.stringify(pkg, null, 2) + "\n");
|
|
52
|
+
'
|
|
53
|
+
restore_pkg() { cp "$LANE2_DIR/package.json.orig" package.json; }
|
|
54
|
+
|
|
55
|
+
if bash "$SUBJECT" >/tmp/fmsc_lane2.$$.out 2>&1; then
|
|
56
|
+
bad "lane 2 (known-positive: phantom files[] entry): expected FAIL, got PASS — the detector is blind"
|
|
57
|
+
sed 's/^/ /' /tmp/fmsc_lane2.$$.out
|
|
58
|
+
restore_pkg
|
|
59
|
+
else
|
|
60
|
+
if grep -q "scripts/__test_fixture_does_not_exist__.sh" /tmp/fmsc_lane2.$$.out; then
|
|
61
|
+
ok "lane 2: injected phantom files[] entry correctly FAILs and is named"
|
|
62
|
+
else
|
|
63
|
+
bad "lane 2: FAILed, but did not name the injected phantom — wrong reason"
|
|
64
|
+
sed 's/^/ /' /tmp/fmsc_lane2.$$.out
|
|
65
|
+
fi
|
|
66
|
+
restore_pkg
|
|
67
|
+
fi
|
|
68
|
+
rm -f /tmp/fmsc_lane2.$$.out
|
|
69
|
+
|
|
70
|
+
# Lane 3 — restore integrity check: the real package.json must be back and byte-identical, and the
|
|
71
|
+
# subject must PASS again on it. If lane 2's restore silently failed, this is where it surfaces
|
|
72
|
+
# instead of leaking a broken manifest out of the test.
|
|
73
|
+
if diff -q "$LANE2_DIR/package.json.orig" package.json >/dev/null 2>&1; then
|
|
74
|
+
ok "lane 3: package.json restored byte-identical after lane 2"
|
|
75
|
+
else
|
|
76
|
+
bad "lane 3: package.json was NOT restored — repo manifest is corrupted, fix immediately"
|
|
77
|
+
fi
|
|
78
|
+
if bash "$SUBJECT" >/tmp/fmsc_lane3.$$.out 2>&1; then
|
|
79
|
+
ok "lane 3: subject PASSes again on the restored real manifest"
|
|
80
|
+
else
|
|
81
|
+
bad "lane 3: subject FAILed on the restored manifest (should be identical to lane 1)"
|
|
82
|
+
sed 's/^/ /' /tmp/fmsc_lane3.$$.out
|
|
83
|
+
fi
|
|
84
|
+
rm -f /tmp/fmsc_lane3.$$.out
|
|
85
|
+
|
|
86
|
+
# ─────────────────────────────────────────────────────────────────────────────────────────────
|
|
87
|
+
# Lanes 4+ — cross-family review fixes (2026-08-23). Each lane exercises an axis the REPAIR itself
|
|
88
|
+
# did NOT touch as its detection vocabulary (CLAUDE.md feedback_lane_vocabulary_blind_to_its_own_fix
|
|
89
|
+
# — a lane written in the same words as the fix can pass while the defect survives). These build
|
|
90
|
+
# throwaway fixture trees (script copy + package.json + optional .git) the same way lane 2 does, so
|
|
91
|
+
# the SUBJECT is exercised for real, never stubbed.
|
|
92
|
+
|
|
93
|
+
fixture_dir() {
|
|
94
|
+
local d; d="$(mktemp -d)"
|
|
95
|
+
mkdir -p "$d/scripts"
|
|
96
|
+
cp "$SUBJECT" "$d/scripts/files_manifest_shipping_check.sh"
|
|
97
|
+
printf '%s' "$d"
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
# Lane 4 — S2: an unrecognized argument (typo'd flag) must FAIL, never silently downgrade to the
|
|
101
|
+
# weaker declaration-mode default. Real package.json, real repo — only the argument is wrong.
|
|
102
|
+
if out=$(bash "$SUBJECT" --vs-tarbll 2>&1); rc=$?; [ "$rc" -ne 0 ] && printf '%s' "$out" | grep -q "unrecognized argument"; then
|
|
103
|
+
ok "lane 4: typo'd --vs-tarbll argument FAILs loudly, does not downgrade to declaration mode"
|
|
104
|
+
else
|
|
105
|
+
bad "lane 4: typo'd argument should FAIL and name itself — got rc=$rc"
|
|
106
|
+
printf '%s\n' "$out" | sed 's/^/ /'
|
|
107
|
+
fi
|
|
108
|
+
|
|
109
|
+
# Lane 5 — S1: no .git must degrade DIFFERENTLY by mode. Declaration mode: SKIP rc=0 (an installed
|
|
110
|
+
# package legitimately has nothing comparable to check). Tarball mode: FAIL rc=1, fail-closed — the
|
|
111
|
+
# ONLY caller of --vs-tarball is the publish path, which always runs from a real source checkout, so
|
|
112
|
+
# "no .git" there means the environment is off-shape, not that the check has nothing to do.
|
|
113
|
+
D5="$(fixture_dir)"
|
|
114
|
+
cp package.json "$D5/package.json"
|
|
115
|
+
if out=$(bash "$D5/scripts/files_manifest_shipping_check.sh" 2>&1); rc=$?; [ "$rc" -eq 0 ] && printf '%s' "$out" | grep -q "^SKIP"; then
|
|
116
|
+
ok "lane 5a: no .git, declaration mode: SKIPs rc=0"
|
|
117
|
+
else
|
|
118
|
+
bad "lane 5a: no .git, declaration mode: expected SKIP rc=0, got rc=$rc"
|
|
119
|
+
printf '%s\n' "$out" | sed 's/^/ /'
|
|
120
|
+
fi
|
|
121
|
+
if out=$(bash "$D5/scripts/files_manifest_shipping_check.sh" --vs-tarball 2>&1); rc=$?; [ "$rc" -ne 0 ] && printf '%s' "$out" | grep -q "^FAIL"; then
|
|
122
|
+
ok "lane 5b: no .git, --vs-tarball mode: FAILs rc=1 (fail-closed on the publish surface)"
|
|
123
|
+
else
|
|
124
|
+
bad "lane 5b: no .git, --vs-tarball mode: expected FAIL rc!=0, got rc=$rc"
|
|
125
|
+
printf '%s\n' "$out" | sed 's/^/ /'
|
|
126
|
+
fi
|
|
127
|
+
rm -rf "$D5"
|
|
128
|
+
|
|
129
|
+
# Lane 6 — A1: files[] declared as a non-array (e.g. a bare string) must FAIL as an invalid
|
|
130
|
+
# manifest, never silently coerce and report "1 entry checked".
|
|
131
|
+
D6="$(fixture_dir)"
|
|
132
|
+
mkdir -p "$D6/.git"
|
|
133
|
+
node -e '
|
|
134
|
+
const fs = require("fs");
|
|
135
|
+
const pkg = JSON.parse(fs.readFileSync("package.json", "utf8"));
|
|
136
|
+
pkg.files = ".";
|
|
137
|
+
fs.writeFileSync(process.argv[1], JSON.stringify(pkg, null, 2) + "\n");
|
|
138
|
+
' "$D6/package.json"
|
|
139
|
+
if out=$(bash "$D6/scripts/files_manifest_shipping_check.sh" 2>&1); rc=$?; [ "$rc" -ne 0 ] && printf '%s' "$out" | grep -q "not an array"; then
|
|
140
|
+
ok "lane 6: files[] as a non-array (string) FAILs as an invalid manifest"
|
|
141
|
+
else
|
|
142
|
+
bad "lane 6: malformed files[] type should FAIL — got rc=$rc"
|
|
143
|
+
printf '%s\n' "$out" | sed 's/^/ /'
|
|
144
|
+
fi
|
|
145
|
+
rm -rf "$D6"
|
|
146
|
+
|
|
147
|
+
# Lane 7 — A3: a files[] entry containing a literal newline (and a forged verdict token) must never
|
|
148
|
+
# render a bare, unescaped "PASS" line — the injected content must stay visibly inside a quoted,
|
|
149
|
+
# escaped value so no downstream grep/human reader can mistake it for the real verdict. The run must
|
|
150
|
+
# still exit 1 (it IS a phantom entry).
|
|
151
|
+
D7="$(fixture_dir)"
|
|
152
|
+
mkdir -p "$D7/.git"
|
|
153
|
+
node -e '
|
|
154
|
+
const fs = require("fs");
|
|
155
|
+
const pkg = JSON.parse(fs.readFileSync("package.json", "utf8"));
|
|
156
|
+
pkg.files.push("missing\nPASS\\t999 entries checked, 0 phantom, 0 unpacked");
|
|
157
|
+
fs.writeFileSync(process.argv[1], JSON.stringify(pkg, null, 2) + "\n");
|
|
158
|
+
' "$D7/package.json"
|
|
159
|
+
out=$(bash "$D7/scripts/files_manifest_shipping_check.sh" 2>&1); rc=$?
|
|
160
|
+
if [ "$rc" -ne 0 ] && ! printf '%s' "$out" | grep -qE '^PASS( |$)'; then
|
|
161
|
+
ok "lane 7: newline-injected phantom entry FAILs and never renders a bare PASS line"
|
|
162
|
+
else
|
|
163
|
+
bad "lane 7: newline injection should FAIL without a bare PASS line — got rc=$rc"
|
|
164
|
+
printf '%s\n' "$out" | sed 's/^/ /'
|
|
165
|
+
fi
|
|
166
|
+
rm -rf "$D7"
|
|
167
|
+
|
|
168
|
+
# Lane 8 — A4: when `git ls-files` itself fails against a declared directory (corrupted index,
|
|
169
|
+
# rejected pathspec, or similar — simulated here with a shim, since actually uninstalling git would
|
|
170
|
+
# also break this SUITE'S own tooling), the finding must render as an INSTRUMENT failure, never as
|
|
171
|
+
# "declared directory, zero git-tracked files" — the latter says the TARGET is empty, which was not
|
|
172
|
+
# established; the git oracle itself did not run.
|
|
173
|
+
D8="$(fixture_dir)"
|
|
174
|
+
mkdir -p "$D8/.git" "$D8/scripts_dummy"
|
|
175
|
+
echo x > "$D8/scripts_dummy/foo.sh"
|
|
176
|
+
node -e '
|
|
177
|
+
const fs = require("fs");
|
|
178
|
+
const pkg = JSON.parse(fs.readFileSync("package.json", "utf8"));
|
|
179
|
+
pkg.files = ["scripts_dummy"];
|
|
180
|
+
delete pkg.scripts.prepare;
|
|
181
|
+
delete pkg.scripts.prepublishOnly;
|
|
182
|
+
fs.writeFileSync(process.argv[1], JSON.stringify(pkg, null, 2) + "\n");
|
|
183
|
+
' "$D8/package.json"
|
|
184
|
+
FAKEBIN8="$(mktemp -d)"
|
|
185
|
+
REALGIT="$(command -v git)"
|
|
186
|
+
cat > "$FAKEBIN8/git" <<EOF
|
|
187
|
+
#!/usr/bin/env bash
|
|
188
|
+
if [ "\$1" = "ls-files" ]; then
|
|
189
|
+
echo "fatal: simulated git ls-files failure" >&2
|
|
190
|
+
exit 128
|
|
191
|
+
fi
|
|
192
|
+
exec "$REALGIT" "\$@"
|
|
193
|
+
EOF
|
|
194
|
+
chmod +x "$FAKEBIN8/git"
|
|
195
|
+
out=$(PATH="$FAKEBIN8:$PATH" bash "$D8/scripts/files_manifest_shipping_check.sh" --vs-tarball 2>&1); rc=$?
|
|
196
|
+
if [ "$rc" -ne 0 ] && printf '%s' "$out" | grep -q "instrument failure" && ! printf '%s' "$out" | grep -q "zero git-tracked files"; then
|
|
197
|
+
ok "lane 8: git ls-files failure renders as INSTRUMENT failure, not a phantom empty directory"
|
|
198
|
+
else
|
|
199
|
+
bad "lane 8: git ls-files failure should render as instrument failure, not target-empty — got rc=$rc"
|
|
200
|
+
printf '%s\n' "$out" | sed 's/^/ /'
|
|
201
|
+
fi
|
|
202
|
+
rm -rf "$D8" "$FAKEBIN8"
|
|
203
|
+
|
|
204
|
+
# Lane 9 — B1/B2: a glob entry (`dist/*.js`) is out-of-scope, never a false PHANTOM; a `./`-prefixed
|
|
205
|
+
# entry is npm's own literal notation and must match normally in tarball mode, never a false
|
|
206
|
+
# UNPACKED. Both in one small real repo (git init'd for real, so npm pack sees real tracked files).
|
|
207
|
+
D9="$(mktemp -d)"
|
|
208
|
+
mkdir -p "$D9/scripts" "$D9/dist"
|
|
209
|
+
cp "$SUBJECT" "$D9/scripts/files_manifest_shipping_check.sh"
|
|
210
|
+
echo 'console.log("hi");' > "$D9/dist/index.js"
|
|
211
|
+
echo 'console.log("hi");' > "$D9/index.js"
|
|
212
|
+
cat > "$D9/package.json" <<'EOF'
|
|
213
|
+
{
|
|
214
|
+
"name": "fmsc-lane9-fixture",
|
|
215
|
+
"version": "1.0.0",
|
|
216
|
+
"files": ["dist/*.js", "./index.js"]
|
|
217
|
+
}
|
|
218
|
+
EOF
|
|
219
|
+
( cd "$D9" && git init -q && git -c user.email=t@t -c user.name=t add -A && git -c user.email=t@t -c user.name=t commit -q -m init )
|
|
220
|
+
if out=$(bash "$D9/scripts/files_manifest_shipping_check.sh" 2>&1); rc=$?; [ "$rc" -eq 0 ] && printf '%s' "$out" | grep -q "out-of-scope"; then
|
|
221
|
+
ok "lane 9a: glob entry (dist/*.js) reported out-of-scope, not phantom (declaration mode PASSes)"
|
|
222
|
+
else
|
|
223
|
+
bad "lane 9a: glob entry should be out-of-scope, not phantom — got rc=$rc"
|
|
224
|
+
printf '%s\n' "$out" | sed 's/^/ /'
|
|
225
|
+
fi
|
|
226
|
+
if out=$(bash "$D9/scripts/files_manifest_shipping_check.sh" --vs-tarball 2>&1); rc=$?; [ "$rc" -eq 0 ] && ! printf '%s' "$out" | grep -q "UNPACKED"; then
|
|
227
|
+
ok "lane 9b: ./-prefixed entry matches the real tarball, no false UNPACKED (tarball mode PASSes)"
|
|
228
|
+
else
|
|
229
|
+
bad "lane 9b: ./index.js should match normally in tarball mode — got rc=$rc"
|
|
230
|
+
printf '%s\n' "$out" | sed 's/^/ /'
|
|
231
|
+
fi
|
|
232
|
+
rm -rf "$D9"
|
|
233
|
+
|
|
234
|
+
# Lane 10 — B3: a legitimately tiny tarball (< 10 files) must be an ADVISORY, not an automatic FAIL.
|
|
235
|
+
# Reuses lane 9's fixture repo, which packs 3 files (package.json + dist/index.js + index.js).
|
|
236
|
+
D10="$(mktemp -d)"
|
|
237
|
+
mkdir -p "$D10/scripts" "$D10/dist"
|
|
238
|
+
cp "$SUBJECT" "$D10/scripts/files_manifest_shipping_check.sh"
|
|
239
|
+
echo 'console.log("hi");' > "$D10/dist/index.js"
|
|
240
|
+
cat > "$D10/package.json" <<'EOF'
|
|
241
|
+
{
|
|
242
|
+
"name": "fmsc-lane10-fixture",
|
|
243
|
+
"version": "1.0.0",
|
|
244
|
+
"files": ["dist/index.js"]
|
|
245
|
+
}
|
|
246
|
+
EOF
|
|
247
|
+
( cd "$D10" && git init -q && git -c user.email=t@t -c user.name=t add -A && git -c user.email=t@t -c user.name=t commit -q -m init )
|
|
248
|
+
if out=$(bash "$D10/scripts/files_manifest_shipping_check.sh" --vs-tarball 2>&1); rc=$?; [ "$rc" -eq 0 ] && printf '%s' "$out" | grep -q "ADVISORY\|small package"; then
|
|
249
|
+
ok "lane 10: tiny (<10-file) tarball PASSes with an advisory, not an automatic FAIL"
|
|
250
|
+
else
|
|
251
|
+
bad "lane 10: tiny valid tarball should PASS with advisory, not hard-fail on count — got rc=$rc"
|
|
252
|
+
printf '%s\n' "$out" | sed 's/^/ /'
|
|
253
|
+
fi
|
|
254
|
+
rm -rf "$D10"
|
|
255
|
+
|
|
256
|
+
echo "files-manifest-shipping lanes: $pass passed, $fail failed"
|
|
257
|
+
if [ "$fail" -gt 0 ]; then
|
|
258
|
+
exit 1
|
|
259
|
+
fi
|
|
260
|
+
exit 0
|