Skip to content

feat(roadmap): Check test references to entities a plan removes #3324

Closed

Description

@dan-petty

Problem or Motivation

When a plan removes or deprecates an exposed entity (such as an MCP tool, a CLI command, a parameter, or a configuration constant), existing tests and contract checks often reference that entity directly.

In plan #3230 (pull request #3283), the planner removed valkey_set from CONST_MCP_EXPOSURE_TABLE and _PATH_PARAM_RESTRICTIONS. The planner did not check downstream test references to valkey_set. It omitted four contract tests in tests/ai/mcp/test_fastmcp_contracts.py and two tests in tests/ai/mcp/test_mcp.py (test_export_schemas_command and mcp_command_exclusions). When implemented, these omitted tests fail immediately.

Proposed Solution & Architectural Design

Add a probe during plan staging (devops roadmap stage) that detects deletions from registries, exposure tables, or command sets:

  • When a plan proposes removing a public entity, search tests/ and source files for references to the symbol.
  • Require the proposal, design, and task list to account for each reference (by migrating tests, updating coverage exclusions, or deleting obsolete assertions).
  • Emit a validation failure if unhandled downstream references exist in tests.

Target Subsystem

SDLC, Git & PR Governance

Existing Tool Considered

git grep and pytest find broken references only after code changes are implemented. The planning stage currently lacks a reference scan for deleted entities. Cost to build: about 15k tokens and 1 hour.

Source: #3283

Proposed design

Problem statement

A plan that removes a public entity can leave tests that name that entity. The stage job does not check those references now. The stage job must find each reference and make the plan account for it. The reported case is plan #3230.

Acceptance criteria

Requirement: removal-reference scan

The stage job SHALL scan tests/ and src/ for each name that the change folder declares as removed, before the draft pull request opens.

Scenario: a test file references a removed name

  • WHEN a temporary repository holds a change folder that names valkey_set as removed and tests/example_test.py references it
  • THEN the scan reports tests/example_test.py as an unhandled reference to valkey_set.

Requirement: removed names come from a removal verb

The scan SHALL take each backticked identifier that a removal verb governs in proposal.md or design.md as a removed name.

Scenario: a removal sentence names two identifiers

  • WHEN a fixture proposal.md holds the sentence removes valkey_setfromCONST_MCP_EXPOSURE_TABLE``
  • THEN the scan searches for valkey_set and does not search for CONST_MCP_EXPOSURE_TABLE.

Requirement: a task that names the file accounts for the reference

The scan SHALL treat a reference as accounted for only when the change's tasks.md names the file that holds it.

Scenario: tasks.md names the test file

  • WHEN a fixture tasks.md names tests/example_test.py and that file references the removed name
  • THEN the scan reports no unhandled reference for tests/example_test.py.

Requirement: stage fails on an unhandled test reference

devops roadmap stage MUST exit non-zero with each unhandled test reference and MUST open no draft pull request.

Scenario: an unhandled test reference stops the stage

  • WHEN the scan finds an unhandled reference in tests/
  • THEN the command exits non-zero, the message names the file and the removed name, and the stage opens no draft pull request.

Requirement: a source reference is a warning

The scan SHALL report an unhandled reference in src/ as a warning and SHALL NOT fail the stage for it.

Scenario: only a source file references the removed name

  • WHEN a fixture src/example.py references the removed name and tasks.md does not name it
  • THEN the stage succeeds and its comment names src/example.py as a warning.

Requirement: a change with no removal passes

A change folder that names no removed entity SHALL pass the scan with no finding.

Scenario: a plan removes nothing

  • WHEN no sentence in proposal.md or design.md has a removal verb and a backticked identifier
  • THEN the scan reports no finding and the stage proceeds.

Existing Tool Considered

No alternatives check has run. The closest open, maintained tools are git grep (Git, GPL-2.0) and vulture (MIT). git grep finds each reference to a name. vulture finds dead code. Neither reads an OpenSpec change folder. Neither knows which names a plan removes. Neither fails devops roadmap stage. The written cost to build, keep and fix the probe is about 15,000 tokens and 1 hour.

Key questions

  • Which files reference valkey_set at the staging commit?: tests/ai/mcp/test_fastmcp_contracts.py, tests/ai/mcp/test_mcp.py, src/devops_cli/config/constants.py and the generated docs/MCP_TOOLS.md reference valkey_set. CONST_MCP_EXPOSURE_TABLE still exposes it. [sources: tests/ai/mcp/test_fastmcp_contracts.py, tests/ai/mcp/test_mcp.py, src/devops_cli/config/constants.py, docs/MCP_TOOLS.md]
  • Should the stage job check removed-entity references with a deterministic scan or with an instruction to the planner model?: A deterministic scan in the stage job. The stage job runs the scan on the written change folder and fails on an unhandled test reference. (best practice) [sources: docs/adr/0005-review-findings-come-from-tools-not-models.md, CONTEXT.md]
    • Chosen: deterministic scan in the stage job. ADR 0005 keeps a model to explanation and planning. A check must give the same result on equal input.
    • Rejected: planner-prompt instruction. A model forgets a name. Its result differs between runs, so a missed reference passes.
    • Rejected: CI check after implementation. It fails after the code exists. The fix then costs a new change, and the item asks for the check at staging.
  • Which names does the probe treat as removed?: Each backticked identifier that a removal verb governs in proposal.md or design.md. (best practice) [sources: openspec/changes/3230-decide-the-free-text-mcp-parameters/proposal.md, openspec/changes/3230-decide-the-free-text-mcp-parameters/design.md]
    • Chosen: a removal verb plus a backticked identifier. Current plans already state a removal in this form. The probe reads text that exists.
    • Rejected: a new machine-readable ## Removals section. It is a new convention that a planner can omit. No current plan has it.
    • Rejected: the REMOVED Requirements of the spec delta. An exposure-table row is no spec requirement. The feat(security): decide the free-text MCP parameters that can carry a secret #3230 change would list nothing.
  • What makes a reference accounted for?: The change's tasks.md names the file that holds the reference. (best practice) [sources: openspec/changes/3230-decide-the-free-text-mcp-parameters/tasks.md, openspec/changes/3230-decide-the-free-text-mcp-parameters/design.md]
    • Chosen: tasks.md names the file. The task list is the work the implement job runs. A file it does not name is a file the plan forgot.
    • Rejected: any change file names the removed name. proposal.md always names the removed name, so no reference would ever be unhandled.
    • Rejected: a per-reference exclusion list in the change. It is a second list to keep in step with tasks.md.
  • Does an unhandled reference in src/ fail the stage?: No. An unhandled reference in tests/ fails the stage. An unhandled reference in src/ is a warning in the stage comment. (best practice) [sources: src/devops_cli/config/constants.py, src/devops_cli/ai/mcp/generator.py]
    • Chosen: fail on tests, warn on source. The registry row and the generator are source references. A failure there would stop each correct removal.
    • Rejected: fail on both. A correct removal always leaves a source reference that the plan must edit.
    • Rejected: warn on both. The item asks for a failure, because a failing test is the cost that it removes.
  • Where does the stage job run the scan?: In the stage job, after the planner writes the change folder and before the draft pull request opens. (best practice) [sources: CONTEXT.md]
    • Chosen: in the stage job, before the draft pull request opens. Staging writes the change folder and the draft pull request. The plan can still change.
    • Rejected: in the implement job, before the first step. The plan has merged by then. A failure costs a second change.
    • Rejected: in devops roadmap refine. The change folder does not exist yet at refinement.
  • Does the scan run on every stage?: Yes. A change folder that names no removal passes at once, and the check has one path. (best practice) [sources: CONTEXT.md]
    • Chosen: run on every stage. The gate that decides whether to run is the same parse. A condition saves no work and adds a path.
    • Rejected: run only when the change names a removal. It adds a branch to test. The parse must run to find the removal anyway.
  • How does the probe test a removal when the item's own change folder removes nothing?: Use a fixture change folder and fixture files in a temporary repository. Do not require the item's change folder to name a removal. (best practice) [sources: src/devops_cli/config/constants.py, tests/ai/mcp/test_mcp.py]
    • Chosen: a fixture change folder. CONST_MCP_EXPOSURE_TABLE still exposes valkey_set at the staging commit. A fixture makes the test independent of the current table.
    • Rejected: the feat(security): decide the free-text MCP parameters that can carry a secret #3230 change folder. The stage job returned the item because that premise does not hold at the staging commit.
    • Rejected: the item's own change folder. The item adds a probe and removes no entity. It cannot declare a removal.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Alternatives check of 2026-11-06: partly.
Tool: git/git (https://github.com/git/git), NOASSERTION, last activity 2026-11-06, maintained.

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 3, 2026
  2. dan-petty commented on Nov 3, 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/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 known class of test failures at planning time but does not block a release or fix a live defect.
    • Value: Medium. It catches a recurring class of omissions in plans that remove exposed entities.
    • Effort: Low. The body estimates about 15k tokens and 1 hour of work.
    • Related: feat(roadmap): name every caller of a changed function #3307, which asks for a different change. Both add a validation probe during plan staging that checks references, but #3307 checks callers of a changed signature while the candidate checks test references of a removed entity.
  3. added
    priority/p2-medium
    on Nov 3, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 3, 2026
  5. devops-cli-service commented on Nov 3, 2026

    @devops-cli-service
    Contributor

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

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

    @devops-cli-service
    Contributor

    The stage job returned the item to New. The premise of the issue does not hold at the staging commit, so the job planned no change and opened no pull request.

    Evidence:

    placeholder

  7. added
    status/new
    status/ready
    and removed
    status/ready
    status/new
    on Nov 3, 2026
  8. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor

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

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

    @devops-cli-service
    Contributor

    Alternatives check: partly

    Tool: git/git (https://github.com/git/git)

    • License: NOASSERTION
    • Last activity: 2026-11-06
    • Maintained: yes

    Covers:

    • Finds every textual reference to a given name across tests/ and src/ deterministically, which is the reference scan the stage probe needs
    • Reports the matching file and line, so an unhandled test reference can be named in the stage failure message
    • Exits non-zero when a name still occurs, so a stage job can turn a match into a failed stage

    Lacks:

    • Does not read an OpenSpec change folder, so it cannot derive the removed names from a removal verb plus a backticked identifier in proposal.md or design.md
    • Does not know which names a plan removes, so it cannot tell a removed entity's references from any other match
    • Does not treat a reference as accounted for when the change's tasks.md names the file
    • Does not fail devops roadmap stage, block the draft pull request, or separate a tests/ failure from a src/ warning
    • Runs only after code changes exist; it is invoked by hand or by another job, not at plan staging

    Searches run:

    • tool to find all references to a removed function or constant across tests and source code
    • vulture python find dead code unused symbols maintained
    • python dead code detector vulture alternative
    • vulture dead code python
    • git grep search references symbol repository
    • vulture
    • code search tool references removed symbol tests
    • find unused code python
    • ast-grep structural search replace
    • ripgrep search codebase

    Sources:

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

  10. changed the title [-]feat(roadmap): the stage probe checks downstream test references of an entity a plan removes[/-] [+]feat(roadmap): Check test references to entities a plan removes[/+] on Nov 6, 2026
  11. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

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

    • Before: feat(roadmap): the stage probe checks downstream test references of an entity a plan removes
    • After: feat(roadmap): Check test references to entities a plan removes
    • Source of the summary: the background model
  12. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 9, 2026
  13. removed
    status/in-review
    on Nov 9, 2026
  14. devops-cli-service commented on Nov 9, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-09 01:02 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/lowpriority/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