Skip to content

feat(github): current release admission, cap, descoping and stall rules (devops roadmap reprioritize) #740

Closed

Description

@dan-petty

Context & Rationale

A release's scope is fixed when it starts (CONTEXT.md:63-65), and no code enforces that:

  • rg -i "admission|reprioriti|descop" src finds only Kubernetes admission-policy code.
  • _evaluate_pr_blockers (commands/pr.py:1422-1466) checks mergeability, drafts, check runs and review threads. It never checks which release a PR's item is in.

Measured on GitHub on 2026-10-01:

Reprioritization (CONTEXT.md:109-111) re-ranks items, starts each release by filling it to size, and holds the current release to its admission rule and size. This item delivers the release rules. Re-ranking the planned releases and the backlog is split off so that this item fits one PR. It supersedes the phased scope governor (#696, closed as not planned).

What already exists to build on (checked at ef21785):

  • hypothesis==6.168.3 is already a dev dependency (pyproject.toml:75). No test uses RuleBasedStateMachine yet. The only shared property profile (tests/test_sandbox_policy_properties.py:43-47) is derandomized but leaves out the shrink phase.
  • devops release pr opens the release PR from release/vX.Y.Z into main with the release label, as a draft by default (commands/release.py:1055-1066). On a merge to main, .github/workflows/release.yml tags and publishes the GitHub Release, then closes the milestone but carries on if that fails (release.yml:122-124). devops release tag also closes it (_push_git_tag, commands/release.py:1519-1528). So a shipped release's milestone can still be open.
  • GitHub's GraphQL API has Issue.blockedBy, ProjectV2ItemStatusChangedEvent (actor, createdAt, status) and the timeline events BLOCKED_BY_ADDED_EVENT and BLOCKED_BY_REMOVED_EVENT, confirmed by introspection. No blocked-by links exist yet: gh api repos/dan-petty/devops-cli/issues/740/dependencies/blocked_by returns [], and so does the same call for feat(release): item closure summaries, generated changelog and automatic release cut (devops roadmap close) #743.
  • AGENTS.md:65 allows agents to create release branches. No code creates a remote branch: rg git/refs src finds nothing.
  • extract_linked_issues (github/issue_closure.py:100) is the parser that feat(github): pr readiness requires an issue-linked, completed task file #704's readiness blocker uses.
  • MCP mirrors that write default to a dry run with dry_run: bool = True (ai/mcp/server.py:1519, :1609).

Scope & Deliverables

  • Deliverable: devops roadmap reprioritize, which takes --dry-run and --confirm like the rest of feat(github): github-sourced roadmap, migration and generated roadmap view (devops roadmap migrate, render) #739's group, and its MCP mirror. It writes only GitHub state, never a commit (ADR 0001). Every item it changes gets a one-line reason comment.
    • Transition table. The admission, cap, descoping, stall and cut-lock decisions all read one module-level table, held as data. The table maps a release state (planned, started, cut, shipped) and an event to an action and a reason.

    • Current release: the open milestone titled vX.Y.Z with the lowest version. Versions are compared as versions, not as text.

    • Size: the number of open items in a release. The cap is 12, from .github/roadmap.toml.

    • Admitted set: the items the current release holds at its start (or at the first run), plus each critical fix admitted after that. The store keeps it. An item counts as added to the current release when it is in the release and not in the admitted set, so a missed poll or a late run still catches it.

    • A person's placement: an item's release, or its absence from one, counts as a person's when it differs from the last placement a roadmap job set for it. An item no job has placed counts as placed by a person when it is in a release, and as unplaced when it is in the backlog.

    • First run: if the store has no record of an earlier run for the repo, the job records the admitted set and moves nothing. The rules apply to changes made after that.

    • Release start (moved from feat(release): item closure summaries, generated changelog and automatic release cut (devops roadmap close) #743). When the current release ships, the job:

      • closes the shipped milestone if it is still open;
      • creates release/vX.Y.Z for the next planned release at the default branch's head SHA, and leaves the branch alone if it already exists;
      • sends items with status New back to the backlog, except critical fixes;
      • removes Blocked items: a Blocked critical fix moves to the next planned release, and any other Blocked item goes to the backlog;
      • tops up the release to the cap in this order: critical fixes, then P0 features, then priority, Value (High first) and lowest issue number. Candidates are Ready items in the backlog and the later planned release that a person did not place there. If fewer than 12 candidates exist, the release starts with what it has;
      • trims the release to the cap by moving unstarted items, lowest priority first, then lowest Value, then highest issue number, to the next planned release. Trimming binds a person's placement too. It never trims a critical fix or a P0 feature while another unstarted item remains;
      • records the admitted set;
      • creates the next planned milestone (a patch bump of the highest one), so that 2 planned releases remain.
    • Admission: after the release starts, only a critical fix (a P0 type/bug or type/security item) can join it. Anything else added to it moves to the backlog. A P0 feature moves to the next planned release and goes first when that release starts.

    • Cap: when an admitted critical fix takes the release over the cap, the lowest-priority unstarted item that is not an admitted critical fix is descoped. Ties go to the lowest Value, then the highest issue number. If no item can be descoped, the fix joins anyway.

    • Descoping moves an unstarted item to the next planned release. Only this job descopes, and only for one of these reasons:

      • to make room for an admitted critical fix;
      • the item has a blocked-by link to an open item outside the current release;
      • the item's status is Blocked;
      • the item has the needs-split label;
      • the item stalled;
      • every other item in the release is Done.

      An admitted critical fix is descoped only when it is Blocked.

    • Stall: an In Progress item with no activity for the stall window (14 days, from .github/roadmap.toml) goes back to Ready and is descoped. A stalled admitted critical fix goes back to Ready and stays. Activity is the latest of three things: its last status change, the last update to an open PR that links it, and that PR's last commit. The job leaves the item's branch and PR alone. An In Review item never stalls. After the window it gets one nudge comment per window and keeps holding the cut.

    • Cut lock: an open PR into the default branch with label release and milestone vX.Y.Z cuts the release, whether or not it is a draft. feat(release): item closure summaries, generated changelog and automatic release cut (devops roadmap close) #743 shares this predicate, because its release PR's head is chore/release-vX.Y.Z, not release/vX.Y.Z. While the release is cut, nothing joins it, and a critical fix goes first into the next planned release. Closing that PR without merging it un-cuts the release. Only a person closes it.

    • Triggers: a pure function is_due(changes, now, last_stall_check) over refactor(github): roadmap store that reads and writes items, releases and board fields behind one interface #768's changes since the last poll, for feat(k8s): devops-cli runs in the homelab cluster as Jobs, and every cluster Secret is pushed from the keyring, also by deploy-stack (devops k8s push-secrets, devops k8s run-job) #741 and feat(cli): service mode for devops serve with github webhooks, a polling tick and per-repo job queues #752 to call. The job is due:

      • when a release starts, is cut, is un-cut or ships;
      • when an item is added to or removed from the current release;
      • when a current-release item's priority, status, release, labels or blocked-by links change, or the item closes;
      • when now is at least one day after last_stall_check, for the stall check.

      Comments, body edits and the job's own changes (values that match what it last set) are not triggers.

    • Store. From refactor(github): roadmap store that reads and writes items, releases and board fields behind one interface #768 this job uses Items (Release, Status, Priority, Value, Effort), Releases (find, create and close by version), the backlog, the changes since the last poll and the record of the value a job last set. This item adds whichever of these reads and writes refactor(github): roadmap store that reads and writes items, releases and board fields behind one interface #768 and feat(github): github-sourced roadmap, migration and generated roadmap view (devops roadmap migrate, render) #739 do not already provide to both refactor(github): roadmap store that reads and writes items, releases and board fields behind one interface #768 adapters, covered by its contract suite:

    • PR readiness, which extends feat(github): pr readiness requires an issue-linked, completed task file #704's blocker in _evaluate_pr_blockers: a PR into release/vX.Y.Z is blocked when an item it closes or names (Part N of #M) is not in release vX.Y.Z. The message names the item and the release it is in, or says it is in the backlog. PRs into the default branch are not affected.

    • State machine. tests/test_roadmap_lifecycle_properties.py defines a hypothesis.stateful.RuleBasedStateMachine over refactor(github): roadmap store that reads and writes items, releases and board fields behind one interface #768's in-memory adapter. Each rule applies one change and then runs the job when is_due says so. Invariants are checked after that run.

      • Rules:
        • a person adds, moves or reprioritizes an item;
        • a critical fix is filed;
        • an item starts, becomes Blocked, closes or stalls (a clock tick);
        • a blocked-by link is added;
        • the release is cut;
        • the release PR is closed without being merged;
        • the release ships.
      • Invariants, written from CONTEXT.md. Each message starts with the term it enforces:
        • Current release: after the release starts, every item in it is in the admitted set, and every item admitted after the start is a critical fix.
        • Current release: on the first run, the release admits whatever is already in it.
        • Current release: after the release starts, while its size is above the larger of the cap and its size at start, every unstarted item in it is an admitted critical fix.
        • Cut: after the cut, nothing joins until the release is un-cut.
        • Descope: descoping touches only items that have not started.
        • Blocked: no Blocked item is in a release at the moment it starts.
        • Reprioritization: the job never moves an item that a person placed in the backlog or in a later planned release into the current release. It moves an item a person placed in the current release only through admission, the cut lock, trimming at start or descoping, always with a reason comment. It never changes priority, Value or Effort.
  • Acceptance criteria:
    • State machine (verified with uv run pytest tests/test_roadmap_lifecycle_properties.py):
      • Every invariant is asserted after every step. A test checks that each invariant message starts with a term that CONTEXT.md defines, read from its **Term**: lines.

      • A test removes the cut-lock row from the table and asserts that the machine fails. A deep-profile run shrinks the failure to a minimal sequence (start, cut, add an item), which is pasted into the PR description.

      • Gate settings:

        • derandomize=True, which implies database=None;
        • deadline=None;
        • the shrink phase is kept;
        • example and step counts are tuned so that each new test takes at most 1 s in uv run pytest tests/test_roadmap_lifecycle_properties.py -p no:xdist --durations=0.

        DEVOPS_PROPERTY_PROFILE=deep runs a deeper sweep on demand.

      • Every failing sequence found during the build is pinned as a plain test that replays the steps Hypothesis printed. The PR description lists these tests.

    • Rules (unit tests on the in-memory adapter, verified with uv run pytest tests/test_roadmap_reprioritize.py):
      • Admission: after the release starts, an added P2 feature moves to the backlog with a reason comment. A P0 feature moves to the next planned release and sorts first when that release starts. A P0 type/bug item and a P0 type/security item stay. An item added between two runs with no change recorded for it is still found through the admitted set.
      • Cap: with 12 unstarted items, admitting a critical fix descopes the lowest-priority item, with ties broken as described above. With 12 started items, the fix joins and the release holds 13. With 11 started items and 1 unstarted admitted critical fix, a second fix joins and nothing is descoped. With 10 items, nothing is descoped.
      • Cut: with an open draft release PR, an added critical fix moves to the next planned release. After that PR is closed unmerged, the same fix added again stays.
      • First run: with no run record, the job writes nothing to GitHub and records the admitted set. A second run with no changes writes nothing.
      • Release start: on ship, the job creates the branch at the default branch's head SHA when it is missing and leaves it untouched when it exists. The release is filled or trimmed to 12 in the stated order, and trimmed items land in the next planned release. A New item goes to the backlog. A New critical fix stays. A Blocked critical fix moves to the next planned release, and a Blocked feature goes to the backlog. A Blocked backlog item is never pulled in. An item a person placed in the later planned release stays there, and so does an item a person moved to the backlog. A backlog item that only a job placed is pulled in. The next planned milestone is created.
      • Descoping: each listed reason descopes an unstarted item, with a comment that names the reason. A started item is descoped only through the stall rule. An admitted critical fix is descoped only when it is Blocked.
      • Stall, with now injected: an In Progress item idle for 14 days moves to Ready and is descoped, and nothing is written to its branch. An idle In Progress critical fix moves to Ready and stays. An In Review item idle for 14 days gets one nudge and stays. A second run on the same day posts no second nudge.
      • Every write the in-memory adapter records is paired with a reason comment on the same item. No write sets priority, Value or Effort.
      • Triggers: is_due is false for a comment, for a body edit and for a change that matches the job's last-set value. It is true for each listed trigger, including a blocked-by link added to a current-release item. With no changes, it is true once now is a day past last_stall_check and false before that.
      • --dry-run lists each change with its reason, and the adapter records no write. The MCP mirror appears in mcp._list_tools(), defaults to dry_run=True like the existing mirrors, and the adapter records no write unless it is called with dry_run=False.
    • PR readiness (verified with uv run pytest tests/test_pr_cmd.py): a PR into release/v0.2.26 that closes an item in v0.2.27 is blocked, and the message names the item and v0.2.27. A PR that names a backlog item with Part 1 of #N is blocked, and the message says it is in the backlog. A PR that closes a v0.2.26 item passes. The release PR into main is not affected.
    • Store: the contract suite passes against both adapters for each addition. The GitHub adapter's tests use recorded payloads.
    • Gate: uv run devops ci passes within its 5-minute budget, and no new test touches the network.
    • Manual check: a person runs this. It needs GitHub access, and feat(github): github-sourced roadmap, migration and generated roadmap view (devops roadmap migrate, render) #739's migrate must have run first. In this repo, gh issue list -R dan-petty/devops-cli --milestone <current release> --state all --json number,milestone is saved. uv run devops roadmap reprioritize --dry-run reports the first-run baseline and no moves. uv run devops roadmap reprioritize --confirm then records the admitted set, and the same gh issue list prints the same output as before. A second --dry-run reports nothing to do.
  • Key questions:
  • Constraint:
    • After the current release starts, nothing this job does adds an item to it except an admitted critical fix.
    • The job never sets priority, Value or Effort, and never closes or merges the release PR. It never deletes, resets or pushes to a branch. Its only branch write creates a missing release/vX.Y.Z.
    • Write the state machine first, from CONTEXT.md and this issue, before the implementation. The PR's first commit adds tests/test_roadmap_lifecycle_properties.py.
    • Tests run against the in-memory adapter or recorded payloads, never against the network or a cluster. Each new test costs at most 1 s.
    • Tests use AGENTS.md's structural tuple assertions until test(cli): retire the tuple-assert mandate and detect opaque tuple asserts and presence-only tests #851 settles that.
    • No new dependency.

Strategic Alignment

Activity

  1. added this to the v0.2.25 milestone on Sep 30, 2026
  2. added
    type/feature
    scope/github
    priority/p1-high
    on Sep 30, 2026
  3. dan-petty commented on Oct 3, 2026

    @dan-petty
    OwnerAuthor

    Closed by #1084, merged into release/v0.2.25.

    GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by devops gh issues close-merged.

  4. added a commit that references this issue on Oct 3, 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

    priority/p1-highscope/githubtype/feature

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions