fix(core): isolate internal/status observers - #55
Open
tdwhere123 wants to merge 1 commit into
Open
Conversation
Observer failures were poisoning Fiber._error and aborting sibling listeners plus service notify. Contain each listener independently, matching the internal/plugin disposal isolation pattern.
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.
Problem
Fiber._updateStateemitsinternal/statuswith no isolation. A diagnostic observer that throws is caught by the Fiber constructor, written into_error, and can rejectawait plugineven when the plugin itself succeeded. The same throw also:FAILEDis attributed to the observerinternal/statuslistenersreflect.notifythat follows a transition into or out ofACTIVE_reloademit into an unhandled rejection when nobody awaits the Fiberinternal/plugindisposal observers already follow a log-only boundary (see #39).internal/statuson currentmaindoes not.mainawait pluginrejects with the observer errorACTIVE; observer is loggedawait pluginrejects with the observer errorFAILEDACTIVEThe five regressions fail on
8cc9e33for those reasons and pass on this branch.Change
Replace the unguarded
emit('internal/status')with a localdispatchFiberStatushelper:events.dispatchpath so thisArg/bind semantics stay the samectx.logger.errorreflect.notifyon the success path after the broadcastThis does not change
internal/plugin,internal/dispatch, or the Fiber generation/epoch machinery in #39 / #54.Regression coverage
packages/core/tests/status.spec.tscovers the five rows above, including a provider/consumer case so a throwing observer cannot skip service notify.Validation
yarn lintyarn yakumo tscyarn test cordis/status— 5 tests passedyarn test cordis— 13 files, 76 tests passedyarn test:json— 20 files, 168 tests passedgit diff --check origin/main...HEAD— passed