chore(deps): Update xstate to v5.32.4#333
Open
X-Guardian wants to merge 2 commits into
Open
Conversation
e3790c6 to
6e13ead
Compare
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.
Description
Bumps
xstatefrom4.38.3to5.32.4(latest) in@cdktn/cli-core, the only package that declares it.This is a major version bump (4.x → 5.x) and required migrating the deploy state machine, its consumer, and its tests to the reworked v5 API:
createMachine<Ctx, Evt, State>(…)→setup({ types, actors }).createMachine(…). The generic-parameter form was replaced by thesetup()builder with atypesblock, indeploy-machine.ts. ThepredictableActionArgumentsflag was dropped (predictable ordering is the default in v5) andservicesbecameactors.fromCallback. The v4(context, event) => (send, onReceive) => {…}factory becamefromCallback(({ sendBack, receive, input }) => …). Since v5 invoked actors receiveinputrather than the triggering event, the spawn config now flows in throughinvoke.input. The actor is built bymakeTerraformPtyService(spawn)so tests can inject a mock pty.send(…, { to })→sendTo(…);assign<Ctx, Evt>→assign. Action creators were split and theassignimplementation signature changed to a single argument.raise(…)→sendTo(({ self }) => self, …). The two internally re-emitted events (EXITEDon a missing variable, and theOVERRIDE_REJECTED_EXTERNALLYre-label of an external discard) were sent to self rather than raised. Raised events are internal micro-steps and do not surface through the inspection API, so the consumer would otherwise stop observing them.interpret(…)→createActor(…, { inspect }). The actor is now started explicitly before events are sent.The consumer in
terraform-cli.tsneeded the most care, because v5 snapshots no longer expose the triggering event (state.event):service.subscribe(…), which yields a fully-typed snapshot for the root actor only — replacingservice.onTransition(…).inspectcallback (the only source that still carries the triggering event), replacingservice.onEvent(…). The root actor is identified by reference so the invoked pty child's events are ignored, and events are narrowed through the existingisDeployEventguard.EXITEDexit code is now remembered from inspection to decide whether the run failed, since it is no longer readable off the final snapshot.waitForis imported fromxstateand its predicate usessnapshot.status === "done";service.send("X")calls becameservice.send({ type: "X" }).The tests in
deploy-machine.test.tswere migrated to match:interpret().onTransition→createActor().subscribe,withConfig({ services })→provide({ actors }),machine.transition→getNextSnapshot, and thestate.eventassertions rebuilt on the inspection API.Checklist