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: "check_issue_contract.py が preflight-scope / trivially_pass annotation を解釈し、VC コマンドを ParsedVcCommand として構造化出力する annotation parser を追加する"
change_kind: codeParent Issue
なし(単独改善)
Parent Goal Ref
- Goal:
check_issue_contract.pyの VC 解析が annotation を無視して VC コマンドをフラットに扱う問題を解消する - Desired Destination:
# preflight-scope: <value>/# trivially_pass: <reason>annotation を持つ VC コマンドがParsedVcCommandとして構造化出力され、preflight runner 側が annotation metadata を利用して baseline 実行対象を判断できる状態
Current Validated Scope
.claude/skills/review-issue/scripts/check_issue_contract.pyの VC parse ロジックに annotation サポートを追加(annotation parser のみ。baseline 実行・unexpected pass ルーティングは対象外).claude/skills/review-issue/tests/test_vc_annotation_support.pyを新規作成し、annotation 動作の回帰テストを追加
Remaining Parent Gaps
- なし(単独改善)
Outcome
check_issue_contract.py が VC コードブロック内のコマンドを ParsedVcCommand(command, preflight_scope, trivially_pass_reason を持つ構造体)として出力し、# preflight-scope: pr_review_only / runtime_only を持つコマンドは structured skipped result として構造化し、# trivially_pass: <reason> を持つコマンドは reason 付き skipped result として保持し、対応する回帰テストが PASS する状態。
注記: check_issue_contract.py はベースライン実行・unexpected pass ルーティングを行わない。本 Issue は annotation parser と JSON schema validation だけを責務とし、baseline 実行対象除外は preflight runner 側の責務として別 Issue で扱う。
In Scope
check_issue_contract.py:- VC parse 時に直前行の
# preflight-scope: <value>コメントを command metadata として bundle する(物理的な直前行のみ有効) preflight-scopeの有効値をpr_review_only/runtime_only/ unknown に enum 化する- unknown
preflight-scopevalue は fail-closed またはhuman_judgmentとして構造化する - VC parse 時に直前行の
# trivially_pass: <reason>コメントを command metadata として bundle する trivially_pass:を持つコマンドをstructured skipped resultとして出力する(既存 C13 スキーマに沿ってclassification: skipped,skip_reason_type: trivially_passを使用)- annotation コメント行そのもの(
# preflight-scope:/# trivially_pass:)を command として抽出しない - annotation と command の間に blank line または別コメントがある場合、annotation を無効にする
- VC parse 時に直前行の
.claude/skills/review-issue/tests/test_vc_annotation_support.pyの新規作成:preflight-scope: pr_review_only/runtime_onlyが付いた VC を structured skipped として返す回帰テスト- unknown
preflight-scopevalue の fail-closed 動作テスト trivially_pass:が付いたコマンドを unexpected pass 扱いしない回帰テスト- annotation コメントそのものを command として実行しない回帰テスト
- annotation と command の間に blank line がある場合に annotation が無効になる回帰テスト
rg -n "createComment"のような広い grep が context-fixed VC を要求することを示す regression fixturecheck_issue_contract.py --jsonの stdout/stderr 契約が 実装: check_issue_contract.py --json の stdout を stderr から分離する(DeprecationWarning 混入除去) #574/実装: check_issue_contract.py --json consumer の stdout/stderr 契約を regression test で固定する #598 の既存契約を破壊しないことを確認する回帰テスト
Out of Scope
guard-japanese-prose.shの変更(→ 実装: AI-safe GitHub body mutation lane を追加し guard-japanese-prose の過剰ブロックと gh api workaround 化を解消する #594 の責務)- baseline VC 実行ランナーそのものの再設計
- baseline 実行対象除外の runtime routing(preflight runner 側の責務、別 Issue で扱う)
preflight-scope/trivially_pass以外の新規 annotation 種別の追加check_issue_contract.pyの stdout/stderr 分離(→ 実装: check_issue_contract.py --json の stdout を stderr から分離する(DeprecationWarning 混入除去) #574)check_issue_contract.py--json consumer の regression test 追加(→ 実装: check_issue_contract.py --json consumer の stdout/stderr 契約を regression test で固定する #598)- 用語登録・日本語置換登録(trivially_pass / annotation / regression / prose の textlint prh 対応は別 Issue)
Acceptance Criteria
- AC1: VC parser は command 直前行の
# preflight-scope: <value>を command metadata として保持する - AC2:
preflight-scope: pr_review_only/runtime_onlyは baseline executable command から除外され、structured skipped result を返す - AC3: unknown
preflight-scopevalue は fail-closed またはhuman_judgmentとして構造化される - AC4: command 直前行の
# trivially_pass: <reason>は non-empty reason として保持され、unexpected_passに分類されない - AC5: annotation コメント行そのものは command として抽出されない
- AC6: annotation と command の間に blank line または別コメントがある場合、annotation は無効になる
- AC7:
rg -n "createComment"のような広い grep は、annotation ではなく context-fixed VC が必要であることを regression fixture で示す - AC8:
check_issue_contract.py --jsonの stdout/stderr 契約は 実装: check_issue_contract.py --json の stdout を stderr から分離する(DeprecationWarning 混入除去) #574/実装: check_issue_contract.py --json consumer の stdout/stderr 契約を regression test で固定する #598 の既存契約を破壊しない
Verification Commands
# AC1
$ rg -n "preflight.scope" .claude/skills/review-issue/scripts/check_issue_contract.py# AC1b
$ rg -n "pr_review_only" .claude/skills/review-issue/scripts/check_issue_contract.py# AC2
$ rg -n "runtime_only" .claude/skills/review-issue/scripts/check_issue_contract.py# AC3
$ uv run pytest .claude/skills/review-issue/tests/test_vc_annotation_support.py -q -k "unknown_preflight_scope"# AC4
$ rg -n "trivially_pass" .claude/skills/review-issue/scripts/check_issue_contract.py# AC5
$ uv run pytest .claude/skills/review-issue/tests/test_vc_annotation_support.py -q -k "annotation_not_executed_as_command"# AC6
$ uv run pytest .claude/skills/review-issue/tests/test_vc_annotation_support.py -q -k "annotation_out_of_range_ignored"# AC7
$ uv run pytest .claude/skills/review-issue/tests/test_vc_annotation_support.py -q -k "createComment_no_false_positive"# AC8
$ uv run pytest .claude/skills/review-issue/tests/test_vc_annotation_support.py -q -k "json_contract_not_broken"Allowed Paths
.claude/skills/review-issue/scripts/check_issue_contract.py.claude/skills/review-issue/tests/**
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
check_issue_contract.pyの annotation 対応が VC grammar 全体の再設計を要求する場合- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
- Python
- pytest
Scope Delta(任意)
N/A
Runtime Verification Applicability
decision: not_applicable
reason: "annotation 解釈の変更は check_issue_contract.py の unit test で完結する。実 GitHub API / ランタイム実行環境への依存なし。"Delivery Rule
- 1 Issue = 1 PR
- 実装: check_issue_contract.py --json の stdout を stderr から分離する(DeprecationWarning 混入除去) #574 および 実装: check_issue_contract.py --json consumer の stdout/stderr 契約を regression test で固定する #598 と同じファイルを Allowed Paths に含む。並行実装時は merge conflict に注意すること
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Activity
squne121 commentedon Jun 3, 2026
人間からのコメントです。
「trivially_pass」「annotation」「regression」は用語登録と日本語置換登録してほしい。「prose」も同様。Issue,PR,ドキュメントに対してであり、スクリプトなどはその限りではない。
squne121 commentedon Jun 3, 2026
#599 (comment)
認識は妥当です。これは #599 に混ぜず、別 Issue として切るべきです。
#599 は
check_issue_contract.pyの VC annotation 解釈が主対象で、Allowed Paths も.claude/skills/review-issue/scripts/check_issue_contract.pyとその tests だけです。さらに Stop Conditions に「新規 Issue の起票が必要と判断した場合」が明記されています。用語登録・日本語置換登録はこの Allowed Paths 外です。([GitHub]1)また #599 は
guard-japanese-prose.shの変更を Out of Scope として #594 側の責務に寄せています。今回の要求は「Issue / PR / ドキュメントの prose における用語統制」なので、check_issue_contract.pyの annotation パーサではなく、textlint/prh と GitHub body/comment/review guard の領域です。([GitHub]1)既存構成として、
lint:proseは textlint を使ってdocs/**/*.md、README、.github/**/*.md、CLAUDE、AGENTS、SECURITY、.claude/**/*.mdを対象にしており、.textlintrcは.textlint/prh.ymlを参照しています。つまりドキュメント側の用語置換は.textlint/prh.ymlが自然な実装先です。([GitHub]2) textlint-rule-prh 自体もrulePathsで YAML 辞書を読み、expected/patterns/specsによる表記ゆれ・置換を扱えます。([GitHub]3)重要なのは、現行の
.textlint/prh.ymlにはすでにtrivially-pass -> 自明PASSがあり、コメントでtrivially_passは machine-readable token として置換対象外、と明記されています。今回の人間コメントはそこに対する方針変更で、「スクリプト等は除外しつつ、Issue / PR / docs の自然文ではtrivially_passも日本語置換対象にする」という追加要求です。([GitHub]4)#599 へのコメント案:
別 Issue 案:
squne121 commentedon Jun 3, 2026
判定: REQUEST_CHANGES 相当
Issue #599 は方向性は正しいが、このまま実装に入ると 対象ファイル・出力契約・annotation 値・テスト対象がズレる 可能性が高いです。
最大の問題は、Issue 本文が「
check_issue_contract.pyが baseline command execution 対象から除外する」と書いている点です。#599 の Outcome / In Scope はcheck_issue_contract.pyにpreflight-scope/trivially_pass解釈を追加するとしていますが、現行check_issue_contract.pyの VC 処理は主に「VC セクションにコマンドがあるか」の C4 と、「外部から渡された vc_preflight JSON の decision 整合性を見る」C13 です。C4 はコードブロック内の$行などを検出するだけで、baseline 実行・unexpected pass 分類はしていません。C13 もresults[].decisionと skipped metadata を見るだけです。([GitHub]1) ([GitHub]2) ([GitHub]2)ブロッカー
1. 実装責務の置き場所が怪しい。
check_issue_contract.pyに parser を追加するのはありですが、「baseline command execution 対象から除外」「unexpected_pass 扱いしない」は runner / preflight 側の責務に見えます。#331 でもvalidate_issue_body.py/validate_pr_body.py/baseline_vc_preflight.pyは Track A/B/C の担当として切り分けられており、#599 の Allowed Paths がcheck_issue_contract.pyと tests だけなのは危険です。([GitHub]3)2.
preflight-scopeの値がpr_review_onlyだけだと既存利用に足りない。#599 の AC1 は
# preflight-scope: pr_review_onlyの除外だけを要求していますが、既存 Issue では# preflight-scope: runtime_onlyも使われています。#574 / #598 の VC にはruntime_onlyがあり、これも baseline preflight の過剰実行・誤分類の対象になり得ます。preflight-scope: <value>を bundle すると書くなら、最低限pr_review_only/runtime_only/ unknown value の扱いを contract 化すべきです。([GitHub]4) ([GitHub]5)3.
trivially_passの出力スキーマが未定義。#599 は「
trivially_passまたはmanual_onlyとして構造化出力」としていますが、どの JSON key に何を出すのか未定義です。現行 C13 はdecisionをgo / blocked / human_judgmentに限定し、classification == "skipped"の場合だけverification_owner/runtime_verification_requiredを要求します。ここにclassification: trivially_passを入れるのか、classification: skipped+skip_reason_type: trivially_passにするのかを決めないと downstream が壊れます。([GitHub]2)4. Issue #599 自体が現行 C3 に落ちる可能性がある。
現行
check_c3_ac_checkbox_formatは AC に- [ ]形式の checkbox line を要求しています。一方 #599 の AC は通常 bullet の* AC1:形式に見えます。自己検証対象の Issue が checker の C3 に通らない可能性があります。([GitHub]2) ([GitHub]1)5. AC4 の
createCommentfalse positive は annotation 対応だけでは解けない。rg -n "createComment"が別文脈に誤マッチする問題は、#25 / #94 で扱われている「VC のコンテキスト固定」問題です。annotation parser で解けるのは「このコマンドを preflight から除外する」だけで、「cleanup-pr 固有 VC かどうか」を正しく分類するには VC 自体のスコープ固定・AC との対応・対象ファイル/見出し文脈の検査が必要です。#25 では既存 Anchor Verification ブロックに反応して unexpected pass した事例が明記され、#94 でも見出しだけのrgが baseline で pass する構造的弱点が説明されています。([GitHub]6) ([GitHub]7)修正方針
Issue #599 は次のように絞り直すのが妥当です。
check_issue_contract.py側は VC annotation parser と JSON schema validation だけを責務にする。baseline 実行対象除外・unexpected pass ルーティングは、実際に VC を実行または分類する preflight runner / issue-contract-review 側へ別 Issue または Allowed Paths 追加で移す。
preflight-scopeの値は enum 化する。最低限:pr_review_only: baseline 実行から除外、PR review evidence として扱うruntime_only: baseline 実行から除外、runtime/deferred verification 側へ送るhuman_judgmenttrivially_passは schema を固定する。推奨は新分類を増やすより、既存 routing に近い形に寄せることです。例:
{ "command": "rg -n \"createComment\" ...", "classification": "skipped", "decision": "human_judgment", "skip_reason_type": "trivially_pass", "skip_reason": "already covered by static grep only; no runtime execution required", "verification_owner": "reviewer", "runtime_verification_required": false }Issue 本文への具体修正案
Acceptance Criteriaは最低限こう直した方がよいです。実装メモ
check_issue_contract.pyには既存のcheck_c4_vc_commands_presentを直接肥大化させず、別関数を切るべきです。抽出ルールは単純でよいです。
$prefix を command として扱う# AC1は AC ref コメントとして保持するが annotation とは別扱い# preflight-scope:/# trivially_pass:は command ではない例:
trivially_passとpreflight-scopeが連続する場合、command 直前の 1 行だけ有効にするのか、連続 annotation block を bundle するのかを決める現時点の #599 は「必要な改善」ではありますが、今の contract のまま実装すると runner 側の責務に届かないか、逆に
check_issue_contract.pyの出力契約を暗黙に変えて downstream を壊すリスクがあります。まず Issue を parser/schema と runner routing に分けるか、Allowed Paths と AC を明示的に拡張するべきです。squne121 commentedon Jun 3, 2026
issue-refinement-loop 完了(iteration 1 → 承認)
対象コメント
#issuecomment-4609623523: スコープ境界の人間決定(用語登録は別 Issue 扱い)#issuecomment-4609624798: REQUEST_CHANGES 相当(ブロッカー 1〜5 に基づく全面改訂指示)適用した変更点
pr_review_only/runtime_only/ unknown の 3 択に拡張classification: skipped+skip_reason_type: trivially_passに明示scripts/tests/**→tests/**に修正(実際のパスと一致)レビュー結果
iteration 1 で C1〜C11 全チェック通過。ブロッカーなし。承認。
squne121 commentedon Jun 3, 2026
コントラクトスナップショット — issue-contract-review 完了 (2026-06-03T06:33:00Z)
check_issue_contract.pyが# preflight-scope: <value>/# trivially_pass: <reason>annotation を持つ VC コマンドをParsedVcCommandとして構造化出力し、対応する回帰テストが PASS する.claude/skills/review-issue/scripts/check_issue_contract.py.claude/skills/review-issue/tests/**.claude/worktrees/issue-599-check-issue-contract-py-preflight-scopeworktree-issue-599-check-issue-contract-py-preflight-scopesqune121 commentedon Jun 3, 2026
implement-issue: 実装完了
.claude/worktrees/issue-599-check-issue-contract-py-preflight-scopeworktree-issue-599-check-issue-contract-py-preflight-scopepnpm typecheck/pnpm lint/pnpm test/pnpm build)fix(#599): connect parse_vc_commands to run_checks/result_to_dict and…
feat(#599): check_issue_contract.py に preflight-scope / trivially_pas…