Repository navigation
fix(durable): dispatch the effects of a parent transition an actor drives - #270
Merged
Merged
Conversation
Contributor
Author
Review findingsThe AI reviewers' pass over this change checked every review label and found nothing. Five candidates were raised, and each was refuted against the code:
|
Contributor
Author
Decisions for Temple to ratifyI made these calls in this PR. Each is a suggestion for you to confirm or change.
|
This was referenced Nov 18, 2026
reka18
force-pushed
the
fix/durable-actor-outcome-replay
branch
from
November 23, 2026 18:42
23391d7 to
681f0ef
Compare
…or's failure with no onDone Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
…ives A parent Fire an actor drove — a failed spawn's onError during a Fire, a Tick, or a service settle's transition, or a settle or message a DeliverToActor delivery drove — was journaled with the driving step, but its domain effects were never named among the step's, so the EffectHandler never applied them, live or on Recover: the id the effect would have carried deduplicated nothing, because no dispatch ever happened to deduplicate. - durable: drivenFireEffects appends a driven Fire's effects after the driving step's own, in fire order, and fireStep, tickStep, DeliverToActor and the RunService settle all name them through recordStep, so they dispatch under the same deterministic ids as any step effect. - durable: replayActors returns the effects of the transitions it re-fires, and replayRecord folds them into the step's effects after its own work, so Recover re-dispatches a driven Fire's effect that a crash kept from landing, exactly once. The Fires an actor spawned by Start or Recover drives still dispatch none, live and on replay: that gap is filed separately as #269. - durable: DeliverToActor now dispatches after releasing the step lock, as Fire does, since a delivery's step can name effects, and an effect handler must be able to call back into the same Handle. - durable: the EffectID contract states the order: a step's own effects first, then each actor-driven parent Fire's, in fire order, identical live and on Recover, so the ordinal component places a driven Fire's effect the same way on both. Closes #257. Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
reka18
force-pushed
the
fix/durable-actor-driven-effects
branch
from
November 24, 2026 19:40
685a0a4 to
1e2f238
Compare
…dler calling back into the Handle Follow-up to the review of #270: the DeliverToActor doc named the dispatch but not what a failure of it leaves behind, where Fire, Tick and RunService each do; and nothing pinned that a delivery dispatches after releasing the step lock, so its effect handler can call back into the same Handle. - durable: the DeliverToActor doc states the failed-dispatch mode as its siblings do: a failed dispatch fails the Handle with ErrHandleFailed; the step stays recorded, and Recover sends its effects. - durable: TestDeliverToActor_AnEffectHandlerCallsBackIntoTheHandle pins that an effect handler dispatched from a delivery's step — one naming the effects of the parent Fires it drove — can View and Fire on the same Handle, both succeeding without deadlock or ErrReentrantStep, bounded by waitFor so a dispatch under the step lock fails the test rather than hanging it. Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
reka18
marked this pull request as ready for review
November 24, 2026 20:07
joshua-temple
left a comment
Collaborator
There was a problem hiding this comment.
- One medium finding inline: the published exactly-once contract still says actor-driven parent transitions are not dispatched.
- Checked: live naming vs replay order on Fire, Tick, DeliverToActor, RunService; Start/Recover
beforeentries excluded on both sides; refused Fires carry no effects (state/fire.go:160). - Checked: delete-the-fix on each seam and on replay fails the new tests; own/driven order swap fails the id test;
go test -race -count=30on the new tests is clean.
… once The published exactly-once contract still said a parent transition an actor drives 'isn't dispatched'. Since 1e2f238 a step an actor system drove dispatches the domain effects of the parent Fires it drove as its own, live and on Recover. Update the three places the old claim lives — the package doc, the module README, and the durable overview page — to state the new contract, with the remaining gap kept explicit: an actor spawned by Start or Recover still drives parent transitions whose effects are not dispatched yet (#269), and Runner.Start's initial entry remains at-least-once. Closes the docs part of Temple's review of #270. Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
joshua-temple
approved these changes
Nov 24, 2026
joshua-temple
left a comment
Collaborator
There was a problem hiding this comment.
- Live dispatch and recovery replay match on all 4 paths
- Removing the fix fails the new tests
- Docs gap noted in prior review, non-blocking
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 this does
A parent transition that an actor drives can emit domain effects, such as an email or a charge. durable never dispatched them, either live or on
Recover. The same transition dispatched its effects when the host reached it throughHandle.Fire, and dropped them silently when an actor drove it.Now every step adds the effects of the parent Fires its actors drove after its own, and dispatches them. This holds for:
Fire, when an actor spawned during the step settles or fails;Tick, when a timer enters a state that spawns an actor;RunServicesettle, including when an actor the step drove aborts and the Handle fails: the settle the step records names the driven effects, so they still dispatch;DeliverToActor.Replay adds the same effects into the step's dispatch list, so a
Recoverafter a crash between Append and dispatch sends them with the same deterministic ids.Effect order. A step's own effects come first, then each actor-driven parent Fire's effects in fire order. The
EffectIDgodoc says so, and a test pins the ids live and onRecover.DeliverToActor now dispatches outside the step lock, the way
Fire,TickandRunServicealready finish. That way a dispatch handler can call back into the Handle. The step is marked as dispatching before the lock is released, soDrainand a laterRecoversee it.There's no journal format change. A parent Fire driven by an actor that
StartorRecoverspawned is out of scope, and is tracked in #269.Tests
TestFire_DispatchesTheEffectsOfAParentFireAnActorDroveis no longer skipped.TestActorDrivenFire_DispatchesItsDomainEffectscoversFire,DeliverToActor,TickandRunService, both live and onRecoverafter a crash before dispatch.TestActorDrivenFire_EffectIDsPutTheStepsOwnFirstpins the order.TestActorDrivenFire_DispatchesOnAServiceSettleAnActorAbortedIncovers theRunServicesettle when an actor abort fails the Handle, both live and onRecover.Recovercase.Checks
mage checkpasses in every module (go1.27.4)Also in this PR
TestWithSettleTransform_ARewrittenFailureNothingRoutesEscalatesnow covers theInvokeActorpath as well asSpawn: a transform flips an invoked actor's failure to success with no onDone wired, and the original error escalates. It answers a #268 review comment. It came after #268's approval, so it rides here. It's test-only.Closes #257