Repository navigation
Closed
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "CONTRACT_REVIEW_RESULT_V1 の advisory check が巨大でも、trusted owner が投稿した go snapshot の strict fingerprint readback・reuse を壊さない producer/parser round-trip を復旧する"
change_kind: code
Parent Issue
なし(単独改善。#2040 を native dependency の後続として停止させる前提修正)
Parent Goal Ref
- Goal: 実装: implementation Issue の Runtime Verification Applicability 欠落を authoring・readiness・reviewer・consumer 全経路で fail-closed に統一する #2040 の implementation contract が valid な owner-authored
gosnapshot を再利用できる状態へ戻す。 - Desired Destination: 実装: implementation Issue の Runtime Verification Applicability 欠落を authoring・readiness・reviewer・consumer 全経路で fail-closed に統一する #2040 の本文・Allowed Paths は変更せず、本 Issue を hard predecessor として解消後に通常の canonical route で継続できる状態にする。
Current Validated Scope
ensure_contract_snapshot.pyが出力する authoritative comment の advisoryclassificationsとdeclared_path_overlapを、YAML/strict JSON の境界で安全に round-trip できるようにする。contract_review_result_parser.pyの trusted publisher、fingerprint のdict型、comment/id/issue/body/Allowed Paths/base SHA binding、malformed input の fail-closed を維持する。- 新しい ledger、receipt、digest、state hierarchy を追加せず、producer/parser と既存回帰テストだけで最小に復旧する。
Remaining Parent Gaps
なし。本 Issue のマージ後に #2040 は fresh contract snapshot と通常の review/CI route を再実行する。
Outcome
巨大または合理的に複雑な advisory check を含む CONTRACT_REVIEW_RESULT_V1 を producer が安全に表現し、PyYAML 経路と bounded strict-JSON fallback の双方で authoritative status: go、dict fingerprint、全 binding を保持して materialize→parse→reuse できる source/test 修正と Draft PR が完成している状態。
Runtime Verification Applicability
- decision: not_applicable
- reason: Python の producer/parser unit・integration regression で完結し、外部 runtime、CheckRun、実環境 artifact を必要としないため。
In Scope
checks.vc_preflight.classificationsを含む producer 出力を YAML と strict JSON fallback の両方で安全に parse 可能な最小表現へ直す。declared_path_overlapを 実装: issue-contract-review を fresh structural gate に縮小し、OPEN PR の実編集競合のときだけ停止させる #1680 の advisory-only observation として保持し、削除しない。- real publisher/parser output を用い、
declared_path_overlapが 16,384 bytes 未満であってもclassificationsの 16,198-byte flow 値が snapshot を無効化しない回帰を追加する。 - producer comment → parser → trusted existing-go reuse の正経路で、fingerprint が
dictのまま comment/id/issue/body/Allowed Paths/base SHA binding を満たすことを確認する。 - PyYAML と forced fallback の各経路で、malformed JSON、duplicate keys、NaN、Infinity、deep nesting、無関係な untrusted oversized input を fail-closed に維持する。
Out of Scope
_MAX_JSON_FLOW_COLLECTION_CHARS=16384を単に引き上げること、または JSON depth/size DoS control を弱めること。- status 文字列だけで snapshot を採用する fallback、任意・無制限の YAML parser、
ast.literal_eval()等の導入。 - trusted publisher validation、fingerprint strictness、既存の comment/id/issue/body/Allowed Paths/base SHA binding の緩和。
- 実装: implementation Issue の Runtime Verification Applicability 欠落を authoring・readiness・reviewer・consumer 全経路で fail-closed に統一する #2040、実装: fallback parserでcontract fingerprintのJSON flow mappingを保持する #1927、PR fix(issue-contract-review): fallback parserでcontract fingerprintのJSON flow mappingを保持する #1929 を含む既存 Issue/PR の本文・コメント変更、実装: implementation Issue の Runtime Verification Applicability 欠落を authoring・readiness・reviewer・consumer 全経路で fail-closed に統一する #2040 の Allowed Paths 変更。
- 新規 ledger、receipt、digest、state hierarchy、workflow redesign、PR merge または Issue close。
Acceptance Criteria
- AC1: advisory fields が巨大または合理的に複雑でも、authoritative
status: goとexpected_contract_fingerprintが parser で失われず、fingerprint はdictとして残る。 - AC2: real producer/parser output で
declared_path_overlapが 2,999 bytes(2,771 chars)かつ 16,384 未満でも、16,198-byteclassificationsが PyYAMLScannerErrorと fallback の invalid-escape を起こさず go retention を阻害しない。 - AC3: materialize→parse→trusted existing-go reuse が comment ID、issue URL/number、body SHA、Allowed Paths hash、base SHA を含む strict fingerprint binding を維持する。
- AC4:
declared_path_overlapは 実装: issue-contract-review を fresh structural gate に縮小し、OPEN PR の実編集競合のときだけ停止させる #1680 の advisory-only semantics のまま保存され、削除・authoritative gate 化・size-limit 根因との誤記をしない。 - AC5: PyYAML 利用時と forced fallback の双方で producer output を受理し、fallback は strict JSON object/array を必要な型としてのみ保持する。
- AC6: malformed JSON、duplicate keys、NaN、Infinity、deep nesting、untrusted oversized input は従来どおり fail-closed であり、status-string-only fallback や arbitrary/unbounded YAML parse を導入しない。
- AC7: JSON flow collection の depth/size DoS controls、trusted publisher validation、fingerprint strictness、および既存 binding regressions が維持される。
- AC8: Allowed Paths に限定した targeted pytest と変更 Python の Ruff check が PASS する。
Verification Commands
# AC1
$ uv run --locked pytest .claude/skills/issue-contract-review/tests/test_contract_review_result_parser.py -q
# AC2
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py -q
# AC3
# preflight-scope: pr_review_only
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot_fingerprint_patch.py -q
# AC4
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py -q
# AC5
$ uv run --locked pytest .claude/skills/issue-contract-review/tests/test_contract_review_result_parser.py -q
# AC6
$ uv run --locked pytest .claude/skills/issue-contract-review/tests/test_contract_review_result_parser.py -q
# AC7
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py -q
# AC8
# preflight-scope: pr_review_only
$ uv run --locked ruff check .claude/skills/impl-review-loop/scripts/ensure_contract_snapshot.py .claude/skills/issue-contract-review/scripts/contract_review_result_parser.py .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot_fingerprint_patch.py .claude/skills/issue-contract-review/tests/test_contract_review_result_parser.py
Allowed Paths
.claude/skills/impl-review-loop/scripts/ensure_contract_snapshot.py.claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py.claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot_fingerprint_patch.py.claude/skills/issue-contract-review/scripts/contract_review_result_parser.py.claude/skills/issue-contract-review/tests/test_contract_review_result_parser.py
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合。
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)。
- 後続 Phase / 別スコープへの波及が判明した場合。
- nested SubAgent delegation が必要になった場合。
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合。
- trusted publisher validation、fingerprint binding、JSON depth/size DoS control、または 実装: issue-contract-review を fresh structural gate に縮小し、OPEN PR の実編集競合のときだけ停止させる #1680 advisory-only semantics を弱めなければ解決できない場合。
- 実装: implementation Issue の Runtime Verification Applicability 欠落を authoring・readiness・reviewer・consumer 全経路で fail-closed に統一する #2040 の本文または Allowed Paths の変更、新規 state/ledger/receipt/digest hierarchy、任意 YAML parser の導入が必要になった場合。
Required Skills
- Python
- pytest
- JSON
Required Design References
- docs/dev/workflow.md
- docs/dev/workflows/impl-review-loop-design.md
- docs/dev/agent-skill-boundaries.md
Scope Delta(任意)
N/A
Delivery Rule
1 Issue = 1 Draft PRとし、実装は dedicated worktree で行う。- merge は current-head review と CI 後の通常 canonical route に限定する。
- 本 Issue は 実装: implementation Issue の Runtime Verification Applicability 欠落を authoring・readiness・reviewer・consumer 全経路で fail-closed に統一する #2040 を block する hard predecessor として native dependency を登録し、実装: implementation Issue の Runtime Verification Applicability 欠落を authoring・readiness・reviewer・consumer 全経路で fail-closed に統一する #2040 の body/Allowed Paths は変更しない。
Notes for Reviewer
- 発見証跡: 実装: implementation Issue の Runtime Verification Applicability 欠落を authoring・readiness・reviewer・consumer 全経路で fail-closed に統一する #2040 (comment)
- 基準 main:
cf765aa093d19b2b36f6aa75bb918b783260a30d。 - 観測: PyYAML は line 14 column 14917 で unknown escape の
ScannerError、fallback は char 約14894でclassificationsの invalid JSON escape を返す。fingerprint は owner-authored で存在するが parser candidate が 0 件となり existing-go reuse が失敗する。 declared_path_overlapは 2,771 chars / 2,999 bytes で_MAX_JSON_FLOW_COLLECTION_CHARS=16384未満であり根因ではない。一方classificationsflow value は 16,198 bytes である。- 実装: fallback parserでcontract fingerprintのJSON flow mappingを保持する #1927 / PR fix(issue-contract-review): fallback parserでcontract fingerprintのJSON flow mappingを保持する #1929 は fallback が正しい strict JSON flow mapping を
dict/listとして保持する別 scope の修正であり、本 Issue の producer が未エスケープ値を出す defect の重複ではない。 - 方針比較: prompt/運用 workaround は snapshot の authoritative readback を不安定に残すため採用しない。producer/parser contract の決定論的な最小 round-trip 修正を採用する。
- Scope Collision (C1): 実装: stale base-bound contract snapshot をfresh materializationする #1655 と 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 は
ensure_contract_snapshot.pyの既存 snapshot freshness/binding concern、consumer 側で CONTRACT_REVIEW_ONCE_RESULT_V1.applicability フィールドを読むよう更新する #1944・実装: 両review loopの人間向けGitHub作業履歴をphase-awareに整理し推奨理由を記録する #1908 等は broad test-directory declaration で重なる。今回の edit intent はclassificationsの未エスケープ producer value による PyYAML/fallback parse failure のみであり、current main を起点にこれらの open Issue/PR との merge order と実 diff conflict を確認する。実装: fallback parserでcontract fingerprintのJSON flow mappingを保持する #1927 / PR fix(issue-contract-review): fallback parserでcontract fingerprintのJSON flow mappingを保持する #1929 と統合しない理由は上記のとおり。
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Activity
squne121 commentedon Aug 9, 2026
Contract Review Result
squne121 commentedon Aug 9, 2026
implement-issue: 実装完了
.claude/worktrees/issue-2056-snapshot-advisory-roundtripworktree-issue-2056-snapshot-advisory-roundtrip68b80fca7794759732974bead2dd62c9a731a96dfix: preserve snapshot authority regressions (#2056)
test: bind live snapshot fixture to product spec authority (#2056)
fix-contract-review-escape-advisory-snapshot-json (#2058)