Skip to content

Delete ~5,100 lines of orphaned modules (13% of the package has zero importers) #122

Description

@jeremymanning

Part of #108 · Phase 4 · label: tech-debt

Problem

A full AST import-graph analysis over clustrix/ found ~5,100 lines (~13% of the package) with zero importers anywhere in the package.

Module Lines Note
pricing_clients/validation_alerts.py 784 plus its exclusive deps below
pricing_clients/performance_monitor.py 558 reachable only from validation_alerts
pricing_clients/resilience.py 495 reachable only from validation_alerts
notebook_magic_enhanced.py 635
notebook_magic_ssh.py 554
notebook_magic_gcp.py 516
notebook_magic_azure.py 499
notebook_magic_aws.py 474
enhanced_notebook_widget.py 448
secure_credentials.py 149 self-described "Legacy... 1Password support has been removed"

Additionally functionally dead: notebook_magic_widget.py (2,040 lines) is imported only for re-export by notebook_magic.py:36. The actual runtime widget is modern_notebook_widget.display_modern_widget (notebook_magic_core.py:20-22). ModernClustrixWidget won; EnhancedClusterConfigWidget is vestigial.

Not dead, for the record: executor.py is a legitimate 39-line re-export shim (:19-26); the executor_core/_connections/_schedulers/_scheduler_status/_kubernetes/_cloud split is real and live. cli.py has no in-package importer but is the console_scripts entry point (pyproject.toml:50). Neither should be removed.

Why this is worth doing before writing more tests

Several of these modules appear in the coverage report at 0.00% (notebook_magic_widget.py, 839 stmts) and are currently counted in the denominator. Deleting them improves the real coverage number without writing a single test — and prevents someone spending a week writing tests for code nobody runs. That is the correct sequencing, and it is why the coverage re-baseline issue should land after this one.

Related dead code

  • 1Password shims left after removal (remove 1password #97): secure_credentials.py:20-55, cli_credentials.py:867-879, cli.py:270. store_credential() is a silent no-op returning False with only a logger.warning, and 8+ files under tests/real_world/ still import it. A silently-failing credential API is worse than none.
  • function_flattening.py:23-30 — _ast_unparse returns f"# {type(node).__name__} statement" when astor is missing, silently corrupting generated code rather than failing.
  • Root-level artifacts: htmlcov/, build/, dist/, coverage.json, coverage_detailed_report.txt, aws_provision_test.log, plus notes/ (one stale 2025-09-04 file).
  • Duplicate CI workflow files real_world_tests.yml / real-world-tests.yml.

Acceptance criteria

  • All listed orphans deleted (not commented out, not moved to an unused/ folder)
  • Import graph re-run confirms no new orphans
  • Test suite still passes; anything that only existed to test deleted code is deleted with it
  • Coverage re-measured afterwards and the change reported

Verification

python - <<'PY'
# re-run the AST import graph over clustrix/ and print modules with zero importers
PY

Activity

  1. added a commit that references this issue on Aug 18, 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

    P2-mediumImportant but not blockingtech-debtDead code, duplication, refactoring

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions