Skip to content

実装: open-pr の契約束縛 overlap readback waiver を一般化する #1509

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1491"
goal_ref: "open-pr の overlap preflight hard gate が、live Issue body と trusted go snapshot に束縛された期限付き waiver を exact candidate としてのみ安全に consumer する"
change_kind: code
depends_on:
  - "#1470"

Parent Issue

#1491

Parent Goal Ref

Current Validated Scope

Remaining Parent Gaps

Outcome

.claude/skills/open-pr/scripts/open_pr.py が、linked Issue の live body と trusted go snapshot に同一 SHA で束縛された期限付き waiver を、fresh evidence の完全一致する readback-incomplete candidate だけに適用し、それ以外を fail-closed にする実装と pytest 証跡が揃う。

Background

#1503 は cross-process ledger writer の修正を commit 済みだが、legacy #521 の ## Outcome / ## In Scope 欠落だけで overlap preflight が停止する。#521 は catalog から schema-governance 文書を生成する未実装の独立作業であり、クローズして preflight を回避してはならない。現行の #1477 固定 exception を複製せず、contract / snapshot / candidate 更新時刻に束縛された最小の consumer を実装する。

In Scope

  • open_pr.py の 実装: Scope Collision Preflight で Allowed Paths 未記載 Issue を候補から除外する #1477 固定 waiver binding を、linked Issue の live body にある overlap_readback_waiver を検証する generic consumer に置換する
  • waiver に repository、linked issue、candidate 番号と updated_at、readback-incomplete reason、expiry、承認者を必須化し、live body と最新 trusted go snapshot の SHA 一致を検証する
  • fresh evidence の incomplete candidate 集合・reason・updated_at が waiver と完全一致し、complete candidate が C1/C2a だけである場合に限り proceed_with_collision_evidence として扱う
  • candidate 集合差分、reason / updated_at drift、期限切れ、body / snapshot / repository / linked issue 不一致、source・validation・dependency の既存 unsafe predicate を fail-closed とする pytest と skill 手順を追加する

Out of Scope

Acceptance Criteria

Runtime Verification Applicability

decision: not_applicable
applicable_acs: []
reason: "contract / snapshot / fresh evidence の組合せは fixture ベース pytest で決定論的に検証でき、GitHub API の可用性や原子性を本 Issue の成功根拠にしない"

Verification Commands

# AC1
$ uv run --locked pytest .claude/skills/open-pr/scripts/tests/test_open_pr_contract_bound_waiver.py::test_contract_bound_waiver_allows_exact_stale_candidate_only -q

# AC2
$ uv run --locked pytest .claude/skills/open-pr/scripts/tests/test_open_pr_contract_bound_waiver.py::test_contract_bound_waiver_rejects_candidate_timestamp_or_reason_drift -q

# AC3
$ uv run --locked pytest .claude/skills/open-pr/scripts/tests/test_open_pr_contract_bound_waiver.py::test_contract_bound_waiver_rejects_invalid_live_contract_or_snapshot -q

# AC4
$ uv run --locked pytest .claude/skills/open-pr/scripts/tests/test_open_pr_overlap_gate.py -q

Allowed Paths

  • .claude/skills/open-pr/scripts/open_pr.py
  • .claude/skills/open-pr/scripts/tests/test_open_pr_contract_bound_waiver.py
  • .claude/skills/open-pr/SKILL.md

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

  • Python 3
  • pytest
  • GitHub CLI

Required Design References

Scope Delta(任意)

N/A

Delivery Rule(配信ルール)

Notes for Reviewer(レビュアー向け補足)

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    on Jul 13, 2026
  2. squne121 commented on Jul 19, 2026

    @squne121
    OwnerAuthor

    Contract Review Result

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-07-19T00:20:01Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/1509
      body_sha256: "sha256:84f2546aaa4a1486b08f5e3cc085219f9891019657b4e08f919689a68b17e5f2"
      checks:
        readiness: go
        blockers: pass
        product_spec: pass
        product_spec_check: {"schema":"product_spec_check/v1","applicability":"applicable","decision":"pass","triggers":{"docs_product_allowed_paths":false,"tasks_md_mentioned":false,"specify_artifact_mentioned":false,"generated_task_mentioned":false,"product_spec_context_present":false,"machine_readable_contract_present":true},"conditions":{"docs_product_requires_spec_evidence":{"status":"pass","evidence":[]},"tasks_md_not_direct_source":{"status":"pass","evidence":[]},"specify_not_canonical":{"status":"pass","evidence":[]},"diff_first_rationale_present":{"status":"pass","evidence":[]},"generated_task_trace_present":{"status":"pass","evidence":[]},"task_dependencies_materialized":{"status":"pass","evidence":[]}},"blocked_reasons":[],"body_sha256":"sha256:84f2546aaa4a1486b08f5e3cc085219f9891019657b4e08f919689a68b17e5f2","source_provenance":{"source_type":"github_api","body_file":null}}
        vc_preflight:
          decision: pass
          classifications: [{"ac":"AC1","line":2,"raw_command":"uv run --locked pytest .claude/skills/open-pr/scripts/tests/test_open_pr_contract_bound_waiver.py::test_contract_bound_waiver_allows_exact_stale_candidate_only -q","command_hash":"sha256:64fa0ebcdf62cc7db4877f184aebc541cb777c2c5a5b1f11b735c3a58fcd01cb","execution_key_hash":"sha256:f25f9df77c7412da0c2b97a322eff82a437a9cfe74af1cb79ef85cf0e6999125","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["no tests ran in 0.00s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":["ERROR: file or directory not found: .claude/skills/open-pr/scripts/tests/test_open_pr_contract_bound_waiver.py::test_contract_bound_waiver_allows_exact_stale_candidate_only"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":194,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null},{"ac":"AC2","line":5,"raw_command":"uv run --locked pytest .claude/skills/open-pr/scripts/tests/test_open_pr_contract_bound_waiver.py::test_contract_bound_waiver_rejects_candidate_timestamp_or_reason_drift -q","command_hash":"sha256:9c73bc3c0fc82329b5de68c5581c2069022b0fe2653d0c083154381b31b58125","execution_key_hash":"sha256:b8fb268836611c3dd98921e2eed4a747ac6cdb3bd5abf38eb3fbcf611abbd7a5","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["no tests ran in 0.00s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":["ERROR: file or directory not found: .claude/skills/open-pr/scripts/tests/test_open_pr_contract_bound_waiver.py::test_contract_bound_waiver_rejects_candidate_timestamp_or_reason_drift"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":178,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null},{"ac":"AC3","line":8,"raw_command":"uv run --locked pytest .claude/skills/open-pr/scripts/tests/test_open_pr_contract_bound_waiver.py::test_contract_bound_waiver_rejects_invalid_live_contract_or_snapshot -q","command_hash":"sha256:cc180c806014d695be9f828c73780b1e25911301912923dd74bda3dca045b8a8","execution_key_hash":"sha256:70683e4b979b8c2a3b9d6b691d1e83c4bcc53a1905dd5807b5fa9187b3bc814a","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["no tests ran in 0.00s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":["ERROR: file or directory not found: .claude/skills/open-pr/scripts/tests/test_open_pr_contract_bound_waiver.py::test_contract_bound_waiver_rejects_invalid_live_contract_or_snapshot"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":173,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null},{"ac":"AC4","line":11,"raw_command":"uv run --locked pytest .claude/skills/open-pr/scripts/tests/test_open_pr_overlap_gate.py -q","command_hash":"sha256:1210c26b9c3c6246c55eec5d6046ae41aa82cc6c041aab259fec79cca28d59f6","execution_key_hash":"sha256:38a8cec71bfa8854f78be095f075eb3626511c51921e7eea7dce4fca1d87829b","runner":"exec","exit_code":0,"classification":"expected_pass","category":"regression_gate","decision":"go","scope_class":"regression_gate","confidence":"low","stdout_head":[".............................................................            [100%]","61 passed in 0.11s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":[],"stderr_truncated":false,"stderr_original_line_count":1,"runner_env_delta":{},"duration_ms":281,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null}]
      source: ensure_contract_snapshot_auto
      expected_contract_fingerprint: {"issue_number":1509,"contract_source_kind":"issue_comment","contract_source_id":"5013484194","contract_body_sha256":"sha256:84f2546aaa4a1486b08f5e3cc085219f9891019657b4e08f919689a68b17e5f2","allowed_paths_normalized_sha256":"bf1c290a21f0cb0540c5157c85177f0daf0e9c729072b16622f4d69d2658f149","base_ref":"main","base_sha_at_snapshot":"bb1d320ef063670308192f0fb0c3faeddc27a27f"}
  3. squne121 commented on Jul 20, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-07-20T10:30:00Z)

    人間 owner の REQUEST_CHANGES(#issuecomment-5014987898)で指摘された P1×2 / P2×3 / P3×1 の全6件を修正し、pr-reviewer による再レビューで APPROVE を確認した。検証内容の詳細は PR レビューコメント を参照。

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      merge_ready: true
      pr_url: "https://github.com/squne121/loop-protocol/pull/1627"
      head_sha: "a41ec7569d5e3d1d6133860181d434fa3239b45e"
      issue_number: 1509
      termination_reason: approved
      iteration: 1
      required_auto_actions: []
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues: []
      note_only_observations: []
    
    ISSUE_SCOPE_ROLLUP_DECISION_V2:
      schema_version: 2
      recorded_at: "2026-07-20T10:30:00Z"
      rollup_plan_ref:
        body_sha256: null
        generated_at: null
      decision: skipped
      executed_actions: []
      skipped_reason: "resumed loop session did not re-run scope rollup preflight for this fix_delta iteration; no new scope-affecting changes introduced beyond the reviewed fix_delta"
      candidates_reviewed: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/implementerenhancementphase/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions