Refactor modules_controller.py: Extract 10 handlers into focused modules #15
      
        
          +1,257
        
        
          −662
        
        
          
        
      
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
The 658-line
modules_controller.pyviolated Single Responsibility Principle by containing 10 unrelated handler classes, making navigation and maintenance difficult.Changes
Extracted handlers into focused modules organized by concern:
UI State Controllers (
controllers/)combobox_state_handler.py(177 lines) - Combobox state management based on XML dataxml_output_search_handler.py(48 lines) - XML output search functionalityXPath Operations (
controllers/)xpath_handlers.py(245 lines) - Three related handlers:AddXPathExpressionToListHandler- Expression validation and list managementXPathBuildHandler- Expression building from UI selectionsGenerateCSVHeaderHandler- Header generation from expressionsService Orchestrators (
services/)csv_service_handlers.py(172 lines) - Four CSV orchestrators:CSVConversionHandler,SearchAndExportToCSVHandlerLobsterProfileExportCleanupHandler,CSVColumnDropHandlerxml_service_handlers.py(39 lines) -ParseXMLFileHandlerBackward Compatibility
modules_controller.pyreduced to 31-line facade re-exporting all classesArchitecture
Clear three-layer separation now enforced:
Documentation
REFACTORING_SUMMARY.mdanddocs/ARCHITECTURE_REFACTORING.mddocs/REFACTORING_ANALYSIS_2025.md- comprehensive analysisREFACTORING_QUICK_REFERENCE.md- quick reference guideMetrics
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.