Repository navigation
Closed
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "baseline_vc_preflight.py の classify_result() が rg exit_code==2 を無条件に human_judgment/unknown へ落とす問題を解消し、Allowed Paths 内の新規ファイル missing を厳密証明できる場合だけ決定論的な expected fail category として扱えるようにする"
change_kind: codeParent Issue
none
Parent Goal Ref
- Goal: 新規ファイル追加を伴う implementation Issue で issue-contract-review の status:go が構造的に発行できない問題を解消する
- Desired Destination: N/A(parent なし、単独改善)
Current Validated Scope
.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.pyのclassify_result()に、rg exit_code==2 を厳密条件下でのみ expected fail 化する分類ロジックを追加するclassify_result()の signature にallowed_pathsが渡っていない問題を解消する(signature 拡張、または post-execution 判定を呼び出し側に移す)_candidate_new_allowed_path_target()を_rg_has_broad_search_path()相当の argv parser へ置換する- stderr 判定に whitelist(missing path 系)と blacklist(invalid regex / unsupported option / config error / permission denied)の両方を実装する
- 対応するテストを
.claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.pyに追加する
Remaining Parent Gaps
なし
Outcome
.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py の classify_result() が更新され、rg が Allowed Paths 内の新規ファイル(未作成)に対して実行され exit_code 2 かつ stderr が missing path 系である場合にのみ expected_fail / go / 専用 category(new_file_missing_expected)を返し、.claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py に追加されたテストが全件 PASS している状態。invalid regex / unsupported option / permission error / Allowed Paths 外 path は従来通り blocked または human_judgment のままであることもテストで固定されている。この判定には allowed_paths が classify_result() の判定経路に確実に渡り、path operand 抽出は _rg_has_broad_search_path() 相当の成熟した argv parser で行われる。
In Scope
.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.pyのclassify_result()に、rg exit_code == 2 を「missing Allowed Paths file と厳密に証明できる場合」だけ新規 category(new_file_missing_expected)としてexpected_fail/goに分類するロジックを追加する- 判定条件を実装する: (1)
classify_static_command()を通過済み(static block されていない), (2) rg の path operand を安全な argv parser で抽出済みで missing と判定した path が全て normalized Allowed Paths 配下, (3) stderr が「対象 path が存在しない/読めない」系のパターンに限定され regex/config/option error でないこと classify_result()の signature を拡張する(例:allowed_paths: list[str],cwd: Path,static_policy_passed: bool等を追加する)か、または post-execution の分類判定を呼び出し側(main()等)に移し、allowed_paths_from_bodyと static classification 結果を判定に利用できるようにする。いずれの方針を採るかは実装時に選択し、AC として固定する_candidate_new_allowed_path_target()(現行.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.pyL1701-1739)を維持・統合はせず、_rg_has_broad_search_path()等で既に実装されている成熟した rg argv parser(-e/--regexp/--glob/--/複数path/value-taking-flags 対応)へ置換する。既存_candidate_new_allowed_path_target()は wrapper 化または削除する- stderr 判定に whitelist だけでなく blacklist を実装する: invalid regex / unsupported option / config error / permission denied を示す stderr が含まれる場合は
new_file_missing_expectedにしない - 新規 category
new_file_missing_expectedをcompute_confidence()の high confidence set に追加する - 上記変更に対応するテストを
.claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.pyに追加する
Out of Scope
allowed_paths_review_gate.pyの fingerprint 必須要件(別 Issue で扱う)- issue-contract-review の他の gate ロジック全般の見直し
- PR files API pagination 対応
Runtime Verification Applicability
- decision: not_applicable
- reason: 本 Issue の変更は
classify_result()の分類ロジックと対応する pytest ユニットテストのみで完結し、プロセス起動・外部通信・I/O は不要(pnpm typecheck/lint/test/buildと対象ファイルのpytestのみで検証が成立する)
Acceptance Criteria
- AC1: rg が Allowed Paths 内の単一の新規ファイル(未作成)に対して実行され exit_code 2 かつ stderr が missing path 系である場合、
classify_result()はexpected_fail/go/ 専用 category(new_file_missing_expected)を返す - AC2: rg の missing path のうち一つでも Allowed Paths 外の場合は、
blockedまたはhuman_judgmentのままであり、expected_failにならない - AC3: rg が invalid regex(例: 閉じていない括弧)で exit_code 2 を返す場合、
expected_failにならずhuman_judgmentまたはblockedのままである - AC4: rg が unsupported option(例: 存在しないフラグ)で exit_code 2 を返す場合、
expected_failにならずhuman_judgmentまたはblockedのままである - AC5: rg コマンドが
-e,--regexp,--glob,--, value-taking options, 複数 path を含む場合でも、path operand の抽出が誤判定しないことをテストで示す - AC6: 既存の
test -f/test -d/test -sのfile_not_found_expected分類が回帰しないことをテストで示す - AC7:
_candidate_new_allowed_path_target()を_rg_has_broad_search_path()相当の argv parser へ置換する実装が行われ、そのテストが追加されている(既存 helper は維持・統合の対象にしない) - AC8: 上記すべてのテストが
.claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.pyに追加され pass する - AC9:
classify_result()の判定経路にallowed_pathsが確実に渡ること(signature 拡張 または post-execution 判定への移行のいずれか)がテストで示され、allowed_pathsなしで stderr だけからnew_file_missing_expectedに分類されるケースが存在しないことがテストで固定されている - AC10: stderr に missing path 系のメッセージと invalid regex / unsupported option / config error / permission denied のいずれかが混在する場合、
new_file_missing_expectedに分類されないことをテストで示す - AC11:
new_file_missing_expectedcategory がcompute_confidence()の high confidence set に含まれることをテストで示す
Verification Commands
# AC1
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py
# AC2
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py
# AC3
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py
# AC4
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py
# AC5
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py
# AC6
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py
# AC7
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py
# AC8
$ pnpm typecheck
$ pnpm lint
$ pnpm test
$ pnpm build
# AC9
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py
# AC10
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py
# AC11
$ uv run --locked pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.pyAllowed Paths
- .claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py
- .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
なし
Scope Delta(任意)
N/A
Notes for Reviewer
- 参照: Issue 調査: baseline_vc_preflight rg exit2 判定と allowed_paths_review_gate fingerprint 必須要件の contract-review ブロック問題の対応方針を決定する #1324(research-only、方針決定), Issue 実装: UpgradeSystem で quote / atomic purchase / snapshot save を実装する #1281 / PR feat: add UpgradeSystem atomic purchase core (#1281) #1318(実例)
- 採用方針: rg exit2 は無条件に expected fail にしない。missing path が Allowed Paths 内の新規ファイルと厳密証明できる場合のみの極小特例。
allowed_paths_review_gate.pyの fingerprint 必須要件は本 Issue のスコープ外(別 Issue で扱う)。- 本文は Issue 実装: new-file VC preflight を missing Allowed Paths file として決定論的に分類する #1328 への OWNER anchor comment(要修正判定、ripgrep exit status 仕様・
classify_result()signature・_candidate_new_allowed_path_target()の argv parser 未成熟・stderr blacklist 欠如の 4 点指摘)を反映して更新した。classify_result()にallowed_pathsが渡っていない点と_rg_has_broad_search_path()への置換方針は codebase 調査(baseline_vc_preflight.pyL2067 以降 / L1701-1739)で技術的に確認済み。ripgrep の exit code 0/1/2(match / no-match / error)はローカルで実行確認済み。
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Activity
squne121 commentedon Jul 4, 2026
判定
要修正。#1328 の問題設定は正しいが、現 Issue 文のまま実装すると
rg exit 2の false-green を作る危険が残ります。#1328 は
baseline_vc_preflight.pyのclassify_result()がrg exit_code == 2をhuman_judgment/unknownに落とす問題を、Allowed Paths 内の新規ファイル missing と厳密証明できる場合だけexpected_fail/goにする Issue です。Issue コメントは現時点で 0 件です。今回確認した範囲は、#1328、関連 #1324 / #1281 / #1329、PR #1318、
baseline_vc_preflight.py、既存テスト、ripgrep 公式仕様、Python のshlex/ path 正規化仕様です。ローカルでのテスト実行はしていません。根本問題の整理
#1328 の前提は妥当です。現行
classify_result()はrgの no-match、つまりexit_code == 1だけをexpected_fail / expected_baseline_fail / goにし、rg exit_code == 2には専用分岐がありません。最終的にhuman_judgment / unknownに落ちます。一方、ripgrep 仕様上、exit status は「match あり = 0」「match なし = 1」「error = 2」です。さらに exit 2 は regex syntax error のような catastrophic error と、ファイルが読めない soft error の両方を含みます。したがって、
exit_code == 2を一括で expected fail にする実装は不可です。(Debian Manpages)PR #1318 はこの問題の実例です。#1281 では新規ファイル
src/systems/UpgradeSystem.ts等を対象にrg -n ...の baseline VC が多数定義されており、新規ファイル未作成時にrg exit 2になり得る構造でした。 PR #1318 側では最終的に実装・テスト・CI は通っていますが、review コメントではallowed_paths_gate: indeterminateが blocker とされ、fresh fingerprint binding がないため worker self-report を正本にできない、と fail-closed されています。P0 指摘
1.
classify_result()だけを直す設計だと Allowed Paths 判定に必要な情報が足りない現行
classify_result()の signature はexit_code, stdout, stderr, command, cwd, runner_env_deltaだけで、allowed_pathsを受け取りません。 実行ループでもclassify_result()呼び出しにallowed_paths_from_bodyは渡されていません。#1328 は「missing path がすべて normalized Allowed Paths 配下」という条件を要求していますが、今の
classify_result()単体ではそれを証明できません。実装方針は次のどちらかに固定すべきです。
classify_result(..., allowed_paths: list[str], cwd: Path, static_policy_passed: bool)のように signature を拡張するあるいは post-execution の分類を
main()側に寄せ、allowed_paths_from_bodyと static classification 結果を持った状態でrg exit 2特例を判定するIssue 文には「
classify_result()に追加」とありますが、このままだと実装者が allowed_paths なしで stderr だけを見て expected fail 化する余地があります。2.
_candidate_new_allowed_path_target()は今回の判定エンジンに使ってはいけない現行
_candidate_new_allowed_path_target()はtestなら非フラグ引数を全部候補、rgならargv[1:]の非 option を集めてnon_opt[1:]を path とみなします。 これはrg -e PATTERN PATH、--regexp=PATTERN、--glob GLOB、--、value-taking option、複数 path、pattern が-で始まるケースで誤判定します。一方、同じファイルには
_rg_has_broad_search_path()があり、-e/--regexp/--regexp=/-ePATTERN、--glob/--iglob、value-taking flags、--、combined short flags を考慮して path args を抽出しています。#1328 の AC7 は「維持 / 統合 / 置換のいずれか」としていますが、敵対的には 置換一択 です。既存 helper は strict mode の「baseline-expect 未記載検出」には使われていますが、post-execution の
rg exit 2をgoに昇格させる根拠としては弱すぎます。3. stderr 判定は whitelist + blacklist の両方が必要
rg exit 2の stderr が missing path 系であることだけでは不十分です。stderr に missing path と invalid regex / unsupported option / config error / permission denied が混在する可能性があります。ripgrep 仕様上、exit 2 は soft error と catastrophic error の両方を含むためです。(Debian Manpages)必要な分類条件は最低限これです。
exit_code == 2command basename が
rgclassify_static_command()が blocked を返していないpath operand が 1 個以上抽出できる
broad path ではない
stderr が missing path / cannot read target path 系に限定される
stderr に regex parse error、unsupported option、config parse error、permission denied が含まれない
missing と読める path がすべて Allowed Paths 内で、baseline cwd 上で未存在
stderr 内の missing path と argv path operands が対応している
「一部 path だけ Allowed Paths 内」「一部だけ missing」「stderr に複数 error が混在」は
expected_fail/goにしてはいけません。4. Allowed Paths containment は文字列 prefix だけでは弱い
現行 helper の
_in_allowed()はlstrip("./")とstartswith(a + "/")で判定しています。 これは..、絶対パス、symlink、Windows path 風入力、正規化前後の差分に弱いです。Python では
os.path.commonpath()が「有効な共通パス」を返す API で、文字列 prefix のcommonprefix()とは違います。(Python documentation) またPurePath.is_relative_to()は純粋に文字列ベースであり、..や symlink 解決をしない点に注意が必要です。(Python documentation)この Issue では、少なくとも次の方針を AC に入れるべきです。
repo root / cwd を基準に path を正規化する
absolute path は原則 reject
..で Allowed Paths 外へ抜ける path は rejectmissing file 自体は
resolve(strict=True)できないため、存在する親ディレクトリを基準に containment を判定する最終判定は
commonpath()相当で行い、単純 prefix だけにしない推奨実装仕様
#1328 は次のように仕様を硬くしたうえで実装開始するのが安全です。
_extract_rg_path_operands(argv)を追加し、_rg_has_broad_search_path()とnew_file_missing_expected判定の両方から使う。既存_candidate_new_allowed_path_target()は wrapper 化または削除する。rg exit 2特例は専用 helper に閉じ込める。戻り値 category は
expected_baseline_failに混ぜず、new_file_missing_expectedにする。既存 category に混ぜると、後で「no-match」と「new-file missing」の監査区別ができません。compute_confidence()の high confidence set にnew_file_missing_expectedを追加する。追加しないと contract-review fragment の confidence が low になり、別 gate で不要な揺れを生みます。allowed_paths_review_gate.pyの fingerprint fallback は触らない。これは 実装: issue-contract-review fingerprint refresh path を明示する #1329 の範囲であり、実装: issue-contract-review fingerprint refresh path を明示する #1329 も fingerprint 必須要件を維持し、欠落時はindeterminateのまま action-oriented reason を返す方針です。追加すべきテスト
既存テストには subprocess 経由で preflight を実行する helper があり、JSON を parse する形になっています。 現在は
rg exit 1の expected fail や exit code contract のテストはありますが、rg exit 2の new-file missing 特例はまだありません。最低限、以下を追加してください。
優先度 | ケース | 期待 -- | -- | -- P0 | rg -n quoteUpgrade src/systems/UpgradeSystem.ts、path は Allowed Paths 内、未存在 | expected_fail / new_file_missing_expected / go P0 | missing path が Allowed Paths 外 | expected_fail にならない P0 | rg -n '(' src/systems/NewFile.ts | invalid regex として human_judgment または blocked P0 | rg --include '*.ts' foo src/systems/NewFile.ts | static block、rg_option_mismatch P0 | rg foo . | broad_search_path_unbounded P0 | rg -n -e quoteUpgrade --glob '*.ts' src/systems/UpgradeSystem.ts tests/upgrade-system.test.ts | path operand 抽出が正しい P0 | rg --regexp=quoteUpgrade -- src/systems/UpgradeSystem.ts | -- 処理が正しい P0 | rg -n -- -foo src/systems/UpgradeSystem.ts | pattern が - 始まりでも path 誤判定しない P1 | --max-count 1、--type ts、--replace x、--color never など value-taking options | option value を path と誤認しない P1 | test -f / test -d / test -s 既存分類 | file_not_found_expected が回帰しないripgrep は
-e/--regexpで pattern を明示でき、pattern が-で始まる場合や複数 pattern の場合に使われます。また--も同等の曖昧性回避に使われます。(Debian Manpages)-g/--globは検索対象のファイルを glob で絞る option であり、path operand ではありません。(GitHub)#1328 本文への修正案
現 Issue に追記するなら、次の4点です。
classify_result()に allowed_paths が無い問題を明記classify_result()の signature 拡張、またはmain()側 post-execution 判定への移動を AC に入れる。_candidate_new_allowed_path_target()は維持ではなく置換方針にする_rg_has_broad_search_path()相当の argv parser を shared helper 化し、strict-mode の missing annotation 検出とrg exit2分類の両方で使う。stderr 判定の blacklist を AC に入れる
invalid regex / unsupported option / config error / permission denied / broad path / outside Allowed Paths は明示的に
expected_fail禁止。category と confidence の追加を AC に入れる
new_file_missing_expectedを fragment / confidence / schema consistency の対象として固定する。最終判断
#1328 は 採用してよいが、そのまま実装プロンプトに渡すにはまだ危険 です。
特に危険なのは「
rg exit 2を分類する」と言いながら、実際にはclassify_result()に Allowed Paths が渡っていない点と、既存_candidate_new_allowed_path_target()が rg argv parser として未成熟な点です。実装者への指示は、次の一文に圧縮できます。
## 判定要修正。#1328 の問題設定は正しいが、現 Issue 文のまま実装すると
rg exit 2の false-green を作る危険が残ります。#1328 は
baseline_vc_preflight.pyのclassify_result()がrg exit_code == 2をhuman_judgment/unknownに落とす問題を、Allowed Paths 内の新規ファイル missing と厳密証明できる場合だけexpected_fail/goにする Issue です。Issue コメントは現時点で 0 件です。今回確認した範囲は、#1328、関連 #1324 / #1281 / #1329、PR #1318、
baseline_vc_preflight.py、既存テスト、ripgrep 公式仕様、Python のshlex/ path 正規化仕様です。ローカルでのテスト実行はしていません。根本問題の整理
#1328 の前提は妥当です。現行
classify_result()はrgの no-match、つまりexit_code == 1だけをexpected_fail / expected_baseline_fail / goにし、rg exit_code == 2には専用分岐がありません。最終的にhuman_judgment / unknownに落ちます。一方、ripgrep 仕様上、exit status は「match あり = 0」「match なし = 1」「error = 2」です。さらに exit 2 は regex syntax error のような catastrophic error と、ファイルが読めない soft error の両方を含みます。したがって、
exit_code == 2を一括で expected fail にする実装は不可です。([Debian Manpages]1)PR #1318 はこの問題の実例です。#1281 では新規ファイル
src/systems/UpgradeSystem.ts等を対象にrg -n ...の baseline VC が多数定義されており、新規ファイル未作成時にrg exit 2になり得る構造でした。 PR #1318 側では最終的に実装・テスト・CI は通っていますが、review コメントではallowed_paths_gate: indeterminateが blocker とされ、fresh fingerprint binding がないため worker self-report を正本にできない、と fail-closed されています。P0 指摘
1.
classify_result()だけを直す設計だと Allowed Paths 判定に必要な情報が足りない現行
classify_result()の signature はexit_code, stdout, stderr, command, cwd, runner_env_deltaだけで、allowed_pathsを受け取りません。 実行ループでもclassify_result()呼び出しにallowed_paths_from_bodyは渡されていません。#1328 は「missing path がすべて normalized Allowed Paths 配下」という条件を要求していますが、今の
classify_result()単体ではそれを証明できません。実装方針は次のどちらかに固定すべきです。
classify_result(..., allowed_paths: list[str], cwd: Path, static_policy_passed: bool)のように signature を拡張するmain()側に寄せ、allowed_paths_from_bodyと static classification 結果を持った状態でrg exit 2特例を判定するIssue 文には「
classify_result()に追加」とありますが、このままだと実装者が allowed_paths なしで stderr だけを見て expected fail 化する余地があります。2.
_candidate_new_allowed_path_target()は今回の判定エンジンに使ってはいけない現行
_candidate_new_allowed_path_target()はtestなら非フラグ引数を全部候補、rgならargv[1:]の非 option を集めてnon_opt[1:]を path とみなします。 これはrg -e PATTERN PATH、--regexp=PATTERN、--glob GLOB、--、value-taking option、複数 path、pattern が-で始まるケースで誤判定します。一方、同じファイルには
_rg_has_broad_search_path()があり、-e/--regexp/--regexp=/-ePATTERN、--glob/--iglob、value-taking flags、--、combined short flags を考慮して path args を抽出しています。#1328 の AC7 は「維持 / 統合 / 置換のいずれか」としていますが、敵対的には 置換一択 です。既存 helper は strict mode の「baseline-expect 未記載検出」には使われていますが、post-execution の
rg exit 2をgoに昇格させる根拠としては弱すぎます。3. stderr 判定は whitelist + blacklist の両方が必要
rg exit 2の stderr が missing path 系であることだけでは不十分です。stderr に missing path と invalid regex / unsupported option / config error / permission denied が混在する可能性があります。ripgrep 仕様上、exit 2 は soft error と catastrophic error の両方を含むためです。([Debian Manpages]1)必要な分類条件は最低限これです。
exit_code == 2rgclassify_static_command()が blocked を返していない「一部 path だけ Allowed Paths 内」「一部だけ missing」「stderr に複数 error が混在」は
expected_fail/goにしてはいけません。4. Allowed Paths containment は文字列 prefix だけでは弱い
現行 helper の
_in_allowed()はlstrip("./")とstartswith(a + "/")で判定しています。 これは..、絶対パス、symlink、Windows path 風入力、正規化前後の差分に弱いです。Python では
os.path.commonpath()が「有効な共通パス」を返す API で、文字列 prefix のcommonprefix()とは違います。([Python documentation]2) またPurePath.is_relative_to()は純粋に文字列ベースであり、..や symlink 解決をしない点に注意が必要です。([Python documentation]3)この Issue では、少なくとも次の方針を AC に入れるべきです。
..で Allowed Paths 外へ抜ける path は rejectresolve(strict=True)できないため、存在する親ディレクトリを基準に containment を判定するcommonpath()相当で行い、単純 prefix だけにしない推奨実装仕様
#1328 は次のように仕様を硬くしたうえで実装開始するのが安全です。
_extract_rg_path_operands(argv)を追加し、_rg_has_broad_search_path()とnew_file_missing_expected判定の両方から使う。既存_candidate_new_allowed_path_target()は wrapper 化または削除する。rg exit 2特例は専用 helper に閉じ込める。戻り値 category は
expected_baseline_failに混ぜず、new_file_missing_expectedにする。既存 category に混ぜると、後で「no-match」と「new-file missing」の監査区別ができません。compute_confidence()の high confidence set にnew_file_missing_expectedを追加する。追加しないと contract-review fragment の confidence が low になり、別 gate で不要な揺れを生みます。allowed_paths_review_gate.pyの fingerprint fallback は触らない。これは 実装: issue-contract-review fingerprint refresh path を明示する #1329 の範囲であり、実装: issue-contract-review fingerprint refresh path を明示する #1329 も fingerprint 必須要件を維持し、欠落時はindeterminateのまま action-oriented reason を返す方針です。追加すべきテスト
既存テストには subprocess 経由で preflight を実行する helper があり、JSON を parse する形になっています。 現在は
rg exit 1の expected fail や exit code contract のテストはありますが、rg exit 2の new-file missing 特例はまだありません。最低限、以下を追加してください。
rg -n quoteUpgrade src/systems/UpgradeSystem.ts、path は Allowed Paths 内、未存在expected_fail / new_file_missing_expected / goexpected_failにならないrg -n '(' src/systems/NewFile.tshuman_judgmentまたはblockedrg --include '*.ts' foo src/systems/NewFile.tsrg_option_mismatchrg foo .broad_search_path_unboundedrg -n -e quoteUpgrade --glob '*.ts' src/systems/UpgradeSystem.ts tests/upgrade-system.test.tsrg --regexp=quoteUpgrade -- src/systems/UpgradeSystem.ts--処理が正しいrg -n -- -foo src/systems/UpgradeSystem.ts-始まりでも path 誤判定しない--max-count 1、--type ts、--replace x、--color neverなど value-taking optionstest -f/test -d/test -s既存分類file_not_found_expectedが回帰しないripgrep は
-e/--regexpで pattern を明示でき、pattern が-で始まる場合や複数 pattern の場合に使われます。また--も同等の曖昧性回避に使われます。([Debian Manpages]1)-g/--globは検索対象のファイルを glob で絞る option であり、path operand ではありません。([GitHub]4)#1328 本文への修正案
現 Issue に追記するなら、次の4点です。
classify_result()に allowed_paths が無い問題を明記classify_result()の signature 拡張、またはmain()側 post-execution 判定への移動を AC に入れる。_candidate_new_allowed_path_target()は維持ではなく置換方針にする_rg_has_broad_search_path()相当の argv parser を shared helper 化し、strict-mode の missing annotation 検出とrg exit2分類の両方で使う。stderr 判定の blacklist を AC に入れる
invalid regex / unsupported option / config error / permission denied / broad path / outside Allowed Paths は明示的に
expected_fail禁止。category と confidence の追加を AC に入れる
new_file_missing_expectedを fragment / confidence / schema consistency の対象として固定する。最終判断
#1328 は 採用してよいが、そのまま実装プロンプトに渡すにはまだ危険 です。
特に危険なのは「
rg exit 2を分類する」と言いながら、実際にはclassify_result()に Allowed Paths が渡っていない点と、既存_candidate_new_allowed_path_target()が rg argv parser として未成熟な点です。実装者への指示は、次の一文に圧縮できます。
squne121 commentedon Jul 4, 2026
Refinement Loop: Human Escalation Required
The loop has terminated and requires human review. Cause: human judgment required
human_escalationhuman_judgment_requiredBlockers
squne121 commentedon Jul 4, 2026
Human Decision: Scope Delta 承認(ANCHOR_SCOPE_REFRAME_V1)
対象:
issue-refinement-looptermination report のscope_signal_guard判定。scope_signal_guard_triggered: truescope_signal_guard_reason_code: new_in_scope_area(## In Scopeセクションへの新規機能領域追加を検知)excluded_by_anchor_reframe: false(未承認のためhuman_escalationで停止していた)オーナー(squne121)として、上記
new_in_scope_area判定が指摘した Issue 本文の## In Scope拡張(classify_result()へのallowed_paths引渡し・_candidate_new_allowed_path_target()の argv parser 置換・stderr whitelist/blacklist 判定を含む一連の拡張)を承認する。この拡張は Allowed Paths(下記 2 ファイル)の範囲内で完結しており、新しい Allowed Path 層の追加は伴わない。squne121 commentedon Jul 4, 2026
Refinement Loop: Human Escalation Required
The loop has terminated and requires human review. Cause: human judgment required
human_escalationhuman_judgment_requiredBlockers
docs: _VC_PREFLIGHT_MAX_COMMAND_BUDGET のコメントが根本解決を主張しないよう修正
fix: VC preflight タイムアウトを named constant の関係式で定義し drift を防ぐ (#1335)
実装: new-file VC preflight を missing Allowed Paths file として決定論的に分類する (#…
fix: rg/grep exit code 2 の regex/usage error を needs_fix として分類する (#2643)