Skip to content

#14 - Option for Persistent Context Parameters/Errors After Substates#61

Merged
DamianSuess merged 7 commits intodevelopfrom
feature/14-IsContextPersistant
Jan 1, 2026
Merged

#14 - Option for Persistent Context Parameters/Errors After Substates#61
DamianSuess merged 7 commits intodevelopfrom
feature/14-IsContextPersistant

Conversation

@DamianSuess
Copy link
Contributor

@DamianSuess DamianSuess commented Jan 1, 2026

Details

Adds the option for persisting the Context's Parameters and ErrorStack after returning back from the Composite's sub-states. This feature provides the ability to maintain a more lean memory usage during the lifetime of the state machine.

New property

IsContextPersistent

Architecture Updates

When IsContextPersistent is disabled (false), it will take snapshot of original Context keys AFTER the OnEntering transition so we can give the state a chance to purposely add new keys to and carry forward for subsequent top-level states.

Any new Context keys added via OnEnter are considered "for children consumption only". After our OnExit, they'll be (optionally) removed.

… and ErrorStack after the parent composite state's OnExit.
…mposite state. Added note for method name change
…Service for test. Renamed BaseDiState->DiStateBase, added helper TestBase for common methods for all tests.
…safely passed along. Updated tests to confirm IsContextPersistent is honored and properly removed keys when not.
…through "OnEntering" transition and will carry forward to other top-level states. Any new keys added during Composite's "OnEnter" transition will pass forward to sub-states, but will optionally deleted after the Composite state's "OnExit transition.
@DamianSuess DamianSuess added this to the v2.1 milestone Jan 1, 2026
@DamianSuess DamianSuess self-assigned this Jan 1, 2026
@DamianSuess DamianSuess added the enhancement New feature or request label Jan 1, 2026
@DamianSuess DamianSuess merged commit 1df1df5 into develop Jan 1, 2026
@DamianSuess DamianSuess deleted the feature/14-IsContextPersistant branch January 1, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v2.1] Optional To Persist Context Parameters and ErrorStack through Composite States

1 participant