Skip to content

fix(roadmap): stage must check packed files before opening a draft plan #3970

Closed as not planned

Description

@dan-petty

Problem

The devops roadmap stage job measures task groups with measure_groups. But it does not check if a group changes existing files and packs no file.

Because stage omits this check, it pushes plan pull requests that fail CI Plan Check immediately with group-no-files. For example, pull request #3928 had task groups 3 and 7 that packed no files from the head commit. The stage job accepted the plan, but CI failed.

Expected

The function _settle in src/devops_cli/roadmap/stage/stage.py checks group-no-files with the same logic as plan_check._size_problems. When a group packs no files, _settle returns _Refused with texts.plan_check_group_no_files to the planner model during the revision loop.

Acceptance criteria

  • The stage job checks each task group for group-no-files during proposal validation.
  • A plan with a task group that changes existing files and packs no file is refused during staging.
  • Tests prove that _settle rejects a plan with group-no-files before opening a pull request.

Existing tool considered

The existing function measure_groups and plan_check._size_problems already implement the check. No external library is needed.

Related

Related: #3499, #3669, #3928.

Proposed design

Problem statement

The stage job measures each task group but accepts a group that changes existing files and packs no file. It can then open a plan pull request that CI Plan Check rejects with group-no-files. The fix makes _settle apply the same check during staging and return the plan to the planner before any draft opens.

Acceptance criteria

Requirement: Stage refuses an empty packed group

The stage job SHALL refuse a task group that changes an existing file and packs no file before it opens a draft pull request.

Scenario: A group changes an existing file and packs no file

  • WHEN _settle receives a plan whose group changes a file that exists at the staged commit and whose packed files are empty.
  • THEN _settle returns _Refused with texts.plan_check_group_no_files.

Requirement: Stage check matches plan check

The stage job MUST use the same group-no-files logic as plan_check._size_problems.

Scenario: Both checks agree on an empty packed group

  • WHEN A plan contains a group that plan_check._size_problems reports as group-no-files.
  • THEN _settle refuses the plan with the same problem text.

Requirement: Second refusal stops the item

The stage job SHALL return the group-no-files problem to the planner once and SHALL stop the item on a second refusal.

Scenario: The planner repeats the empty packed group

  • WHEN The planner returns a second plan with the same group-no-files defect.
  • THEN The stage job raises RoadmapStageError and opens no draft pull request.

Requirement: Test proves no pull request opens

The change MUST add a test that proves _settle rejects a plan with group-no-files before _open_pull runs.

Scenario: The test observes the refusal

  • WHEN The test calls _settle with a plan that changes an existing file and packs no file.
  • THEN The test observes _Refused with texts.plan_check_group_no_files and no call to _open_pull.

Existing Tool Considered

No alternatives check has run. No open, maintained external tool or library covers this internal stage-validation need; the project already holds measure_groups and plan_check._size_problems. The change adds a call and tests, about 1,500 tokens and about 1 hour to build, keep and fix, with no external dependency.

Key questions

  • Where does the stage job apply the group-no-files check?: In _Planner._settle, after _fit measures the final groups and before _plan_body or _open_pull. The check returns _Refused with texts.plan_check_group_no_files. (best practice) [sources: src/devops_cli/roadmap/stage/stage.py, src/devops_cli/roadmap/plan_check.py, docs/roadmap/plan-check.md:31]
    • Chosen: Check in _Planner._settle. _settle holds the final groups and the existing _Refused return path.
    • Rejected: Check in the StageProposal schema validator. The schema has no staged commit or packed-file measurement.
    • Rejected: Leave the check to CI Plan Check. The stage job then opens a draft that CI rejects, which is the reported defect.
  • Should the stage job reuse the plan-check rule or copy it?: Reuse the plan_check._size_problems logic through one shared helper or call. Do not copy the rule into stage.py. (best practice) [sources: src/devops_cli/roadmap/plan_check.py, src/devops_cli/roadmap/stage/stage.py]
    • Chosen: Reuse the plan-check logic. The issue states that plan_check._size_problems already implements the check.
    • Rejected: Copy the rule into stage.py. A copy lets the stage and CI rules diverge.
  • Which groups does the stage check judge after a split?: The final groups after _fit makes at most one split. The check does not judge the original groups. (best practice) [sources: openspec/changes/archive/2026-10-30-2772-stage-group-files/design.md:13, src/devops_cli/roadmap/stage/stage.py]
    • Chosen: Final groups after the split. The archived 2772 design says the check runs on the final groups.
    • Rejected: Original groups before the split. A split can change which files a group packs.
  • What does the stage job do after a second group-no-files refusal?: It raises RoadmapStageError and opens no draft pull request. The first refusal returns the problem to the planner once. [sources: src/devops_cli/roadmap/stage/stage.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Alternatives check of 2026-11-09: none.
Tool: none found.

Activity

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 7, 2026
  2. dan-petty commented on Nov 7, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. The defect wastes CI runs but the plan-check gate still catches the error before merge.
    • Value: Medium. It prevents draft pull requests that fail immediately, saving reviewer time and CI cost.
    • Effort: Low. The check already exists in plan_check._size_problems; only wiring it into _settle and adding a test is needed.
    • Possible duplicate: fix(roadmap): stage gates task groups against empty packed files #3965, which may ask for the same change. The model names the _settle function in stage.py checks group-no-files and refuses the plan when a task group packs no files as the change that both ask for. Both items ask _settle in stage.py to check group-no-files and refuse the plan before opening a draft pull request. A person closes one of the two if that is so.
  3. added
    priority/p2-medium
    on Nov 7, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 8, 2026
  5. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 1f03ee3 (see proposed design in issue body).

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

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: The search found no external tool for this need. It is an internal check in the project's own stage job, and the issue says the existing measure_groups and plan_check._size_problems already hold the logic. The fix only wires that logic into _settle.

    Tool: none found

    Lacks:

    • No external tool knows this project's plan format, staged commit or packed-file measurement

    Searches run:

    • validate plan task groups touch files before opening draft pull request planner agent check, results: 5

    Checked on 2026-11-09. A person decides what this means for the item. The check changes no label and closes no issue.

  7. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor

    Closed as superseded by #5416 (feat(roadmap): run the plan checks before the stage push, release v0.129.0, live on the roadmap Service since 2026-11-13 14:23Z).

    The stage job now runs all the rules of devops roadmap plan-check on the files that it writes, before the push (_file_findings and _plan_check in src/devops_cli/roadmap/stage/stage.py). The rule group-no-files is one of these rules. A plan that a rule refuses goes back to the planner model, as a refusal of any other gate does. So the stage job no longer pushes a plan that CI Plan Check refuses for group-no-files.

    If a plan PR from the stage job fails Plan Check with group-no-files after v0.129.0, file a new bug and link that PR.

  8. removed
    status/ready
    on Nov 13, 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/lowpriority/p2-mediumscope/roadmapsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions