[codex] Add optional staged lifecycle stack - #156
Merged
LimiNode merged 4 commits intoSep 2, 2026
Conversation
Introduce the optional ILifecycleModule contract and a non-owning LifecycleStack that processes dependencies forward and shuts them down one stage at a time in reverse order. Integrate MarketDataRouter and BaseTradingPlatform, add a routed-cleanup example and focused tests, and document the contract in synchronized English and Russian guides.
Run the lifecycle stack test and example on Ubuntu and Windows smoke jobs. Document that nested lifecycle stacks must remain acyclic while keeping cycle detection outside the optional stack implementation.
LimiNode
marked this pull request as ready for review
September 2, 2026 21:31
LimiNode
merged commit Sep 2, 2026
84feeec
into
refactor/market-data-router-implementation
2 checks passed
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.
Summary
lifecycle::ILifecycleModulecontract for owner-loop modules withprocess(), idempotentshutdown(), and terminalis_stopped()lifecycle::LifecycleStackthat processes dependencies forward and shuts dependents down one stage at a time in reverse registration orderMarketDataRouterandBaseTradingPlatformwith the common lifecycle interface while preserving their direct APIsrun(bool), componentinitialize(), and application bot startup do not share one semantic contractLifecycle Contract
platform -> router -> botprocess()runs forward through modules that still participate in the current stageshutdown()starts with the last dependent and does not request shutdown of the next lower module until the current module reportsis_stopped()Router Integration
MarketDataRouter::is_stopped()maps to its existingis_shutdown_complete()stateplatform -> routerkeeps the platform owner loop alive until late subscribe/unsubscribe completions and Router physical cleanup finishDocumentation
guides/lifecycle-stack.md: canonical English contractguides/lifecycle-stack.ru.md: synchronized Russian contractVerification
lifecycle_stack_test: 3 passedmarket_data_router_test: 21 passedmarket_data_subscriber_base_test: 15 passedlifecycle_event_safety_test: 8 passedheader_only_odr_test: 4 passedlifecycle_stack_example: ran successfully and drained a deferred routed unsubscribebad=0,duplicates=0missing=0git diff --checkLocal MinGW compilation used
-Wa,-mbig-objfor large umbrella translation units.Stack
Depends on #155 (
refactor/market-data-router-implementation).