pipeline_manager: refactor register_process into focused helper methods (#642)#643
Open
tiagonix wants to merge 1 commit into
Open
Conversation
…ds (Tracer-Cloud#642) Decompose register_process into small private helpers that separate orchestration from domain logic, reducing cyclomatic complexity while preserving matching behavior. Extract candidate updates, candidate discovery, and best-match selection into dedicated methods without changing the public API or outcome semantics. Note: tie-break clarification, unwrap hardening, and additional unit tests are deferred to a follow-up change.
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.
Here's the PR description text:
📌 Summary
Refactor
register_processinto focused helper methods to reduce cyclomatic complexity and improve maintainability of the pipeline task identification logic.🔍 Related Issues/Tickets
Part of ongoing work to improve pipeline manager code quality.
Closes #642
✨ Changes Introduced
Decomposes the monolithic
register_processmethod into three private helpers:update_existing_candidates: Handles filtering and deduplication when adding PIDs to existing candidate matchesidentify_new_candidates: Isolates candidate discovery logic including specialized rule matchingfind_best_match: Extracts scoring, threshold checking, and tie-break selectionThis reduces complexity in a critical code path while preserving all existing behavior and semantics.
✨ Infrastructure Impact
None. This is a behavior-preserving refactor with no changes to public APIs or external interfaces.
✅ Checklist
🛠️ How to Test
Run existing unit tests:
cargo test --package tracer pipeline_managerAll tests should pass unchanged, demonstrating behavior preservation.
📌 Additional Notes
This refactor intentionally preserves existing behavior including:
total_ruleswins on equal scores)unwrap()for task lookupsFollow-up work (deferred to separate PR):
find_best_matchtie-break behaviorunwrap()with graceful error handling