Fix/verb event inject id before deserialize#237
Open
ChrisThompsonTLDR wants to merge 19 commits intohirethunk:mainfrom
Open
Fix/verb event inject id before deserialize#237ChrisThompsonTLDR wants to merge 19 commits intohirethunk:mainfrom
ChrisThompsonTLDR wants to merge 19 commits intohirethunk:mainfrom
Conversation
Serializer excludes Event::id during serialization (IGNORED_ATTRIBUTES) but SerializedByVerbs events require it for deserialization. Merge the verb_events row id into the data so the event reconstructs with the correct id instead of failing or generating a new one.
Fixes FsmTransitioned deserialization error when firing with named args - Events require an id but we don't have one yet when creating fresh.
…ies with union types ReflectionUnionType (e.g. FsmStateEnum|string|null) does not have isBuiltin() or getName() - only ReflectionNamedType does. Guard with instanceof before calling.
…llProperties ReflectionUnionType does not have getName() - only ReflectionNamedType does. Guard with instanceof before calling; union-typed properties cannot be State.
…Interface/Carbon)
…ReflectionUnionType Updated the EventStateRegistry class to handle ReflectionIntersectionType and ReflectionUnionType correctly. Added necessary guards to prevent errors when dealing with union-typed properties in the findAllProperties method. This improves the robustness of state discovery for events.
Co-authored-by: Cursor <cursoragent@cursor.com>
…es - not needed for event ID fix Co-authored-by: Cursor <cursoragent@cursor.com>
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 pull request introduces improved handling of event
idserialization and deserialization, adds a new configuration option to control this behavior, and enhances type safety in property reflection. It also expands compatibility for several dependencies and adds comprehensive tests to ensure correct eventidhandling.Event ID Serialization & Deserialization Improvements:
serialize_event_idconfiguration option inconfig/verbs.phpto control whether the eventidis included in serialized data. By default, it is excluded, and the row's primary key is used as the source of truth for the eventid.VerbEvent::event()to always inject the rowidinto deserialized events, ensuring correct deserialization even when the stored data lacks anidor contains a stale value.serialize_event_idconfig, excluding or includingidas appropriate during serialization.PendingEvent::hydrate()to inject a generatedidif missing when hydrating new events.Type Safety and Reflection Enhancements:
EventStateRegistryandNormalizeToPropertiesAndClassNameby explicitly checking forReflectionNamedTypeand ensuring nullability is handled safely. [1] [2] [3] [4]Dependency Compatibility:
illuminate/contractsandlaravel/promptsincomposer.jsonfor broader Laravel compatibility.Testing:
VerbEventDeserializesWithoutIdInDataTest.phpto verify correct event deserialization whenidis missing or stale in stored data and to confirm serialization behavior with the new config option.Documentation:
serialize_event_idoption and related logic. [1] [2]