Skip to content

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

Open

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

A plan pull request merges, and delete_branch_on_merge deletes the plan branch. The implement job then makes its own branch. D1 of the approved pipeline split design (tracker #5482) runs a scaffold of kind delivery first in the tests unit. E2 needs test and module stubs from tasks.md as Coder input. This item adds the delivery kind to devops roadmap step scaffold. The step creates the branch ref at the origin/main head with no commit, and it writes the stubs. The live proof after the release goes to a separate issue.

Acceptance criteria

Requirement: Delivery branch ref

The delivery scaffold SHALL create the branch ref 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 the line # 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 run SHALL get the delivery branch from the scaffold step and SHALL make no ref create call of its own.

Scenario: Scaffold runs before the first group

  • WHEN A test runs the implement job for a Planned item with a fake GitHub client.
  • THEN The recorded calls hold the delivery scaffold with --kind delivery 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.

Existing Tool Considered

Fission-AI/OpenSpec (https://github.com/Fission-AI/OpenSpec), MIT, last activity 2026-11-17, maintained, is the tool of the alternatives check of 2026-11-17 in the issue body, with 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. It adds only what OpenSpec lacks: the delivery branch ref at the origin/main head, the test and module stubs, the --stub-arm choice and 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/, and the issue names steps/scaffold.py as the module of the scaffold step. feat(roadmap): scaffold makes, resumes or adopts the item branch #5499 adds that step. The stub paths come from parse_task_groups in src/devops_cli/roadmap/step_files.py, which reads tasks.md. The implement job runs from src/devops_cli/roadmap/implement/implement_run.py. [sources: src/devops_cli/roadmap/steps/watch.py, src/devops_cli/roadmap/step_files.py:211, src/devops_cli/roadmap/implement/implement_run.py]
  • How does the delivery scaffold create the branch ref with no commit?: The scaffold asks the GitHub client of the project for one git ref at the SHA of the origin/main head. It makes no local commit and no push. (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]
    • 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 step already 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 step calls GitHub in process.
  • Which branch name and base does the delivery scaffold use?: The name comes from the shared branch form in src/devops_cli/git/branch_form.py, with the type of the issue title and the slug of the change folder openspec/changes/<issue>-<slug>/. The base is the origin/main head at the run. (best practice) [sources: src/devops_cli/git/branch_form.py:54, CONTEXT.md]
    • Chosen: One shared branch name function. 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 in src/devops_cli/roadmap/step_files.py, and 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:211, 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, and 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.
  • How does the proposal prove the delivery scaffold in the live implement job?: It does not. The live proof waits on the release of this item and on the next Planned item, and only those outside events settle it. A separate issue holds the live proof, and offline tests cover the branch ref, the stubs, the arms and the resume rule. (best practice) [sources: CONTEXT.md]
    • Chosen: Defer the live proof to a separate issue. The rest of the item is workable offline, so the item can reach Ready without the live proof.
    • Rejected: Keep the live proof in this item. No offline test shows the App token, the real origin/main head and a real Planned item.
  • What holds this item before it starts?: The item needs feat(roadmap): scaffold makes, resumes or adopts the item branch #5499 for the --kind delivery option and chore(roadmap): hold incremental stage and implement work #6521 for the re-architecture of the stage, implement and fix-checks jobs. Waiting on another item is a dependency, not a block. [sources: CONTEXT.md]

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.

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/agentstatus/newtype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions