Skip to content

refactor(roadmap): group the job modules in subpackages #3187

Closed

Description

@dan-petty

Problem or Motivation

src/devops_cli/roadmap/ is one flat package of 63 files. The jobs show as name prefixes: refine*, stage*, implement*, intake*, and the stores. The largest files are refine.py (2,438 lines), intake.py (1,445), stage.py (1,412), implement_step.py (1,330) and run.py (1,304). A reader cannot see from the folder which files belong to one job, and a change to one job touches files that sit among the files of the others.

Proposed Solution & Architectural Design

Open question for the refine step: whether the test folder tests/roadmap/ should mirror the new layout. The test rules in docs/TESTING.md and tests/invariants may name the paths.

Target Subsystem

src/devops_cli/roadmap/, the imports of it, and tests/roadmap/.

Existing Tool Considered

ruff and the editor can rewrite imports, and git mv keeps history. No tool decides the grouping. The cost is about 120k tokens and 6 hours to build, and nothing to keep. The risk is a merge conflict with open work, which is why it waits.

Proposed design

Problem statement

The roadmap package is one flat folder of 63 files. The job files and the store files are mixed, so a reader cannot see which files belong to one job, and a change to one job touches files among the files of other jobs. The change moves each job's modules into its own subpackage and the stores into one, with no behavior change.

Acceptance criteria

Requirement: Job subpackages

The roadmap package SHALL place each job module under intake/, refine/, stage/, or implement/, and each store module under stores/.

Scenario: Job and store modules have subpackages

  • WHEN A test lists the top level of src/devops_cli/roadmap/ and its subpackages.
  • THEN No top-level module name starts with intake, refine, stage, or implement, and every store module is under stores/.

Requirement: Caller imports

Every import of a moved module inside src/ and tests/ SHALL use the new module path.

Scenario: No old module path remains

  • WHEN A test runs ! git grep -n 'from devops_cli.roadmap import \(store\|github_store\|intake\|refine\|stage\|implement_step\)' src/ tests/.
  • THEN The search finds no match.

Requirement: Package docstring kept

The devops_cli.roadmap package SHALL keep its module docstring and SHALL NOT gain re-exports of the moved modules.

Scenario: Package init stays a docstring

  • WHEN A test parses src/devops_cli/roadmap/init.py.
  • THEN The module body holds only the docstring, with no import or assignment.

Requirement: History follows the move

The change SHALL move each file with git mv so that its history follows it.

Scenario: Git log follows a moved file

  • WHEN A test runs git log --follow on a moved module path.
  • THEN The log includes the commits that touched the file before the move.

Requirement: Test tree mirrors source tree

The tests/roadmap/ tree SHALL mirror the new src/devops_cli/roadmap/ subpackages, with test files named after behaviour rather than one per source module.

Scenario: Roadmap test files mirror source subpackages

  • WHEN A test lists the test files for each new roadmap subpackage.
  • THEN The tests for intake, refine, stage, implement and stores sit in tests/roadmap//, and no test file is named after a source module.

Requirement: Behavior is unchanged

The change SHALL not alter runtime behavior.

Scenario: Full test suite passes

  • WHEN The full test suite runs with uv run pytest.
  • THEN Every test passes with no change to a behavior assertion.

Existing Tool Considered

No open tool or library decides the grouping. git mv keeps history and produces clean R100 renames, and ruff or the editor rewrites the import lines; the grouping itself is a person's judgement. Building the move costs about 120k tokens and 6 hours, and keeping it costs nothing.

Key questions

  • Which package layout groups the roadmap modules?: Use intake/, refine/, stage/, implement/ and stores/ under src/devops_cli/roadmap/. The file prefixes already name the jobs, and the store modules (store.py, github_store.py, memory_store.py) form the stores group. (best practice) [sources: src/devops_cli/roadmap/init.py:1, src/devops_cli/roadmap/store.py, src/devops_cli/roadmap/github_store.py, src/devops_cli/roadmap/memory_store.py]
    • Chosen: One subpackage for each job and one for stores. The module prefixes name the jobs, and the three store modules share one role.
    • Rejected: Keep the flat package. It hides the job boundary and keeps 63 files in one folder.
    • Rejected: Group by layer. The issue groups by job, not by layer.
  • Should tests/roadmap/ mirror the new layout?: Yes. tests/roadmap/ mirrors src/devops_cli/roadmap/ at full depth, as the earlier test-tree migration did, but a test file is named after the behaviour it checks, not after one source module. (best practice) [sources: docs/TESTING.md:90, openspec/changes/archive/2026-10-31-1313-tests-mirror-source-tree/proposal.md:9]
    • Chosen: Mirror the source tree. docs/TESTING.md:90 and the archived test-tree change set the mirror as the layout.
    • Rejected: Keep the test tree flat. It breaks the documented layout and hides the job boundary.
    • Rejected: Mirror only job subpackages. The stores are a subpackage too, so a partial mirror is inconsistent.
  • Should a module over 1,000 lines split in this change?: No. Move each module whole, as a rename with no edit to its body, and split only a module that already shows two independent public parts. The earlier test-tree move did the same: R100 renames with no edits to file bodies. (best practice) [sources: openspec/changes/archive/2026-10-31-1313-tests-mirror-source-tree/proposal.md:9]
    • Chosen: Move whole unless two clear parts exist. A mechanical rename keeps the diff and the merge conflict small, as the archived test-tree move did.
    • Rejected: Split every file over 1,000 lines. The issue rejects a split for size alone, and a split would hide the move in the diff.
    • Rejected: Split only the largest file. Size alone is not a clear part boundary.
  • How does the change keep callers stable?: Update each caller's import to the new module path. The package init.py holds only a docstring and exports no name, and every caller imports a submodule (from devops_cli.roadmap import store as roadmap_store), so there is no public name to re-export; the callers are the commands, github, survey and tests modules that the search lists. (best practice) [sources: src/devops_cli/roadmap/init.py:1, src/devops_cli/commands/roadmap.py:45, src/devops_cli/github/issues.py:25, src/devops_cli/survey/intake.py:9, tests/support/roadmap.py:25]
    • Chosen: Update each caller's module path. The package exports no name, so the callers import submodules and only their path changes.
    • Rejected: Re-export the moved modules from init.py. It adds an export layer the package does not have and leaves two import paths for one module.
    • Rejected: Leave the callers unchanged. The old module paths would no longer resolve.
  • Should the move use git mv?: Yes. Move each file with git mv so that git records a rename and git log --follow keeps the history, as the archived test-tree move did. (best practice) [sources: openspec/changes/archive/2026-10-31-1313-tests-mirror-source-tree/proposal.md:35]
    • Chosen: Use git mv. Git records a rename and git log --follow keeps the history.
    • Rejected: Copy and delete. Git sees a new file and a deleted file, so history is harder to follow.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#3011, #3015, #3017, #3019

Activity

  1. added
    type/refactor
    scope/roadmap
    status/new
    value/medium
    effort/high
    on Nov 2, 2026
  2. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

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

    • Type: type/refactor. The refactor prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P3-Low. No behavior change, explicit merge-conflict risk, and no user-facing impact make this low urgency.
    • Value: Medium. Improves navigability of a 63-file flat package but changes no user-visible behavior.
    • Effort: High. Moving 63 files, updating all imports, and coordinating with open PRs takes about 6 hours.
    • Related: refactor(github): the github, roadmap and git tables move out of config/ next to their owners #1026, which asks for a different change. Both refactor the roadmap package, but #1026 moves config constants into the package while the candidate splits the package into subpackages.
  3. added
    priority/p3-low
    status/ready
    and removed
    status/new
    on Nov 2, 2026
  4. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    Contributor

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

  5. devops-cli-service commented on Nov 3, 2026

    @devops-cli-service
    Contributor

    Staged: branch refactor/3187-group-the-job-modules-in-subpackages, draft pull request #3322. The pull request plans the item and closes no issue.

    The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:

    1. Move the store modules into stores/: 16771 tokens
    2. Move the intake modules into intake/: 16782 tokens
    3. Move the refine modules into refine/: 16732 tokens
    4. Move the stage modules into stage/: 16822 tokens
    5. Move the implement modules into implement/: 16724 tokens
    6. Rewrite the imports of the modules that stay at the top level: 15083 tokens
    7. Rewrite the imports of the commands and of the other packages: 21705 tokens
    8. Hold the layout with invariant tests: 20881 tokens
    9. Rewrite the imports of the tests and move the roadmap test modules: 12782 tokens
    10. Document the roadmap package layout: 17853 tokens

    The plan run made 3 model request(s), and used 227315 input tokens and 22968 output tokens. The model made no tool call.

    A model review of the plan found these points. They stop no draft, and a person judges them:

    • other at groups 4 and 5, and specs: The plan moves only five stage modules and two implement modules. Many more top-level modules start with stage or implement, so the planned invariant test fails. The plan also leaves their imports unrewritten. Evidence: "from devops_cli.roadmap.stage_form import form_problems"
  6. added a commit that references this issue on Nov 3, 2026
  7. added
    status/planned
    and removed
    status/ready
    on Nov 3, 2026
  8. added
    owner/agent
    status/in-progress
    and removed
    status/planned
    on Nov 6, 2026
  9. removed
    status/in-progress
    owner/agent
    on Nov 7, 2026
  10. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    Contributor
  11. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-07 06:18 UTC

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/highpriority/p3-lowscope/roadmaptype/refactorvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions