Skip to content

Add LocalServiceManager with start_local for LocalSet-driven services#1

Closed
mcharytoniuk wants to merge 5 commits into
mainfrom
add-start-local-variant
Closed

Add LocalServiceManager with start_local for LocalSet-driven services#1
mcharytoniuk wants to merge 5 commits into
mainfrom
add-start-local-variant

Conversation

@mcharytoniuk
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a “local” service orchestration path (LocalServiceManager + start_local) intended for running !Send services on a Tokio LocalSet, and refactors some shared lifecycle logic (shutdown draining + outcome classification) out of the existing RunningServiceCollection. It also adds a parallel set of integration tests validating the same behaviors for local services.

Changes:

  • Add LocalService, LocalServiceManager, and LocalRunningServiceCollection to run !Send services via LocalSet.
  • Refactor service shutdown draining and panic/error classification into service_task_drainer and service_outcome_classifier.
  • Add extensive local_* integration tests and do minor import re-ordering in existing tests.

Reviewed changes

Copilot reviewed 54 out of 54 changed files in this pull request and generated 25 comments.

Show a summary per file
File Description
trzcina/src/lib.rs Wire up new local modules and re-export new public types.
trzcina/src/service.rs Minor formatting change in Service trait.
trzcina/src/running_service_collection.rs Use shared outcome classifier + task drainer; adjust start visibility/attributes.
trzcina/src/service_task_drainer.rs New shared shutdown/drain/abort logic extracted from running collection.
trzcina/src/service_outcome_classifier.rs New shared panic/error/ok outcome classification helper.
trzcina/src/local_service.rs New LocalService trait for !Send services.
trzcina/src/local_service_manager.rs New manager for registering local services/bundles and starting locally.
trzcina/src/local_service_bundle.rs New bundle trait for producing local services.
trzcina/src/local_running_service_collection.rs New local running collection backed by LocalSet + shared drainer/classifier.
trzcina/src/local_registered_service.rs New internal representation for registered local services.
trzcina/tests/supports_notify_driven_event_loop_pattern.rs Import ordering adjustment.
trzcina/tests/supports_mutable_internal_state_across_iterations.rs Import ordering adjustment.
trzcina/tests/supports_multi_channel_select_pump_pattern.rs Import ordering adjustment.
trzcina/tests/supports_interval_ticker_reconciliation_pattern.rs Import ordering adjustment.
trzcina/tests/supports_internal_retry_loop_pattern.rs Import ordering adjustment.
trzcina/tests/supports_actix_style_shutdown_signal_pattern.rs Import ordering adjustment.
trzcina/tests/run_reports_leaked_beyond_abort_deadline_when_service_ignores_abort.rs Import ordering adjustment.
trzcina/tests/run_records_string_literal_panic_payload.rs Import ordering adjustment.
trzcina/tests/run_records_service_panic_and_cancels_siblings.rs Import ordering adjustment.
trzcina/tests/run_records_service_error_and_cancels_siblings.rs Import ordering adjustment.
trzcina/tests/run_records_non_string_panic_payload.rs Import ordering adjustment.
trzcina/tests/run_records_all_failures_when_multiple_services_error.rs Import ordering adjustment.
trzcina/tests/run_completes_when_all_services_finish_simultaneously.rs Import ordering adjustment.
trzcina/tests/run_completes_immediately_when_no_services_registered.rs Import ordering adjustment.
trzcina/tests/run_cancels_siblings_when_one_service_finishes_first.rs Import ordering adjustment.
trzcina/tests/run_cancels_all_services_when_external_token_cancelled.rs Import ordering adjustment.
trzcina/tests/run_aborts_hung_services_on_external_cancel.rs Import ordering adjustment.
trzcina/tests/run_aborts_hung_service_after_shutdown_deadline.rs Import ordering adjustment.
trzcina/tests/register_service_runs_registered_service.rs Import ordering adjustment.
trzcina/tests/register_bundle_runs_all_services_returned_by_bundle.rs Import ordering adjustment.
trzcina/tests/coordinates_via_shared_holder_between_two_services.rs Import ordering adjustment.
trzcina/tests/local_supports_notify_driven_event_loop_pattern.rs New local-service behavioral test.
trzcina/tests/local_supports_mutable_internal_state_across_iterations.rs New local-service behavioral test.
trzcina/tests/local_supports_multi_channel_select_pump_pattern.rs New local-service behavioral test.
trzcina/tests/local_supports_interval_ticker_reconciliation_pattern.rs New local-service behavioral test.
trzcina/tests/local_supports_internal_retry_loop_pattern.rs New local-service behavioral test.
trzcina/tests/local_supports_actix_style_shutdown_signal_pattern.rs New local-service behavioral test.
trzcina/tests/local_runs_tokio_spawn_local_inside_service.rs New local-service behavioral test (spawn_local).
trzcina/tests/local_runs_non_send_service.rs New local-service behavioral test (Rc/RefCell).
trzcina/tests/local_run_records_string_literal_panic_payload.rs New local-service failure-reporting test (panic string).
trzcina/tests/local_run_records_service_panic_and_cancels_siblings.rs New local-service sibling-cancellation + panic recording test.
trzcina/tests/local_run_records_service_error_and_cancels_siblings.rs New local-service sibling-cancellation + error recording test.
trzcina/tests/local_run_records_non_string_panic_payload.rs New local-service failure-reporting test (non-string panic).
trzcina/tests/local_run_records_all_failures_when_multiple_services_error.rs New local-service multi-failure aggregation test.
trzcina/tests/local_run_completes_when_all_services_finish_simultaneously.rs New local-service completion test.
trzcina/tests/local_run_completes_immediately_when_no_services_registered.rs New local-service empty-manager test.
trzcina/tests/local_run_cancels_siblings_when_one_service_finishes_first.rs New local-service sibling-cancellation test.
trzcina/tests/local_run_cancels_all_services_when_external_token_cancelled.rs New local-service external-cancel test.
trzcina/tests/local_run_aborts_hung_services_on_external_cancel.rs New local-service hung-service abort-on-cancel test.
trzcina/tests/local_run_aborts_hung_service_after_shutdown_deadline.rs New local-service hung-service abort-on-deadline test.
trzcina/tests/local_register_service_runs_registered_service.rs New local-service registration test.
trzcina/tests/local_register_bundle_runs_all_services_returned_by_bundle.rs New local-service bundle registration test.
trzcina/tests/local_register_bundle_propagates_error_from_bundle.rs New local-service bundle error-propagation test.
trzcina/tests/local_coordinates_via_shared_holder_between_two_services.rs New local-service coordination/shared-state test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread trzcina-sendable-service/src/running_service_collection.rs
Comment thread trzcina-local-service/src/local_running_service_collection.rs
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 55 out of 55 changed files in this pull request and generated 2 comments.

Comment thread README.md
Comment thread trzcina-sendable-service/src/running_service_collection.rs
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 81 out of 88 changed files in this pull request and generated 3 comments.

Comment thread README.md
Comment thread trzcina-service/src/service_shutdown_error.rs
Comment on lines +37 to +42
impl Manager for LocalServiceManager {
type Running = LocalRunningServiceCollection;

fn start(self, cancellation_token: CancellationToken) -> LocalRunningServiceCollection {
LocalRunningServiceCollection::start(self.services, cancellation_token)
}
@mcharytoniuk mcharytoniuk deleted the add-start-local-variant branch May 20, 2026 17:37
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.

2 participants