Skip to content

pipeline_manager: refactor register_process into focused helper methods (#642)#643

Open
tiagonix wants to merge 1 commit into
Tracer-Cloud:mainfrom
tiagonix:642-pipeline-manager-extract-registration-helpers
Open

pipeline_manager: refactor register_process into focused helper methods (#642)#643
tiagonix wants to merge 1 commit into
Tracer-Cloud:mainfrom
tiagonix:642-pipeline-manager-extract-registration-helpers

Conversation

@tiagonix

@tiagonix tiagonix commented Feb 8, 2026

Copy link
Copy Markdown

Here's the PR description text:


📌 Summary

Refactor register_process into 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_process method into three private helpers:

  • update_existing_candidates: Handles filtering and deduplication when adding PIDs to existing candidate matches
  • identify_new_candidates: Isolates candidate discovery logic including specialized rule matching
  • find_best_match: Extracts scoring, threshold checking, and tie-break selection

This 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

  • Code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have tested the changes and they work as expected
  • Documentation has been updated if needed
  • Tests have been added or updated

🛠️ How to Test

Run existing unit tests:

cargo test --package tracer pipeline_manager

All tests should pass unchanged, demonstrating behavior preservation.

📌 Additional Notes

This refactor intentionally preserves existing behavior including:

  • Current tie-break semantics (higher total_rules wins on equal scores)
  • Use of unwrap() for task lookups
  • Exact same scoring and filtering logic

Follow-up work (deferred to separate PR):

  • Add unit tests for find_best_match tie-break behavior
  • Evaluate tie-break semantics and document intent
  • Consider replacing unwrap() with graceful error handling

…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.
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.

Reduce pipeline manager complexity by extracting process registration orchestration into helpers

1 participant