Repository navigation
Closed
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasestate/queuedQueued for implementationtriage-requiredNeeds owner triage for priority decisionworkflowWorkflow / skill automation changes
Description
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "baseline VC preflight helper script を SSOT 化し、issue-contract-review と impl-review-loop で共有する"
change_kind: workflow
status: superseded
superseded_by:
issues:
- "#329"
prs:
- "#354"
tracker: "#244-B"Status
Superseded — #244 Track B / #329 / PR #354 に吸収・実装済み(merged 2026-05-24)。
このIssueの元契約(- リスト形式 VC 抽出)と現行実装(extract_fenced_bash_blocks())に仕様差分があります。
残課題は follow-up Issue で追跡します。
- 実装先: PR feat(#329): add baseline_vc_preflight.py with fixture-driven tests #354 (merged 2026-05-24)
- 吸収元: 導入: Issue/PR body authoring 機械検証化 親トラッカー — validator・linter・preflight スクリプトによる体系的品質保証 #244 Track B → 実装: baseline_vc_preflight.py を実装し VC を AC 別に単体実行・分類して JSON で返す — #244-B #329 (closed)
- 残課題 follow-up: see comment for details
Parent Issue
none
Parent Goal Ref
- Goal: VC 実行のワンライナー && 連鎖による途中停止を防ぎ、Issue 本文からの VC 抽出・実行・分類を共通スクリプトに集約する
- Desired Destination: N/A(standalone improvement)
Current Validated Scope
.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.sh(または Python helper)の新規作成- issue-contract-review / impl-review-loop からの共有呼び出し記述
Remaining Parent Gaps
なし
Outcome
.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.sh(または Python helper)が Issue 本文から VC を抽出して 1 つずつ実行・分類するロジックを提供し、issue-contract-review と impl-review-loop が同一スクリプトを呼び出す。
実装済み: baseline_vc_preflight.py は PR #354 で main にマージ済み(2026-05-24)。ただし実装は extract_fenced_bash_blocks() で fenced bash block を抽出する形式を採用しており、本 Issue 元契約の「- リスト形式 VC 抽出」とは異なる。この仕様差分は follow-up で解消する。
In Scope
baseline_vc_preflight.shまたはbaseline_vc_preflight.pyの新規作成- VC 抽出(
-リスト +# AC<N>マーカー形式)ロジック - 1 コマンドずつ実行・PASS/FAIL 分類・結果出力ロジック
- issue-contract-review SKILL.md への呼び出し手順追記
- impl-review-loop SKILL.md への呼び出し手順追記
Out of Scope
- CI/CD への組み込み
- GitHub Actions workflow の変更
- 既存のワンライナー実行ロジックの遡及修正
Acceptance Criteria
-
.claude/skills/issue-contract-review/scripts/配下にbaseline_vc_preflight.shまたはbaseline_vc_preflight.pyが存在する(PR feat(#329): add baseline_vc_preflight.py with fixture-driven tests #354 で充足済み) - スクリプトが Issue 本文(stdin または引数)から
-リスト形式の VC を抽出できる(未充足: 現行実装は fenced bash block 抽出。follow-up Issue で対処) - 各 VC を 1 つずつ実行し PASS/FAIL を出力できる(PR feat(#329): add baseline_vc_preflight.py with fixture-driven tests #354 で充足済み)
- issue-contract-review と impl-review-loop の SKILL.md に同一スクリプトへの呼び出し手順が記載されている(PR feat(#329): add baseline_vc_preflight.py with fixture-driven tests #354 で充足済み)
Verification Commands
# AC1: スクリプトの存在確認
test -f .claude/skills/issue-contract-review/scripts/baseline_vc_preflight.sh || test -f .claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py
# AC4: 両 skill からの参照確認
rg "baseline_vc_preflight" .claude/skills/issue-contract-review/SKILL.md .claude/skills/impl-review-loop/SKILL.md 2>/dev/nullAllowed Paths
.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.sh.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py.claude/skills/issue-contract-review/SKILL.md.claude/skills/impl-review-loop/SKILL.md
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
- bash または Python スクリプト authoring
- skill authoring(SKILL.md Markdown 構造)
Scope Delta(任意)
N/A
Source
- origin_skill: post-merge-cleanup
- origin_pr: docs: post-M1 playable outcome roadmap を docs/product/playable-roadmap.md に記録する (#148) #226
- dedupe_key:
baseline-vc-preflight-helper-script - extracted_from: PR docs: post-M1 playable outcome roadmap を docs/product/playable-roadmap.md に記録する (#148) #226 本文
## Process Observationsセクション
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasestate/queuedQueued for implementationtriage-requiredNeeds owner triage for priority decisionworkflowWorkflow / skill automation changes
Activity
squne121 commentedon May 30, 2026
結論
#234 単体のままなら REQUEST_CHANGES。
ただし実装作業としては、#244 Track B / #329 / PR #354 に吸収され、
baseline_vc_preflight.pyはかなり改善された状態で main にマージ済みです。問題は、#234 の契約が古いまま Open / queued に残っており、実装済み成果物との仕様差分が整理されていないことです。#234 は「-リスト形式の VC 抽出」を明記していますが、現行実装は## Verification Commands内の fenced bash block を主対象にしているように読めます。ここは放置すると、今後の Issue authoring / contract review の判定基盤に仕様ドリフトを残します。([GitHub]1) ([GitHub]2) ([GitHub]3)参照関係の整理
#234 の発端は、PR #226 の post-merge cleanup で観測された「手組み
&&ワンライナーが grep exit code で途中停止した」問題です。提案自体は妥当で、Issue 本文から VC を抽出し、1 コマンドずつ実行・分類する helper をissue-contract-reviewとimpl-review-loopで共有する、というものです。([GitHub]4)その後 #244 で目的が「body-authoring の validator / linter / preflight script による機械検証」へリフレームされ、#234 は Track B の #329 に absorb されました。#244 は
baseline_vc_preflight.pyが VC を抽出・単体実行・分類し、両 skill が同一 JSON を参照することを最終像にしています。([GitHub]2) ([GitHub]2)PR #354 は #329 の実装 PR として merge 済みで、Issue body から VC を AC marker ごとに抽出し、
subprocess.run(..., shell=False)で実行し、expected_fail / unexpected_pass / blocked / human_judgmentに分類する CLI を追加しています。最終レビューでは C1–C6 と M1–M3 が解消され、29 tests passed / 1 skipped、AC1–AC11 strict VC pass、5 checks passed で main に merge されています。([GitHub]5) ([GitHub]5) ([GitHub]5)良い点
subprocess.run()を使い、引数列をshell=Falseで渡す方向は正しいです。Python 公式 docs でもsubprocess.run()は推奨 API とされ、capture_outputやtimeoutの挙動も明記されています。また、引数は string より sequence が一般に望ましいと説明されています。([Python documentation]6)compound shell syntax の検出に
shlex.shlex(..., posix=True, punctuation_chars=True)を使う修正も筋が良いです。Python docs はpunctuation_chars=Trueにより();<>|&の連続を shell punctuation token として扱えると説明しています。ただし同じ docs は、これは full shell parser ではなく、戻った token に対する独自エラーチェックが必要だとも明記しています。([Python documentation]7)PR #354 のレビュー過程で、空抽出 fail-open、compound 実行前検出、exit code contract、PyYAML lazy import、
human_judgmentの fragment 保持、impl-review-loop側の pass-only 続行など、重要な安全弁はかなり潰されています。特にblocked/human_judgmentでimpl-review-loopを止める修正は、このスクリプトを workflow gate として扱うなら必須です。([GitHub]5)ブロッカー
1. #234 の literal contract と現行成果物が一致していない
#234 は In Scope / AC で「
-リスト +# AC<N>marker 形式」から VC を抽出できることを要求しています。([GitHub]1)一方、現行
baseline_vc_preflight.pyはextract_fenced_bash_blocks()で fenced bash block を抽出し、そこから$prefix 行や非コメント行を command として parse する構造に見えます。([GitHub]3)これは「実装が悪い」というより、#234 が #329 に吸収された後の契約変更が #234 側に反映されていないことが問題です。選択肢は二つです。
-list parser を追加する。superseded by #329/#354として閉じ、docs: body-authoring.md に VC authoring format (リスト形式 + # AC<N> マーカー) を明文化する #229 / body-authoring / validator 側に「VC は fenced bash block が正」と明記する。現状のままでは、#234 を見た実装者が bullet-list VC を出し、preflight が 0 件抽出で blocked になるか、逆に validator と preflight の責務がずれます。
2. 任意コマンド実行の threat model がまだ弱い
shell=Falseは shell injection の面では改善ですが、Issue body に書かれた任意の first argv は実行されます。Python docs でもPopenは child program を実行し、sequence の最初の item が実行対象になると説明しています。([Python documentation]6)現行コードも
shlex.split(command)したargvをsubprocess.run(..., shell=False, cwd=args.cwd)に渡しています。([GitHub]3)これは CI/CD 組み込み外であっても危険です。人間や agent がローカル worktree で実行する前提なら、
rm/git push/gh api/curl/bash/python -cのような副作用系をどう扱うかの policy が必要です。修正案:
--policy strictを default にする。rg,grep,test,python -m py_compile,pytest,uv run pytest,pnpm typecheck/lint/test/build程度に限定。bash,sh,python -c,node -e,curl,wget,gh api,git push,rm,mv,chmod,chown,dd, redirect, pipe,xargsは blocked。--allow-mutatingを明示指定しない限り mutation 系は実行しない。--cwdが repo root であることを検証し、/,$HOME,/tmpなどを拒否する。3. command substitution / negated search の static
goは危険現行コードは
$(...), backtick,${...}を検出すると、実行せずexpected_fail / expected_baseline_fail / goにしているように見えます。また! rg/! grepのような negated search も static にexpected_fail / goへ分類しています。([GitHub]3)これは fail-closed の観点で弱いです。
shell=Falseでは!や$()は shell syntax として評価されません。したがって「shell なら失敗期待」という人間の意図を、実行せずgoにするのは、壊れた VC を正当化する分類になり得ます。shlexdocs も shell-like parser であって full shell parser ではないため、独自エラーチェックが必要だとしています。([Python documentation]7)修正案:
$(...), backtick,${...}はunsupported_shell_syntax / blocked。! rg PATTERN FILEを許可したいなら、shell として実行せず、内部 DSL としてrg PATTERN FILEを実行し、exit 1 を expected_fail、exit 0 を unexpected_pass に反転分類する。!を単に prefix として検出してgoにする実装は禁止。4.
errors[]が #244 の “failing rule + minimal_context” 契約に対して弱い#244 は、AI に渡す修正コンテキストを validator JSON の
failing rule + minimal_contextに限定することを目標にしています。([GitHub]2)しかし現行コードの retrieval / extraction error は、少なくとも表示上は
errors: ["Verification Commands section not found"]や["No verification commands extracted ..."]のような string array です。([GitHub]3)これは人間には読めますが、修正 agent には弱いです。最低限、次の schema に寄せるべきです。
{ "kind": "vc_extraction_error", "rule": "verification_commands.fenced_bash_required", "message": "No verification commands extracted", "minimal_context": { "section": "## Verification Commands", "expected_format": "fenced bash block with # AC<N> markers" }, "fix_hint": "Wrap VCs in ```bash and add # AC<N> markers" }追加の中リスク指摘
gh issue view --json body --repo経路自体は妥当です。GitHub CLI docs はgh issue view {number|url}、--json <fields>、--repo <OWNER/REPO>をサポートしています。([GitHub CLI]8)ただし PR #354 の最終レビューでも、実 GitHub 呼び出しの integration は auth 必要で 1 skipped、
--issue --repo経路の test は deterministic に寄せた部分的検証とされています。CI では mock test を必須化し、任意でGH_TOKENありの e2e を別 job にする方が堅いです。([GitHub]5)また、最終レビューでは
expected_baseline_failは argv[0] basename + stderr 条件へ修正済みとされていますが、現行 raw 表示上はif "rg " in command and exit_code == 1やany(util in command for util in [...])の substring 判定もまだ見えます。これは path / argument 内の偶然一致を拾う余地があります。実コードの改行が raw 表示で潰れているため断定は避けますが、少なくとも追加テストで固定すべきです。([GitHub]3) ([GitHub]5)推奨する次アクション
feat: baseline VC preflight helper script を issue-contract-review と impl-review-loop で共有する #234 をそのまま実装 Issue として扱わない。
superseded by #329/#354と明記し、導入: Issue/PR body authoring 機械検証化 親トラッカー — validator・linter・preflight スクリプトによる体系的品質保証 #244 Track B に吸収済みとして close する。ただし、bullet-list VC 互換を捨てるなら、その理由と新 canonical format を残す。follow-up Issue を 1 本切る。
タイトル例:
fix: baseline_vc_preflight.py の VC format contract と unsafe command policy を明文化・強制する修正対象を明確化する。
goにしない。errors[]を structured error にする。contract-review-fragmentとの parity test を golden fixture 化する。最終 verdict
#354 の実装品質は、初期案からは大幅に改善済み。
しかし #234 の契約管理としては未完了 です。特に「
-list VC」対「fenced bash VC」の仕様差分と、Issue body 由来コマンドをローカルで実行する security boundary が未整理です。私なら、#234 には以下のコメントを付けます。
squne121 commentedon May 30, 2026
Superseded by #329/#354. Closing as absorbed into #244-B.
squne121 commentedon May 30, 2026
issue-refinement-loop 終了レポート