feat(lifecycle): ResourceLifecycleRegistry for unified resource disposal#161
Open
hernandez42 wants to merge 1 commit into
Open
feat(lifecycle): ResourceLifecycleRegistry for unified resource disposal#161hernandez42 wants to merge 1 commit into
hernandez42 wants to merge 1 commit into
Conversation
- Add ResourceLifecycleRegistry for centralized, coordinated resource disposal. Replaces ad-hoc teardown scattered through createLocalGateway. Supports register/dispose/disposeAll with error collection and logging. - Integrate ResourceLifecycleRegistry into createLocalGateway dispose flow: config-store, extension-watch-manager, and telemetry are now registered and disposed through the registry. dispose() is now async. - Update CreateLocalGatewayResult.dispose type from () => void to () => Promise<void> and add await to disposeGateway() call in pilotdeck.ts server stop handler.
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
PR 1: ResourceLifecycleRegistry + Lifecycle Unification
Add unified lifecycle resource registry for PilotDeck, replacing ad-hoc teardown scattered through
createLocalGateway.Changes
New file:
src/lifecycle/runtime/ResourceLifecycleRegistry.tsResourceLifecycleRegistry: centralized registry for lifecycle resourcesregister(disposer): register a resource for later disposaldispose()/disposeAll(): run all disposers in reverse order (LIFO)disposeSync(): synchronous variant for contexts where async is not availableunregister(),has(),registered(): management APIsModified:
src/lifecycle/index.tsResourceLifecycleRegistryfrom the lifecycle moduleModified:
src/cli/createLocalGateway.tsdispose()now usesResourceLifecycleRegistryinstead of inline cleanupregistry.invalidate(),stopConfigWatching(),stopExtensionWatching(),telemetry.shutdown(),gateway.dispose()dispose()is nowasync () => Promise<void>Modified:
src/cli/pilotdeck.tsdisposeGateway()toawait disposeGateway()since dispose is now asyncVerification
npm testWhy this matters
Previously, telemetry shutdown, config watcher stop, extension watcher stop, and gateway dispose were separate inline calls. If any threw, others might be skipped. Now they are registered in a registry that:
TODO follow-up (not in this PR)
.pilotdeck-always-on/.apex-memretention/cleanup strategytestvstest:noforcedefault decisionCo-authored-by: Xuanji xuanji@ouvaton.org