Repository navigation
fix(durable): Start and Recover start a compound state's services and actors - #286
Merged
Merged
Conversation
StartEffects covered the active leaves only, so a service or actor declared on a compound state started when a Fire entered that state - the kernel's entry path emits every entered state's invokes - but not when a host cast into it or resumed in it. It now reports every state the active configuration makes active, each leaf and its compound and parallel ancestors, in entry order, each state once. ResumeEffects stays leaves-only: a snapshot can't say which of a compound state's invokes had already settled into one of its children, so a host that re-arms from StartEffects alone after a Restore may run one again; the durable runner records which settled and skips them (#249). Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
… actors Start and Recover started only the active leaves' invokes, while a Fire that entered a compound state started its declares, so an instance that started in, or recovered into, a compound state ran without that state's services and actors. The widened StartEffects flows through: a compound state's service that settled into one of its children lands in the checkpoint's EndedServices as the leaves' do, its ended actors in EndedActors, and the unstarted/ended rule covers its actors. Unskips the four #234-era tests, each shown failing on the parent branch: Start didn't spawn a superstate's actor, the settled compound service wasn't found in flight, the compound's actor wasn't spawned for a delivery, and Recover never retried a compound's unstarted actor. Pins a compound state's ended actor landing in EndedActors, the actor side of the settled rule, which no surviving test pinned: Recover leaves it ended by the journal, by a checkpoint, and by one a recovered Handle took. Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
reka18
marked this pull request as ready for review
December 2, 2026 15:35
joshua-temple
approved these changes
Dec 2, 2026
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.
What was wrong
Instance.StartEffectscovered only the active leaves. When aFireentered a compound state, its services and actors started, because the kernel's entry path emits every entered state's invokes. WhenStartcast into that state, orRecoverresumed in it, they didn't start. So a durable instance that started in a compound state, or recovered into one, ran without that state's services and actors.#234 tried this widening and reverted it, to keep
state's v1 behavior unchanged inside that PR. This PR brings it back on its own.What changed
state:StartEffectsnow reports every state the active configuration makes active: each leaf and its compound and parallel ancestors, in entry order, each state once.ResumeEffectsstays leaves-only, and its doc says why: a snapshot can't say which of a compound state's invokes already settled into one of its children.durable: the widenedStartEffectsflows throughStartandRecover. A compound state's service that settled lands in the checkpoint'sEndedServices, and its ended actors land inEndedActors, the same as a leaf's. Recover's rule for unstarted and ended actors covers them too.Startdidn't spawn a superstate's actor, a settled compound service wasn't found in flight, the compound's actor wasn't spawned for a delivery, andRecovernever retried a compound's unstarted actor.EndedActors. Recover leaves it ended whether it reads the journal, a checkpoint, or a checkpoint taken by a recovered Handle.durable/older_checkpoint_compound_test.go: those two tests pinned a guard for checkpoints written before the journal recorded ended services and actors. fix(durable): don't journal a step whose context ended partway #234 added that guard and then reverted it along with the widening. durable is greenfield, so this PR doesn't bring back an older-checkpoint gate.How it's tested
stateanddurable:go build,go test -race ./..., and golangci-lint with CI's config. All pass.examples/fooddeliveryandexamples/dispatchboth callStartEffects, and both pass.Fixes #249