Skip to content

refactor(github): pr check-readiness reads one merge-readiness verdict from github/, and the item rules are public predicates in roadmap/ #2442

Closed

Description

@dan-petty

Problem or Motivation

Part 1 of #998. The merge-readiness rules of devops pr check-readiness live inside the Typer module src/devops_cli/commands/pr.py (about 750 lines from _check_mergeable_blocker to check_readiness, origin/main 4226904). The rules print their own warnings and info lines while they decide, so no other caller can get the verdict as data.

  • The item rules (_closes_one_issue, _closes_an_open_issue, _closes_an_item, _archives_its_change, _writes_only_its_own_record and the others in _GROUNDING_CHECKS) are private helpers of the command module.
  • The readiness tests patch devops_cli.commands.pr.run_gh and import private names of commands/pr.py (tests/test_pr_cmd.py, tests/test_pr_check_runs.py, tests/commands/test_pr.py).

Proposed Solution & Architectural Design

  • One module in src/devops_cli/github/ reads a pull request and returns its merge-readiness verdict as data: the blockers, the advisories (the warnings and information lines of today), the pending checks as their own fact, and the grounding facts. It takes the repository, the pull request number and a runner with run_gh's signature. It prints nothing and raises no typer.Exit.
  • The item rules become public pure predicates over the grounding facts in src/devops_cli/roadmap/, because they state the Item definition of CONTEXT.md and ADR 0016.
  • devops pr check-readiness renders the verdict and exits as today: 1 on any blocker, pending checks count as a blocker unless --allow-pending-checks is given, and the same messages.
  • The MCP tool pr_check_readiness is generated from the command (refactor(mcp): the mcp tool bridge is generated from the typer app instead of 147 hand-written argv lists #997) and runs it in-process, so it follows with no change.
  • The verdict reads its checks only through github/check_verdict.py.

Target Subsystem

src/devops_cli/commands/pr.py, src/devops_cli/github/, src/devops_cli/roadmap/, and the readiness tests.

Existing Tool Considered

No open tool decides the merge readiness of this repository's own rules (the item rules and the OpenSpec archive rules). GitHub's mergeable_state, check runs and review threads stay the inputs. The change moves code and adds none of its own design.

Acceptance criteria

  • One public function in github/ returns the verdict from canned payloads through a scripted runner and the github_api session fake, with no print and no typer.Exit.
  • Each item rule is a public predicate in roadmap/ with a table test.
  • pr check-readiness gives the same exit code and the same lines as before for: a clean PR, a merged PR, a closed PR, merge conflicts, unknown mergeability, a blocked state with and without --allow-blocked-state, a draft with and without --allow-draft, failing, pending and unread checks with and without --allow-pending-checks, unresolved, replied and unreadable threads, and each grounding blocker. A table test pins each case.
  • No readiness test patches devops_cli.commands.pr.run_gh or imports a private name of commands/pr.py.
  • The tests run offline. uv run devops ci passes.

Related

Parent: #998. The second part moves pr ready and pr monitor onto the verdict. #1324 moves the rest of the devops pr tests onto edge fakes, and whichever lands second rebases.

Source: #998

Activity

  1. added
    source/agent
    type/refactor
    status/new
    value/medium
    effort/high
    on Oct 28, 2026
  2. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/refactor. The title and body describe moving code between modules without changing user-facing behaviour.
    • Priority: P2-Medium. It is part of a planned architectural effort (#998) with no active bug or security gap.
    • Value: Medium. It improves testability and reusability of the readiness logic but adds no new user-facing capability.
    • Effort: High. It moves roughly 750 lines across two new modules, updates three test files, and must preserve identical output and exit codes.
    • Related: refactor(github): read a pull request's checks once, fail-closed, for wait, monitor and readiness #769, which asks for a different change. Both restructure check-readiness in the same files, but #769 deduplicates the check-reading seam while this candidate extracts the full verdict and makes item rules public predicates.
  3. added
    priority/p2-medium
    on Oct 28, 2026
  4. removed
    status/new
    on Oct 30, 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

    effort/highpriority/p2-mediumsource/agenttype/refactorvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions