Repository navigation
Description
Problem
The vulture trial of #1871 found 19 functions and methods in src that appear only at their definition in src and tests. Each may be dead code. Each needs a manual check before anyone deletes it.
Evidence
The list, with the line of each definition on the tip at the time (docs/agent/tasks/task-1871-tombstone-tests-and-dead-code-tool.md holds the same list):
run_stream_asyncatsrc/devops_cli/ai/agents/agent.py:1244validate_slotatsrc/devops_cli/ai/harness/slots.py:82_is_mutating_toolatsrc/devops_cli/ai/harness/slots.py:226validate_invariantsatsrc/devops_cli/ai/harness/slots.py:748active_resourcesatsrc/devops_cli/ai/mcp/dispatcher.py:156record_rejectionatsrc/devops_cli/ai/review/profile.py:203_unique_preserve_orderatsrc/devops_cli/ai/review/sanitization.py:13_tokenize_titleatsrc/devops_cli/ai/review_schema.py:148less_severeatsrc/devops_cli/ai/review_schema.py:624remove_custom_pricingatsrc/devops_cli/ai/spend/pricing.py:552should_ignore_diratsrc/devops_cli/argo/gitops.py:68_extract_policy_include_emailatsrc/devops_cli/cloudflare/client.py:219_run_gh_pr_commandatsrc/devops_cli/commands/pr.py:98_resolve_pr_head_shaatsrc/devops_cli/commands/pr.py:320_render_logs_jsonatsrc/devops_cli/commands/sandbox.py:943_extract_roadmap_versionsatsrc/devops_cli/docs/compactor.py:222get_last_request_epochatsrc/devops_cli/github/rate_limiter.py:903_is_numberedatsrc/devops_cli/review/diff.py:68is_p1atsrc/devops_cli/roadmap/reprioritize.py:499
#1952 deleted src/devops_cli/docs/compactor.py and src/devops_cli/roadmap/reprioritize.py. So _extract_roadmap_versions and is_p1 are gone, and 17 names remain.
Two other findings, get_native_tools and get_description in src/devops_cli/ai/agents/capabilities.py, are live Pydantic AI hooks. Five more names share a word with another object and need the same check: argo_app_status, set_mcp_sampling_model, to_cli, traces and merge. Some of these functions belong to code that other open items delete (for example the rate limiter and the harness).
Remedy
For each name, search src, tests, the docs, the knowledge base and the entry points for a caller (a string, a registry or a framework hook counts). Delete the functions with no caller, with the tests that only call them. Skip a name that another open item deletes. Do not add vulture as a gate: the trial needed 12 decorator patterns and 7 name patterns first.
Alternatives check of 2026-11-01: not-applicable.
Tool: none found.
Proposed design
Problem statement
The vulture trial found 19 dead-code candidates in src. #1952 removed 2 of them, so 17 names remain. A later CI audit measured 129 src symbols that only tests use, and at least 26 of those tests are false positives. This change checks each symbol for a production caller and deletes each confirmed dead symbol with its tests. It leaves out test helpers, unwired code, invariant and gate helpers, and code that another open item deletes. It does not add vulture as a gate.
Acceptance criteria
Requirement: Deletion evidence
The pull request MUST state, for each deleted symbol, that no production caller exists in src, an entry point or a framework hook.
Scenario: A deleted symbol records its evidence
- WHEN The pull request deletes a symbol.
- THEN The pull request body lists the symbol and states that its only references are tests.
Requirement: Dead symbol removal
A symbol with no production caller SHALL be deleted from src.
Scenario: No production caller
- WHEN A search of src, docs, the knowledge base and the entry points finds no caller of the symbol.
- THEN The symbol no longer appears in src.
Requirement: Test removal
A test that only calls a deleted symbol SHALL be deleted with it.
Scenario: The test of a deleted symbol
- WHEN A test module only calls a symbol that the change deletes.
- THEN The test module or the test case no longer appears in tests.
Requirement: False positives stay
The change MUST NOT delete wait_active, build_allowlist, or an invariant or gate helper.
Scenario: A false positive stays in the tree
- WHEN The pull request diff is inspected.
- THEN wait_active and build_allowlist still appear in the tree.
Requirement: Code other items delete stays
The change MUST leave src/devops_cli/github/rate_limiter.py and src/devops_cli/ai/harness/slots.py unchanged.
Scenario: Rate limiter and harness untouched
- WHEN The pull request diff is inspected.
- THEN Neither file has a change.
Requirement: No vulture gate
The change MUST NOT add vulture as a CI gate or a required check.
Scenario: No vulture step
- WHEN The pull request diff is inspected.
- THEN No vulture step appears in .github/workflows/ or .github/roadmap.toml.
Requirement: Suite and mypy pass
The full test suite and mypy MUST pass after the deletions.
Scenario: Required checks pass
- WHEN The Tests & Coverage and Static Analysis checks run on the pull request.
- THEN Both checks pass.
Existing Tool Considered
The alternatives check returned not-applicable because this item is a refactor, which is a skip class. vulture (https://github.com/jendrikseipp/vulture) is the open, maintained dead-code finder that produced the candidate list. It lacks dynamic-use detection: it cannot see a framework hook, a registry entry or a string caller. Its trial needed 12 decorator patterns and 7 name patterns before its list was usable. The change uses vulture only to list candidates and does not add it as a gate.
Key questions
- Which tool finds the dead-code candidates, and does the change adopt it as a gate?: vulture finds the candidates. The alternatives check returned not-applicable because the item is a refactor. vulture lacks dynamic-use detection and needed 12 decorator patterns and 7 name patterns before its list was usable. The change does not add vulture as a gate. (best practice) [sources: docs/TESTING.md]
- Rejected: Add vulture as a CI gate. The trial needed 12 decorator patterns and 7 name patterns, and vulture misses dynamic use.
- Chosen: Use vulture to list candidates and check each caller by hand. The body and the CI audit say not to add a gate, and each deletion needs evidence.
- Rejected: Build a custom dead-code finder. It adds code to keep and fix, and vulture already finds the candidates.
- What is the scope of the caller check after the CI audit?: The scope is the 129 src symbols that only tests use. The check leaves out the false positives: wait_active, build_allowlist of feat(roadmap): allow-list builder for planner read-only commands #4004, and the architecture invariant helpers. It also leaves out the invariant and gate helpers and the code that is not yet wired. The 5 names that share a word with another object get the same check. (best practice) [sources: docs/TESTING.md]
- Rejected: Keep the 17 named functions only. The CI audit measured 129 symbols and set the new scope.
- Chosen: Use the 129-symbol audit list, minus false positives and exclusions. It is the latest measured list, and it keeps the named 17.
- Rejected: Delete every vulture finding with no read. At least 26 findings are false positives.
- How does a checker decide that a symbol is dead?: Search src, docs, the knowledge base and the entry points for the name. A string, a registry entry or a framework hook counts as a caller. A reference in a test does not count. Delete the symbol when no production caller exists. (best practice) [sources: docs/TESTING.md]
- Rejected: Search src and tests only. A string, a registry entry or a framework hook in docs or an entry point is a caller.
- Chosen: Search src, docs, the knowledge base and the entry points. The body and the CI audit name these sources.
- Rejected: Trust vulture with no manual read. vulture does not see dynamic use.
- What happens to the tests of a deleted symbol?: Delete the tests with the symbol. docs/TESTING.md says to delete dead code. The full suite and mypy must pass after the deletion. (best practice) [sources: docs/TESTING.md]
- Rejected: Keep the tests. A test of a deleted symbol cannot pass.
- Chosen: Delete the tests with the symbol. docs/TESTING.md says to delete dead code, and the suite must pass.
- Are the symbols in the rate limiter and the harness in scope?: No. Another open item deletes the rate limiter and the harness. This change leaves src/devops_cli/github/rate_limiter.py and src/devops_cli/ai/harness/slots.py unchanged. (best practice) [sources: src/devops_cli/github/rate_limiter.py, src/devops_cli/ai/harness/slots.py]
- Rejected: Delete them in this change. Another open item deletes these files, so a change here conflicts.
- Chosen: Skip them and leave the files unchanged. The body says to skip a name that another open item deletes.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Sub-issues
Collapse Sub-issuesSub-issues
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNew
- StatusShow more project fieldsNew
Activity
dan-petty commentedon Oct 22, 2026
Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.
The candidate proposes to delete dead code, which is a refactor.This is a hygiene task that improves code quality but does not block other work or fix an urgent issue.Removing unused code improves maintainability and reduces confusion for developers, but it's not critical to users.Each function requires a manual check for callers, but the work is straightforward once identified.dan-petty commentedon Oct 28, 2026
Refine cannot set this item to Ready at bb46660 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.
docs(openspec): plan #2175 delete five dead definitions from src (#2983)
refactor(cli): delete five unused definitions from src (#3086)
devops-cli-service commentedon Nov 1, 2026
Alternatives check: not-applicable
Tool: none found
Checked on 2026-11-01. A person decides what this means for the item. The check changes no label and closes no issue.
5 remaining items
devops-cli-service commentedon Nov 11, 2026
Status set to Ready at 5c71ad4 (see proposed design in issue body).
devops-cli-service commentedon Nov 11, 2026
Staged: branch
refactor/1910-delete-unused-functions-after-manual-caller, draft pull request #4849. 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 64000 tokens:
A model review of the plan found these open findings. The stage keeps this pull request a draft with the label
plan/needs-fixuntil a later round clears them:criterion_droppedat summary, what_changes and rejected: The issue's CI audit and proposed design make the scope the 129 src symbols that only tests use, minus false positives; the plan deletes only the 15 symbols of the original 19+5 list, so the other dead symbols have no task. The plan's rejected alternative 'Delete every symbol that vulture or the 129-symbol audit lists' is not the issue's chosen option, which keeps the 129 list minus the false positives and exclusions. Evidence: "The scope is the 129 src symbols that only tests use."criterion_droppedat groups (every verify line): The issue requires the full test suite and mypy to pass after the deletions, but no group runs them; every group's verify is a singlegit grep, so the plan has no task for the criterion and only asserts in its feasibility that CI runs the checks. Evidence: "The full test suite and mypy MUST pass after the deletions."A model review of the plan found these points. They stop no draft, and a person judges them:
otherat group 13: The group deletes the wholetest_set_price_for_a_model_of_the_setting_wins_and_remove_restores_the_setting, but the test also asserts that the liveset_custom_pricingbeats the setting; the plan's own decision says to remove only the assertions of the deleted symbol when a test also covers other code, so this drops live coverage. Evidence: "assert (by_hand, removed, restored) == (9.0, True, 0.035)"otherat group 3: After the group deletes_tokenize_title, the module-level_TITLE_FILLER_WORDShas no caller, but the group deletes only 'the imports that only it used'; the constant and theCONST_REVIEW_TITLE_FILLER_WORDSimport remain, so the group leaves dead code. Evidence: "_TITLE_FILLER_WORDS = CONST_REVIEW_TITLE_FILLER_WORDS"The runs of the planner and the review made 45 model request(s), and used 2902326 input tokens and 128401 output tokens. The tool calls, in order:
read_issue({"number":1952})read_issue({"number":1871})read_issue({"number":4004})list_files({"directory":"src/devops_cli/ai/harness"})list_files({"directory":"src/devops_cli/github"})search_code({"text":"_is_numbered"})search_code({"text":"validate_slot"})search_code({"text":"_is_mutating_tool"})search_code({"text":"validate_invariants"})search_code({"text":"active_resources"})search_code({"text":"record_rejection"})search_code({"text":"_unique_preserve_order"})search_code({"text":"_tokenize_title"})search_code({"text":"less_severe"})search_code({"text":"remove_custom_pricing"})search_code({"text":"should_ignore_dir"})search_code({"text":"_extract_policy_include_email"})search_code({"text":"_run_gh_pr_command"})search_code({"text":"_resolve_pr_head_sha"})search_code({"text":"_render_logs_json"})search_code({"text":"get_last_request_epoch"})search_code({"text":"argo_app_status"})search_code({"text":"def traces"})search_code({"text":"def merge("})search_code({"text":"set_mcp_sampling_model"})search_code({"text":"to_cli"})file_symbols({"path":"src/devops_cli/commands/ci.py"})read_file({"path":"src/devops_cli/ai/tools/builtin_tools.py","start_line":240,"end_line":275})read_issue({"number":2175})find_issues({"terms":"rate_limiter"})find_issues({"terms":"harness slots"})read_file({"path":"src/devops_cli/commands/ci.py","start_line":1866,"end_line":1920})search_code({"text":".merge("})search_code({"text":"traces("})search_code({"text":"argo_apps"})read_file({"path":"src/devops_cli/commands/sandbox.py","start_line":805,"end_line":875})read_file({"path":"src/devops_cli/sandbox/engine.py","start_line":600,"end_line":640})read_file({"path":"tests/ai/spend/test_pricing_registry_overrides.py","start_line":120,"end_line":170})read_file({"path":"tests/cloudflare/test_client.py","start_line":830,"end_line":860})read_file({"path":"tests/security/test_builtin_tools.py","start_line":215,"end_line":240})search_code({"text":"def traces"})search_code({"text":"def merge("})search_code({"text":"def traces("})search_code({"text":"merge"})search_code({"text":"_is_numbered"})read_file({"path":"src/devops_cli/ai/review_schema.py","start_line":1130,"end_line":1175})search_code({"text":"traces"})references({"name":"merge"})search_code({"text":"merged_findings"})search_code({"text":"merge another"})read_file({"path":"src/devops_cli/sandbox/engine.py","start_line":600,"end_line":660})search_code({"text":"resolve_trace_spans"})search_code({"text":".traces("})list_files({"directory":"src/devops_cli/docs"})list_files({"directory":"src/devops_cli/roadmap"})list_files({"directory":"src/devops_cli/review"})search_code({"text":"_record_rejection"})search_code({"text":"_unique_preserve_order"})search_code({"text":"active_resources"})search_code({"text":"record_rejection"})search_code({"text":"_tokenize_title"})search_code({"text":"less_severe"})search_code({"text":"_is_numbered"})search_code({"text":".merge("})search_code({"text":"merged_findings"})search_code({"text":"remove_custom_pricing"})search_code({"text":"should_ignore_dir"})search_code({"text":"_extract_policy_include_email"})search_code({"text":"_run_gh_pr_command"})search_code({"text":"_resolve_pr_head_sha"})search_code({"text":"_render_logs_json"})search_code({"text":"argo_app_status"})search_code({"text":"def traces("})search_code({"text":"resolve_trace_spans"})search_code({"text":"def merge("})read_file({"path":"tests/security/test_builtin_tools.py","start_line":180,"end_line":270})read_file({"path":"src/devops_cli/commands/argo.py","start_line":320,"end_line":360})search_code({"text":".traces"})search_code({"text":"target_trace_id"})read_file({"path":"src/devops_cli/commands/sandbox.py","start_line":815,"end_line":900})list_files({"directory":"src/devops_cli/ai/agents"})list_files({"directory":"src/devops_cli/docs"})list_files({"directory":"src/devops_cli/roadmap"})search_code({"text":"set_mcp_sampling_model"})search_code({"text":"to_cli"})read_file({"path":"src/devops_cli/commands/sandbox.py","start_line":930,"end_line":1010})read_file({"path":"src/devops_cli/ai/review/profile.py","start_line":200,"end_line":260})search_code({"text":"traces("})search_code({"text":"engine.traces"})search_code({"text":"from devops_cli.ai.tools.builtin_tools import"})search_code({"text":"argo_apps"})read_spec({})read_file({"path":"src/devops_cli/commands/sandbox.py","start_line":1010,"end_line":1075})read_spec({"capability":"sandbox-logs"})search_code({"text":"validate_slot"})search_code({"text":"_is_mutating_tool"})search_code({"text":"validate_invariants"})search_code({"text":"get_last_request_epoch"})list_files({})search_code({"text":"knowledge base"})read_file({"path":"tests/cloudflare/test_client.py","start_line":820,"end_line":870})read_file({"path":"tests/ai/spend/test_pricing_registry_overrides.py","start_line":135,"end_line":175})read_file({"path":"src/devops_cli/cloudflare/client.py","start_line":190,"end_line":270})read_file({"path":"docs/agent/tasks/task-1871-tombstone-tests-and-dead-code-tool.md","start_line":1,"end_line":5})list_files({"directory":"docs/agent/tasks"})search_code({"text":"dead code"})read_file({"path":"src/devops_cli/ai/review_schema.py","start_line":1120,"end_line":1165})search_code({"text":"merged_conf"})search_code({"text":"set_custom_pricing"})read_issue({"number":1910})read_issue({"number":4405})find_issues({"terms":"rate_limiter"})find_issues({"terms":"harness slots"})search_code({"text":"_TITLE_FILLER_WORDS"})read_file({"path":"src/devops_cli/ai/review_schema.py","start_line":140,"end_line":160})read_file({"path":"src/devops_cli/ai/review_schema.py","start_line":615,"end_line":645})search_code({"text":"severity_named"})search_code({"text":"derive_recommendation"})search_code({"text":"sort_findings"})Tool calls: file_symbols=1 (empty=0), find_issues=4 (empty=2), list_files=10 (empty=0), read_file=22 (empty=0), read_issue=6 (empty=0), read_spec=2 (empty=0), references=1 (empty=0), search_code=73 (empty=2)
The stage job read the open pull requests and their files in 1 GraphQL request(s).
docs(openspec): plan #1910 Delete fifteen symbols that have no caller
refactor: delete the src symbols that only tests call
devops-cli-service commentedon Nov 12, 2026
Released in v0.123.1: https://github.com/dan-petty/devops-cli/releases/tag/v0.123.1
devops-cli-service commentedon Nov 12, 2026
Live since 2026-11-12 21:56 UTC
refactor: delete dead code kept by #1910 (#7653)
chore(main): release 0.241.0 (#7656)