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: "materialized_go の CONTRACT_REVIEW_RESULT_V1 を source-bound expected_contract_fingerprint 付きで発行し、parser・intake・reviewer が同一 fingerprint で Allowed Paths gate を認証できるようにする"
change_kind: codeParent Issue
なし(単独改善)
Parent Goal Ref
- Goal: Issue contract snapshot を実装・PR レビュー間で同一の source-bound Allowed Paths fingerprint により認証し、欠落した snapshot を merge-blocking とする。
- Desired Destination: materialized go snapshot の producer と loop consumer / reviewer の契約接続を固定する。
Current Validated Scope
ensure_contract_snapshot.pyは materialized go を投稿できるが、CONTRACT_REVIEW_RESULT_V1にexpected_contract_fingerprintを発行していない。contract_review_result_parser.pyとbuild_intake_capsule.pyは fingerprint 欠落のstatus: goを loop-consumable な fresh go として扱い得る。allowed_paths_review_gate.pyは fingerprint 欠落をindeterminateと fail-closed にするが、snapshot から同一 fingerprint を直接 gate input として受け取る接続が固定されていない。- Issue 実装: issue-contract-review fingerprint refresh path を明示する #1329 は reviewer 側の欠落 reason / fix_hint の明確化だけを対象とし、producer・parser・intake・reviewer 間の fingerprint 発行/認証は対象外である。
run_contract_review_once.pyと controlled metadata executor は trustedstatus: goを authoritative に採用する consumer であり、fingerprint-ready 判定を共通 predicate へ狭める必要がある。- 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 が所有していた
patch_comment()の実送信 byte / response / independent GET reconciliation は、PR feat: source-bound contract fingerprint を materialize する #1548 の二相発行で orphanstatus: goを残さないため、この Issue へ限定統合する。
Remaining Parent Gaps
なし。本 Issue は source-bound fingerprint の発行・authoritative consumer 認証・二相 transport を扱う。CI runtime baseline の収集・比較、PR 本文整形、Allowed Paths matcher / reason / fix_hint の変更は扱わない。
Outcome
provisional 投稿は authoritative な CONTRACT_REVIEW_RESULT_V1 status: go ではない pending schema に閉じ、PATCH と独立 read-back が成功した後だけ、実際に投稿された GitHub Issue comment を source とする 7 項目の expected_contract_fingerprint を持つ go snapshot になる。欠落・不正・不一致の snapshot はすべての authoritative consumer で採用されず、intake は再 materialize 経路へ戻り、reviewer の Allowed Paths gate は同じ fingerprint を認証して ok または fail-closed を決定できる実装と回帰テストが存在する状態。
In Scope
ensure_contract_snapshot.pyが materialization 時にbase_refとbase_sha_at_snapshotを capture し、投稿後に read-back で確定した実 GitHub Issue comment のcontract_source_kind/contract_source_idに bind して、expected_contract_fingerprintを発行・投稿・検証する。- fingerprint は
issue_number、contract_source_kind、contract_source_id、contract_body_sha256、allowed_paths_normalized_sha256、base_ref、base_sha_at_snapshotの 7 項目と、Allowed Paths gate と同一の正規化・SHA-256 規則を使用する。 contract_review_result_parser.pyが source-bound fingerprint を持つ go snapshot だけを fingerprint-ready として返し、必須項目の欠落・型不正・source binding 不正を valid fresh go として採用しない。build_intake_capsule.pyが fingerprint 欠落/不正の go snapshot をnormalized_status: missing_goとしてensure_contract_snapshotの再 materialize route に送り、loop-consumable fresh go に昇格させない。allowed_paths_review_gate.pyが snapshot 由来の fingerprint を gate input としてそのまま用い、同一 7 項目の再計算結果との一致時だけ source-boundokを許可する。fingerprint の再生成、欠落 fallback、Issue 実装: issue-contract-review fingerprint refresh path を明示する #1329 が扱う reason / fix_hint の文言変更は行わない。- provisional POST は
CONTRACT_SNAPSHOT_MATERIALIZATION_PENDING_V1だけを含み、PATCH 成功後にのみ finalCONTRACT_REVIEW_RESULT_V1 status: goを配置する。PATCH/read-back failure の orphan pending は authoritative consumer が採用しない。 run_contract_review_once.py、ensure_contract_snapshot.py、build_intake_capsule.py、controlled_skill_mutation_exec.pyは fingerprint-ready を共通 predicate で必須にし、caller ごとの緩和を作らない。- fingerprint readiness は exact 7 keys、inner body hash との一致、full commit OID、authority binding を検証する。intake は live Issue の canonical Allowed Paths hash も再計算して照合する。
- producer は canonical Allowed Paths extractor と gate の strict canonicalization を共有し、missing / empty / invalid / valid+invalid は POST 前に fail-closed にする。
- 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 から限定統合した PATCH transport は canonical UTF-8 payload bytes を一度だけ送信し、PATCH response body と single-comment GET body を照合する。timeout / transport error は GET reconciliation 後も不明なら non-authoritative にする。
- 実装: contract snapshot既存再利用パスにpublish receipt bindingを追加する #1490 の既存 snapshot publish receipt、実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 の check-only 診断・過去コメント inventory、実装: issue-contract-review fingerprint refresh path を明示する #1329 の reason / fix_hint 文言は引き続き別責務とする。
Out of Scope
allowed_paths_review_gate.pyの fingerprint 必須要件の緩和、status: okfallback、欠落時の reason / fix_hint 文言(Issue 実装: issue-contract-review fingerprint refresh path を明示する #1329)CONTRACT_SNAPSHOT_PUBLISH_RECEIPT_V1の保存・既存 snapshot 再利用時の receipt 照合(Issue 実装: contract snapshot既存再利用パスにpublish receipt bindingを追加する #1490)- 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 が扱う check-only 診断、過去 snapshot の inventory、又は Issue 実装: source-bound contract fingerprint を materialize する #1537 の限定統合外の post helper 変更
- CI runtime baseline(
ci_runtime_baseline_v1)の収集・比較、および CI workflow の変更 - PR 本文の定型セクション整形、Allowed Paths matcher v2 / changed-files provenance / pagination adapter の変更
Runtime Verification Applicability
- decision: not_applicable
- reason: 本 Issue の AC1〜AC5 はすべて
expected_contract_fingerprintの発行・検証・ルーティングという Python スクリプト間のデータ契約を対象とし、Verification Commands も pytest によるユニットテストのみで完結する。プロセス起動・外部通信・実行環境 I/O を要する動作検証は不要。
Acceptance Criteria
- AC1: materialized go の
CONTRACT_REVIEW_RESULT_V1は投稿後 read-back で確定した GitHub Issue comment をcontract_source_kind/contract_source_idに使い、Allowed Paths gate と同じ 7 項目・正規化・SHA-256 規則のexpected_contract_fingerprintを含む。base ref と base SHA を materialization 時に capture できない場合は go を発行しない。 - AC2: contract review result parser は 7 項目の fingerprint、source kind / source ID、各 hash を検証し、欠落・型不正・source binding 不正の
status: goを fingerprint-ready snapshot として返さない。 - AC3: intake capsule は fingerprint-ready でない go snapshot を
normalized_status: missing_goとしてensure_contract_snapshotの再 materialize route に送り、fresh go として実装 worker を起動しない。 - AC4: reviewer の Allowed Paths gate は snapshot の
expected_contract_fingerprintを無変換で gate input に使用し、同じ 7 項目から計算した fingerprint が一致し、changed files が Allowed Paths 内にある場合だけstatus: okを返す。欠落・不一致は従来どおり merge-blocking のままである。 - AC5: materialized go、parser、intake、reviewer の回帰テストが、同一 fingerprint の happy path と fingerprint 欠落 snapshot の fail-closed / re-materialize path を固定して PASS する。
- AC6: provisional 投稿は
CONTRACT_SNAPSHOT_MATERIALIZATION_PENDING_V1だけであり、PATCH failure / orphan を含めて parser、run-once、controlled readback が authoritativestatus: goとして採用しない。 - AC7: fingerprint readiness は exact 7 keys、fingerprint と inner の body SHA 一致、full commit OID、実 comment ID / Issue number を必須にし、intake は live Issue の canonical Allowed Paths hash 不一致を
missing_goに route する。 - AC8: producer と gate は canonical Allowed Paths extractor / strict canonicalization を共有し、unquoted・
*・+bullet の valid path を同じ hash にし、missing / empty / invalid / valid+invalid は POST 前に fail-closed にする。 - AC9: 限定統合した PATCH transport は同一 UTF-8 payload bytes、PATCH response body、single-comment GET body を照合し、timeout / transport error は GET reconciliation 後も不明なら final go を認証しない。
- AC10:
run_contract_review_once.pyの回帰テストが、fingerprint-ready でない provisional / orphan を authoritative go として採用しないことを固定して PASS する。 - AC11: controlled metadata executor の回帰テストが、fingerprint-ready でない provisional / orphan を authoritative go として採用しないことを固定して PASS する。
Verification Commands
# AC1
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py
# AC2
$ uv run --locked pytest .claude/skills/issue-contract-review/tests/test_contract_review_result_parser.py
# AC3
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_build_intake_capsule.py
# AC4
$ uv run --locked pytest .claude/skills/pr-review-judge/tests/test_allowed_paths_review_gate.py
# AC5
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py
# AC6
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py
# AC7
$ uv run --locked pytest .claude/skills/issue-contract-review/tests/test_contract_review_result_parser.py
# AC8
$ uv run --locked pytest .claude/skills/pr-review-judge/tests/test_allowed_paths_review_gate.py
# AC9
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py
# AC10
$ uv run --locked pytest .claude/skills/issue-contract-review/tests/test_run_contract_review_once.py
# AC11
$ uv run --locked pytest scripts/agent-guards/tests/test_controlled_issue_metadata_exec.pyAllowed Paths
.claude/skills/impl-review-loop/scripts/ensure_contract_snapshot.py.claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py.claude/skills/issue-contract-review/scripts/contract_review_result_parser.py.claude/skills/issue-contract-review/tests/test_contract_review_result_parser.py.claude/skills/impl-review-loop/scripts/build_intake_capsule.py.claude/skills/impl-review-loop/tests/test_build_intake_capsule.py.claude/skills/pr-review-judge/scripts/allowed_paths_review_gate.py.claude/skills/pr-review-judge/tests/test_allowed_paths_review_gate.py.claude/skills/impl-review-loop/tests/test_contract_snapshot_author_binding.py(Scope Delta、PR feat: source-bound contract fingerprint を materialize する #1548 追加分。詳細は下記「Scope Delta」参照).claude/skills/issue-contract-review/scripts/run_contract_review_once.py.claude/skills/issue-contract-review/tests/test_run_contract_review_once.pyscripts/agent-guards/controlled_skill_mutation_exec.pyscripts/agent-guards/tests/test_controlled_issue_metadata_exec.py
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- 投稿後 read-back なしに comment ID を source として主張する実装、または snapshot 自己申告の source ID を受理する必要が生じた場合
- 7 項目の fingerprint 規則を Allowed Paths gate と共有できず、別の hash・正規化規則を導入する必要が生じた場合
- Issue 実装: contract snapshot既存再利用パスにpublish receipt bindingを追加する #1490 の publish receipt、実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 の check-only 診断・過去 snapshot inventory、又は Issue 実装: issue-contract-review fingerprint refresh path を明示する #1329 の reason / fix_hint 変更を同一 PR に含める必要が生じた場合
Required Skills
- Python
- pytest
Required Design References
docs/dev/workflow.md#Issue 駆動開発フローdocs/dev/agent-skill-boundaries.md#Loop Sequencing & Preconditionsdocs/dev/workflows/impl-review-loop-design.md#State Model.claude/skills/pr-review-judge/references/allowed-paths-gate.md
Scope Delta(任意)
- 対象パス:
.claude/skills/impl-review-loop/tests/test_contract_snapshot_author_binding.py(実装: contract snapshotのtrusted publisher identityとcomment ID bindingを検証する #1485 が所有する既存回帰テスト、本 Issue の Allowed Paths 外) - 理由: 本 Issue の AC1 実装(
ensure_contract_snapshot.pyへのcapture_base_ref_and_sha/patch_commentを伴う二段階 materialize 追加)により、上記ファイル内のTestControlledPublisherCommentIdBinding系テスト(test_controlled_publisher_comment_id_binding_is_requiredの mismatched-binding 分岐、test_materialization_blocked_when_binding_fails、test_materialization_succeeds_when_binding_matches)が、新規 subprocess 呼び出し(capture_base_ref_and_sha/patch_comment)を未モックのまま実行してしまいruntime_errorで失敗する。 - 許可する変更範囲: 上記 3 テストへの
capture_base_ref_and_sha/patch_commentのモック追加のみ。AC の意味論・アサーション対象・ファイル内の他テスト・ファイル削除は変更しない(simple_contract_hygiene_fix相当の最小差分)。 - 検証: 変更後も
.claude/skills/impl-review-loop/tests/test_contract_snapshot_author_binding.pyが単体で全 PASS すること(実装: contract snapshotのtrusted publisher identityとcomment ID bindingを検証する #1485 の既存回帰保証を維持)。 - 追加対象:
.claude/skills/issue-contract-review/scripts/run_contract_review_once.py/.claude/skills/issue-contract-review/tests/test_run_contract_review_once.py/scripts/agent-guards/controlled_skill_mutation_exec.py/scripts/agent-guards/tests/test_controlled_issue_metadata_exec.py。 - 追加理由: feat: source-bound contract fingerprint を materialize する #1548 review comment #5002641369 が authoritative consumer と controlled boundary の provisional go 採用を merge blocker として特定した。実装: contract snapshotのtrusted publisher identityとcomment ID bindingを検証する #1485 の merged precedent と同じく、trusted 判定だけでなく fingerprint-ready 判定を全 consumer に適用する最小更新に限定する。
- 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 限定統合:
ensure_contract_snapshot.pyの PATCH transport について、実送信 payload bytes・PATCH response・single-comment GET の照合と timeout reconciliation だけを 実装: source-bound contract fingerprint を materialize する #1537 へ移管する。実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 の check-only 診断・過去 snapshot inventory は移管しない。
Delivery Rule
1 Issue = 1 PRとし、専用 worktree で実装して Draft PR を作成する。- PR の review evidence は、materialized snapshot URL、snapshot 内 fingerprint、Allowed Paths gate 出力の fingerprint が同一であることを current HEAD に bind して記録する。
Bootstrap Fingerprint Exception Policy
BOOTSTRAP_FINGERPRINT_EXCEPTION_POLICY_V1:
authorization: "owner approved 2026-07-17"
status: "expired_due_to_issue_body_revision"
purpose: "source-bound fingerprint producer 自身を初回レビューするための、循環しない限定 bootstrap policy"
target:
issue: 1537
pull_request: 1548
reviewed_head_sha: "51d1e429f083b2fab3c01173c0633fb1f80fa54b (historical target only)"
snapshot_selection:
required: "この本文更新後に issue-contract-review が controlled metadata lane で投稿する、同一 body_sha256 の最新 trusted CONTRACT_REVIEW_RESULT_V1 status: go"
disallow: "PR branch・worker report・手作業の snapshot を authoritative source として採用すること"
waiver:
only_reason: "expected_contract_fingerprint_missing"
effect: "PR #1548 の初回 review に限り Allowed Paths gate の当該 reason を bootstrap exception として判定する。snapshot が fingerprint-ready 又は authoritative fingerprint source であるとは主張しない。"
not_waived:
- "Allowed Paths"
- "reviewed head SHA 一致"
- "Acceptance Criteria / Verification Commands"
- "CI"
- "schema consumer inventory"
- "safety claims"
- "その他の Allowed Paths gate reason"
prohibited:
- "未マージ PR の producer を使った GitHub contract snapshot の生成、PATCH、権威化"
- "worker 自己申告又は自由記述による fingerprint 補完"
post_merge_requirement:
- "PR #1548 merge 後、trusted main の producer で二相 materialize を実行する"
- "独立 read-back で fingerprint-ready snapshot を確認する"
- "以後の PR review で本 exception を再利用しない"
expiration:
- "PR #1548 の head SHA が変化した時"
- "対象 issue 本文が変化した時"
- "選択された contract snapshot の source 又は body_sha256 が不一致になった時"
- "PR #1548 merge 後の fingerprint-ready snapshot read-back 完了時"Notes for Reviewer
- 決定論的修正を採用する。fingerprint 欠落を reviewer の自由記述や worker 自己申告で補う workaround は採用しない。
- 実装: issue-contract-review fingerprint refresh path を明示する #1329 との shared path は
allowed_paths_review_gate.pyだけだが、実装: issue-contract-review fingerprint refresh path を明示する #1329 は欠落を発見した後の reason / fix_hint、こちらは snapshot producer / consumer の値の発行・認証であり、変更する関数・AC・完了条件が異なる。 - 実装: contract snapshot既存再利用パスにpublish receipt bindingを追加する #1490 / 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 と
ensure_contract_snapshot.pyを共有するため、実装開始時に live issue / PR 状態を read-back し、同一行・同一 helper の変更が必要になれば Stop Conditions に従って依存・統合判断を記録する。 - 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 の PATCH transport 範囲は owner 選択により本 Issue へ限定統合した。実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 の check-only 診断・過去 snapshot inventory は変更しない。
- Scope Delta(
test_contract_snapshot_author_binding.py)は 実装: contract snapshotのtrusted publisher identityとcomment ID bindingを検証する #1485 所有ファイルへのモック追加のみを許可する。ファイル削除・内容移設・他ファイルへの統合は許可しない。
Scope Collision Preflight
ISSUE_OVERLAP_PREFLIGHT_RESULT_V1:decision: overlap_requires_comment、policy_class: C1、GitHub search / read-back はともにok。- 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 は投稿 body の byte-level hash と check-only 検出を対象にする。このうち PATCH transport の exact payload / response / GET reconciliation は owner 選択で本 Issue へ限定統合し、check-only 診断・過去 snapshot inventory は 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 に残す。
- 実装: contract snapshot既存再利用パスにpublish receipt bindingを追加する #1490 は publish receipt による既存 snapshot 再利用を対象にし、本 Issue は fingerprint 欠落 snapshot を再 materialize に戻す。receipt schema は導入しない。
- 実装: issue-contract-review の human_judgment に対する人間 override を CONTRACT_REVIEW_HUMAN_OVERRIDE_V1 スキーマで記録・検出できるようにする #1348 は human override marker の検出を対象にし、本 Issue は
CONTRACT_REVIEW_RESULT_V1 status: goの fingerprint-ready 判定だけを対象にする。 - 実装: issue-contract-review fingerprint refresh path を明示する #1329 は reviewer の reason / fix_hint を対象にし、本 Issue は snapshot の fingerprint を reviewer input に接続する。実装: feat(impl-review-loop): no-diff / superseded の終了処理を再実行可能なfinalizerに集約する #1116 / feat(impl-review-loop): startup を capsule-first に強制し raw 初期調査を禁止する #1114 / 実装: issue-contract-review scripts の CLI alias compatibility を追加する #1053 / feat(agent-ops): broad regex VC を検出する vc_text_assert.py を追加し、positive assertion の unexpected_pass を事前に潰す #996 / 実装: concurrent work ledger で active worktree / dirty main / overlapping paths を loop 前に検出する #966 / 実装: ci_failure_attribution.py で known infra failure を分類し fix_delta 汚染を防ぐ #965 / 実装: model capability router で Haiku fallback の編集・成功判定スコープを制限する #962 / 実装: SubAgent result evidence gate で証跡なし成功報告を fail-closed にする #961 / 実装: human-interface-finalizer skill / SubAgent を導入し PR本文・Issue本文・公開コメント・人間向け docs を公開前 finalize する #351 は directory-wide test 又は workflow surface の一致のみで、fingerprint の 7 項目・source binding・re-materialize routing は扱わない。
- 実装: contract snapshotのtrusted publisher identityとcomment ID bindingを検証する #1485 は
test_contract_snapshot_author_binding.pyを新規追加した Issue であり、本 Issue はその既存テストへの最小モック追加(Scope Delta 参照)のみを行う。テスト内容・アサーション意図の変更は行わない。
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Activity
squne121 commentedon Jul 16, 2026
Scope Collision (C1): related_issue=#1513, #1490, #1348, #1329, #1116, #1114, #1053, #996, #966, #965, #962, #961, #351; overlapping_paths=.claude/skills/impl-review-loop/scripts/build_intake_capsule.py, .claude/skills/impl-review-loop/scripts/ensure_contract_snapshot.py, .claude/skills/impl-review-loop/tests/test_build_intake_capsule.py, .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py, .claude/skills/issue-contract-review/tests/test_contract_review_result_parser.py, .claude/skills/pr-review-judge/scripts/allowed_paths_review_gate.py, .claude/skills/pr-review-judge/tests/test_allowed_paths_review_gate.py. non_conflict_reason / edit_intent / dependency ordering を記録すること。
Non-conflict reason
Edit intent
ensure_contract_snapshot.py: 実 Issue comment ID と materialization 時の base ref/SHA に bind した fingerprint を発行・read-back 検証する。Dependency ordering
squne121 commentedon Jul 16, 2026
判定: NO-GO / REQUEST_CHANGES
方向性は妥当です。特に、fingerprint 欠落時の fallback を認めず、producer・parser・intake・reviewer を同一の値で接続しようとしている点は正しいです。
ただし、現在の Issue #1537 は、実装可能性・独立検証性・障害時状態遷移の3点が閉じていません。このまま着手すると、表面上は AC を満たすものの、実際には snapshot 自己申告を再比較するだけの実装か、半端に投稿された authoritative comment を残す実装になる可能性が高いです。
1.
[P0 / Merge blocker]comment ID の自己参照を解く発行プロトコルがないAC1 は、実際に投稿された GitHub Issue comment の ID を
contract_source_idとし、その値を同じ comment 内のexpected_contract_fingerprintに含めることを要求しています。しかし現行実装は次の順序です。
_build_contract_review_comment()は POST 前に最終本文を構築し、post_comment()は.html_urlだけを返します。取得した ID は read-back 検証にしか使われず、同じ comment を更新する PATCH 経路はありません。GitHub API 上も、comment ID は作成後のレスポンスで初めて確定します。既存 comment の本文更新には、その ID を指定した PATCH が必要です。GET・PATCH・DELETE はいずれも
owner/repo/comment_idを要求します。したがって、単一 POST では AC1 を満たせません。(GitHub Docs)必須修正
Issue に以下の二相発行状態機械を明記すべきです。
provisional comment は、絶対に
CONTRACT_REVIEW_RESULT_V1 status: goとして parser が認識できない形式にします。例えば次です。PATCH または最終 read-back に失敗した場合は、同じ ID を DELETE します。DELETE にも失敗した場合、pending comment が非 authoritative であるため安全側に残ります。GitHub の comment 作成は通知と secondary rate limit を発生させ得るため、再実行時の重複排除と orphan pending の回復規則も必要です。(GitHub Docs)
また、POST レスポンスを
.html_urlへ縮退させ、正規表現で ID を再構成する必要はありません。GitHub のレスポンス object からid、html_url、body、user、issue_urlを直接保持すべきです。(GitHub Docs)2.
[P0 / Merge blocker]Issue #1513 は条件付き衝突ではなく、先行依存Scope Collision コメントでは、#1513 と同一 helper・同一行に衝突した場合だけ先行 merge を待つとしています。
しかし、衝突条件は既に成立しています。
Issue #1513 は、まさに以下を変更対象としています。
post_comment()_build_contract_review_comment()verify_controlled_publisher_comment_id_binding()実際に送信した一時ファイルの byte 列を hash の正とする処理
check-only での投稿済み comment 検出
#1537 が二相発行を導入すると、「送信した本文」が provisional POST と final PATCH の2種類になります。authoritative hash は final PATCH の実送信 byte 列でなければなりません。#1513 の byte-level 修正を先に確定せず #1537 を実装すると、双方が同じ投稿・hash・read-back 境界を別々の前提で変更します。
必須修正
依存関係を次のように固定してください。
少なくとも Issue 本文に以下が必要です。
「同一 helper に及ぶ場合」という条件文では不十分です。既に同一 helper に及ぶことが確認できています。
3.
[P1 / Merge blocker]“source-bound” だが repository-bound ではない現行 gate の
ContractFingerprintは次の7項目です。repositoryは含まれません。CLI にも repository input はありません。一方、GitHub comment の取得・更新・削除は
owner/repo/comment_idで識別され、issue number も repository 内の番号です。GitHub は owner/repo 名を case-insensitive と定義しています。(GitHub Docs)共有 parser は scoped repository から comment を取得し、
issue_urlも検査するため、通常の経路では多くの誤配線を防げます。しかし AC4 は reviewer gate が「同じ fingerprint を認証する」と主張しています。現行7項目だけでは、gate 単体は wrong-repository capsule や source context の取り違えを検出できません。推奨修正
第一選択は
repositoryを追加した8項目化です。repositoryはowner/repoを case-fold した canonical form にします。既存の7項目を維持する場合は、少なくとも外側に独立検証される envelope が必要です。
ただし、その場合は「7項目 fingerprint 単体が source-bound」という主張を弱める必要があります。現在の Stop Conditions は固定キー集合の変更を禁止しているため、実装開始前に Issue 契約自体を修正する必要があります。
4.
[P1 / Merge blocker]gate の「再計算」が独立検証になっていない現行
compute_contract_fingerprint()が内部で実際に導出しているのは、主にallowed_paths_normalized_sha256です。それ以外の項目は evaluator に渡された値をContractFingerprintへコピーしています。したがって caller が snapshot から、
expected_contract_fingerprintcontract_source_idcontract_body_sha256base_refbase_sha_at_snapshotをすべて取り出して同時に gate へ渡すだけなら、比較はほぼ snapshot 自己申告値と snapshot 自己申告値の一致確認 になります。
Issue には、各値をどの独立 authority から取得するかを固定した provenance table が必要です。
項目 | reviewer 側の独立 authority -- | -- repository | 現在レビュー中の repository context issue_number | PR の linked issue / closing reference source kind / ID | GitHub comment API の実 comment metadata contract body hash | GitHub API から再取得した現在の Issue body Allowed Paths hash | 現在の Issue body から shared canonicalizer で再計算 base_ref | PR base ref、または契約で明示された target ref base SHA | GitHub refs API または検証済み local remote-tracking refhelper を mock して成功値を返すだけではなく、少なくとも1系統は GitHub API response fixture を通した CLI-level integration test が必要です。
推奨実装順序
#1329 は gate の reason/fix_hint を変更するため、#1537 後に rebase する方が安全です。#1348 は intake の precedence と schema surface に触れるため、同時実装は避け、どちらかを先に merge して回帰テストを統合すべきです。
最終判断: Issue #1537 は実装開始前に、少なくとも 二相発行プロトコル、#1513 への明示依存、repository binding、独立 provenance、invalid-go precedence、capsule propagation、共有 canonicalizer を契約へ追加する必要があります。現在のままの Draft PR 作成は非推奨です。
## 判定: **NO-GO / REQUEST_CHANGES**方向性は妥当です。特に、fingerprint 欠落時の fallback を認めず、producer・parser・intake・reviewer を同一の値で接続しようとしている点は正しいです。
ただし、現在の Issue #1537 は、実装可能性・独立検証性・障害時状態遷移の3点が閉じていません。このまま着手すると、表面上は AC を満たすものの、実際には snapshot 自己申告を再比較するだけの実装か、半端に投稿された authoritative comment を残す実装になる可能性が高いです。
1.
[P0 / Merge blocker]comment ID の自己参照を解く発行プロトコルがないAC1 は、実際に投稿された GitHub Issue comment の ID を
contract_source_idとし、その値を同じ comment 内のexpected_contract_fingerprintに含めることを要求しています。しかし現行実装は次の順序です。
_build_contract_review_comment()は POST 前に最終本文を構築し、post_comment()は.html_urlだけを返します。取得した ID は read-back 検証にしか使われず、同じ comment を更新する PATCH 経路はありません。GitHub API 上も、comment ID は作成後のレスポンスで初めて確定します。既存 comment の本文更新には、その ID を指定した PATCH が必要です。GET・PATCH・DELETE はいずれも
owner/repo/comment_idを要求します。したがって、単一 POST では AC1 を満たせません。([GitHub Docs]1)必須修正
Issue に以下の二相発行状態機械を明記すべきです。
provisional comment は、絶対に
CONTRACT_REVIEW_RESULT_V1 status: goとして parser が認識できない形式にします。例えば次です。PATCH または最終 read-back に失敗した場合は、同じ ID を DELETE します。DELETE にも失敗した場合、pending comment が非 authoritative であるため安全側に残ります。GitHub の comment 作成は通知と secondary rate limit を発生させ得るため、再実行時の重複排除と orphan pending の回復規則も必要です。([GitHub Docs]1)
また、POST レスポンスを
.html_urlへ縮退させ、正規表現で ID を再構成する必要はありません。GitHub のレスポンス object からid、html_url、body、user、issue_urlを直接保持すべきです。([GitHub Docs]1)2.
[P0 / Merge blocker]Issue #1513 は条件付き衝突ではなく、先行依存Scope Collision コメントでは、#1513 と同一 helper・同一行に衝突した場合だけ先行 merge を待つとしています。
しかし、衝突条件は既に成立しています。
Issue #1513 は、まさに以下を変更対象としています。
post_comment()_build_contract_review_comment()verify_controlled_publisher_comment_id_binding()#1537 が二相発行を導入すると、「送信した本文」が provisional POST と final PATCH の2種類になります。authoritative hash は final PATCH の実送信 byte 列でなければなりません。#1513 の byte-level 修正を先に確定せず #1537 を実装すると、双方が同じ投稿・hash・read-back 境界を別々の前提で変更します。
必須修正
依存関係を次のように固定してください。
少なくとも Issue 本文に以下が必要です。
「同一 helper に及ぶ場合」という条件文では不十分です。既に同一 helper に及ぶことが確認できています。
3.
[P1 / Merge blocker]“source-bound” だが repository-bound ではない現行 gate の
ContractFingerprintは次の7項目です。repositoryは含まれません。CLI にも repository input はありません。一方、GitHub comment の取得・更新・削除は
owner/repo/comment_idで識別され、issue number も repository 内の番号です。GitHub は owner/repo 名を case-insensitive と定義しています。([GitHub Docs]1)共有 parser は scoped repository から comment を取得し、
issue_urlも検査するため、通常の経路では多くの誤配線を防げます。しかし AC4 は reviewer gate が「同じ fingerprint を認証する」と主張しています。現行7項目だけでは、gate 単体は wrong-repository capsule や source context の取り違えを検出できません。推奨修正
第一選択は
repositoryを追加した8項目化です。repositoryはowner/repoを case-fold した canonical form にします。既存の7項目を維持する場合は、少なくとも外側に独立検証される envelope が必要です。
ただし、その場合は「7項目 fingerprint 単体が source-bound」という主張を弱める必要があります。現在の Stop Conditions は固定キー集合の変更を禁止しているため、実装開始前に Issue 契約自体を修正する必要があります。
4.
[P1 / Merge blocker]gate の「再計算」が独立検証になっていない現行
compute_contract_fingerprint()が内部で実際に導出しているのは、主にallowed_paths_normalized_sha256です。それ以外の項目は evaluator に渡された値をContractFingerprintへコピーしています。したがって caller が snapshot から、
expected_contract_fingerprintcontract_source_idcontract_body_sha256base_refbase_sha_at_snapshotをすべて取り出して同時に gate へ渡すだけなら、比較はほぼ snapshot 自己申告値と snapshot 自己申告値の一致確認 になります。
Issue には、各値をどの独立 authority から取得するかを固定した provenance table が必要です。
GitHub refs API は
heads/<branch>を指定して ref と commit SHA を取得できます。([GitHub Docs]2)特に
contract_source_idは、snapshot 本文内の自己申告値を authority にしてはいけません。parser が走査している comment object 自身のidと、本文内 fingerprint の ID が一致することを検査すべきです。5.
[P1]base_sha_at_snapshotの freshness 意味論が曖昧現行 gate では、fingerprint 計算に使用する
base_sha_at_snapshotと、changed-files 用のcurrent_base_shaは別入力です。current_base_shaは merge-base 検証に使われますが、fingerprint のbase_sha_at_snapshotと現在の base tip を比較する処理ではありません。そのため reviewer が snapshot 内の
base_sha_at_snapshotをそのまま evaluator に渡せば、base branch が進んでいても fingerprint は一致します。以下のどちらかを明示する必要があります。
freshness binding とする
現在の
base_reftip を独立取得し、snapshot のbase_sha_at_snapshotと異なればstale_snapshot。historical audit binding とする
snapshot 作成時点の base SHA を記録するだけで、base movement 自体は stale 条件にしない。
現在の Issue は「freshness」「snapshot時のbase SHA」「同一 fingerprint」を混在させており、どちらの意味論なのか確定していません。名称からは1が自然です。その場合、現在の gate 接続だけでは不足します。
6.
[P1 / Security]新しい invalid go が古い valid go へ downgrade され得る共有 parser は、validation に失敗した YAML block を結果集合へ追加せず、valid な結果だけを時系列順に選択します。
このまま fingerprint validation を追加すると、次の状態が危険です。
これは fail-closed ではなく、実質的な downgrade です。
必須 precedence
blockedは fingerprint の有無に関係なく precedence を維持する。goが fingerprint missing/invalid なら、古い go に fallback せずmissing_go。最低限、次の状態を parser output に持たせるべきです。
7.
[P1]intake から reviewer への値の伝播契約が存在しない現在の
build_intake_capsule.pyは、live snapshot を次のような状態へ正規化します。fingerprint object 自体は出力していません。
一方、
pr-reviewerの明示入力は PR number と任意の reviewed head SHA であり、fingerprint の具体的な取得元・capsule field・gate CLI 接続は固定されていません。ドキュメント上は fingerprint 必須と宣言しているだけです。AC3 と AC4 の間に、少なくとも次の出力契約が必要です。
reviewer はこの object を手入力・再構築せず、capsule または GitHub API の検証済み結果から取得する必要があります。
また、現在の Allowed Paths は gate script/test だけで、reviewer skill・orchestrator の wiring 変更を含みません。AC4 を end-to-end で完了させるなら、実際に reviewer input を構築する資産を Allowed Paths に追加する必要があります。追加しない場合は、AC4 を「gate library の入力契約」までに狭めるべきです。
8.
[P1]schema・型・canonicalization の single source of truth がない現行 gate の Allowed Paths hash は、
sorted(set(...))json.dumps(..., separators=(",", ":"), ensure_ascii=True)という Python 固有の手順です。
一方、現在のテスト fixture は
base_sha_at_snapshot: "abc123"、contract_body_sha256: "contract_sha"のような placeholder を正常入力としており、SHA・Git object ID・source ID の形式検証を証明していません。次を固定すべきです。
issue_number: 正数 int、boolは拒否contract_source_kind:issue_commentの enumcontract_source_id: 正数 int、または canonical decimal string のどちらかに統一sha256:prefix の有無、大文字小文字、64 hexbase_ref:mainかrefs/heads/mainかhash input は producer と consumer 間で byte 単位に一致する必要があります。RFC 8785 も、hash や署名には不変表現が必要であり、deterministic property sorting と UTF-8 を含む canonical representation を定義しています。JCS をそのまま採用する必要はありませんが、少なくとも現行 Python 手順を versioned algorithm として共有 module に切り出すべきです。([RFC Editor]3)
推奨資産は例えば次です。
producer・parser・intake・gate の4系統がこの1実装を import します。現在の Allowed Paths には存在しないため、Issue 契約の修正が必要です。
9.
[P1]Issue #1490 との security claim 境界を明文化すべきGitHub issue comment は後から PATCH で更新可能です。したがって、ID と現在の本文が一致していても、それだけでは「この process が当初投稿した byte 列」の永続的証跡にはなりません。([GitHub Docs]1)
PR #1485 も、投稿直後の binding は強化した一方、existing snapshot reuse では publication-time binding を再検証しないと明示し、完全な receipt を Issue #1490 に分離しています。
Issue #1490 は
repo、issue_number、comment_id、comment body hash、publisher identity などを含む publish receipt を対象にしています。したがって #1537 は、保証範囲を次のように限定する必要があります。
「controlled publisher が当初投稿した不変 snapshot」まで主張するなら、#1490 は follow-up ではなく先行依存です。
設計上は、in-toto Statement のように「対象 subject の digest」と「付随 metadata」を分離する形が参考になります。現在の
expected_contract_fingerprintは単一 fingerprint というより、source-binding statement に近い構造です。([GitHub]4)修正後の Acceptance Criteria 案
AC1: 二相発行
AC2: strict schema
AC3: precedence
AC4: intake propagation
ensure_contract_snapshotresult path が同一 schema を返す。fingerprint_state != readyは必ずmissing_go。AC5: reviewer independence
AC6: failure-injection integration tests
helper を mock して成功値を返すだけではなく、少なくとも1系統は GitHub API response fixture を通した CLI-level integration test が必要です。
推奨実装順序
#1329 は gate の reason/fix_hint を変更するため、#1537 後に rebase する方が安全です。#1348 は intake の precedence と schema surface に触れるため、同時実装は避け、どちらかを先に merge して回帰テストを統合すべきです。
最終判断: Issue #1537 は実装開始前に、少なくとも 二相発行プロトコル、#1513 への明示依存、repository binding、独立 provenance、invalid-go precedence、capsule propagation、共有 canonicalizer を契約へ追加する必要があります。現在のままの Draft PR 作成は非推奨です。
squne121 commentedon Jul 16, 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 16, 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 16, 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 16, 2026
Refinement Loop: Approved
The issue has been approved and is ready for implementation.
approvedsqune121 commentedon Jul 16, 2026
Contract Review Result
squne121 commentedon Jul 16, 2026
implement-issue: 実装完了
.claude/worktrees/issue-1537-source-bound-contract-fingerprint-materiworktree-issue-1537-source-bound-contract-fingerprint-materi.claude/skills/impl-review-loop/tests/test_contract_snapshot_author_binding.py(既存2テストへのモック追加のみ、詳細は PR 本文参照)#1348との構造的シグナル共有によりroute: human_review_requiredを返したため、PR はopen_pr.pyを経由せずgh pr createで直接起票した(既存 precedent は PR 実装: contract snapshotのtrusted publisher identityとcomment ID bindingを検証する #1485 の Notes 参照)。人間による overlap 判定の再確認が必要。fix: PR #1548 の author-binding テストに capture_base_ref_and_sha の mock を…
fix: PR #1548 の Allowed Paths 外テストを移設し pr-review-judge blocker を解消する
squne121 commentedon Jul 17, 2026
Contract Review Result
test: TestControlledPublisherCommentIdBinding に capture_base_ref_and_…
squne121 commentedon Jul 17, 2026
Contract Review Result
squne121 commentedon Jul 17, 2026
Bootstrap Fingerprint Exception
squne121 commentedon Jul 17, 2026
Contract Review Result
squne121 commentedon Jul 17, 2026
Bootstrap Fingerprint Exception