Extract Solr operations into dedicated SolrService class#34
Draft
Copilot wants to merge 2 commits intoindex_creatorsfrom
Draft
Extract Solr operations into dedicated SolrService class#34Copilot wants to merge 2 commits intoindex_creatorsfrom
Copilot wants to merge 2 commits intoindex_creatorsfrom
Conversation
Co-authored-by: alexdryden <47127862+alexdryden@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor arcflow/main.py by extracting Solr operations
Extract Solr operations into dedicated SolrService class
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
First step in decomposing the monolithic
main.py(1,446 lines): pulls all Solr-related logic out ofArcFlowinto a standaloneSolrServiceclass to improve testability and separation of concerns.New:
arcflow/services/solr_service.pyExtracted from
ArcFlow:_get_target_agent_criteria()SolrService.get_target_agent_criteria()_get_nontarget_agent_criteria()SolrService.get_nontarget_agent_criteria()_execute_solr_query()SolrService.execute_query()get_all_agents()SolrService.get_all_agents()delete_arclight_solr_record()SolrService.delete_record()All methods gain type hints and docstrings. Also fixes two latent bugs carried over from the original: spurious period in a log message and inconsistent
Arclight→ArcLightcapitalization, plus adds a missingreturn Falseon the exception path ofdelete_record().Changes to
main.pyArcFlow.__init__()now instantiates the service:Call sites updated to
self.solr_service.get_all_agents(...)andself.solr_service.delete_record(...). Net result: ~141 lines removed frommain.py.Original prompt
Overview
Refactor the monolithic
arcflow/main.py(1,446 lines) by extracting Solr-related operations into a dedicatedSolrServiceclass. This is the first step in a larger refactoring effort to improve code maintainability and testability.What to Change
1. Create Service Infrastructure
Create the services package structure:
2. Create
arcflow/services/solr_service.pyExtract the following methods from the
ArcFlowclass into a newSolrServiceclass:Methods to move (with current line numbers for reference):
_get_target_agent_criteria()- lines 697-714_get_nontarget_agent_criteria()- lines 716-737_execute_solr_query()- lines 739-791get_all_agents()- lines 793-826delete_arclight_solr_record()- lines 1188-1204SolrService class structure:
3. Update
arcflow/main.pyImport the service:
In
ArcFlow.__init__()(around line 44):After initializing instance variables, add: