Skip to content

feat(roadmap): list registry and ratchet entries a plan needs #3254

Closed

Description

@dan-petty

Problem

A change that adds a constant, a setting, a metric or a job write must also add entries to registries and ratchet tests. A plan cannot know this without running the suite, so the entries are missed. Evidence from 2026-11-02:

Proposed change

Build a table of "if the plan adds X, these places need an entry" from the code, not by hand: each ratchet and registry test declares what it counts (a constant prefix, an enum, a table name). The context lists, for each kind of addition that the plan's Changes implies, the tests and tables that count it, with path:line. check_proposal refuses a plan that adds such a thing and has no task for the listed place. A check also fails when a path in a docstring or a spec names a test file that does not exist.

Acceptance criteria

  1. A test shows that a plan that adds a DEFAULT_ROADMAP_* constant gets the limit-class ratchet in its context and is refused without a task for it.
  2. A test shows that a plan that adds a job write gets the dry-run, fault-test and contract entries.
  3. A test fails when a test path named in a docstring or a spec does not exist.
  4. The table is derived from the tests (a marker or a named constant), not copied by hand.

Related: #3203, #3204, #3189.

Proposed design

Problem statement

A plan can add a constant, a setting, a metric or a job write. The plan can miss the registry entry and the ratchet test that the suite requires. The stage job must list these places from declarations in the tests. It must refuse a plan that has no task for a listed place. It must also fail when a docstring or a spec names a test file that does not exist.

Acceptance criteria

Requirement: Registry table comes from test declarations

The stage job SHALL build the registry and ratchet table from module-level declarations in the test files, and it MUST NOT use a hand-copied table.

Scenario: A new declaration appears in the table

  • WHEN A test module adds a REGISTRY_COUNTS entry for a counted prefix, enum or table name.
  • THEN The table builder returns that entry with the test path and line, and no hand table changes.

Requirement: Limit-class ratchet is listed and enforced

A plan that adds a DEFAULT_ROADMAP_* constant SHALL get tests/roadmap/test_roadmap_limit_classes.py in its context, and check_proposal MUST refuse the plan when no task names that path.

Scenario: New roadmap limit without a ratchet task

  • WHEN A plan adds DEFAULT_ROADMAP_EXAMPLE_LIMIT and has no task for tests/roadmap/test_roadmap_limit_classes.py.
  • THEN The context names the limit-class test and check_proposal returns a missing-path problem for it.

Requirement: Job-write registries are listed and enforced

A plan that adds a job write SHALL get the dry-run, fault-test, contract-test and request-plan entries in its context, and check_proposal MUST refuse the plan when a task for one entry is missing.

Scenario: New job write without one registry task

  • WHEN A plan adds a write method and has no task for tests/roadmap_faults.py.
  • THEN The context names tests/roadmap/test_roadmap_dry_runs.py, the WRITES table in tests/roadmap_faults.py, tests/roadmap/test_roadmap_store_contract.py and src/devops_cli/roadmap/request_plan.py, and check_proposal returns a problem for the fault-test path.

Requirement: Docstring and spec test paths exist

A check SHALL fail when a test file path in a Python docstring or a spec does not exist in the repository.

Scenario: A spec names a missing test file

  • WHEN A spec contains tests/test_missing_example.py and that file is absent.
  • THEN The check reports tests/test_missing_example.py as a missing path.

Requirement: check_proposal reports missing test paths

check_proposal MUST add each missing test path from a docstring or a spec to its refusal list.

Scenario: A plan changes a docstring with a stale test path

  • WHEN A plan changes a Python file whose docstring names a missing test file.
  • THEN check_proposal returns a problem that names the missing test path.

Existing Tool Considered

No alternatives check has run. No open, maintained tool or library covers a repository-specific table of test declarations. Build in-house: about 20,000 tokens to build, 8,000 tokens each year to keep, 4,000 tokens for each fix, and 2 engineer-days.

Key questions

  • Which open, maintained tool or library covers the registry and ratchet discovery need?: No alternatives check has run. The need is specific to this repository's test declarations, and no open maintained tool covers it. Use an in-repo AST reader. (best practice) [sources: tests/roadmap/test_roadmap_limit_classes.py, tests/roadmap_faults.py:20, tests/telemetry/test_telemetry_instruments.py]
    • Chosen: In-repo AST reader. It reads test declarations without importing pytest and keeps one source of truth.
    • Rejected: Runtime import of test modules. It pulls test dependencies into the stage job and can run test code.
    • Rejected: Hand-kept table. The issue forbids a hand-copied table, and the table goes stale.
  • Where do the declarations that the table reads live?: A module-level constant named REGISTRY_COUNTS in each test module holds a tuple of rules. A rule names the test path, the counted kind, and the prefix, enum or table name. (best practice) [sources: tests/roadmap/test_roadmap_limit_classes.py, tests/roadmap_faults.py:20, tests/telemetry/test_telemetry_instruments.py]
    • Chosen: Module-level REGISTRY_COUNTS constant. The declaration lives beside the test that enforces it and stays in review.
    • Rejected: Marker comments. A comment is easy to break and hard to validate.
    • Rejected: Central YAML file. A central file is a second hand-kept copy.
  • How does the stage job find the declarations without running the tests?: Parse the test modules with ast and read REGISTRY_COUNTS literals. Do not import the test modules. (best practice) [sources: src/devops_cli/roadmap/stage_change.py, tests/roadmap/test_roadmap_limit_classes.py]
    • Chosen: Parse with ast. It reads literals without test imports and without running test code.
    • Rejected: Import test modules. It adds pytest and test-only dependencies to the runtime path.
    • Rejected: Regular-expression scan. It breaks on multiline literals and on comments.
  • How does the stage job know that a plan adds a counted item?: Each rule gives a match token, such as DEFAULT_ROADMAP_, an enum name or a table name. The job scans the plan task text and changed paths for the token. (best practice) [sources: tests/roadmap/test_roadmap_limit_classes.py, tests/roadmap_faults.py:20, docs/TELEMETRY.md:45]
    • Chosen: Token scan of task text and changed paths. It is deterministic and uses the plan text that check_proposal already holds.
    • Rejected: Run the test suite in the stage job. It is slow and needs the full test environment.
    • Rejected: Ask the model to infer additions. It is not deterministic and cannot be a gate.
  • What makes a plan satisfy a listed registry entry?: A task must name the declared path in its text. check_proposal refuses the plan when no task names the path. (best practice) [sources: docs/ROADMAP_WORKFLOW.md:232, src/devops_cli/roadmap/stage_change.py]
    • Chosen: Task text names the declared path. It is simple to check and shows the task that covers the entry.
    • Rejected: Any task in the same group. It lets an unrelated task hide a missing registry entry.
  • Where should the path-existence check run?: A pure function checks Python docstrings and openspec spec files. check_proposal calls it, and a unit test calls it directly. (best practice) [sources: docs/ROADMAP_WORKFLOW.md:232, CONTRIBUTING.md:132, docs/TELEMETRY.md:45]
    • Chosen: Pure function called by check_proposal and by a unit test. It refuses a bad plan at stage time and has an offline test.
    • Rejected: CI-only test. It does not refuse a bad plan at stage time.
    • Rejected: Model review. It is not deterministic.
  • Should the path check scan all documentation for stale test paths?: No. The body limits the check to docstrings and specs. A stale path in docs/TELEMETRY.md stays for a separate documentation fix. (best practice) [sources: docs/TELEMETRY.md:45, CONTRIBUTING.md:132]
    • Chosen: Docstrings and specs only. It matches the acceptance criteria and avoids unrelated documentation edits.
    • Rejected: All Markdown under docs/. It expands the scope and changes generated documentation.
  • Does this change extend the mirror-folder rule to tests added to an existing module?: No. This change does not extend fix(roadmap): the stage job refuses a pytest verify command #3189. The acceptance criteria cover registry entries and test paths only. Keep fix(roadmap): the stage job refuses a pytest verify command #3189 as a related item. (best practice) [sources: tests/invariants/test_change_folders.py]
  • Where should the new table builder and path scanner live?: Put them in a new module src/devops_cli/roadmap/stage_registry.py. check_proposal calls it from src/devops_cli/roadmap/stage_change.py. (best practice) [sources: src/devops_cli/roadmap/stage_change.py, src/devops_cli/roadmap/stage_eval_gates.py]
    • Chosen: New stage_registry.py module. It keeps the table builder and path scanner separate from the stage gate code.
    • Rejected: Add to stage_change.py. It mixes a large new concern into the gate module.
    • Rejected: Add to tests/support. Runtime code cannot import test support.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    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/feature. The feat prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. It prevents a recurring class of missed entries in plans but does not block a release or fix a live defect.
    • Value: Medium. It removes a known source of plan defects across constants, job writes, and instruments.
    • Effort: Medium. It requires deriving a table from test markers, wiring it into check_proposal, and adding three acceptance tests.
    • Related: test(cli): Convert ratchets to bans and merge invariant tests #1336, which asks for a different change. Both items concern ratchet tests in the suite, but #1336 restructures existing ratchets into bans while the candidate adds a plan-time check that references those ratchets.
  3. added
    priority/p2-medium
    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 d428c7f (see proposed design in issue body).

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

    @devops-cli-service
    Contributor

    Staged: branch feat/3254-list-the-registry-and-ratchet-entries, draft pull request #3303. 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. Read the registry declarations of the test modules: 19033 tokens
    2. Declare what each registry test counts: 37339 tokens
    3. List the matching places in the plan context: 32771 tokens
    4. Refuse a plan that misses a listed place: 28770 tokens
    5. Refuse a stale test path in a docstring or a spec: 23004 tokens
    6. Correct the stale test path in the telemetry doc: 21615 tokens

    The plan run made 3 model request(s), and used 232306 input tokens and 16531 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:

    • criterion_dropped at group 2 and criterion 2: Criterion 2 needs the contract entry in the context, but no group adds a REGISTRY_COUNTS declaration for the contract test. The table cannot list it, so the spec scenario fails. Evidence: "tests/roadmap/test_roadmap_store_contract.py"
    • criterion_dropped at criteria, criterion 1 (group 3): Criterion 1 asks for a refusal of a DEFAULT_ROADMAP_* plan without a ratchet task. Group 3 tests only the context, and the group 4 test covers only a write method. Evidence: "gets the limit-class ratchet in its context and is refused without a task for it."
    • other at group 6: The plan edits docs/TELEMETRY.md by hand but says that the file is generated from INSTRUMENTS. Regeneration overwrites the edit. The refined design also leaves this stale path for a separate fix. Evidence: "docs/TELEMETRY.md is generated from INSTRUMENTS in src/devops_cli/telemetry/instruments.py"
  6. added 2 commits that reference this issue on Nov 3, 2026
  7. added
    status/planned
    and removed
    status/ready
    on Nov 3, 2026
  8. changed the title [-]feat(roadmap): list the registry and ratchet entries that a new constant or job write needs[/-] [+]feat(roadmap): list registry and ratchet entries a plan needs[/+] on Nov 6, 2026
  9. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

    The job shortened the title of this item. The summary had 76 characters, and the limit is 60. The type and the scope stay.

  10. added a commit that references this issue on Nov 7, 2026
    d3dc4d1
  11. added
    status/in-review
    and removed
    status/planned
    on Nov 7, 2026
  12. removed
    status/in-review
    on Nov 7, 2026
  13. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-07 15:48 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/mediumpriority/p2-mediumscope/roadmaptype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions