status: (未 review)
実測 fixture: scripts/build-daily-banner.ts の hasStep2124AntihydraReversalPreRegBFire activator regex に:
Syracuse.*+1.*抜き.*撤回
を 含めた。 これ は JavaScript regex で 「Nothing to repeat」 error (invalid): + は 単独 quantifier で、 .* の 直後 に literal + を 置く と 「量指定子 の 直後 に 量指定子」 と 解釈される。 正解 は Syracuse.*\+1.*抜き.*撤回 (\+ escape)。
Symptom: tsx runtime は parse-error recovery で 該当 regex を skip、 data/daily-banner.json は 生成 されるが 該当 pill が false = 「script は exit 0 で 呼吸してる が pill 判定 は 静かに false」 pattern (STEP 1610 candidate F distinction green-washing pathology 同型)。
Timeline:
ee5c6508c push (broken regex 含む)node -e "new RegExp('...')" で SyntaxError verify*+ → \+) + commit f7850fc76 + pushscripts/verify-daily-banner-regexes.tsTypeScript Compiler API 経由 の regex literal enumeration + V8 compile 検証:
ts.createSourceFile + ts.forEachChild visitor で file 内 の ts.SyntaxKind.RegularExpressionLiteral node を 全件 enumeratetext を /pattern/flags shape に parse → new RegExp(pattern, flags) で V8 に 再 compilefailures[] に 追加 (line + column + pattern preview + V8 message)0 = 全 valid / 1 = invalid あり / 2 = file 未読 or AST parse 失敗--json mode = machine-readable output ({target, total, passed, failed, failures[]})--target <path> = 任意 file 指定 (test fixture + 未来 別 file 拡張用)test/step2134-verify-daily-banner-regexes-test.ts| Test | 検証内容 | Verdict |
|---|---|---|
| T1 | STEP 2124 replay fixture (Syracuse.*+1) → exit 1 + stderr に「Nothing to repeat」 or 「Invalid regular」 hit | 2 assertions PASS |
| T2 | Valid-only fixture (Syracuse.*\+1) → exit 0 + stdout 「0 invalid」 | 2 assertions PASS |
| T3 | Edge-case (character class 内 escaped /) → exit 0 (誤検出なし) | 1 assertion PASS |
| T4 | Production build-daily-banner.ts (79 regex) → exit 0 + 「0 invalid」 | 2 assertions PASS |
| T5 | Non-existent target → exit 2 | 1 assertion PASS |
| T6 | --json mode → parseable JSON with failures[] 構造 verify (failed count + passed count + error message pattern) | 4 assertions PASS |
.githooks/pre-commit Section 10scripts/build-daily-banner.ts が staged (diff-filter=ACM) の 時 のみ 発火:
if [ "${SKIP_DAILY_BANNER_REGEX_CHECK:-0}" != "1" ]; then
bdb_staged=$(git diff --cached --name-only --diff-filter=ACM 2>/dev/null \
| grep -E '^scripts/build-daily-banner\.ts$' || true)
if [ -n "$bdb_staged" ]; then
echo "[pre-commit] (daily-banner-regex) build-daily-banner.ts staged → running verifier"
if npx tsx "$repo_root/scripts/verify-daily-banner-regexes.ts" 2>&1; then
echo "[pre-commit] (daily-banner-regex) check: OK (all regex literals compile)"
else
echo "[pre-commit] (daily-banner-regex) ★ ABORT: invalid regex literal(s) in build-daily-banner.ts" >&2
echo "[pre-commit] (daily-banner-regex) fix the regex, or bypass with: SKIP_DAILY_BANNER_REGEX_CHECK=1 git commit ..." >&2
exit 1
fi
fi
fi
f4eabba5f):
[pre-commit] (daily-banner-regex) build-daily-banner.ts staged → running verifier [verify-daily-banner-regexes] target=scripts\build-daily-banner.ts [verify-daily-banner-regexes] checked 79 regex literals, 0 invalid [pre-commit] (daily-banner-regex) check: OK (all regex literals compile)
| Script | 用途 |
|---|---|
npm run verify:daily-banner-regexes | 単独走査 (CLI or CI) |
npm run test:step2134 | Self-test (6 test / 12 assertions) |
Bypass (edge case のみ、 default で は 使用 しない):
SKIP_DAILY_BANNER_REGEX_CHECK=1 git commit ...
| # | failure mode | 予防 |
|---|---|---|
| fm2134-1 | verifier 自身 の bootstrapping paradox (「verifier が 自身 の regex で silent failure」) | T4 で production 実 file を verify + T1-T3 で 既知 fixture の 期待動作 verify、 verifier 自身 は 最小 regex 使用 (^\/([\s\S]*)\/([gimsuy]*)$ のみ) |
| fm2134-2 | pre-commit hook が invalid regex に対して 誤って pass (false negative) | T1 で STEP 2124 実測 fixture (Syracuse.*+1) を replay、 exit 1 + stderr 「Nothing to repeat」 hit verify |
| fm2134-3 | edge-case regex (character class 内 escaped /) で verifier が 誤検出 (false positive) | T3 で edge-case fixture verify、 誤検出 なし |
| fm2134-4 | production build-daily-banner.ts に 追加 STEP activator が invalid | pre-commit hook Section 10 が 事前 catch (本 STEP の 本体) |
| fm2134-5 | semantic / match correctness は 本 gate の scope 外 = 別 layer 必要 | 明示外 = 別 STEP defer (E2E pill 発火 verify)、 未来 candidate registry に 記録 |