Repository navigation
Description
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_recordand the others in_GROUNDING_CHECKS) are private helpers of the command module. - The readiness tests patch
devops_cli.commands.pr.run_ghand import private names ofcommands/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 withrun_gh's signature. It prints nothing and raises notyper.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-readinessrenders the verdict and exits as today: 1 on any blocker, pending checks count as a blocker unless--allow-pending-checksis given, and the same messages.- The MCP tool
pr_check_readinessis 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 thegithub_apisession fake, with no print and notyper.Exit. - Each item rule is a public predicate in
roadmap/with a table test. pr check-readinessgives 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_ghor imports a private name ofcommands/pr.py. - The tests run offline.
uv run devops cipasses.
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
dan-petty commentedon Oct 28, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
The title and body describe moving code between modules without changing user-facing behaviour.It is part of a planned architectural effort (#998) with no active bug or security gap.It improves testability and reusability of the readiness logic but adds no new user-facing capability.It moves roughly 750 lines across two new modules, updates three test files, and must preserve identical output and exit codes.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.fix(github): pr monitor waits until the checks settle and names every…