Skip to content

feat: expire idle state-machine drafts on read - #119

Merged
Theauxm merged 1 commit into
mainfrom
feat/snapshot-draft-ttl
Aug 1, 2026
Merged

feat: expire idle state-machine drafts on read#119
Theauxm merged 1 commit into
mainfrom
feat/snapshot-draft-ttl

Conversation

@Theauxm

@Theauxm Theauxm commented Aug 1, 2026

Copy link
Copy Markdown
Member

Add an opt-in draft TTL to the persistence layer. When Load reads a draft whose updated_at is older than the configured window, it deletes the row and returns NotFound, so the caller starts fresh. Deleting rather than ignoring also clears a committed (terminal) draft, so a returning user isn't wedged behind a finished one.

Configured via AddTraxStateMachines(o => o.DraftTtl = ..., asm); the default is null (never expire). Checked lazily on load only, so there's no scheduled job and an active advance/autosave is never disturbed. Adds ISnapshotStore.Delete and surfaces UpdatedAt on StoredSnapshot.

Add an opt-in draft TTL to the persistence layer. When Load reads a draft whose updated_at is older than the configured window, it deletes the row and returns NotFound, so the caller starts fresh. Deleting rather than ignoring also clears a committed (terminal) draft, so a returning user isn't wedged behind a finished one.

Configured via AddTraxStateMachines(o => o.DraftTtl = ..., asm); the default is null (never expire). Checked lazily on load only, so there's no scheduled job and an active advance/autosave is never disturbed. Adds ISnapshotStore.Delete and surfaces UpdatedAt on StoredSnapshot.
@codecov

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Theauxm
Theauxm merged commit ff772e1 into main Aug 1, 2026
3 checks passed
@Theauxm
Theauxm deleted the feat/snapshot-draft-ttl branch August 1, 2026 18:00
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

This PR is included in version 1.46.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant