Skip to content

Dead Code Analysis for libs/netherframe.core

Historical note: This page is preserved as an archival analysis snapshot. It reflects the repository state at the time it was written and should not be treated as the current architecture contract. Start with Historical Internal Docs, Hybrid Execution Overview, and Migration Guide for current guidance.

Summary

This analysis identifies dead code, duplicates, and potentially unused modules in the libs/netherframe.core package.

1. Duplicate Functionality

Native Execution Modules

  • native_execution.py - Main native execution module (actively used)
  • native_execution_enhanced.py - Enhanced version with TUI support (NOT imported anywhere - DEAD CODE)
  • native_executor.py - Only imported in benchmarks/benchmark_suite.py
  • native_provider.py - NOT imported anywhere - DEAD CODE

Orchestrator Modules

  • orchestrator.py - Base orchestrator (actively used)
  • parallel_orchestrator.py - Enhanced parallel version (actively used)
  • circular_orchestrator.py - Circular dependency handling (actively used)
  • circular_orchestrator_enhanced.py - Enhanced version (only imports native_circular_deps_parallel - limited use)

Phase Planning Modules

  • phase_planner.py - Original phase planner (still used in some places)
  • phase_planner_v2.py - Version 2 (only used in tests - possibly experimental)

State Engine Modules

  • state_engine.py - Main state engine (actively used)
  • transactional_state_engine.py - NOT imported anywhere - DEAD CODE

2. Backup and Debug Files

Backup Files

  • core_backup.py - NOT imported anywhere - DEAD CODE
  • 17 .backup files in tests/ - All are backup copies that should be removed

Debug Scripts (Top Level)

  • debug_auto_detection.py
  • debug_autoscope_test.py
  • debug_frames.py
  • debug_provider.py

These appear to be temporary debugging scripts that should be removed or moved to a debug utilities folder.

3. Temporary Fix Scripts

  • comprehensive_fix.py - Referenced in drift_patch_generation.py
  • fix_e2e_resources.py - Referenced in fix_remaining_resources.py
  • fix_remaining_resources.py - Self-referential
  • remove_duplicates.py - Self-referential

These appear to be one-time migration/fix scripts that may no longer be needed.

4. Duplicate Protocol Buffer Files

Protocol buffer generated files exist in multiple locations: - Root level: grpc_controller_pb2*.py, grpc_stdio_pb2*.py, tfplugin6_pb2*.py - nf/core/gen/: Same files - These duplicates should be consolidated to one location

5. Unused Modules Summary

Definitely Dead Code (not imported anywhere):

  1. nf/core/native_execution_enhanced.py
  2. nf/core/native_provider.py
  3. nf/core/core_backup.py
  4. nf/core/transactional_state_engine.py

Potentially Dead Code (only used in tests/benchmarks):

  1. nf/core/native_executor.py - Only in benchmarks
  2. nf/core/phase_planner_v2.py - Only in tests
  3. nf/core/circular_orchestrator_enhanced.py - Limited use

Test Coverage and Utility Files

  • test_all_rpcs.py - Top level test file
  • test_codec.py - Top level test file
  • test_status.py - Top level test file
  • coverage_report.py - Coverage utility
  • run_test_isolation.py - Test utility

These should probably be moved to the tests directory.

Recommendations

  1. Remove definitely dead code files listed above
  2. Delete all .backup files in the tests directory
  3. Consolidate protobuf files to nf/core/gen/ and remove duplicates
  4. Move debug scripts to a proper debug utilities location or remove them
  5. Review temporary fix scripts and remove if no longer needed
  6. Move top-level test files to the tests directory
  7. Consider removing or documenting potentially dead code that's only used in tests

File Count Summary

  • Total dead code files identified: 4
  • Backup files to remove: 17
  • Debug scripts to review: 4
  • Temporary fix scripts: 4
  • Duplicate protobuf files: 9 (3 sets × 3 locations)
  • Test files in wrong location: 3

Total files that could be removed or relocated: ~41 files