Skip to content

実装: implementation_landed_evidence.py の gh api --paginate に --slurp を追加し timeline JSON parse 失敗を防ぐ #2739

Open

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "implementation_landed_evidence.py::collect_candidate_inputs() の GitHub timeline 取得が gh api --paginate の複数ページ出力を単一 json.loads() に渡しており、100件超の timeline で multi-document JSON parse に失敗する不具合を修正する"
change_kind: code

Parent Issue

なし(#2713 レビューコメントからの scope 分離 follow-up)

Parent Goal Ref

Current Validated Scope

  • .claude/skills/impl-review-loop/scripts/implementation_landed_evidence.py::collect_candidate_inputs() の gh api --paginate 呼び出し(timeline 取得部分)を --slurp 付きに変更し、複数ページ配列を1段 flatten してから既存の消費ロジックへ渡す

Remaining Parent Gaps

Outcome

gh api --paginate で取得した Issue timeline が、0 件・単一ページ・101 件以上(複数ページ)のいずれの shape でも、collect_candidate_inputs() が正しく単一のフラットな配列として解釈し、multi-document JSON parse 失敗を起こさない状態になっている。

Runtime Verification Applicability

  • decision: not_applicable
  • reason: gh コマンド呼び出しを fake transport に差し替えた決定論的テストで検証可能であり、live GitHub API 呼び出しを必須要件にしない。

In Scope

  • implementation_landed_evidence.py の timeline 取得コマンドに --slurp を追加する
  • --slurp 付き出力(外側配列でページ配列をラップした構造)を1段 flatten し、既存の _json() ないし後続処理が期待する「flat なイベントリストの配列」形状に正規化する処理を追加する
  • 0 件(空 timeline)、単一ページ(100 件以下)、101 件以上(複数ページ)の 3 shape を検証する fixture ベースの regression test を追加する

Out of Scope

Acceptance Criteria

  • timeline 取得コマンドが gh api --paginate --slurp ... の形になっている
  • --slurp によりページごとの配列がネストされた出力を、既存消費ロジックが期待するフラットな配列へ1段 flatten する処理が実装されている
  • 0 件 / 単一ページ / 101 件以上(複数ページ)の 3 fixture shape それぞれで、collect_candidate_inputs() が JSON parse エラーを起こさず正しいイベント件数を返すことを検証する regression test が追加されている
  • .claude/skills/impl-review-loop/tests/ 配下の pytest が全件 PASS している

Verification Commands

# timeline 取得コマンドに --slurp が追加されている
$ rg -n -- "--paginate" .claude/skills/impl-review-loop/scripts/implementation_landed_evidence.py

# 0/単一/複数ページの pagination regression test が存在する
$ rg -n "def test.*timeline.*pag" .claude/skills/impl-review-loop/tests/test_implementation_landed_evidence.py

# slurp flatten regression test が存在する
$ rg -n "def test.*slurp" .claude/skills/impl-review-loop/tests/test_implementation_landed_evidence.py

# 複数ページ regression test が存在する
$ rg -n "def test.*multi.*page" .claude/skills/impl-review-loop/tests/test_implementation_landed_evidence.py

# impl-review-loop tests 全件 PASS
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/ -q

Allowed Paths

  • .claude/skills/impl-review-loop/scripts/implementation_landed_evidence.py
  • .claude/skills/impl-review-loop/tests/test_implementation_landed_evidence.py

Stop Conditions

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

Required Skills

なし

Required Design References

  • .claude/skills/impl-review-loop/scripts/implementation_landed_evidence.py

Notes for Reviewer

由来: Issue #2713 の operator-selected human-context anchor(issuecomment-5808708572)レビュー P2 の分離 follow-up。レビュー原文: 「gh api --paginate の出力を単一の json.loads() へ渡している。GitHub CLI 公式仕様では pagination の各ページは別々の JSON 配列/オブジェクトであり、複数ページを外側配列にまとめるのが --slurp。--paginate --slurp とページ配列の1段 flatten をセットで実施し、0件・単一ページ・101件以上の fixture で検証する。」

Dedupe 確認結果: paginate slurp / timeline pagination / gh api pagination JSON 等での open Issue 検索により重複は確認されなかった。Issue #1610(実装: overlap pagination の read-only runtime smoke を controlled VC として追加する)は GraphQL cursor pagination を扱う別サブシステム(#1493 系列)であり、本件(gh api --paginate REST timeline JSON)とは無関係。

優先度: #2713 の Remaining Parent Gaps に「低優先度」と記録されている通り、緊急ではないが、個人開発運用でも実害があるため独立した小規模修正として起票する。

Source

Activity

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

    phase/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions