Skip to content

feat(roadmap): scaffold makes the delivery branch and its stubs #5518

Not planned

Description

@dan-petty

Problem or Motivation

After a plan PR merges, delete_branch_on_merge deletes the plan branch, and the implement Job makes its own branch. D1 of the approved pipeline split design (tracker #5482) runs scaffold of kind delivery first in the tests unit. E2 needs test and module stubs from tasks.md as Coder input.

Proposed Solution & Architectural Design

Target Subsystem

Roadmap Service and roadmap jobs (src/devops_cli/roadmap/steps/, src/devops_cli/roadmap/implement/).

Acceptance Criteria

  • Test first: a Planned item gets a branch ref with no commit and one stub for each task path. The test fails on the base.
  • A test: arm B adds the header comment, and arm A does not.
  • Live proof: after the merge and the release, the implement Job runs scaffold of kind delivery as the App on the next Planned item. A comment on this issue gives the result line.

Existing Tool Considered

The GitHub git refs API and the OpenSpec tasks reader exist. Build: 150,000 to 300,000 agent tokens and 0.5 day.

Related

Tracker #5482, Phase 7. Depends on #5499. #5519, #5520.

Source: #5482

Dependencies

Alternatives check of 2026-11-23: in-use.
The repository already uses this tool.
Tool: Fission-AI/OpenSpec (https://github.com/Fission-AI/OpenSpec), MIT, last activity 2026-11-23, maintained.
Reason: Searches found no tool that creates a delivery branch ref and writes test and module stubs; OpenSpec, already the project's change layer, supplies the tasks.md checklist and its reader, which the scaffold reuses.

Covers:

  • Writes the tasks.md implementation checklist per change
  • Reads and parses a change's task list
  • Validates and archives change proposals

Lacks:

  • Creates the branch ref at the origin/main head
  • Writes empty or header test and module stubs
  • Resume rule and the --stub-arm choice
  • Keeps stubs untracked with no commit

Proposed design

Problem statement

Build the delivery kind of devops roadmap step scaffold after #5499 and #6521. The plan branch is gone after the plan PR merges, and the implement job must make the delivery branch and the Coder stubs. Offline tests cover the ref, the stubs, the two arms and the resume rule; the live proof is a person step after the release.

Acceptance criteria

Requirement: Delivery branch ref

The delivery scaffold SHALL create refs/heads/<type>/<issue>-<slug> at the origin/main head and SHALL make no commit.

Scenario: Ref at the origin/main head

  • WHEN A test runs devops roadmap step scaffold --kind delivery for a Planned item with a fake GitHub client in a checkout whose origin/main head is one commit.
  • THEN The fake records one ref create call for refs/heads/<type>/<issue>-<slug> at that SHA, and git rev-parse HEAD gives the same SHA after the run.

Requirement: Resume rule

A second run of the delivery scaffold SHALL create no ref and write no stub when the ref and the stub files exist.

Scenario: Second run changes nothing

  • WHEN A test runs the delivery scaffold twice for one Planned item with a fake GitHub client.
  • THEN The second run records no ref create call, each stub file keeps its bytes, and the command exits 0.

Requirement: Stub for each task path

The delivery scaffold SHALL write one stub file for each repository path that a task of the change names in backticks.

Scenario: Test stub and module stub

  • WHEN The tasks.md of the change names src/app/foo.py in one task and tests/app/test_foo.py in another, and a test runs the delivery scaffold with a fake GitHub client.
  • THEN The checkout holds src/app/foo.py and tests/app/test_foo.py.

Requirement: Arm A plain stub

Arm A SHALL write each stub as an empty file.

Scenario: Arm A writes empty files

  • WHEN A test runs the delivery scaffold with --stub-arm a.
  • THEN Each stub file exists and has zero bytes.

Requirement: Arm B header

Arm B MUST write # TODO(#<issue>): implement <path> as the first line of each Python stub.

Scenario: Arm B writes the header

  • WHEN A test runs the delivery scaffold with --stub-arm b for issue 5518 and the path src/app/foo.py.
  • THEN The first line of src/app/foo.py is # TODO(#5518): implement src/app/foo.py.

Requirement: No stub commit

The delivery scaffold SHALL leave each stub untracked and SHALL make no commit.

Scenario: Stubs stay untracked

  • WHEN A test runs the delivery scaffold and then git status --porcelain in the checkout.
  • THEN Each stub shows the ?? status, and the branch ref still points at the origin/main head.

Requirement: Implement job uses the scaffold

The implement job SHALL call the delivery scaffold in its prepare phase before the first task group and SHALL make no ref create call of its own.

Scenario: Scaffold runs in prepare

  • WHEN A test runs the implement job for a Planned item with a fake GitHub client and a fake scaffold step.
  • THEN The recorded calls hold the delivery scaffold with --kind delivery in the prepare phase before the first group step, and the job makes no ref create call.

Requirement: One writer of the delivery ref

No module of src/devops_cli/roadmap/implement/ SHALL create a git ref.

Scenario: The implement modules create no ref

  • WHEN A test reads each module of src/devops_cli/roadmap/implement/ for a call that creates a git ref.
  • THEN No module holds such a call, so the delivery ref comes only from src/devops_cli/roadmap/steps/scaffold.py.

Requirement: Pending a person after the merge

After the release, the implement job SHALL run the delivery scaffold as the App on the next Planned item and SHALL write the result line as a comment on this issue.

Scenario: Live proof after the release

  • WHEN The release that holds this change is out and a Planned item is next.
  • THEN The implement job runs devops roadmap step scaffold --kind delivery as the App, and a comment on this issue gives the result line.

Existing Tool Considered

Fission-AI/OpenSpec (https://github.com/Fission-AI/OpenSpec), MIT, maintained: the alternatives check of 2026-11-23 in the issue body gives the verdict in-use. The issue body gives what the tool covers and lacks. The proposal uses the OpenSpec tasks reader for the task list and adds only the behavior that the check says the tool lacks: it creates the ref at the origin/main head, writes the stubs, adds --stub-arm and applies the resume rule. The issue body gives the written cost of that code: 150,000 to 300,000 agent tokens and 0.5 day.

Key questions

  • Which modules hold the delivery scaffold, the stub paths and the implement job?: The roadmap step modules live in src/devops_cli/roadmap/steps/. feat(roadmap): scaffold makes, resumes or adopts the item branch #5499 adds the delivery scaffold as a step in that folder. parse_task_groups at src/devops_cli/roadmap/step_files.py:216 reads tasks.md and gives the task paths. The implement job phases are in src/devops_cli/roadmap/implement/implement_run.py; its prepare phase holds the App token and its agent phase makes no GitHub call. [sources: src/devops_cli/roadmap/step_files.py:216, src/devops_cli/roadmap/implement/implement_run.py, src/devops_cli/roadmap/steps/watch.py, CONTEXT.md]
  • How does the delivery scaffold create the branch ref with no commit?: It calls the GitHub git refs API through the in-process GitHub client of the project. It creates refs/heads/<type>/<issue>-<slug> at the SHA of the origin/main head. It makes no local commit and no push. The prepare phase of the implement job holds the App token, so the scaffold runs there. (best practice) [sources: CONTEXT.md, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md, src/devops_cli/roadmap/implement/implement_run.py]
    • Chosen: GitHub git refs API through the in-process client. It creates a ref at a SHA with no local commit and no push, and the prepare phase holds the App token.
    • Rejected: Push of a local branch. A push needs a commit, and it changes the checkout.
    • Rejected: gh api subprocess. It adds a process and gives no typed result, and the job calls GitHub in process.
  • Which branch name and base does the delivery scaffold use?: The branch is <type>/<issue>-<slug>. The type comes from the issue title, and the slug comes from the change folder openspec/changes/<issue>-<slug>/. The base is the origin/main head at the run. (best practice) [sources: CONTEXT.md]
    • Chosen: The branch form in CONTEXT.md. The implement job and the scaffold give the same name, so no second rule drifts.
    • Rejected: Build the name in the scaffold. Two rules for one name can differ.
  • How does the scaffold find the stub paths, and where does it write the stubs?: It reads the tasks of the change with parse_task_groups at src/devops_cli/roadmap/step_files.py:216. It takes each repository path that a task names in backticks. It writes each stub under the checkout path that the caller gives it. (best practice) [sources: src/devops_cli/roadmap/step_files.py:216, CONTEXT.md]
    • Chosen: Paths of the tasks in tasks.md. tasks.md is the checklist of the change and the Coder input, and the step reader already parses it.
    • Rejected: Glob the spec deltas. A spec delta holds no file path.
    • Rejected: Let the Coder write the stubs. E2 needs the stubs before the Coder runs.
  • How does a run pick arm A or arm B, and what does arm B write?: The step takes --stub-arm {a,b} with default a. Arm A writes an empty file. Arm B writes # TODO(#<issue>): implement <path> as the first line of each Python stub. A run names the arm on its command line. (best practice) [sources: CONTEXT.md, src/devops_cli/roadmap/steps/watch.py]
    • Chosen: --stub-arm option on the step. One command tests both arms offline, and the experiment needs no config change.
    • Rejected: Setting in .github/roadmap.toml only. A test then needs a config change to reach arm B.
    • Rejected: A second scaffold command. A roadmap step is one module and one command.
  • What does a second run of the delivery scaffold do?: A second run creates no ref when the branch exists on origin. It writes no stub when the file exists. It exits 0. (best practice) [sources: CONTEXT.md]
    • Chosen: Create only when absent. GitHub state is the first marker, so a second run is safe and keeps the commits of the implement job.
    • Rejected: Move the ref to the origin/main head. It would drop the commits that the implement job made.
  • Does the delivery scaffold commit the stubs?: No. The scaffold leaves each stub untracked and makes no commit. The implement job commits the work of a task group after its checks pass. (best practice) [sources: CONTEXT.md, src/devops_cli/roadmap/implement/implement_run.py]
    • Chosen: Leave each stub untracked. The scaffold only prepares the worktree, and the implement job owns the commits.
    • Rejected: Commit the stubs in the scaffold. A commit on the delivery branch before the first group hides the untracked state that E2 reads.
  • Where does the implement job call the delivery scaffold?: The implement job calls the delivery scaffold in its prepare phase, before the first task group. The prepare phase holds the App token. The agent phase makes no GitHub call. The job makes no ref create call of its own. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py, CONTEXT.md, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md]
    • Chosen: Prepare phase. The prepare phase holds the App token, and the agent phase must make no GitHub call.
    • Rejected: Agent phase. The agent phase holds no GitHub credential and makes no GitHub call.
    • Rejected: Each task group. One scaffold before the first group gives the same ref and stubs to every group.
  • How does the proposal prove the delivery scaffold in the live implement job?: Offline tests cover the ref, the stubs, the two arms, the resume rule and the prepare call. The live proof is the acceptance criterion Pending a person after the merge. After the release, a person checks the next Planned item and comments the result line on the issue. (best practice) [sources: CONTEXT.md, docs/ROADMAP_WORKFLOW.md]
    • Chosen: Keep the live proof as a pending person acceptance criterion. Offline tests cannot show the App token, the real origin/main head and a real Planned item, and the proof is after delivery.
    • Rejected: Make the live proof a person question. It does not change the pre-build plan, so it is a step after delivery.
    • Rejected: Defer the live proof to a separate issue. The rule writes a post-release live proof as an acceptance criterion named Pending a person after the merge.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#5499, #6521

Activity

  1. added
    source/agent
    on Nov 13, 2026
  2. added
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 13, 2026
  3. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 13, 2026
  5. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: Searches found no tool that scaffolds a delivery branch and stubs; OpenSpec already supplies the tasks.md task list that names the stub paths, but it creates no ref and writes no files.

    The repository already uses this tool.

    Tool: Fission-AI/OpenSpec (https://github.com/Fission-AI/OpenSpec), MIT, last activity 2026-11-17, maintained.

    Covers:

    • Reads and validates tasks.md task lists
    • Gives the change and spec folder layout
    • CLI commands to validate spec deltas

    Lacks:

    • Creates no delivery branch ref at origin/main
    • Writes no test or module stub files
    • No --kind delivery scaffold step or resume rule
    Searches (8)

    Tools considered:

    Searches run:

    • create git branch ref without commit GitHub API library, results: 5
    • generate code stubs from tasks markdown spec scaffold tool, results: 5
    • PyGithub create_git_ref branch from sha without commit, results: 5
    • OpenSpec tasks.md generate test stubs code scaffolding, results: 5
    • Fission-AI OpenSpec GitHub spec-driven development, results: 5
    • GitHub REST API git refs create a reference documentation, results: 5
    • OpenSpec, results: 5
    • octokit create git ref branch, results: 5

    Sources:

    A person decides what this check of 2026-11-17 means for the item.

  6. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Owner question: Who gives the live proof after the release? (a person decides)

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  7. dan-petty commented on Nov 20, 2026

    @dan-petty
    OwnerAuthor

    Frozen on 2026-11-20. The stage, implement and fix-checks jobs grade under 60%, so the owner rule asks for a re-architecture before more fixes inside the current design (tracker #6519). This item is incremental work on those jobs, so its Dependencies section now names #6521 first. Stage and implement leave this item while #6521 is open. When the experiments of #6519 decide, a person closes #6521 (this item can then continue) or closes this item as not planned.

  8. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies and Watched files in the section Proposed design of the body.

  9. devops-cli-service commented on Nov 22, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  10. dan-petty commented on Nov 30, 2026

    @dan-petty
    OwnerAuthor

    Premise check after the release of the hold #6521 (2026-11-30): devops roadmap step scaffold was deleted in 90cf4f6 (#6664); delivery branches now come from implement_phases.py and open_row.py. Closed as not planned (AGENTS.md rule 2); a person may reopen it, or file a new item from fresh evidence.

  11. removed
    status/new
    on Nov 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/mediumpriority/p2-mediumscope/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions