Skip to content

fix(autopilot): findPrForIssue/hasMergedPullRequest が非デフォルト base 宛て PR を解決できない #831

Description

@smalruby3-editor-bot

概要

findPrForIssue / hasMergedPullRequesttools/autopilot/src/project.js)は GitHub の
close リンク(closedByPullRequestsReferences)で Issue↔PR を解決する(#826)。しかし
GitHub は PR が非デフォルトブランチ宛て(例: EPIC サブ Issue の PR が topic/koshien-epic-738 宛て)の
場合、本文の Closes #N を閉じる PR リンクとして登録しない

#829(base ブランチ宣言で epic ブランチ宛て PR を作る)と相互作用し、epic サブ Issue の PR が
findPrForIssue で見つからない

実害(#827 / PR #828 で観測)

対処案

findPrForIssue / hasMergedPullRequestbase 非依存にする。autopilot の PR は必ず
head ブランチが topic/autopilot-<issue> なので、これを使う:

  • findPrForIssue(N): まず close リンク(既存・default base に強い)、無ければ
    gh pr list --search "head:topic/autopilot-<N>" --state open で特定(base 非依存・あいまい検索でない)。
  • hasMergedPullRequest(N): 同様に head ブランチで PR を引き、その merged を見る
    (close リンクに依存しない)。

これで default base / 非 default base どちらの PR も確実に解決でき、#825 の全文あいまい検索にも戻らない。

受け入れ条件

  • epic ブランチ宛て PR(topic/autopilot-<N> head)を findPrForIssue(N) が見つける
  • default base PR も従来どおり解決できる(回帰なし)
  • hasMergedPullRequest(N) が非 default base への merge も検知する
  • node:test 追加(head 検索フォールバックのモック)

Metadata

Metadata

Assignees

No one assigned

    Labels

    🤖 autopilotautopilot が処理対象にした Issue/PR(daemon が付与)

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Close

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions