Skip to content

refactor: delete the src symbols that only tests call - #4849

Merged
dan-petty merged 4 commits into
mainfrom
refactor/1910-delete-unused-functions-after-manual-caller
Nov 12, 2026
Merged

dan-petty merged 4 commits into
mainfrom
refactor/1910-delete-unused-functions-after-manual-caller

Conversation

@devops-cli-service

@devops-cli-service devops-cli-service Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Delete the src symbols that only tests call. The CI audit counted 129 with vulture 2.16. Each one, and each name of the #1910 list, was read by hand: a symbol goes when no module of src, no entry point, no framework hook, no document and no string calls it, with the tests whose subject it is (docs/TESTING.md: dead code is deleted).

The change deletes 75 audit symbols, 13 listed names, the modules ai/agents/capabilities.py, k8s/chaos_runner.py and output/table_builder.py, and the helpers, constants and defaults that only they used. Tests of live code move from a deleted wrapper to the live function.

It keeps framework hooks, gate helpers, test seams, unwired new code, files of other open items and names that a spec or standard holds; the OpenSpec design gives each reason, and #5148 takes the rest. No vulture gate is added.

Closes #1910

Change: openspec/changes/archive/2026-11-12-1910-delete-unused-functions-after-manual-caller/

@devops-cli-service devops-cli-service Bot added type/docs Type docs: a change to the documents scope/openspec OpenSpec changes, specs and their checks verdict/fix-plan Verdict Needs fix of a plan: an open finding keeps the plan in draft until a fix labels Nov 11, 2026
@devops-cli-service

Copy link
Copy Markdown
Contributor Author

The stage_ready row leaves pull request #4849 a draft. It holds the label plan/needs-fix, because the model review of its plan found an open finding. Fix the plan, or remove the label when the finding is no defect.

devops-cli-service Bot and others added 2 commits November 12, 2026 17:11
Read each of the 129 symbols that vulture 2.16 lists as called only by
tests, and each name of the #1910 list. Delete a symbol when no module
of src, no entry point, no framework hook, no document and no string
calls it, with the tests whose subject is that symbol. Delete the three
modules that no module of src imports, and the helpers, constants,
defaults and tool message that only a deleted symbol used.

Keep framework hooks, invariant and gate helpers, test seams, unwired
new code, files that other open items change, and names that a spec or
a standards document holds. The design of the OpenSpec change gives
the reason of each kept symbol. #5148 deletes the rest.
@dan-petty
dan-petty force-pushed the refactor/1910-delete-unused-functions-after-manual-caller branch from b9053fa to 76e896d Compare November 12, 2026 17:11
@dan-petty dan-petty changed the title docs(openspec): plan #1910 Delete fifteen symbols that have no caller refactor: delete the src symbols that only tests call Nov 12, 2026
@dan-petty

Copy link
Copy Markdown
Owner

Measurements

Test cases in the 54 changed test files, from pytest --collect-only on origin/main and on this branch:

Before After
Test cases 1361 1270
Deleted test cases 103
Renamed test cases (moved to the live function) 12

Time of the deleted test cases, pytest -n 0 -p no:randomly --durations=0, sum of the setup, call and teardown phases:

Run Deleted cases on origin/main Renamed cases on this branch
Plain run, no coverage 3.71 s 1.03 s
Audit run of 2026-11-11, coverage with per-test contexts 15.7 s (102 cases) not in that run

Code: 2100 lines deleted from 52 files of src (3 modules), 1708 lines deleted from 54 test files. A second uvx vulture src (vulture 2.16) gives no new unused name in src, except one enum member and two model fields, which stay.

Checks run on this branch

  • uv run mypy --python-version 3.14 --strict src: no issues in 815 source files.
  • The 596 test files that import a changed module, and tests/invariants: 14946 passed, 1 skipped, 1 import error (test_embedding_config_retention.py imported the deleted Embedder; fixed, and the file passes).
  • pytest --collect-only tests: 23781 tests, no collection error.
  • The swallowed-failures ratchet passes after --lower.
  • uv run devops openspec check and the archive validate.

@dan-petty
dan-petty force-pushed the refactor/1910-delete-unused-functions-after-manual-caller branch from 76e896d to 49219ce Compare November 12, 2026 17:21
@dan-petty
dan-petty marked this pull request as ready for review November 12, 2026 17:34
@dan-petty
dan-petty self-requested a review as a code owner November 12, 2026 17:34
@dan-petty

Copy link
Copy Markdown
Owner

Owner steps

The stage job opened this pull request as a plan, and it keeps the labels of that plan. The plan now covers the 129-symbol scope of the CI audit, and group 5 runs mypy and the tests, so the two open findings of the plan review are fixed. The agent could not remove the labels.

  1. Remove the label plan/needs-fix from refactor: delete the src symbols that only tests call #4849.
  2. Replace the labels type/docs and scope/openspec with type/refactor, because the pull request now deletes code.

Note: the first CI Quality Gate run of head 49219ce2a stopped with "The operation was canceled" during the security scan step, and no newer run of the branch existed. The agent started the cancelled jobs again, and every check passed.

@dan-petty

Copy link
Copy Markdown
Owner

Independent review of head 49219ce (2026-11-12): no blocking findings.

  • Premise holds: none of the 167 deleted definitions has a caller left. The review checked the dynamic lookups too: the tool registry list, MCP hydration, string imports, LogQL fallbacks and the dry-run renderers. The 3 deleted modules have no importer or entry point. The branch merges cleanly with main 490513f.
  • No public surface changes (commands, options, MCP tools, settings, generated docs). 84 deleted tests covered only deleted code. Where live behavior shared a test (pricing override, INJ001/INJ003, the review concurrency clamp), a test still covers it. 655 tests in the 30 changed files pass, and so does devops openspec check.
  • The open plan-review findings are answered: the 129-symbol scope (75 deleted, 54 kept with a reason each in design.md), the suite and mypy tasks, and the group 13 and group 3 points. A fresh vulture run on the head gives exactly the 54 kept rows.

Minor, non-blocking: orphans that only deleted code used remain (pipeline.py:700,702 _VERSION_RANGE_MARKERS/_VERSION_WILDCARD, vault_lease.py:41 _VAULT_AUTH_LOGIN_PATH, embeddings.py:1342,1350 EmbeddingCost/EmbeddingResult, now test-only); they go to #5148. The change documents name 37 of the 75 deleted symbols, and a few figures are off (2100 src lines, 54 test files, 91 fewer test cases). Info: #1430's _llm_request_preview was never wired.

The label plan/needs-fix goes, and the type changes to type/refactor.

@dan-petty dan-petty added type/refactor Type refactor: a new structure, same behavior and removed verdict/fix-plan Verdict Needs fix of a plan: an open finding keeps the plan in draft until a fix type/docs Type docs: a change to the documents scope/openspec OpenSpec changes, specs and their checks labels Nov 12, 2026
@dan-petty
dan-petty merged commit 2550643 into main Nov 12, 2026
42 of 43 checks passed
@dan-petty
dan-petty deleted the refactor/1910-delete-unused-functions-after-manual-caller branch November 12, 2026 21:39
dan-petty pushed a commit that referenced this pull request Nov 12, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.123.1](v0.123.0...v0.123.1)
(2026-11-12)


### Bug Fixes

* **roadmap:** write and read the kind of each plan task group
([#5262](#5262))
([592227e](592227e))


### Code Refactoring

* delete the src symbols that only tests call
([#4849](#4849))
([2550643](2550643))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/refactor Type refactor: a new structure, same behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: Delete unused functions after manual caller check

1 participant