Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "check_implementation_overlap.py が生成する overlap_preflight evidence に repository binding(canonicalize 済み、必須)を追加し、GitHub native issue dependency(blockedBy / blocking)を公式 API 経路(既定: REST issue-dependencies、必要なら GraphQL 併用)で完全ページ取得する"
change_kind: codeParent Issue
なし(単独 follow-up。起点は #1458 の OWNER レビュー指摘)
Parent Goal Ref
- Goal: なし(単独 follow-up issue)
- Desired Destination: なし
Current Validated Scope
.claude/skills/implement-issue/scripts/check_implementation_overlap.pyの evidence 構築ロジック(repositoryfield 追加・canonicalize・hash 計算への統合)- 同スクリプトの issue fetch 経路(
fetch_current_issue/fetch_implementation_candidates/fetch_predecessor_issue)に、native issue dependency(blockedBy/blocking)を repository identity 付きで完全取得する経路を追加する。既定実装は GitHub REST issue-dependencies endpoint(GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by等)とし、GraphQL を用いる場合はblockedBy/blockingフィールドとpageInfoによる全ページ取得を必須とする .claude/skills/implement-issue/tests/test_check_implementation_overlap.py/tests/agent_ops/test_implement_issue_overlap_policy.pyへの既存テスト整合(後方互換).claude/skills/implement-issue/tests/test_check_implementation_overlap_repository_binding.py(新規)/.claude/skills/implement-issue/tests/test_check_implementation_overlap_native_dependencies.py(新規)への新規テスト追加
Remaining Parent Gaps
- 本 Issue は 実装: open-pr の validator に overlap_preflight evidence の hard gate を追加する #1458(実装: open-pr の validator に overlap_preflight evidence の hard gate を追加する #1458 、OWNER レビュー 実装: open-pr の validator に overlap_preflight evidence の hard gate を追加する #1458 (comment) の Blocker 4 / Blocker 5)が
open-prskill 側(.claude/skills/open-pr/**)の Allowed Paths に閉じるため対応できなかった、evidence producer 側(.claude/skills/implement-issue/**)の修正を切り出したもの - 実装: open-pr の validator に overlap_preflight evidence の hard gate を追加する #1458 は本 Issue 完了を待たずに Blocker 1/2/3 相当の in-scope 修正で進行できるが、Blocker 4(repository binding)と Blocker 5(native dependency 取得)の完全解消には本 Issue の完了が前提条件になる
- 本 Issue完了後、
open_pr.py(consumer 側)がfresh["repository"] == repoを強制検証する変更は本 Issue のスコープに含まれない。別 Issue(本 Issue クローズ後に issue-refinement-loop の Step 4.5 follow-up materialization gate で起票判断される)が prerequisite として本 Issue を参照する想定
Outcome
.claude/skills/implement-issue/scripts/check_implementation_overlap.py が生成する IMPLEMENT_SCOPE_COLLISION_PREFLIGHT_V1 evidence payload について、次の状態が成立している。
- online / dry-run の両経路で canonical な
repository: owner/namefield が必須で存在し、decision_inputs_sha256/evidence_sha256の計算対象に組み込まれている(欠落時は evidence を出力せずruntime_errorに倒す)。 - 大文字小文字や記法揺れのある
--repo入力が canonical value(gh api repos/{owner}/{repo}のfull_name相当)へ正規化されてから evidence に書き込まれる。 - GitHub native issue dependency(
blockedBy/blocking)を、完全性を検証できる公式 API 経路(既定は REST issue-dependencies endpoint、GraphQL を使う場合はpageInfoによる全ページ取得必須)で取得し、repositoryを含む{repository, number, state}の typed record として保持し、blockedByとblockingを混同せず別々に扱う。 - 新規・更新 pytest が全て PASS している。
本 Issue のスコープ外(Out of Scope 参照): consumer 側(open_pr.py 等)が repository field を実際に強制検証する cross-repo gate は本 Issue には含まれない。producer evidence が repository-bound になる状態までが本 Issue の完了条件であり、consumer enforcement は別 Issue が完了するまで未解消のまま残る。
Background
Issue #1458(実装: open-pr の validator に overlap_preflight evidence の hard gate を追加する)に対する OWNER レビュー(REQUEST_CHANGES, squne121, https://github.com/squne121/loop-protocol/issues/1458#issuecomment-4945284437)で 5 件の Blocker が指摘され、codebase-investigator SubAgent による fact-check で全件が現状コードに対して正確であることを確認した。うち Blocker 4 と Blocker 5 は .claude/skills/implement-issue/scripts/check_implementation_overlap.py(evidence producer script)の修正を要求しており、これは #1458 の Allowed Paths(.claude/skills/open-pr/**)の外側にある別 skill ディレクトリである。issue-refinement-loop の運用ポリシー上、レビュー中に Issue の Allowed Paths を別 skill / アーキテクチャ層へ拡張することは scope-change signal として扱い、同一 Issue に黙って畳み込まず別 Issue に分離する必要がある。そのため本 Issue として切り出し、#1458 側は本 Issue を dependency として参照した上で、#1458 自身の scope 内で可能な修正のみを進める。
本 Issue は初稿後、OWNER による REQUEST_CHANGES レビュー(#1462 (comment) )を受けて issue-refinement-loop で改訂されている。 改訂の主な理由は次の 4 点(原文 Blocker 1〜4)。
- 初稿は native dependency 取得手段を
gh api graphql必須としていたが、GitHub は専用のバージョン付き REST API(GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by等)を提供しており、GraphQL 必須という技術選定は不適切だった。REST を既定、GraphQL は併用選択肢とする。 - 初稿は offline(dry-run)経路で
repositoryが必須になっておらず、AC1(repository 必須)と AC6(既存テスト後方互換)が同時に満たせない矛盾があった。online / dry-run 両方で--repo owner/nameを必須化し、欠落時はruntime_errorに倒す。 - 初稿の AC5 は「非空の dependency number が返る」ことしか要求しておらず、先頭ページのみ取得する実装でも PASS してしまう。全ページ取得の完全性を検証する pagination boundary test を追加する。
- 初稿の
_extract_native_dependency_numbersは依存先を単なる issue number に潰しており、repository identity とblockedBy/blockingの向きを区別していなかった。{repository, number, state}の typed record として保持し、同一 repository 制約を検証してから既存 resolver へ渡す設計に変更する。
Problem 1(Blocker 4): evidence に repository binding が存在しない
IMPLEMENT_SCOPE_COLLISION_PREFLIGHT_V1 evidence schema の payload(check_implementation_overlap.py のおおよそ 697〜735 行目、evidence 構築コード。実装時に正確な行番号を再確認すること)には repository: owner/name field がどこにも存在しない。このため、evidence の消費側(例えば #1458 で計画されている open-pr の overlap_preflight gate)は、ある repo/issue-number 向けに生成された evidence が別 repo の同一 issue-number に誤って再利用されていないかを検出できない。
現在の dry-run(offline)経路は --repo を必須にしておらず、repo = args.repo として None を許容する。既存テストの CLI 呼び出しヘルパーも --repo を一度も渡していない。このため「online / dry-run の両方で repository を必須にする」契約と「既存テストが後方互換のまま PASS する」契約は、既存テストヘルパー自体に --repo squne121/loop-protocol 相当の引数を追加しない限り両立しない。
修正方針: online / dry-run の両方の呼び出し経路で --repo owner/name を必須引数にする。repository 値は gh api repos/{owner}/{repo} の full_name(または同等の正規化規則)で canonicalize してから evidence payload(body dict)のトップレベルと decision_payload(decision_inputs_sha256 の計算対象)の両方に組み込む。repository が取得不能な場合は evidence を出力せず runtime_error に倒す。既存 evidence file の consumer が存在する場合は後方互換性を保つか、schema バージョン調整を明記する(Out of Scope / Notes for Reviewer の migration 方針を参照)。
Problem 2(Blocker 1・Blocker 3・Blocker 5、改訂済み — 初稿の GraphQL 必須方針を撤回): native GitHub dependency(blockedBy/blocking)が実際には取得されていない
スクリプトには fetch した issue データから blockedBy / blocking を読み取るパースコード(_extract_native_dependency_numbers、約 266 行目、_resolve_dependencies 内での呼び出し約 309 行目)が存在するが、実際に issue データを取得している gh issue view / gh issue list --json <fields> の呼び出し(fetch_current_issue 約 447 行目、fetch_implementation_candidates 約 469 行目、fetch_predecessor_issue 約 491 行目)はいずれも number,title,body,labels,updatedAt,url[,state] のみを要求しており、blockedBy / blocking は field list に一度も含まれていない。結果として、この dependency-parsing コードは現状常に空・欠落データしか見ておらず、native issue dependency は preflight の判定に一切反映されていない。
初稿からの訂正(OWNER レビューを反映): 初稿は取得手段を gh api graphql(trackedIssues / trackedInIssues 等の未確定フィールド名)に限定していたが、これは技術選定として不適切である。GitHub は native issue dependency 用に専用のバージョン付き REST API を提供している。
GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by
GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocking
このため、既定の実装方針は REST issue-dependencies endpoint(gh api --paginate --slurp "repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by?per_page=100" 相当)を使うハイブリッド構成とする。既存の gh issue view / gh issue list --json は本文・ラベル・候補一覧取得に残し、native dependency だけ REST(または blockedBy/blocking/pageInfo を持つ GraphQL クエリ)で補完する。取得は 1 ページに限定せず、全ページを取得し、API 失敗・ページ欠落・レスポンス形状不正を「依存なし」として黙って握りつぶさない(完全性を証明できない場合は fail-closed にする)。
取得した dependency は、依存先を単なる issue number に潰さず、{repository, number, state} の typed record として保持する。同一 repository 制約を検証してから既存の number-based resolver / classifier へ接続する。blockedBy(current issue の停止理由になり得る)と blocking(current issue が後続を止めているだけで、current issue 自身の停止理由にはならない)は別々に扱い、混同しない。
両問題は同じ fetch 関数群・同じ evidence schema version に触れるため、まとめて修正するのが妥当と考えられる。
In Scope
.claude/skills/implement-issue/scripts/check_implementation_overlap.pyの evidence 構築コード(_build_evidence相当の関数)に、canonicalize 済みrepository: owner/namefield を追加し、decision_inputs_sha256/evidence_sha256の計算対象に含める- online / dry-run 両方の呼び出し経路で
--repo owner/nameを必須引数にし、欠落時はruntime_errorに倒す repositoryの canonicalization ロジック(gh api repos/{owner}/{repo}のfull_name参照、または固定の正規化規則)を追加する- 同スクリプトの
fetch_current_issue/fetch_implementation_candidates/fetch_predecessor_issue(または同等の fetch 経路)に、native issue dependency(blockedBy/blocking)を repository identity 付きで取得する経路を追加する。既定は REST issue-dependencies endpoint(gh api --paginateによるハイブリッド構成)とし、GraphQL を使う場合はblockedBy/blockingとpageInfoによる全ページ取得を必須とする - 取得した dependency を全ページ取得し、API 失敗・ページ欠落・レスポンス形状不正を「依存なし」として扱わない(完全性を証明できなければ fail-closed にする)
_extract_native_dependency_numbers/_resolve_dependenciesを、{repository, number, state}の typed record を受け取り、同一 repository 制約を検証してから既存ロジックへ接続する形に調整する。blockedByとblockingを別々に扱う.claude/skills/implement-issue/tests/test_check_implementation_overlap.pyに、repositoryfield の必須化・canonicalization・hash 計算への統合を検証する更新テストを追加する.claude/skills/implement-issue/tests/test_check_implementation_overlap_repository_binding.py(新規ファイル)に、repository tamper 検出・canonicalization・offline/online 必須化のテストを追加する.claude/skills/implement-issue/tests/test_check_implementation_overlap_native_dependencies.py(新規ファイル)に、REST/GraphQL fixture をモックした native dependency 取得・pagination 境界(50/51件、100/101件)・blockedBy/blocking方向検証・repository 不一致時の fail-closed 挙動のテストを追加するtests/agent_ops/test_implement_issue_overlap_policy.pyの既存テストとの後方互換性を維持する- 既存 evidence consumer との後方互換性、または schema バージョン調整の方針を明記する(Notes for Reviewer 参照)
- native dependency 取得の read-only smoke 検証(Runtime Verification Applicability 参照)
Out of Scope
.claude/skills/open-pr/scripts/open_pr.py(実装: open-pr の validator に overlap_preflight evidence の hard gate を追加する #1458 側、Allowed Paths が異なるため本 Issue では変更しない)。fresh["repository"] == repoを強制する consumer 側 cross-repo gate は本 Issue に含まれず、別 Issue(本 Issue 完了後に issue-refinement-loop の follow-up materialization gate で起票判断)の scope とするcheck_implementation_overlap.pyの Allowed Paths collision scoring ロジック自体の再設計(本 Issue は evidence schema 拡張と fetch 経路修正のみ)check_issue_overlap.py(create-issueskill 側の別スクリプト)への同種変更- native dependency 取得結果を preflight の route 判定(
_classify)へ新たに組み込むロジック変更(データを正しく取得できる状態にすることが本 Issue の範囲であり、取得結果を判定ロジックへどう反映するかの設計変更は別途判断・別 Issue の可能性がある。ただし_resolve_dependenciesが既存の空データ処理から実データ処理へ移行するために必要な最小限の調整は In Scope に含む)
Acceptance Criteria
- AC1: online に加え dry-run(offline)経路でも
--repo owner/nameが必須引数になっており、欠落時にcheck_implementation_overlap.pyがOverlapRuntimeError("--repo is required for dry-run" 相当のメッセージ)で終了する - AC2:
check_implementation_overlap.pyが生成する evidence payload(bodydict)のトップレベルに、canonicalize 済みrepositoryfield が含まれる - AC3:
repositoryfield の値がdecision_payload(decision_inputs_sha256の計算対象)にも含まれ、repositoryを変更するとdecision_inputs_sha256が変化する - AC4:
repositoryfield を改ざんした fixture に対し、evidence_sha256の再計算結果が元のevidence_sha256と一致しない(tamper 検出)ことを検証する新規 pytest が PASS する - AC5: 大文字小文字や記法揺れのある
--repo入力(例:squne121/LOOP-PROTOCOL)が canonical value へ正規化されて evidence に書き込まれることを検証する新規 pytest が PASS する - AC6: native issue dependency(
blockedBy/blocking)取得が GitHub の公式 API 経路(既定: REST issue-dependencies endpoint。GraphQL を使う場合はblockedBy/blocking/pageInfoを含むクエリ)で行われ、gh issue view --json/gh issue list --jsonに存在しないフィールド名を指定する既知失敗パターンを使用しない - AC7: REST/GraphQL レスポンス fixture をモックした pytest で、native dependency 取得処理が
{repository, number, state}の typed record を含む非空の dependency リストを実際に返すことを検証する新規 pytest が PASS する - AC8: 50件/51件・100件/101件の pagination 境界を持つ fixture に対し、全ページ取得(欠落なし)が行われることを検証する新規 pytest が PASS する
- AC9:
blockedByの OPEN predecessor / CLOSED predecessor、blockingのみのケース、両方向が存在するケース、repository 不一致ケース、duplicate dependency ケース、API レスポンスに number/repository/state が欠けるケースをそれぞれ検証する新規 pytest が PASS する(blockingは current issue の停止理由として扱わない) - AC10: 既存の
.claude/skills/implement-issue/tests/test_check_implementation_overlap.pyおよびtests/agent_ops/test_implement_issue_overlap_policy.pyの既存テストが全て PASS する(後方互換性の維持。既存テストヘルパーへの--repo squne121/loop-protocol相当の引数追加を含む) - AC11: 実際の
squne121/loop-protocolリポジトリに対し、native dependency 取得の read-only smoke 検証を行う。gh auth statusが利用できない環境では SKIP(exit 77)とし、fallback として fixture ベースの検証(AC7)で代替する
Runtime Verification Applicability
decision: immediate
reason: >-
初稿は fixture-only の unit test で検証が完結するとしていたが、OWNER レビュー(Major finding 2)の
指摘どおり、既存 native dependency テストはすべて offline fixture で `blockedBy` を直接埋め込んでおり、
実際の online fetch がそのフィールドを取得していなかった不具合を検出できなかった前例がある(mock は
通るが live 経路が壊れている典型例)。本 Issue で再び mock のみを受け入れると同じ再発条件が残るため、
実リポジトリに対する read-only API smoke test を必須とする。
applicable_acs:
- AC11
execution_environment:
cli_tools:
- gh
- uv
auth_required: true
network_required: true
skip_conditions:
- "`gh auth status` が失敗する環境では SKIP(exit 77)とし、fixture ベースの AC7 検証で代替する"
fallback_policy:
fallback_success_is_pass: false
notes: "fixture fallback(AC7)の成功を AC11 の PASS に変換しない。AC11 は live smoke test 自体の成否のみを PASS/FAIL とする"
artifact_requirements:
- "live smoke test の pytest output(stdout/stderr)"
- "取得した dependency 件数・pagination 完全性のログ"Verification Commands
# AC1
$ rg -n '"--repo is required for dry-run"' .claude/skills/implement-issue/scripts/check_implementation_overlap.py
# AC2
$ rg -n '"repository"' .claude/skills/implement-issue/scripts/check_implementation_overlap.py
# AC3
# baseline-expect: pass
$ rg -n "decision_payload" .claude/skills/implement-issue/scripts/check_implementation_overlap.py
# AC4
$ uv run pytest .claude/skills/implement-issue/tests/test_check_implementation_overlap_repository_binding.py -k tamper -q
# AC5
$ uv run pytest .claude/skills/implement-issue/tests/test_check_implementation_overlap_repository_binding.py -k canonicaliz -q
# AC6
$ rg -n '"--json", "number,title,body,labels,updatedAt,url,blockedBy,blocking"' .claude/skills/implement-issue/scripts/check_implementation_overlap.py
# AC7
$ uv run pytest .claude/skills/implement-issue/tests/test_check_implementation_overlap_native_dependencies.py -k typed_record -q
# AC8
$ uv run pytest .claude/skills/implement-issue/tests/test_check_implementation_overlap_native_dependencies.py -k pagination_boundary -q
# AC9
$ uv run pytest .claude/skills/implement-issue/tests/test_check_implementation_overlap_native_dependencies.py -k direction_and_repository -q
# AC10
$ uv run pytest .claude/skills/implement-issue/tests/test_check_implementation_overlap.py tests/agent_ops/test_implement_issue_overlap_policy.py -q
# AC11
$ uv run pytest .claude/skills/implement-issue/tests/test_check_implementation_overlap_native_dependencies.py -k live_smoke_read_only -qAllowed Paths
.claude/skills/implement-issue/scripts/check_implementation_overlap.py.claude/skills/implement-issue/tests/test_check_implementation_overlap.py.claude/skills/implement-issue/tests/test_check_implementation_overlap_repository_binding.py.claude/skills/implement-issue/tests/test_check_implementation_overlap_native_dependencies.pytests/agent_ops/test_implement_issue_overlap_policy.py
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- 正しい REST / GraphQL レスポンス形状の調査が完了せず、実装方針が確定できない場合
Required Skills
- Python 3
- Bash
- GitHub REST API / GraphQL API(
gh apiの利用に必要な知識のみ。ワークフロー skill は記載しない)
Required Design References
.claude/skills/implement-issue/scripts/check_implementation_overlap.py(evidence producer の正本).claude/skills/implement-issue/SKILL.md(producer script の運用文脈)docs/dev/runtime-verification-policy.md(AC11 の Runtime Verification Applicability 判定・<!-- runtime-verification: true -->タグ・SKIP exit 77 契約の正本)docs/dev/dor.md(baseline-expect annotation の per-command 規約、pytest exit code semantics の正本)- Issue 実装: open-pr の validator に overlap_preflight evidence の hard gate を追加する #1458(https://github.com/squne121/loop-protocol/issues/1458)— evidence consumer 側の follow-up、本 Issue 完了後に repository binding / native dependency を活用可能になる
Scope Delta(任意)
初稿からの Allowed Paths 拡張: .claude/skills/implement-issue/tests/test_check_implementation_overlap_repository_binding.py と .claude/skills/implement-issue/tests/test_check_implementation_overlap_native_dependencies.py(いずれも新規ファイル)を追加した。理由: docs/dev/dor.md の pytest exit code semantics(既存ファイルへの新規 node-id 追加は existing_file_missing_node_id_noncanonical として block されるため、baseline で expected_baseline_fail 判定を得るには「未作成の specific test file」を参照する必要がある)に従うため。追加先は既存 Allowed Paths と同一ディレクトリ(.claude/skills/implement-issue/tests/)内であり、アーキテクチャ層の変更は伴わない。
Delivery Rule(配信ルール)
1 Issue = 1 PRで完結する- worktree:
.claude/worktrees/issue-<N>-overlap-preflight-producer-repo-binding-native-deps - Draft PR を既定とする
Notes for Reviewer(レビュアー向け補足)
- 関連 Issue: 実装: open-pr の validator に overlap_preflight evidence の hard gate を追加する #1458(Allowed Paths 外だった評価が本 Issue に分離された背景元)、OWNER レビュー comment: https://github.com/squne121/loop-protocol/issues/1458#issuecomment-4945284437(Blocker 4 / Blocker 5)
- 実装: open-pr の validator に overlap_preflight evidence の hard gate を追加する #1458 は本 Issue の完了を待たずに Blocker 1/2/3 に相当する in-scope 修正で進行可能。本 Issue は Blocker 4 / Blocker 5 の完全解消のための prerequisite として 実装: open-pr の validator に overlap_preflight evidence の hard gate を追加する #1458 側から dependency 参照される想定
- 本 Issue は初稿に対する OWNER の REQUEST_CHANGES レビュー(実装: overlap_preflight producer に repository binding と native dependency (blockedBy/blocking) 取得を追加する #1462 (comment) )を受けて issue-refinement-loop で改訂されている。改訂内容は Background セクション末尾の 4 点を参照
- schema migration 方針: evidence schema 名は
IMPLEMENT_SCOPE_COLLISION_PREFLIGHT_V1(V1)のまま維持する。repositoryは additive required field として追加する。producer 更新前に生成された evidence file は本 Issue 完了後に再生成が必須になる。consumer は unknown field を受容するが、repositoryの equality 強制は別 Issue(Out of Scope 参照)で行う。migration allowlist(旧 schema の evidence を無期限に許容する例外)は設けない - repository canonicalization は
gh api repos/{owner}/{repo}のfull_nameを正本とする方針を推奨するが、ネットワークアクセスを避けたい場合は固定の正規化規則(小文字化等)を実装者が選択してよい。いずれを選んでも AC5 の canonicalization テストで検証されること - consumer 側 cross-repo gate(
open_pr.pyがfresh["repository"] == repoを強制する変更)は本 Issue 完了後、issue-refinement-loop の Step 4.5 follow-up materialization gate で起票判断される。本 Issue の Outcome はこの gate が未解消のままである前提で記述している
Activity
fix: overlap preflight gate の TOCTOU / provenance chain 断絶を解消する (#1458 …
feat: open-pr に overlap_preflight evidence の hard gate を追加する (#1467)
squne121 commentedon Jul 11, 2026
判定
REQUEST_CHANGES— 現状の Issue 契約では実装着手不可です。問題の切り出し自体は妥当です。#1458/PR #1467 が残した producer 側の欠陥を正しく対象にしています。ただし、現在の仕様には 4件の Blocker があり、このまま実装すると「テストは通るが、依存関係を欠落・切り詰め・逆向き解釈する」実装になり得ます。
現時点で #1462 にコメントはなく、直接対応する実装 PR も見つかりません。マージ済み PR #1467 が follow-up として参照している段階です。
Blocker 1:
gh api graphqlを必須にする技術選定が不適切Issue は AC5 で GraphQL 呼び出しを必須化し、フィールド候補として
trackedIssues/trackedInIssuesを挙げています。しかし、現在の GitHub CLI 実装が issue dependency 用に生成している GraphQL フィールドは、明確に次です。現在の公式 CLI マニュアルも
blockedBy/blockingを JSON フィールドとして掲載しています。#1462 に記載されたローカルのghv2.88.1 が未対応なのは、GitHub のデータモデルではなく CLI バージョンの互換性問題です。([GitHub CLI]1)さらに、GitHub は現在、専用のバージョン付き REST API を提供しています。
このため「旧 CLI の
--jsonが未対応 → GraphQL 必須」という結論は成立しません。REST の方が関係の意味、API バージョン、ページング契約が明示されています。([GitHub Docs]2)必須修正
AC5 を「GraphQL 必須」から次へ変更すべきです。
既存の
gh issue view/listは issue 本文・ラベル・候補一覧取得に残し、native dependency だけ REST で補完するハイブリッド構成が最小変更です。Blocker 2: offline 経路では
repositoryを生成できない現在の dry-run 経路は
--repoを必須にしておらず、そのままrepo = args.repoとしてNoneを許容します。既存テストの
_run_cli()も--repoを一度も渡していません。したがって、次の2条件は同時に満たせません。
repository: owner/nameがあるrepository: nullや空文字を許せば repository binding になりません。fixture 名やカレントディレクトリから暗黙推定するのも非決定的です。必須修正
次のいずれかを契約として固定してください。
--repo owner/nameを必須にするrepositoryを必須フィールドとして持たせ、CLI 引数との一致を検証する推奨は 1 です。全テストヘルパーに次を追加すれば済みます。
repository が取得不能な場合は evidence を出力せず
runtime_errorに倒すべきです。Blocker 3: dependency の完全取得を証明できない
Issue の AC5 は「非空の dependency number を返す fixture」が通ることしか要求していません。これでは先頭ページだけ取得する実装も PASS します。
GitHub CLI の現在の GraphQL 実装は
first:50ですが、pageInfoを取得していません。これをそのまま模倣すると51件目以降を黙って欠落させます。REST endpoint もデフォルト30件、最大100件のページング方式です。([GitHub Docs]2)
gh apiには全ページ取得用の--paginateと、ページを配列として返す--slurpがあります。GraphQL のページングではクエリ内にpageInfo { hasNextPage endCursor }が必要です。([GitHub CLI]3)必須修正
例えば REST なら次の構成です。
50件、51件、100件、101件の境界テストが必要です。
Blocker 4: repository identity と関係の向きを捨てている
現在の
_extract_native_dependency_numbers()は、依存先を単なる issue number に潰しています。しかし、GitHub CLI が返す linked issue には
repository.nameWithOwnerが含まれ、REST レスポンスにもrepository_urlが含まれます。 ([GitHub Docs]2)同一 repository の依存だけを許す設計であっても、repository identity を捨ててから同一 repository と仮定するのは順序が逆です。まず
{repository, number}として保持し、その後に同一 repository 制約を検証する必要があります。また、現在のロジックが blocking 判定へ統合しているのは
blockedByだけです。blockingは取得・解析しても current issue の停止理由にはなりません。AC5 の「非空になった」という検証だけでは、次の誤実装も通ります。
blockingをblockedByとして扱う必須テスト
blockedByの OPEN predecessor →wait_for_predecessorblockedByの CLOSED predecessor → C2ablockingのみ → current issue を停止しないMajor findings
1. #1462 単体では cross-repo gate は閉じない
マージ済み consumer の
open_pr.pyが安全条件として確認している binding はcurrent_issue.number == linked_issueまでです。repository は検証していません。#1462 が producer にフィールドを追加しても、consumer が読まなければ cross-repo 誤用は阻止されません。PR #1467 自身も repository field を #1462 の follow-up として明記しています。
Issue の Outcome は次のように限定すべきです。
併せて、
open_pr.pyでfresh["repository"] == repoを強制する follow-up Issue を #1462 の完了条件として起票・リンクすべきです。2. Runtime Verification を
not_applicableにしてはいけない既存 native dependency テストはすべて offline fixture で、fixture 自体に
blockedByを直接埋め込んでいます。一方、実際の online fetch はそのフィールドを取得していませんでした。
つまり今回のバグは、mock が通って live integration が壊れていた典型例です。この Issue で再び mock のみを受け入れるのは再発条件をそのまま残します。
Runtime Verification は次へ変更すべきです。
PR作成や dependency 作成は不要ですが、実リポジトリに対する read-only API smoke test は必須です。
3. schema migration の結論がない
repositoryをdecision_inputs_sha256に加えると、producer 更新前の evidence と更新後の fresh evidence は必ず drift します。これは妥当な挙動ですが、「後方互換性を保つか schema bump を判断する」では実装者ごとに結論が変わります。このスコープなら、次を明記するのが妥当です。
repositoryは additive required field4. repository 名の canonicalization が未定義
REST の
owner/repoは大文字小文字を区別しません。([GitHub Docs]2) 一方、SHA-256 の入力文字列は区別します。そのため、入力された生の
--repoをそのまま hash すると、同じ repository に対する次の入力が別 digest になります。gh api repos/{owner}/{repo}のfull_nameを正本にするか、少なくとも正規化規則を固定すべきです。可能ならnode_idも evidence に保持すると rename 監査が容易です。推奨実装
既存コードへの影響を抑えるなら、次の構成が適切です。
Evidence は既存フィールドを壊さず、追加情報を保持します。
{ "schema": "IMPLEMENT_SCOPE_COLLISION_PREFLIGHT_V1", "repository": "squne121/loop-protocol", "dependency_resolution": { "blocked_by_refs": ["1450"], "blocking_predecessor": { "repository": "squne121/loop-protocol", "issue_number": 1450, "state": "OPEN" }, "native_dependencies": { "blocked_by": [ { "repository": "squne121/loop-protocol", "number": 1450, "state": "OPEN" } ], "blocking": [], "complete": true, "transport": "rest" }, "closed_predecessors": [], "unresolved_refs": [] } }修正版 Acceptance Criteria
repositoryが必須であり、欠落時はruntime_error。repositoryが両 SHA の計算対象に含まれる。{repository, number, state}として保持し、同一 repository 制約を検証してから既存 resolver へ渡す。blockedByとblockingの向きを別々に検証する。rgによる否定確認ではなく、mock subprocess の実引数を直接 assertion する。現状の #1462 は、問題認識は正しいものの、API transport・offline contract・完全性・identity の4点が未確定です。特に「GraphQL fixture が非空になった」だけでは、本番で dependency を欠落させる false green を再び作ります。
squne121 commentedon Jul 11, 2026
Refinement Loop: Approved
The issue has been approved and is ready for implementation.
approvedsqune121 commentedon Jul 11, 2026
Contract Review Result
squne121 commentedon Jul 11, 2026
implement-issue: 実装完了・PR 起票は overlap preflight gate で保留(人間判断待ち)
実装状況
.claude/skills/implement-issue/scripts/check_implementation_overlap.py.claude/skills/implement-issue/tests/test_check_implementation_overlap.py(既存テストヘルパーに--repo追加、後方互換維持).claude/skills/implement-issue/tests/test_check_implementation_overlap_repository_binding.py(新規).claude/skills/implement-issue/tests/test_check_implementation_overlap_native_dependencies.py(新規)tests/agent_ops/test_implement_issue_overlap_policy.py(既存テストヘルパーに--repo追加).claude/worktrees/issue-1462-overlap-preflight-producer-repository-biworktree-issue-1462-overlap-preflight-producer-repository-bi(push 済み)-kフィルタも個別に確認済み)、ruff checkPASS--repo is required for dry-run)・AC2(repositoryfield)・AC3(decision_payload統合)の VC 文字列もrgで確認済みPR 起票を保留した理由(Major 1 deterministic drift gate)
implement-issue/SKILL.mdの PR 作成直前 drift gate に従いcheck_implementation_overlap.py --issue-number 1462 --repo squne121/loop-protocolを再実行したところ、route: human_review_requiredが返った。原因は #1462 自体の内容とは無関係で、候補プールに含まれる 既存 OPEN
phase/implementationIssue のうち 8 件(#150, #152, #154, #173, #481, #666, #667, #901)が## Allowed Pathsセクションを欠いているため、Major 5 の fail-closed 検証(missing_allowed_paths)が発火し、validation_errorsが非空になっていることによる(_classifyの route 決定順序では、この検証エラーが構造的衝突判定より優先される)。参考までに、Allowed Paths が部分的に重なる候補として #420(playtest-log JSON Schema)・#1390(visual diff AI/VLM triage 非ブロッキング化)も検出されたが、いずれも #1462 とは goal_ref・Outcome・In Scope が完全に disjoint な別ドメインの Issue であり、
shared_ac_ids(AC1/AC2/AC3 のような汎用番号の一致)に起因する false positive の可能性が高い。この状態は repo 全体の backlog データ品質(古い Issue の contract 未整備)に起因する systemic な条件であり、#1462 の Allowed Paths / Out of Scope(
check_implementation_overlap.pyの scoring ロジック再設計は対象外)には含まれない。SKILL.md の contract に従い、route: human_review_requiredの状態ではgh pr createを呼ばず人間判断へ停止する。依頼事項
以下のいずれかの人間判断をお願いします。
evidence(再実行結果 JSON)は worktree 内に保持しており、必要であれば追加で共有します。
squne121 commentedon Jul 11, 2026
実装 PR を作成した: #1474 (Draft,
Closes #1462)Overlap Preflight Gate Override の要約
open_pr.pyの PR 作成直前 overlap preflight hard gate がroute: human_review_requiredを返したため、open_pr.pyを経由せずgh pr createを直接実行して本 PR を作成した(人間承認済み)。phase/implementationissue 8 件(実装: post-merge-cleanup に parent body materialization guard を追加する #150, 実装: issue-contract-review に parent body consistency check を追加する #152, 実装: open-pr に tracking/parent issue への Closes 自動付与を防ぐ guard を追加する #154, chore: #145/#146/#147 を milestone-ops.md 確定後に issue-contract-review で再 preflight する #173, fix: verify_acp_roundtrip.sh の scenario 2b (fake ACP + --approve-edits) FAIL を修正する #481, 実装: plan_refinement_loop の _extract_missing_contract_keys を PyYAML 不在時に fail-closed にする(#661 follow-up) #666, 実装: plan_refinement_loop の fail_closed reason code exhaustiveness invariant をテストする(#661 follow-up) #667, 実装: baseline-expect annotation の pytest テストを CI required ジョブに追加し regression gate 化する #901)が## Allowed Pathsセクションを欠いており、これらが「Allowed Paths 不明」として扱われた(control-plane が 実装: post-merge-cleanup に parent body materialization guard を追加する #150 本文を直接確認し検証済み)。いずれも本 Issue のドメインとは無関係な legacy issue。.claude/skills/implement-issue/**/tests/agent_ops/test_implement_issue_overlap_policy.py)との意味的衝突なしと確認済み。validate_pr_body.pyとvalidate_japanese_content.py --threshold 0.1の両方を通過済み。squne121 commentedon Jul 11, 2026
PR #1474 REQUEST_CHANGES 対応完了
pr-review-judge の REQUEST_CHANGES 判定(reviewed_head_sha 25fa61f)に対応し、以下を実施した。
修正内容
.claude/skills/implement-issue/tests/test_check_implementation_overlap_native_dependencies.py:185の test 関数名(125文字、120文字制限超過)を意味を保ったまま短縮。test_given_blocked_by_open_predecessor_when_direction_and_repository_resolved_then_wait_for_predecessor_signaltest_given_blocked_by_open_predecessor_when_direction_repo_resolved_then_wait_for_signalgit merge origin/mainでbranchをmainに追従(コンフリクトなし。issue-reviewer関連の変更を取り込み)。検証結果
uv run pytest .claude/skills/implement-issue/tests/test_check_implementation_overlap.py .claude/skills/implement-issue/tests/test_check_implementation_overlap_repository_binding.py .claude/skills/implement-issue/tests/test_check_implementation_overlap_native_dependencies.py tests/agent_ops/test_implement_issue_overlap_policy.py -q→ 64 passeduv run ruff check .claude/skills/implement-issue/→ All checks passedpush後のhead SHA
7297629697bd1c4275ed8d19ccb726cd60cc9551PR #1474 へ push済み。CI 再実行結果とdeploy-pr flakeの再確認を待つ。
squne121 commentedon Jul 11, 2026
PR #1474 の AC11 live smoke test を修正しました。
修正内容
.claude/skills/implement-issue/tests/test_check_implementation_overlap_native_dependencies.pyのtest_live_smoke_read_only_native_dependency_fetch(AC11)で、gh auth status失敗時の SKIP 処理をpytest.exit(..., returncode=77)からpytest.skip(...)に変更しました。pytest.exit()は pytest-xdist worker 内で呼ぶと worker process ごと落ちてしまい、controller 側でINTERNALERROR: assert not crashitemを引き起こしていました(CI run 29172464382, job 86595777094 で確認済みの実障害)。pytest.skip()に切り替えることで xdist 環境下でも安全に SKIP できるようにしています。SKIP:prefix のメッセージ内容は維持しています。検証結果
uv run pytest .claude/skills/implement-issue/tests/test_check_implementation_overlap_native_dependencies.py -p xdist -n 4 -q→ 18 passed(xdist環境下でクラッシュなし)uv run pytest .claude/skills/implement-issue/tests/test_check_implementation_overlap.py .claude/skills/implement-issue/tests/test_check_implementation_overlap_repository_binding.py .claude/skills/implement-issue/tests/test_check_implementation_overlap_native_dependencies.py tests/agent_ops/test_implement_issue_overlap_policy.py -q→ 64 passeduv run ruff check .claude/skills/implement-issue/→ PASS(exit 0)push 結果
worktree-issue-1462-overlap-preflight-producer-repository-bi7297629697bd1c4275ed8d19ccb726cd60cc9551be3de2a8ce1879deeb7da28136f786c734c05cadfix: native dependency の repository_url schema と candidate 側取得を修正する
squne121 commentedon Jul 12, 2026
PR #1474 に対する OWNER レビュー(REQUEST_CHANGES、#1474 (comment) )対応を完了し、head
b6af00fdを push しました。repository_urlが公式応答形であることを実証確認(nestedrepository.full_nameは架空)。パース処理と fixture を修正。詳細は #1474 (comment) を参照してください。
uv run pytest .claude/skills/implement-issue/139 件 PASS、ruff checkclean。fix: E501 テスト関数名を120文字以内に短縮する
squne121 commentedon Jul 12, 2026
PR #1474 の CI python-test E501 失敗(
test_check_implementation_overlap_native_dependencies.py:423, 124>120文字)を修正しました。冗長な
_raw_with_/_typed_record_を除去し、テスト関数名を意味を保ったまま短縮:test_given_candidate_raw_with_native_blocked_by_typed_record_when_scope_built_then_successor_relation_visible→
test_given_candidate_native_blocked_by_when_scope_built_then_successor_relation_visiblepush 済み head SHA:
ddd1a228822e878ac442ba3b0e80b0f363bf9477(branch: worktree-issue-1462-overlap-preflight-producer-repository-bi)実装: open-pr の overlap_preflight evidence consumer に repository 一致検証を追…