Skip to content

fix(git): skip commit statuses for state-only PR reads - #793

Open
BlackYuriJDU wants to merge 1 commit into
ephico2real2:mainfrom
BlackYuriJDU:fix/775-pr-state-without-ci
Open

BlackYuriJDU wants to merge 1 commit into
ephico2real2:mainfrom
BlackYuriJDU:fix/775-pr-state-without-ci

Conversation

@BlackYuriJDU

Copy link
Copy Markdown

Summary

  • Give pr_status a ci flag (default True), so callers that only need the PR state do not page the host CI.
  • merge and apply pass ci=False; GitHub skips its Actions lookup and Gitea skips the commit-status read.
  • Cover the GitHub path with a request-counting MockTransport test.

Motivation

Fixes #775.

jobs/merge.py and jobs/apply.py call pr_status only for the PR's state, but the provider also fetched the CI on every open-PR read. With host CI on that spent extra GitHub Actions requests and made an Actions outage raise GitUnavailable where only the PR read was needed.

Changes

  • Git protocol and the base/GitHub/Gitea providers: pr_status(pr, *, ci=True).
  • merge.py/apply.py: state-only reads pass ci=False.
  • test_github_actions_ci.py: assert the state-only read requests only /pulls/7 and returns no checks.

Test Plan

  • pytest tests/service/test_github_actions_ci.py -q — 68 passed.
  • Fail-before: with the ci guard removed, the new test fails because the Actions lookup runs and checks is non-empty.
  • The non-CI fields (state, head_sha, merge_sha) are unchanged.

pr_status always paged the commit statuses when host CI was on, even for
merge and apply, which only read the PR's state. Add a ci flag (default true)
to the Git protocol and both providers; merge and apply pass ci=False, and the
GitHub status test asserts the fetch makes no status request.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pr_status reads Actions CI on every call, including merge and apply's state-only reads

1 participant