STEP 2171 · orphan-gauge v0.6 · 2026-09-21 · rei-aios-fe
chat-Claude Code review が 6 指摘 (D=cap再発防止、 #1=mtime食い違い、 B=recall未測、 C=参照抽出穴、 A=意図宣言軸、 感度分析)。 推奨順序 D→B→C→A の 第 1 段。 「20k→50k で 上げただけ」 の temporary bandage を、 cap 到達 = non-zero exit + partial 警告 + opt-in bypass に 昇格 (D)。 mtime axis 置換 は 未実施、 かわりに git commit ctime との 食い違い を 併記 (#1、 置換 判断は 量を 見てから の chat-Claude 推奨)。
7341dc2b6 → 本 site page (帰宅後 review 待ち status「(未 review)」)。 v0.5 (STEP 1954) は maxFiles 上限を 20,000 → 50,000 に 上げただけ で、 cap に 到達しても 沈黙 して 部分結果 を 返す 振る舞い は 残っていた。 呼び手 は「その 数字は 全 tree か partial か」 を 出力から 判別できず、 過去 measure が 全部 cap 前 だった 可能性 が 蓄積される。
v0.6 の 変更:
src/aios/orphan-gauge/collect.ts: cap 到達後 も walk を 継続 (SAFETY_CEILING=500,000)、 totalObserved は count し 続ける。 out への push だけ 停止。{artifacts, totalObserved, capHit} に 変更 (CollectResult)。 capHit = totalObserved > artifacts.length。scripts/orphan-gauge.ts: cap-hit 時 process.exit(1) + partial 警告 (「Coverage = X.X% — the tallies below are PARTIAL」)。--allow-cap-hit flag で 意図的 partial scan は opt-in 化 (exit 0)。$ npx tsx scripts/orphan-gauge.ts --targets src --limit 100 --skip-git-diff
→ exit 1 (cap hit, --allow-cap-hit 未指定)
$ npx tsx scripts/orphan-gauge.ts --targets src --limit 100 --allow-cap-hit --skip-git-diff
→ exit 0 (cap hit だが suppress)
$ npx tsx scripts/orphan-gauge.ts --targets src --limit 5000 --skip-git-diff
→ exit 0 (no cap, 2148 files 全 scan)
更新 axis は 従来 mtime に 頼っていた が、 git clone / git checkout / snapshot restore / bulk editor save で 中身は同じ のに mtime が 「今」 に reset される。 結果、 中身が 古い のに LIVE 判定 (誤 LIVE) や RUIN → LIVE 化 が 起きる。
v0.6 は mtime 定義の 置換 は 未実施 のまま (chat-Claude 推奨: 食い違いの 量を 見てから 判断)。 かわりに 併記診断:
src/aios/orphan-gauge/git-ctime.ts: git log --name-only --pretty=format:__COMMIT__%ct を 1 pass 走査、 tracked file 全 最新 commit ctime map を build。computeCtimeDivergences(artifacts, ctimeMap, minDivergenceDays=7): |mtime - ctime| が 閾値超え の 一覧、 両方向 (mtime>ctime = checkout reset, mtime<ctime = tar 保存) を 拾う。ctimeCoverage: tracked file 割合 出力 (untracked は skip、 0 として 扱わない)。--skip-git-diff + --ctime-days N flag。src/aios/invention/invention-engine.ts mtime=2026-08-20 vs ctime=2026-08-03)。 chat-Claude #1 の 懸念 が 本 repo で empirical evidence を 持つ = rebase / checkout / snapshot restore 由来 の mtime reset が 現在の LIVE/RUIN 判定 を 汚染 している 可能性 が 具体 case で 確認済。
| test set | count | domain |
|---|---|---|
| 既存 T1–T27 | ~50 | quadrant 分類 + consumption mode + tmp dir e2e (未変更 migrate) |
| 新 T-D01–T-D07 | 7 | cap-hit detection: 10 files + maxFiles=3 で artifacts=3 / totalObserved=10 / capHit=true、 no-cap で capHit=false、 gauge() propagation |
| 新 T-G01–T-G06 | 6 | git-ctime: 60d divergence 拾う、 2d 閾値以下 は 拾わない、 untracked は skip (0 で扱わない)、 100d 閾値 で 60d silence、 ctimeCoverage = 2/3、 空 input で 0 |
import "./foo") を 拾えない — C 待ち。 DEAD source からの ref も 1 count = entry-point reachability filter 未実装| 順 | STEP candidate | 内容 | status |
|---|---|---|---|
| 1 | D + #1 (本 STEP 2171) | cap-hit non-zero exit + mtime vs git-ctime diff 併記 | LANDED |
| 2 | v0.7 = B | fixture 4 case (拡張子省略 import / DEAD 源 ref / mtime 単独 reset / known-orphan) + baseline recall metric | defer |
| 3 | v0.8 = C | TS 拡張子省略 import 拾う regex + tsconfig alias + entry-point reachability filter、 完了後 n=50 監査 やり直し | defer |
| 4 | v0.9 = A | manifest / frontmatter で 保存意図 明示、 RUIN ∧ 宣言なし = 規律違反 flag | defer |
各 defer item は 藤本さん explicit go signal 待ち。 私 独断 起工 なし。
cap-hit を silent に 通す cli は 「その数字は 何の 数字か」 を 呼び手が 判別不能。 STEP 1926 v0.4 の 389 件 measure が 全部 cap 前 の partial だった 可能性 が 露見不能 のまま 蓄積、 v0.5 の 上限 引き上げ は temporary bandage で 根本予防 ではない。
cli の default は 「不完全 は 沈黙 しない」 = non-zero exit + 実 total 出力。 「意図的に partial で 良い」 use case は explicit flag で opt-in (--allow-cap-hit)。
過去 measure の cap-hit 疑い は --limit 500000 --allow-cap-hit で 再 scan し totalObserved を 過去 record と diff。 差 > 0 なら 過去 record は partial confirmed。
chat-Claude 推奨 B (recall fixture) は D 後 が 正しい 順序 = D で cap 起因 の measurement noise を 除去した baseline で recall を 測る。 逆順 は「recall が 下がったのは C の 副作用か cap 起因か」 分離不能。