Skip to content

chore: post-bootstrap-merge cleanup (drop retired symbols, modules, notebooks) - #3

Merged
atuldeshpande merged 4 commits into
mainfrom
feature/post-bootstrap-cleanup
Jun 5, 2026
Merged

chore: post-bootstrap-merge cleanup (drop retired symbols, modules, notebooks)#3
atuldeshpande merged 4 commits into
mainfrom
feature/post-bootstrap-cleanup

Conversation

@atuldeshpande

Copy link
Copy Markdown
Member

Summary

Removes deprecated/retired code that the current SEG and NOSEG pipelines no longer reference. Net +166 / −5,856 lines across src/tracer/, tests, and tutorials.

Plan + rationale: docs/superpowers/plans/2026-06-02-post-bootstrap-cleanup.md

What's removed

Tier Target Justification
T1.1 _legacy_dense_compute_npmi (metrics.py, ~150 lines) Explicitly RETIRED in docstring; 0 callers
T1.2 4 deprecated stitching wrappers (coherence_C_from_genes, coherence_C_from_genes_relu, deltaC_between_clusters, deltaC_between_clusters_relu) Already emit DeprecationWarning; 0 callers
T1.3 src/tracer/spatial_kernel.py + its test Orphan module — never wired into stitching/pipeline (the test docstring itself notes it was a never-finished kernel); 0 inbound references
T1.4 tutorials/lung_cancer/lung_cancer_npmi.ipynb 0 external references
T2.1 tutorials/lung_cancer/legacy_workflow.ipynb + the bullet pointing at it in algorithmic_changes.ipynb Pre-this-branch workflow, superseded
T3.1 tutorials/breast_cancer/breast_cancer_npmi.ipynb + src/tracer/tiling.py (paired; tiling's only consumer was that notebook) breast_cancer pipeline is run_breast_cancer.py; the NPMI notebook is retired
fix src/tracer/core.py — drop 4 stale imports of the removed stitching wrappers Caught by the pipeline run below — grep-only verification missed module-level re-imports in core.py

Public API: 4 stitching wrapper names + 5 tiling export names drop from tracer/__init__.py. No external from tracer.core import … / from tracer import … consumer of any removed name was found in src/, tests/, tutorials/, or benchmarks/.

Bit-equivalence proof

Pipeline outputs on a 50 µm ROI of lung_cancer_df.parquet (center (1800, 2200), 383 transcripts, 36 input cells) via run_segmented_pipeline / run_noseg_pipeline:

pipeline branch md5 of per-tx labels agreement
SEG upstream/main (bd239c4) 6df0f6cd…
SEG this branch 6df0f6cd… 383/383 (100 %)
NOSEG upstream/main 3d338f1c…
NOSEG this branch 3d338f1c… 383/383 (100 %)

DataFrame.equals() = True for both; every transcript lands on the same final entity.

Test plan

  • pytest tests/test_pmi_bootstrap.py → 41/41 pass (no regressions on the metrics test suite that runs in the lightweight env).
  • run_segmented_pipeline + run_noseg_pipeline on a 50 µm ROI of lung_cancer data — bit-identical per-transcript output across branches (md5 + DataFrame.equals()).
  • CI suite (test_pipeline_smoke, test_pipeline_regression, test_pipeline_tiled, test_phase1_*) — these require the full torch_geometric / open3d / geopandas stack; running them on CI gives the broader regression check.

Commits

7d0b459 fix(core): drop stale imports of deleted stitching wrappers
4832f1b chore(tracer): drop deprecated stitching wrappers, spatial_kernel, tiling, retired notebooks
82eae9b chore(metrics): drop retired _legacy_dense_compute_npmi function
9cfef87 docs(cleanup): plan for post-bootstrap deprecation removal

🤖 Generated with Claude Code

atuldeshpande and others added 4 commits June 3, 2026 15:10
Maps deprecated functions/modules/notebooks against the current SEG and
NOSEG production pipelines. Tier 1 (zero-risk): _legacy_dense_compute_npmi,
4 stitching wrappers, spatial_kernel.py, lung_cancer_npmi.ipynb. Tier 2:
legacy_workflow.ipynb. Tier 3 (conditional): tiling.py + breast_cancer_npmi.ipynb.

All candidates verified by direct grep across src/tests/tutorials/benchmarks
(0 external callers). Confirms plot.py, cc_scoring.py, density_cascade.py
remain active. Six-commit execution order included.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The dense G**2 NPMI implementation was retired with the move to
compute_pmi_bootstrap; only kept for one-off comparisons. Zero callers
across src/, tests/, tutorials/, benchmarks/.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ling, retired notebooks

Bulk removal per docs/superpowers/plans/2026-06-02-post-bootstrap-cleanup.md
tiers T1.2-T3.1 (all zero-caller, verified against current SEG/NOSEG pipelines):

- src/tracer/stitching.py: 4 deprecated wrappers (coherence_C_from_genes,
  coherence_C_from_genes_relu, deltaC_between_clusters, deltaC_between_clusters_relu)
  emitting DeprecationWarning with zero remaining callers.
- src/tracer/spatial_kernel.py: orphan module, zero inbound references.
  Drops tests/test_spatial_kernel.py with it (test module itself imports
  torch_geometric and never ran in the metrics test env).
- src/tracer/tiling.py: only caller was tutorials/breast_cancer/breast_cancer_npmi.ipynb,
  which is retired.
- tutorials/lung_cancer/lung_cancer_npmi.ipynb: zero external references.
- tutorials/lung_cancer/legacy_workflow.ipynb + the descriptive bullet in
  algorithmic_changes.ipynb that pointed at it.
- tutorials/breast_cancer/breast_cancer_npmi.ipynb: confirmed retired.

src/tracer/__init__.py: drops the matching re-exports
(metis_partition_cells, build_metis_partition_hulls, plot_metis_partitions,
plot_metis_hulls, chunk_transcripts; coherence_C_from_genes,
coherence_C_from_genes_relu, deltaC_between_clusters,
deltaC_between_clusters_relu).

Tests: 41 passed (no regressions vs the pre-change baseline).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
core.py was re-importing the four deprecated stitching wrappers that the
previous commit deleted, so the package failed to load with ImportError.
No __all__ discipline + no external 'from tracer.core import <wrapper>'
callers (verified by grep), so removal is API-clean.

Caught by running run_segmented_pipeline + run_noseg_pipeline on a 50µm
ROI of lung_cancer data across both branches:
  - SEG:   md5(core-refactor) == md5(cleanup),  383/383 tx labels match
  - NOSEG: md5(core-refactor) == md5(cleanup),  383/383 tx labels match

The bit-equivalence proof the static grep couldn't give.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated no new comments.

@atuldeshpande
atuldeshpande merged commit 7102859 into main Jun 5, 2026
9 of 10 checks passed
@atuldeshpande
atuldeshpande deleted the feature/post-bootstrap-cleanup branch June 5, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants