Repository navigation
Version Packages - #93
Merged
Merged
Conversation
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.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
effect-machine@0.31.0
Minor Changes
1e2966aThanks @cevr! -actor.subscribe,actor.client.subscribeandself.client.subscribelisteners now get every state written after they subscribe, each once, in write order, like the waits. A listener reads the states from the state ref's own publication, and a notification only wakes it. Before this change a supervised restart could deliver its restart state after a newer state of the new generation, a send from a listener callback could deliver the newer state to later listeners before the older one and call a listener again inside its own callback, a state whose entry crashed before its notification was never delivered, and a stop of an actor could drop the last write. Behavior changes: a listener that subscribes between a write and its notification, or inside another listener's callback, no longer gets that state (it was current when it subscribed; readgetSnapshotfor it). This includes a listener that a.spawnhandler subscribes: it no longer gets the state that the handler runs for (0.30.0 delivered it); read the handler'sstateorgetSnapshot()for it; a listener is not called again while its own callback runs, and gets the states its callback caused after it returns; the listeners of an actor get a write that a stop overtook beforeawaitExitcompletes; eachsubscribecall is its own registration, so the same function subscribed twice gets each write twice (the listeners were a set of functions before, which called it once), and each unsubscribe ends one registration. The ordering and terminal guarantees cover local actor listeners. An entity'sself.clientlistener can still miss a write that the entity's deactivation overtakes, as in 0.30.0: the entity runtime does not ring its listeners at teardown.1469452Thanks @cevr! -actor.waitFor,actor.awaitFinalandactor.sendAndWaitnow end when the actor terminates. They fail withActorStoppedError(the errorawaitOutputalready uses) when the actor stops, drains, defects, or reaches a final state, and no state from the start of the wait matched. Before this change a wait never resolved after the actor terminated without a match, so callers had to race it againstawaitExitor a time limit. The waits now read the states from the state ref's own publication: the predicate sees the snapshot and then every later state write, each once, in write order and one call at a time, and the wait returns the first match. A brief state around the start of the wait is no longer lost, a state counts as reached once it is written (also when its entry crashes later, when a supervised restart follows, or when a stop comes before its notification), the predicate is not called again after it matches, and a predicate that sends an event cannot re-enter the wait.sendAndWaitstarts to observe before it sends, and does not send when the predicate throws on the snapshot. A predicate that throws on a later state now fails the wait with that defect instead of being ignored. A state restored by recovery now notifiessubscribelisteners and waiters. A wait releases its listener and its subscription when it ends, also when it is interrupted at any point. The error channel of all three widens fromnevertoActorStoppedError: code that annotates them asEffect<State>must handle or declare the new error.