Repository navigation
Closed
Labels
agent/implementerAI implementer agentarea/ai-opsAI operations and agent tooling areaenhancementNew feature or requestphase/implementationImplementation phase
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "baseline_vc_preflight が Verification Commands の品質問題(rg option mismatch・broad search・compound command・unexpected pass)を contract review 時(implementation handoff 前)に検出し、甘い VC を完了扱いにしない"
change_kind: codeParent Issue
none(単独改善)
Parent Goal Ref
- Goal: VC が「実行可能」「対象が狭い」「baseline で誤 pass しない」「compound command に依存しない」ことを contract review 時に機械検証する
- Desired Destination:
rg --include="*.md"のような rg option mismatch、Allowed Paths より広い broad search、shlex 解析後の shell operator を含む compound command、既存資産への偶発ヒットを preflight で検出できる
Current Validated Scope
.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.pyに VC 品質分類の追加(rg option mismatch / 広域検索 / 複合コマンド / 偶発 pass の検出強化).claude/skills/issue-contract-review/tests/へrg option mismatch/broad_search_path_unbounded(Allowed Paths 超過) /compound_command_disallowed(shell operator 検出) /unexpected passの fixture / pytest 追加- 必要に応じて
.claude/skills/issue-contract-review/SKILL.mdの preflight blocker taxonomy 追記
Remaining Parent Gaps
なし
Outcome
baseline_vc_preflight.py が rg --include="*.md" のような rg_option_mismatch、Allowed Paths より広い broad_search_path_unbounded、shlex 解析後に shell operator token として現れる compound_command_disallowed、既存資産への偶発ヒットによる unexpected_pass を blocked として返し、それを検証する pytest が PASS している状態。
Background
Issue 本文の VC は review-issue / issue-contract-review / test-runner が逐語実行する前提だが、現状は以下の品質問題が起きうる。
rg --include="*.md"のように GNU grep 的な想定が混ざったrgコマンドが残る(rgでは-g/--globまたは-t/--typeを使う)- Allowed Paths より広いパスへの検索で、対象ファイルと無関係な既存記述に偶発ヒットして baseline pass する
&&/||/ 裸の|を含む compound command が 1 VC に混在し、成功判定が曖昧になる
本 Issue では authoring guidance の prose 追加ではなく、baseline_vc_preflight.py 自体の blocker 分類を強化して「甘い VC を open issue に入れない」側へ倒す。
既存 taxonomy(SKILL.md)には unexpected_pass・compound_command_disallowed が既に定義されている。本 Issue はこれらの 発火条件・fixture・優先順位を補強する ものであり、新しい top-level JSON schema は追加しない。
In Scope
baseline_vc_preflight.pyにrg_option_mismatch/broad_search_path_unbounded/compound_command_disallowed/unexpected_pass強化の実装を追加するrgargv[0] がrgである場合に限り--include/--include=...をrg_option_mismatchとして blocker にする(--include-zeroは対象外、grep --includeは対象外)rgの検索 path が Allowed Paths より広い、または path 未指定・repo root・docs root 等の場合をbroad_search_path_unboundedとして blocked にする(Allowed Paths が広域 docs を明示している場合は除外)- shlex 解析後に shell operator token(
&&/||/ 裸の|/;/ redirect)として現れる場合をcompound_command_disallowedとして blocked にする(quoted regex 内のfoo|barは compound とみなさない。foo\|barは 実装: VC コマンドの正規表現メタ文字を shell pipe と誤判定しない検証を追加する #589 のregex_literal_pipe_suspected挙動を維持する) - 既存資産に偶発ヒットして baseline pass する fixture を追加し、既存
unexpected_pass分類が発火することを確認する - 上記分類を fixture pytest で固定する
Out of Scope
body-authoring.mdへの広範な authoring guidance 追記- 既存 open issue 本文の一括修正
guard-japanese-prose.shの prose 判定- runtime verification policy の変更
- 新しい top-level JSON schema の追加(既存 taxonomy 内での分類値の使用に限定する)
Acceptance Criteria
- AC1:
rgコマンドに--include/--include=...が含まれる場合、rg_option_mismatchとして blocked になる。--include-zeroは対象外。grep --includeは対象外(rg に対する option mismatch のみ) - AC2:
rgの検索 path が Allowed Paths より広い、または path 未指定・repo root・docs root 等の場合、broad_search_path_unboundedとして blocked になる。Allowed Paths が広域 docs を明示している場合は除外される - AC3: shlex 解析後に shell operator token(
&&/||/ 裸の|/;)として現れる場合、compound_command_disallowedとして blocked になる。quoted regex alternationfoo|barは compound とみなさない。既存のregex_literal_pipe_suspected(実装: VC コマンドの正規表現メタ文字を shell pipe と誤判定しない検証を追加する #589)の挙動を壊さない - AC4: 既存資産への偶発ヒットで baseline exit_code=0 になるが VC が対象成果物を識別できない fixture を追加し、既存の
unexpected_pass分類として blocked になる(新しい top-level schema は追加しない) - AC5: AC1〜AC4 の分類を検証する fixture pytest が PASS する(test_rg_include_is_rg_option_mismatch_blocked / test_rg_include_zero_is_not_rg_option_mismatch / test_grep_include_is_not_rg_option_mismatch / test_regex_alternation_pipe_is_not_compound / test_shell_pipeline_is_compound_command_disallowed / test_rg_without_path_is_repo_wide_broad_search / test_rg_docs_root_is_broad_when_allowed_paths_are_specific / test_rg_specific_allowed_file_is_not_broad / test_existing_asset_hit_is_unexpected_pass を含む)
Verification Commands
# AC1
$ uv run pytest .claude/skills/issue-contract-review/tests/test_vc_quality_guards.py -k "rg_include or rg_option_mismatch" -v# AC2
$ uv run pytest .claude/skills/issue-contract-review/tests/test_vc_quality_guards.py -k "broad_search or path_unbounded" -v# AC3
$ uv run pytest .claude/skills/issue-contract-review/tests/test_vc_quality_guards.py -k "compound or pipeline or alternation" -v# AC4
$ uv run pytest .claude/skills/issue-contract-review/tests/test_vc_quality_guards.py -k "unexpected_pass or existing_asset" -v# AC5
$ uv run pytest .claude/skills/issue-contract-review/tests/test_vc_quality_guards.py -v# 品質ゲート
$ pnpm typecheck# 品質ゲート
$ pnpm lint# 品質ゲート
$ pnpm test# 品質ゲート
$ pnpm build# 品質ゲート
$ uv run pytest .claude/skills/issue-contract-review/tests/ -vAllowed Paths
.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py.claude/skills/issue-contract-review/tests/.claude/skills/issue-contract-review/SKILL.md
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(preflight JSON schema / blocker category 名)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
- Python / pytest
- ripgrep (
rg) CLI semantics - Python
shlexモジュール(shell operator token 解析)
Scope Delta(任意)
N/A
Delivery Rule
1 Issue = 1 PR- Draft PR 既定
Runtime Verification Applicability
- decision: not_applicable
- reason: Python preflight script / tests / skill contract の変更のみであり、静的・ユニットテストで完結する
参考 Issue / Refs
- Refs 実装: issue-contract-review の VC preflight に trivially-pass パターン検出を追加する #201(trivially_pass 検出の先行実装・
--paths偶発 hit 問題) - Refs test: Issue #148 系 VC を source_mvp_loop 4 キー / M2〜M5 8 フィールド完備の厳密判定に差し替えるパターンを SSOT 化する #236(docs-only VC の低識別力問題・broad search 背景)
- Refs 実装: VC 用語の日本語標準化と textlint/prh 辞書登録を追加する #578(trivially_pass / baseline 用語の日本語標準化)
- Refs 実装: VC コマンドの正規表現メタ文字を shell pipe と誤判定しない検証を追加する #589(regex pipe と shell pipe の区別・AC3 非回帰要件)
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentarea/ai-opsAI operations and agent tooling areaenhancementNew feature or requestphase/implementationImplementation phase
Activity
squne121 commentedon Jun 5, 2026
判定
Issue #648 は方向性は正しいですが、このまま実装に渡すのは危険です。
特に AC3 の
|ブロック指定 と AC2 のdocs/全体検索ブロック指定 が粗く、既存の関連 Issue で直した挙動を壊す可能性があります。結論としては 要件修正後に実装 が妥当です。Issue #648 自体は、
baseline_vc_preflightに VC 品質ガードを追加し、rg --include="*.md"、docs/全体検索、compound command、既存資産への偶発 hit を検出する目的です。対象は.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py、同 tests、必要に応じてSKILL.mdです。([GitHub]1) GitHub 上では、現時点で #648 に直接紐づく Branch/PR は表示されていません。([GitHub]1)致命的指摘
1. AC3 は Issue #589 と衝突している
#648 は
&&/||/|を含む compound command を blocker にするとしています。([GitHub]1)しかし #589 では、quoted regex の
|を shell pipe と誤判定しないことが明確に要求されています。rg -n "foo|bar"は regex alternation であり、shell pipeline ではありません。#589 はさらに、rg -n "foo\|bar"のような literal pipe 疑いをregex_literal_pipe_suspectedとして扱う設計まで含んでいます。([GitHub]2)外部仕様上も、Rust regex の
x|yは alternation です。([Docs.rs]3) 一方、escaped ASCII punctuation は literal 扱いなので\|は literal pipe になります。([Docs.rs]3)修正すべき AC3:
Python
shlexはpunctuation_chars=Trueにより();<>|&を shell punctuation として token 化できます。([Python documentation]4) したがって、生文字列検索で|を探す実装は禁止です。2. AC2 の “docs/ 全体検索 = broad search” は雑すぎる
#648 は
docs/全体や repo-wide path を broad search として blocker/要修正分類にするとしています。([GitHub]1)これは意図としては正しいですが、
docs/が常に悪いわけではありません。docs-only Issue ではdocs/配下の検証が正当な場合があります。#236 でも、問題はdocs/そのものではなく、rg | wc -l >= Nのような 低識別力 VC です。([GitHub]5)実装方針はこう切るべきです。
docs/という文字列だけで blocker にすると、正当なドキュメント修正 Issue まで壊します。3.
rg --include検出は argv ベース・rg 限定で実装すべき#648 は
rg --include="*.md"を blocker にする要求です。([GitHub]1)これは妥当です。ripgrep では GNU grep 的な
--includeではなく、include/exclude には-g/--globを使います。([Debian Manpages]6) また file type 制限には-t/--typeが用意されています。([Debian Manpages]6)ただし実装で
"include"の substring 検索をすると誤爆します。ripgrep には--include-zeroという別オプションがあり、これは GNU grep の--includeとは無関係です。([Debian Manpages]6)実装ルール:
grep --includeまで blocker にしてはいけません。あくまで rg に対する option mismatch です。高リスク指摘
4.
unexpected_passは既に SKILL.md の taxonomy に存在する#648 は
unexpected_pass相当分類の追加を求めていますが、現在のSKILL.mdには既にunexpected_passが分類として記載されています。([GitHub]7)したがって #648 は「分類名を追加する Issue」ではなく、既存分類が実際に発火する条件・fixture・優先順位を補強する Issue と明記すべきです。
修正文言:
#648 の Stop Conditions でも JSON schema の後方互換性が要求されているため、既存 schema 内で分類値を増やす/使う方針に限定すべきです。([GitHub]1)
5. #648 自身の Verification Commands が弱い
#648 の VC は
rg -n "include|option mismatch|rg" ...のような存在確認が中心です。([GitHub]1)これはまさに #648 が防ぎたい 偶発 pass の温床です。コメント、docstring、未使用関数、テスト名だけでも pass します。
差し替えるべき VC は、grep ではなく fixture ベースの pytest です。
最低限、次のテストを要求すべきです。
#201 でも、
--paths指定で discovery script が自明 PASS する問題が実害として扱われています。([GitHub]8) #648 の VC が token existence check のままだと、同じ失敗を繰り返します。6. Scope が “起票前” と言いながら issue-contract-review に閉じている
#648 は「起票前に検出」と書いていますが、Allowed Paths は
issue-contract-reviewの preflight 実装と tests、必要に応じてSKILL.mdに限定されています。([GitHub]1)一方、#589 では issue body authoring や test-runner の verbatim 実行まで含めて扱っていました。([GitHub]2)
ここは要件が曖昧です。
この曖昧さを残すと、実装者が Allowed Paths を超えて Stop Conditions に引っかかるか、逆に必要な統合箇所を触らずに完了扱いにします。
関連 Issue から見た設計方針
#648 は単独 Issue として扱うべきではありません。少なくとも次を明示的に Refs に入れるべきです。
理由は以下です。
trivially_pass検出の先行実装。--pathsで既存資産を強制 hit させる問題。([GitHub]8)trivially_pass/baseline用語の認知負荷と日本語標準化。enum は維持しつつ説明を整える必要があります。([GitHub]9)推奨する Issue #648 修正版
追加カテゴリ
compound_command_disallowedとunexpected_passは既存 taxonomy に合わせる。新しい JSON schema は追加しない。優先順位
ただし
compound_command_disallowedは shlex 解析後の shell operator token に限定すること。修正 AC 案
最終評価
この Issue は実装価値あり。ただし現状のままでは “VC 品質ガードを作る Issue” 自体が低品質 VC で完了できてしまう。
着手条件は次の4点です。
rg --includeは argv ベース・rg 限定で検出する。rg存在確認から fixture pytest に差し替える。この修正なしに implementer へ渡すと、quoted regex pipe の既存修正を壊すか、
docs/を雑に blocker 化して正当な Issue を止める可能性が高いです。squne121 commentedon Jun 5, 2026
Contract Snapshot (2026-06-06T00:19:00Z)
baseline_vc_preflight.pyがrg_option_mismatch/broad_search_path_unbounded/compound_command_disallowed/unexpected_pass強化を実装し、それを検証する pytest が PASS している状態rg --include/--include=...→rg_option_mismatchblocked(--include-zero/grep --includeは除外)rgの検索 path が Allowed Paths より広い・path 未指定・repo root・docs root →broad_search_path_unboundedblocked(Allowed Paths が広域 docs を明示している場合は除外)&&/||/ 裸の|/;) →compound_command_disallowedblocked(quoted regex alternation は除外・実装: VC コマンドの正規表現メタ文字を shell pipe と誤判定しない検証を追加する #589 挙動維持)unexpected_passblockeduv run pytest .claude/skills/issue-contract-review/tests/test_vc_quality_guards.py -k "rg_include or rg_option_mismatch" -vuv run pytest .claude/skills/issue-contract-review/tests/test_vc_quality_guards.py -k "broad_search or path_unbounded" -vuv run pytest .claude/skills/issue-contract-review/tests/test_vc_quality_guards.py -k "compound or pipeline or alternation" -vuv run pytest .claude/skills/issue-contract-review/tests/test_vc_quality_guards.py -k "unexpected_pass or existing_asset" -vuv run pytest .claude/skills/issue-contract-review/tests/test_vc_quality_guards.py -vpnpm typecheck/pnpm lint/pnpm test/pnpm build/uv run pytest .claude/skills/issue-contract-review/tests/ -v.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py.claude/skills/issue-contract-review/tests/.claude/skills/issue-contract-review/SKILL.md.claude/worktrees/issue-648-baseline-vc-preflight-vcworktree-issue-648-baseline-vc-preflight-vcsqune121 commentedon Jun 5, 2026
implement-issue: 実装完了 (2026-06-06)
worktree-issue-648-baseline-vc-preflight-vcfix(#648): AC2 broad path detection を Allowed Paths との包含関係判定に修正
fix(#648): add issue-contract-review/tests/ to CI coverage
feat(#648): baseline_vc_preflight に rg_option_mismatch / broad_search…