Skip to content

test(hygiene): tombstone tests for deleted code are deleted and a dead-code tool is trialled #1871

Closed

Description

@dan-petty

Friction

tests/test_codebase_hygiene_and_shims.py pins the names of deleted things forever (aliases, a model verifier, vLLM settings), so every deletion refactor edits it, and a regular expression stands in for a dead-code tool in one place. The Zero Zombie Code rule is enforced by remembering what was deleted, not by finding what is unused.

Evidence

  • Twelve tests, 188 lines, assert deleted names stay deleted: test_tool_has_no_func_alias, test_no_native_mcp_toolset_alias, test_devops_cli_error_has_no_code_alias, test_rag_app_has_no_reset_alias, test_the_model_verifier_its_catalog_and_its_guards_are_gone, test_vllm_dead_settings_commands_and_mcp_tools_are_removed and six more.
  • test_security_module_private_functions_all_have_callers finds uncalled private functions with a regular expression, in security/*.py only. The review proposed vulture at 100% confidence for it. The verification pass found that at 100% vulture reports 11 unused variables and no function, and functions appear only at 60% (1,814 findings, including __getattr__ and framework callbacks). Not re-run here: vulture is not installed in the repository environment.
  • Git history already records that a thing was deleted.

Proposed remedy

  • Delete the twelve tombstone tests.
  • Trial vulture at 60% with a committed whitelist in a scratch directory and report the false-positive count; adopt it as a devops ci row only if the whitelist stays short, and delete the caller test when it does. Otherwise keep the caller test and say why in the pull request.
  • Keep the three hardcoded-extension tests until library classification replaces them (item 6).

What it deletes

  • 188 lines.

Tests

  • No new test for the deletion. If vulture is adopted, one test runs it over a tmp_path module with a known dead function.

Dependencies

  • None.

Acceptance criteria

  • The twelve tests are gone and uv run devops ci passes.
  • The pull request records the vulture trial result and the decision.

Size: S.

Proposed design

Problem statement

The issue addresses the friction caused by tombstone tests that pin names of deleted code, making every deletion refactor require editing these tests. Additionally, a regular expression is used instead of a dead-code tool to find unused private functions, violating the Zero Zombie Code rule which should enforce this through automated detection rather than manual record-keeping.

Acceptance criteria

  • Criterion 1: The twelve tombstone tests are deleted from the test suite.
    Verification: Run uv run devops ci and confirm that the tests no longer exist in tests/test_codebase_hygiene_and_shims.py.
  • Criterion 2: A trial of vulture dead-code detection tool is conducted at 60% confidence with a committed whitelist.
    Verification: Verify that a vulture run on a scratch directory with known dead functions shows fewer false positives than expected, and record the result in the pull request.
  • Criterion 3: The pull request records the decision on adopting vulture or retaining the caller test.
    Verification: Check that the pull request description contains a clear statement of whether vulture was adopted or not, along with the rationale for the decision.

Key questions

  • Should the caller test be kept until library classification replaces the hardcoded-extension tests?: Yes, the three hardcoded-extension tests should be kept until library classification replaces them. (proposed)

Open questions

  • What are the twelve tombstone tests that need to be deleted? (missing verified source)
  • Is vulture installed in the repository environment? (missing verified source)

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/refactor
    on Oct 22, 2026
  2. dan-petty commented on Oct 22, 2026

    @dan-petty
    OwnerAuthor

    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.

    • Type: type/refactor. The candidate proposes deleting unused code and trialling a dead-code tool, which aligns with refactor type.
    • Priority: P2-Medium. It addresses zombie code and improves hygiene but is not critical or urgent.
    • Value: Medium. Improves codebase health and maintainability for users and developers.
    • Effort: Low. Involves deleting tests and trialling a tool, which is a small task.
  3. added this to the v0.2.39 milestone on Oct 22, 2026
  4. added
    status/in-progress
    on Oct 22, 2026
  5. added a commit that references this issue on Oct 22, 2026
    f68621b
  6. dan-petty commented on Oct 22, 2026

    @dan-petty
    OwnerAuthor

    What changed

    #1894, merged into release/v0.2.39 as f68621b.

    Cause: tests/test_codebase_hygiene_and_shims.py held 11 tests that assert that names deleted by earlier refactors stay deleted. Git history already records each deletion. Each deletion refactor had to edit the same file, so the file grew by one test for each deleted thing. The rule "Zero Zombie Code" was enforced by a memory of what was deleted. It was not enforced by a search for what is unused.

    Change: The 11 tests are deleted, with _DELETED_REVIEW_MODULES, the _imported_modules helper and the imports that only they used. The file shrinks from 349 to 90 lines. It keeps the three hardcoded-extension tests and test_security_module_private_functions_all_have_callers. test_run_context_instance_functionality is not a tombstone. It is the only test that checks that RunContext stores loaded_capability_ids and tool_call_metadata, and that model_copy(update=...) keeps the other fields. It moves unchanged to tests/test_pydantic_agent.py, which already tests the helpers of devops_cli/ai/agents/context.py. Four older task files named a deleted test as a current test, so each of those lines now says that #1871 deleted it. No suppression marker was in the deleted lines, so no ceiling falls. The task file docs/agent/tasks/task-1871-tombstone-tests-and-dead-code-tool.md and the fragment changelog.d/1871.md are included.

    Existing tool considered: vulture 2.16, for the check that finds unused code. The trial ran through uvx and changes no file. Ruff has no rul…

    8 file(s) changed.

    How it was verified

    Check runs at f80f2ec:

    • Prune PR DevContainer Images: pass
    • Audit Defect PR Hardening: skipping
    • devops-cli: pass
    • zizmor: pass
    • bandit: pass
    • CodeQL: pass
    • DevContainer Image: skipping
    • Static Analysis: pass
    • Fail-to-Pass Check: pass
    • Changed-Test Independence: pass
    • Rule Pack Tests: pass
    • Fail-to-Pass Self-Check: pass
    • Tests & Coverage: pass
    • Analyze (python): pass
    • Analyze (actions): pass
    • Service Image: skipping
    • Dependency Freshness: skipping

    Acceptance Criteria of docs/agent/tasks/task-1871-tombstone-tests-and-dead-code-tool.md:

    • The 11 tombstone tests are gone. A search of src, tests, AGENTS.md and docs outside docs/agent/tasks for their names finds nothing.
    • test_run_context_instance_functionality passes in tests/test_pydantic_agent.py.
    • The four tests that stay in tests/test_codebase_hygiene_and_shims.py pass.
    • These invariant test files pass too:
      • tests/test_agent_task_files.py and tests/test_release_changelog_fragments.py.
      • tests/test_architectural_invariants.py and tests/test_swallowed_failures_ratchet.py.
      • tests/test_agents_md_claims.py and tests/test_docs_inventory.py.
      • tests/test_test_module_independence.py and tests/test_public_export_surface.py.
    • ruff check, ruff format --check, mypy and deptry pass, and uv run devops docs check reports every file up to date.
    • The pull request records the vulture trial result and the decision.
    • Pending a person: a person files the follow-up that checks the 19 candidates and deletes the dead ones.
    • Pending a person: uv run devops ci passes on the delivering tree. This change ran the targeted tests, not the gate.
  7. added a commit that references this issue on Oct 23, 2026
    f209f6c
  8. removed
    status/in-progress
    on Oct 30, 2026
  9. added a commit that references this issue on Nov 1, 2026
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

    source/agenttype/refactor

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions