dev.py pr — gate, create, register, and open stacked children (design 006 pieces 5 + 19a) nf-hhaw ← Beads

closed priority 2 task unassigned activesession:dev-py-pr

Twinned from https://github.com/cfsh/ninefold/issues/824 by tools/beads/import_github.py's reconcile pass.

Design 006 (design_docs/006-the-coders-front-door.md) pieces 5 (S3) and 19a (S14's opening half) — bundled because they're the same verb, not separable. Prerequisite piece 4 (the dev.py skeleton, tools/nflib/devcli.py + root dev.py) is done (#787). Landing this alongside two sibling issues (filed separately, standalone from this one) clears every remaining prerequisite for piece 8 (dev.py status/review/merge), the highest-value remaining piece in the doc.

What to build

A new dev.py pr verb, in tools/nflib/devcli.py (logic) + wired into root dev.py (argparse). Behavior, in order:

  1. Gate. Run the presubmit gate (reuse whatever dev.py check already does — presubmit.py --all). Refuse to create the PR on red, printing why.
  2. Create. Open the PR: **Session:** nf-dev-<topic> as the first line of the body (existing convention — grep recent PR bodies for the exact format), request review from the reviewer app.
  3. Register. Add the PR to whatever tracked-prs.txt/session_state.py mechanism already tracks a session's open PRs — at creation, not later. Design 006 §2.6 found the current registration point (review_now) leaves a PR that never gets reviewed permanently untracked; a PR must be tracked from birth.
  4. Also the way to open PR 2, 3, 4 of a stack (piece 19a). When run again from a branch whose current PR is already open, branch from the current head, set the new branch's PR base to the branch you just came from (not main), and cross-link parent/child (a line in each body naming the other, e.g. "stacked on #<n>" / "stacked under this: #<n>"). This is the concrete, cheap form of docs/DEV_PRINCIPLES.md's E4 ("write a full stack, then split it for focused reviews") — right now that's five lines of prose in notes/merging.md and nothing enforces or automates it.
What this deletes from a dev's head (the payoff)

"Run presubmit before mailing"; tracked-prs.txt; session_state.py --init; the sid; the state path; how to start a stacked branch by hand.

Constraints
Reference (context, not required reading)

design_docs/006-the-coders-front-door.md §5.2 (the verb table), §5.7 (S14 — why the stack is the default shape, not an edge case: "a four-PR stack is the default shape of a session's work" per @aedanpope 2026-08-09), §2.6 (the registration-timing correction), §8.2 rows 5/19a.

Dependencies

None.

Comments

No comments.

Add a comment