Skip to content

Code health: audit and remove proven dead code paths #2106

Closed

Description

@pzfreo

Part of epic #1939. The audit is underway in #2108 after the maintainer asked to finish the epic promptly; the earlier deferral is superseded.

Task

Use Vulture (or a comparable static scanner) to identify possible dead code paths in src/draftwright, with tests/ and scripts/ included as usage evidence. Triage candidates against dynamic dispatch, public and compatibility import paths, plugin/CLI entry points, reflection, and test fixtures before proposing removals. Keep the initial scanner report advisory; do not add a blanket CI gate or broad whitelist based on raw findings.

Acceptance

  • Record the scanner command, version, scope and confidence threshold so the audit is reproducible.
  • For each proposed removal, prove the symbol/path has no supported caller using source search plus targeted runtime/coverage evidence where static analysis is insufficient. Preserve the five live ADR boundaries and the epic's no-successful-drawing-behavior-change rule.
  • Delete only independently reviewed, demonstrably unused paths in small cohesive slices. Run relevant tests, guards and drawing/lint parity checks; measure net code deletion.
  • Document false positives that matter to future audits without weakening existing coverage or import-boundary guards.

Vulture 2.16 is installed as a local uv tool. The first triaged deletion is under review in #2108; raw scanner findings remain advisory.

Activity

  1. added
    tech-debtInternal maintainability or refactoring work
    on Sep 30, 2026
  2. pzfreo commented on Sep 30, 2026

    @pzfreo
    OwnerAuthor

    Audit in #2108 (current main base b5ba5564, patch de637f8b): vulture 2.16; command vulture src/draftwright tests scripts --min-confidence 60. Vulture exits 3 when it reports candidates. At 100% confidence the baseline report had 20 test-only findings and zero source findings. At 60%, the baseline source list had 41 leads; after this four-helper deletion, the report has 37 source leads and 61 test leads. This is a lead list, not a deletion list or CI gate.

    Four private functions had no executable source, test, script or doc caller by exact-name search, no export, and no relevant string dispatch. Two independent read-only reviews checked each pair and a third reviewed the final diff. The live alternatives are _boss_groove_floor_candidates and shared envelope_is_emittable for recognition, and the len(lanes) * len(obstacles) measured balloon work guard. The patch removes 51 net source lines. Static checks, 258 targeted tests, and byte-identical fresh signatures on all 23 refactor-corpus drawings passed against current main.

    False positives to retain in future triage: __dir__ is Python reflection; pytest hooks, fixtures, pytestmark, and hook parameters are reached by pytest; _addressable_* compiled-plan methods are selected through dynamic dispatch; Sheet/GD&T fluent verbs are public surfaces; CLI and profile names can be registered as data; dataclass fields and test monkeypatch targets have uses invisible to Vulture. Do not whitelist or delete these en masse. Remaining 60% leads require their own call-path and public-contract review if pursued.

  3. pzfreo commented on Sep 30, 2026

    @pzfreo
    OwnerAuthor

    Completed in #2108, merged as a243f00 after independent review, 258 targeted passes, static checks, fresh 23-case drawing-signature parity, and 17 successful PR CI checks. Four proven unused private helpers removed for 51 net source lines. Vulture's remaining leads are advisory; false-positive categories and reproducible command are recorded above.

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

    tech-debtInternal maintainability or refactoring work

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions