Repository navigation
Description
Problem
#1910 deleted the src symbols that only tests call, but it kept some dead code because a deletion needs a spec decision, a standards change, a test rewrite or the end of other open work. No public behaviour reaches this code:
_read_event_streamand_event_frames(src/devops_cli/ai/client/streaming.py): no provider reads a server-sent event stream with them. The stream contract tests intests/ai/client/test_ai_streaming.pydrive them and the NDJSON reader through one table of about ten tests, with a frame parser that the test file holds._parse_and_validate_scheme(src/devops_cli/core/validation.py): no caller. The specconfigured-service-urlsnames it in the requirement "A URL error text never holds the configured URL".can_transitionand_VALID_TRANSITIONS(src/devops_cli/review/state.py): no caller enforces the table. The specreview-finding-stateholds the requirement "Lifecycle state transitions allow CONFIRMED to OPEN".run_json_subprocess(src/devops_cli/core/process.py): no caller.docs/SDLC.mdanddocs/ROUTINE_TASKS.mdtell new code to use it._run_gh_pr_commandand_resolve_pr_head_sha(src/devops_cli/commands/pr.py): no caller. The deletion ofdevops pr updatechanges this file now.- The cache of
ResourceInformer(src/devops_cli/k8s/informer.py): the informer fills it, and onlyget_stateandget_cached_resourcesread it, which only tests call. ResourceSubscriptionManager.subscribe(src/devops_cli/ai/mcp/dispatcher.py): no caller insrc, sonotifyreaches no listener.AgentRetriesandAgentStepNode(src/devops_cli/ai/agents/context.py) andAgentResponse(src/devops_cli/ai/agents/models.py): left by refactor(ai): replace PydanticAgent with pydantic-ai Agent #4237, no caller insrc.
Evidence
uvx vulture src (vulture 2.16) lists each name as unused, and git grep -w finds no caller in src, docs, the knowledge base, pyproject.toml or the workflows. The design of #1910 records why that change kept each one.
Remedy
For each group, decide and delete:
- Delete the server-sent event reader and its rows of the stream contract table.
- Remove the two spec scenarios with a REMOVED or MODIFIED requirement, and delete the two functions.
- Change the two documents to name
run_subprocesswithextract_json_block, and deleterun_json_subprocess. - Delete the two
commands/pr.pyhelpers after the deletion ofdevops pr updatemerges. - Delete the informer cache, the subscription manager's dead half and the three agent models, with the tests that only read them.
Do not add vulture as a gate.
Source: #1910
Alternatives check of 2026-11-16: not-applicable.
Class: refactor, no search.
Tool: none found.
Proposed design
Problem statement
Delete the dead code that #1910 kept, except two groups that wait on other work: the commands/pr.py helpers wait on the deletion of devops pr update, and the names that #4849 leaves dead wait on #4849. Each waiting group goes to its own new issue. The rest of the deletion, its two spec removals and its two document updates fit in one pull request.
Acceptance criteria
Requirement: Event-stream reader removed
The AI client streaming module SHALL hold no _read_event_stream function and no _event_frames function.
Scenario: The streaming module has no event reader
- WHEN a test imports
devops_cli.ai.client.streamingand looks up_read_event_streamand_event_frames - THEN
hasattrreturnsFalsefor both names
Requirement: Stream table drops the event rows
The stream contract tests MUST hold no row that imports _read_event_stream.
Scenario: No test names the deleted reader
- WHEN a developer runs
git grep -rw _read_event_stream src tests - THEN the command prints no match
Requirement: Validation helper removed
The core validation module SHALL hold no _parse_and_validate_scheme function.
Scenario: The validation module has no scheme parser
- WHEN a test imports
devops_cli.core.validationand looks up_parse_and_validate_scheme - THEN
hasattrreturnsFalse
Requirement: URL error requirement removed
The configured-service-urls spec MUST hold no requirement with the text A URL error text never holds the configured URL.
Scenario: The living spec drops the URL error requirement
- WHEN a developer runs
git grep -rF 'A URL error text never holds the configured URL' openspec/specs - THEN the command prints no match
Requirement: State transition table removed
The review state module SHALL hold no can_transition function and no _VALID_TRANSITIONS table.
Scenario: The state module has no transition check
- WHEN a test imports
devops_cli.review.stateand looks upcan_transitionand_VALID_TRANSITIONS - THEN
hasattrreturnsFalsefor both names
Requirement: Transition requirement removed
The review-finding-state spec MUST hold no requirement that states a lifecycle transition rule.
Scenario: The living spec drops the transition requirement
- WHEN a developer runs
git grep -rF 'transitions allow' openspec/specs - THEN the command prints no match
Requirement: Process helper removed
The core process module SHALL hold no run_json_subprocess function.
Scenario: The process module has no JSON helper
- WHEN a test imports
devops_cli.core.processand looks uprun_json_subprocess - THEN
hasattrreturnsFalse
Requirement: Documents name the live helper
The two SDLC documents MUST name run_subprocess with extract_json_block and no run_json_subprocess.
Scenario: The documents point at the live helper
- WHEN a developer runs
git grep -rw run_json_subprocess docs - THEN the command prints no match, and
git grep -n run_subprocess docs/SDLC.md docs/ROUTINE_TASKS.mdshows the name in both files
Requirement: Informer cache removed
The ResourceInformer class SHALL hold no cache and no get_state or get_cached_resources method.
Scenario: The informer has no cache reader
- WHEN a test imports
devops_cli.k8s.informerand looks upResourceInformer.get_stateandResourceInformer.get_cached_resources - THEN
hasattrreturnsFalsefor both methods
Requirement: Subscription manager dead half removed
The ResourceSubscriptionManager class SHALL hold no subscribe method.
Scenario: The manager has no subscribe method
- WHEN a test imports
devops_cli.ai.mcp.dispatcherand looks upResourceSubscriptionManager.subscribe - THEN
hasattrreturnsFalse
Requirement: Agent models removed
The agent context and model modules SHALL hold no AgentRetries, AgentStepNode or AgentResponse.
Scenario: The agent modules have no unused model
- WHEN a test imports
devops_cli.ai.agents.contextanddevops_cli.ai.agents.modelsand looks up the three names - THEN
hasattrreturnsFalsefor each name
Existing Tool Considered
The alternatives check of 2026-11-16 in the issue body gives the verdict not-applicable: class refactor, no search, Tool: none found (see that block). No open tool or library covers a deletion, and the change builds no code. The detector of the dead names is uvx vulture 2.16, which the issue body cites; the change adds it as no gate and as no dependency.
Key questions
- Which names of the AI client stream reader are dead, and what keeps them alive now?:
_read_event_streamand_event_frameshave no caller insrc. Onlytests/ai/client/test_ai_streaming.pyimports_read_event_stream, and it maps theanthropicprotocol to it, so those rows of the table go with the reader._read_ndjson_streamkeeps its caller and its Ollama rows. [sources: src/devops_cli/ai/client/streaming.py, tests/ai/client/test_ai_streaming.py] - What do the two documents name in place of
run_json_subprocess?:run_subprocesswithextract_json_block. The two documents must name that pair, and the module keepsrun_subprocess. (best practice) [sources: src/devops_cli/core/process.py, docs/SDLC.md, docs/ROUTINE_TASKS.md]- Rejected: keep
run_json_subprocess. No caller, so the helper stays dead and the documents point at dead code. - Chosen: delete it and name
run_subprocesswithextract_json_block. This is the helper thatsrccalls, so the documents teach the live path. - Rejected: delete it and say nothing. The documents would still teach a helper that does not exist.
- Rejected: keep
- Do the two spec requirements stay, change, or go?: Both go. No caller enforces either one, so the text states a behaviour that the code does not have. The change's spec delta removes
A URL error text never holds the configured URLfromconfigured-service-urlsand the transition requirement fromreview-finding-state, and the archive writes the living specs. (best practice) [sources: openspec/specs/configured-service-urls/spec.md, openspec/specs/review-finding-state/spec.md, src/devops_cli/core/validation.py, src/devops_cli/review/state.py]- Rejected: keep the requirements and wire the code. No caller enforces the table, so the wiring is new behaviour and out of this deletion's scope.
- Rejected: keep the requirement text. The text would state a behaviour that no code has.
- Chosen: remove both with a REMOVED requirement in the change delta. The living spec then states only behaviour that the code has.
- Does vulture become a gate?: No. The issue body says not to add it, and ADR 0004 pins the required checks to
Static AnalysisandTests & Coverage. A developer runsuvx vulture srcto find the names, and no workflow runs it. (best practice) [sources: docs/adr/0004-ci-is-the-authoritative-gate.md]- Rejected: add a CI row for vulture. A new gate needs a ruleset change, and ADR 0004 names the two required checks.
- Chosen: run
uvx vultureby hand. This gives the evidence of the dead names with no new gate and no new dependency. - Rejected: use no detector. The issue needs evidence that each name has no caller.
- What happens to the informer cache and the subscription manager?: Delete the cache and its two read methods from
ResourceInformer, and deleteResourceSubscriptionManager.subscribewith the listener collection that only it writes. Keep the informer's watch, its typed models, andnotifyif a caller remains. (best practice) [sources: src/devops_cli/k8s/informer.py, src/devops_cli/ai/mcp/dispatcher.py, tests/k8s/test_k8s_service.py, tests/k8s/test_kubernetes_contract.py]- Rejected: keep both. No caller in
srcreads either one, so they stay dead. - Rejected: delete only the cache.
subscribewrites a listener list that nothing reads. - Chosen: delete both dead halves. Each deleted name loses its last caller, and the live watch path stays.
- Rejected: keep both. No caller in
- What happens to
AgentRetries,AgentStepNodeandAgentResponse?: Delete them.AgentRetriesis atsrc/devops_cli/ai/agents/context.py:28,AgentStepNodeat:89, andAgentResponseatsrc/devops_cli/ai/agents/models.py:16. Each name appears only in its own module. [sources: src/devops_cli/ai/agents/context.py:28, src/devops_cli/ai/agents/context.py:89, src/devops_cli/ai/agents/models.py:16] - Does the reply's added scope belong in this change?: No. The five names still have callers in
srcuntil refactor: delete the src symbols that only tests call #4849 merges, so a deletion now breaks the build. The part goes to a new issue that waits on refactor: delete the src symbols that only tests call #4849. (best practice) [sources: src/devops_cli/ai/review/pipeline.py:700, src/devops_cli/security/vault_lease.py:41, src/devops_cli/ai/rag/embeddings.py:1342, tests/ai/agents/test_ai_agent_capabilities.py:73]- Rejected: include the names now. The callers still exist, so the deletion breaks the build.
- Chosen: defer them until refactor: delete the src symbols that only tests call #4849 merges. The names are dead after refactor: delete the src symbols that only tests call #4849, and this change stays buildable.
- Rejected: drop them. They are dead after refactor: delete the src symbols that only tests call #4849 and stay as a defect.
- Do the two
commands/pr.pyhelpers belong in this change?: No. The issue body orders their deletion after the deletion ofdevops pr update, which changes the same file. The part goes to a new issue that waits on that deletion. (best practice) [sources: src/devops_cli/commands/pr.py]- Rejected: delete them now. The callers in
devops pr updatestill exist until that command goes. - Chosen: defer them to a new issue. This change then holds no file that the
devops pr updatedeletion also changes.
- Rejected: delete them now. The callers in
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 12, 2026
Dead code removal with no user-facing behaviour change and no active defect.Both delete dead code identified around #1910, but the candidate removes items #1910 explicitly kept while #2175 removes items #1910 did not list.refactor: delete the src symbols that only tests call
dan-petty commentedon Nov 12, 2026
Add these to the scope (found by the independent review of #4849): names that only code deleted in #4849 used, so they are dead after it merges.
src/devops_cli/ai/review/pipeline.py:700_VERSION_RANGE_MARKERSand:702_VERSION_WILDCARD(only the deleted_is_exact_versionused them)src/devops_cli/security/vault_lease.py:41_VAULT_AUTH_LOGIN_PATH(only the deletedtrack_authused it)src/devops_cli/ai/rag/embeddings.py:1342EmbeddingCostand:1350EmbeddingResult(about 100 lines; now used only bytests/ai/agents/test_ai_agent_capabilities.py:73-100). Vulture misses these becausefrom pydantic_ai.embeddings import EmbeddingResult as PydanticEmbeddingResultcounts as a use of the name.refactor: delete the src symbols that only tests call (#4849)
devops-cli-service commentedon Nov 16, 2026
Alternatives check: not-applicable
Class: refactor. The check makes no search and no model call for an item of this class.
Tool: none found
Checked on 2026-11-16. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 20, 2026
Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.
devops-cli-service commentedon Nov 28, 2026
Released in v0.241.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.241.0
devops-cli-service commentedon Nov 29, 2026
Live since 2026-11-29 00:41 UTC