ContextLab / ContextLab/clustrix

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

Open
#122 0 comments 0 reactions 0 assignees View on GitHub
P2-medium tech-debt
Dominant language
Python
Stars
10
Forks
4
Avg merge
6h 27m
Merged PRs (30d)
9

Description

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 (#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

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

Contributor guide

Open the contributing guide

Research direction

Start by rerunning the AST import-graph check over clustrix/ and reviewing the listed orphan modules. Preserve cli.py because of the pyproject.toml console_scripts entry point and executor.py as the documented re-export shim. Remove confirmed orphans and tests that only cover them, then run the full test suite and re-measure coverage; done means no new orphans and all acceptance checks pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing, tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.