Repository navigation
fix(engine): isolate each event dispatch snapshot - #2013
Merged
joeykchen merged 1 commit intoSep 28, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Reviewed the complete fixed diff for the event snapshot ownership change, including reentrant dispatch, subscription mutation, panic recovery, concurrent triggers, and the generated type snapshot. No actionable correctness or regression findings remain. Verified with go test ./pkg/spx/pkg/engine, go test -race ./pkg/spx/pkg/engine, and go test ./pkg/spx/....
songweijun1203
approved these changes
Sep 28, 2026
joeykchen
force-pushed
the
fix/event-dispatch-snapshot-ownership
branch
from
September 28, 2026 04:28
960198e to
a39c896
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.
A callback that synchronously triggers its own event can overwrite the outer dispatch's shared callback arrays, causing duplicate callbacks and a nil-call panic. Concurrent triggers also race on those arrays. Give each dispatch an ordered callback snapshot captured under the mutex, then invoke it after unlocking.
The cleanup pass shares the snapshot operation across all three event arities and removes persistent scratch buffers, their cleanup helper, unused state and redundant constructor initialization. Subscription order and changes during dispatch retain their existing semantics.
Validation: