Skip to content

実装: edit-issue の native relationship pagination reader を controlled executor に一本化し totalCount 検証を追加する #1916

Open

Description

@squne121

Parent Issue

なし(単独改善)

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "PR #1897 OWNER 敵対的レビュー(https://github.com/squne121/loop-protocol/pull/1897#issuecomment-5149868634)P1-4: native relationship pagination reader の二重実装を単一 canonical reader に統合し totalCount 整合を保証する"
change_kind: code

Parent Goal Ref

Current Validated Scope

  • .claude/skills/edit-issue/scripts/edit_issue_txn.py の _fetch_native_relationships()(first:100 の単発 pre-readback で hasNextPage == true の場合 fail-closed のみ)を、cursor traversal を行う canonical reader に置き換える
  • scripts/agent-guards/controlled_skill_mutation_exec.py 側の issue_relationship.update cursor traversal helper に totalCount 検証を追加する
  • 上記 canonical reader を edit_issue_txn.py の caller から呼び出す形へ統合する
  • .claude/skills/edit-issue/tests/test_edit_issue_txn.py / scripts/agent-guards/tests/test_controlled_skill_mutation_exec.py に回帰テストを追加する

Remaining Parent Gaps

Outcome

.claude/skills/edit-issue/scripts/edit_issue_txn.py と scripts/agent-guards/controlled_skill_mutation_exec.py にまたがる native relationship pagination readback の二重実装が単一の canonical reader(controlled executor 側)へ統合され、各ページで totalCount が integer であること・pagination 中に totalCount が変化しないこと・cursor が前進すること・subject node identity が変化しないこと・number/node ID が重複しないこと・最終 unique node 数が totalCount と完全一致すること・node 数が safety cap 以下であることを検証したうえで exact-set 判定を行うファイルへ変わり、edit_issue_txn.py 側の「100件だけ読む簡易 snapshot」実装が削除され、pytest の回帰テストが追加された状態で全て PASS している状態。

In Scope

  • edit_issue_txn.py の _fetch_native_relationships() を canonical reader(controlled executor 側の cursor traversal helper)呼び出しへ置き換える
  • controlled executor 側の該当 GraphQL query に totalCount フィールドを追加し、ページ検証ロジック(totalCount 型・不変性、cursor 前進、subject node identity 不変、number/node ID 重複なし、最終 unique node 数 == totalCount、safety cap 以下)を実装する
  • edit_issue_txn.py から重複した「100件だけ読む簡易 snapshot」ロジックを削除する
  • 上記変更に対応する回帰テスト(test_total_count_mismatch_rejects_exact_set 等)を両方の test ファイルに追加・拡充する

Out of Scope

Acceptance Criteria

  • AC1: edit_issue_txn.py の _fetch_native_relationships() が scripts/agent-guards/controlled_skill_mutation_exec.py 側の cursor traversal helper を呼び出す実装に置き換わっており、first: 100 の単発簡易 pre-readback ロジックが edit_issue_txn.py から削除されている
  • AC2: controlled executor 側の issue_relationship.update 用 GraphQL query(blockedBy / blocking の pagination query)に totalCount フィールドが追加されている
  • AC3: controlled executor のページ検証ロジックが、各ページで totalCount が integer であること・pagination 中に totalCount が変化しないこと・cursor(endCursor)が前進すること・subject issue node identity(id/number)が変化しないこと・collected node の number/node ID が重複しないこと・最終 unique node 数が totalCount と完全一致すること・node 数が safety cap(_ISSUE_DEPENDENCY_REMOVE_MAX_PAGES 相当の既存 cap)以下であることを検証し、いずれかに違反した場合は exact-set 判定をせず fail-closed で拒否する
  • AC4: test_controlled_skill_mutation_exec.py に totalCount 不一致・totalCount 型不正・重複 node ID を検出する回帰テストが追加されている
  • AC5: test_edit_issue_txn.py の既存テストが _fetch_native_relationships() の新実装(canonical reader 呼び出し)に対応する形へ更新され、全て PASS している

Verification Commands

# AC1
$ git grep -n "first:100" .claude/skills/edit-issue/scripts/edit_issue_txn.py

# AC2
$ git grep -n "totalCount" scripts/agent-guards/controlled_skill_mutation_exec.py

# AC3
$ uv run --locked python3 -m pytest scripts/agent-guards/tests/test_controlled_skill_mutation_exec.py -k total_count -v

# AC4
$ uv run --locked python3 -m pytest scripts/agent-guards/tests/test_controlled_skill_mutation_exec.py -v

# AC5
$ uv run --locked python3 -m pytest .claude/skills/edit-issue/tests/test_edit_issue_txn.py -v

Allowed Paths

  • .claude/skills/edit-issue/scripts/edit_issue_txn.py
  • .claude/skills/edit-issue/tests/test_edit_issue_txn.py
  • scripts/agent-guards/controlled_skill_mutation_exec.py
  • scripts/agent-guards/tests/test_controlled_skill_mutation_exec.py

Stop Conditions

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

Required Skills

なし

Required Design References

  • docs/dev/agent-skill-boundaries.md(issue_relationship.update controlled executor の契約)

Scope Delta(該当時のみ記載)

N/A

Runtime Verification Applicability

Delivery Rule

  • 1 Issue = 1 PR で完結する
  • worktree での作業を前提とし、Draft PR を既定とする

Notes for Reviewer

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    triage-required
    on Aug 1, 2026
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/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions