Skip to content

実装: ci_failure_attribution.py で known infra failure を分類し fix_delta 汚染を防ぐ #965

Open

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "CI failure を script で attribution し、known infra failure(MCR / Playwright Docker pull 失敗等)を実装修正対象から分離して、REQUEST_CHANGES の fix_delta に infra failure が混入するのを防ぐ"
change_kind: workflow

Parent Issue

none(単独改善)

Parent Goal Ref

  • Goal: gh run view --log-failed の手動 grep を毎回繰り返さず、infra flaky と実装修正対象を deterministic に分類する
  • Desired Destination: ci_failure_attribution.py が CI_FAILURE_ATTRIBUTION_V1 を返し、fix_delta_eligible_failures を区別しつつ infra red を自動 merge-ready 化しない

Current Validated Scope

  • .claude/skills/pr-review-judge/scripts/ci_failure_attribution.py を新規追加する
  • pr-review-judge の手順(ci_verdict_summary 利用箇所)に attribution 参照を追記する
  • .claude/skills/pr-review-judge/tests/test_ci_failure_attribution.py と fixtures を追加する

Remaining Parent Gaps

  • ci_verdict_summary.py 自体の出力契約は変更せず、attribution を追加 layer として載せる

Outcome

ci_failure_attribution.py が CI_FAILURE_ATTRIBUTION_V1(per-job category / ownership / merge_blocking / implementation_fix_required / fix_delta_eligible_failures)を返し、MCR Playwright pull の toomanyrequests / unauthorized を infra_registry_pull_failure として分類、implementation_fix_required: false の failure を fix_delta から除外しつつ branch protection 上の red は merge_ready: false を維持する。新規 pytest と pnpm typecheck/lint/test/build が PASS する状態。

In Scope

  • MCR Playwright pull toomanyrequests / unauthorized の infra_registry_pull_failure 分類
  • implementation_fix_required: false failure の fix_delta 除外
  • infra red でも merge_ready: false を維持(自動 merge-ready 化しない)
  • PR body / review comment への「実装修正対象外だが merge blocking」短文出力
  • unknown failure の REQUEST_CHANGES / human judgment route
  • pr-review-judge 手順への参照追記と対応テスト

Out of Scope

  • ci_verdict_summary.py の出力契約変更
  • CI 自体の retry / infra 修復
  • auto-merge の実装
  • Allowed Paths を pr-review-judge skill 配下以外へ拡張すること

Acceptance Criteria

  • AC1: MCR Playwright pull の toomanyrequests / unauthorized を infra_registry_pull_failure に分類する。
  • AC2: implementation_fix_required: false の failure を Step 1 fix_delta(fix_delta_eligible_failures)に入れない。
  • AC3: infra failure でも branch protection 上の red は merge_ready: false のままにし、自動 merge-ready 化しない。
  • AC4: PR body / review comment に「実装修正対象外だが merge blocking」という短い説明を出す。
  • AC5: unknown failure は従来どおり REQUEST_CHANGES / human judgment に route する。
  • AC6: uv run pytest .claude/skills/pr-review-judge/tests/test_ci_failure_attribution.py, pnpm typecheck, pnpm lint, pnpm test, pnpm build が PASS する。

Runtime Verification Applicability

decision: not_applicable
reason: "CI ログ分類 script + docs 変更であり、実 CI 実行を成功条件に含まない。全 AC は fixtures(既知ログサンプル)+ pytest で静的検証可能"

Verification Commands

baseline では新規 script / test が未作成のため、AC1〜AC5 の pytest は file not found(pytest exit 4)で baseline-fail する(baseline-expect: fail)。実装後に PASS する。AC6 は regression gate。

# AC1
# baseline-expect: fail
$ uv run pytest .claude/skills/pr-review-judge/tests/test_ci_failure_attribution.py -k "infra_registry_pull" -v
# AC2
# baseline-expect: fail
$ uv run pytest .claude/skills/pr-review-judge/tests/test_ci_failure_attribution.py -k "fix_delta_excludes_infra" -v
# AC3
# baseline-expect: fail
$ uv run pytest .claude/skills/pr-review-judge/tests/test_ci_failure_attribution.py -k "infra_not_merge_ready" -v
# AC4
# baseline-expect: fail
$ uv run pytest .claude/skills/pr-review-judge/tests/test_ci_failure_attribution.py -k "comment_explains_infra" -v
# AC5
# baseline-expect: fail
$ uv run pytest .claude/skills/pr-review-judge/tests/test_ci_failure_attribution.py -k "unknown_routes_request_changes" -v
# AC6
$ pnpm typecheck
$ pnpm lint
$ pnpm test
$ pnpm build

Allowed Paths

  • .claude/skills/pr-review-judge/scripts/ci_failure_attribution.py
  • .claude/skills/pr-review-judge/tests/(ci failure attribution 関連テスト / fixtures のみ)
  • .claude/skills/pr-review-judge/SKILL.md(attribution 参照の手順追記のみ)

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • ci_verdict_summary.py の出力契約変更が必要になった場合
  • auto-merge ロジックが必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割)
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

  • Python 3(CI ログパターン分類 / fixtures ベーステスト)
  • pr-review-judge の verdict / merge_ready ロジックの理解

Scope Delta(任意)

N/A

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    on Jun 17, 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/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions