Skip to content

[bug] BEHIND and UNSTABLE merge states are treated as ready #18

@coygeek

Description

@coygeek

[bug] BEHIND and UNSTABLE merge states are treated as ready

Summary

DeployBot treats MergeStateStatus.BEHIND and MergeStateStatus.UNSTABLE as ready as long as mergeable == MERGEABLE. GitHub's schema defines BEHIND as an out-of-date head ref and UNSTABLE as mergeable with non-passing commit status.

Those states are not equivalent to CLEAN or HAS_HOOKS, and DeployBot should not place such pull requests into the ready-to-merge path.

Evidence

Impact

DeployBot can report a PR as ready even when GitHub has already computed that the branch is stale or that commit status is non-passing. This creates queue churn and confusing merge failures, and it can hide the real blocker from the user-facing queue state.

The safer interpretation is:

  • CLEAN: ready if DeployBot's other policy checks pass.
  • HAS_HOOKS: ready if DeployBot's other policy checks pass, while recognizing GitHub-side hooks may still reject.
  • BEHIND: waiting or blocked with an explicit "head ref is out of date" reason.
  • UNSTABLE: waiting or blocked with an explicit "GitHub reports non-passing commit status" reason.

Proposed fix

  • Update QueueEntry.classify() to classify BEHIND and UNSTABLE as non-ready states with precise reasons.
  • Keep HAS_HOOKS separate from CLEAN in tests so future changes do not accidentally equate all mergeable states.
  • Replace the current test expectation in test_github_blocked_state_fails_closed_but_mergeable_states_do_not.

Verification

  • python3 -m pytest tests/test_cli.py -q
  • python3 -m pytest -q

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions