Skip to content

fix(state-machine): export the machine's initial context in the IR - #125

Merged
Theauxm merged 1 commit into
mainfrom
fix/ir-initial-context
Aug 12, 2026
Merged

fix(state-machine): export the machine's initial context in the IR#125
Theauxm merged 1 commit into
mainfrom
fix/ir-initial-context

Conversation

@Theauxm

@Theauxm Theauxm commented Aug 12, 2026

Copy link
Copy Markdown
Member

IrExporter derived nothing for the initial context, so a generated runtime rebuilt it from the schema via defaults. That is wrong for a field with a constrained default: a legislature enum defaulting to "" fails its own OneOf, so every Reset()/initial snapshot lands invalid. The IR now carries the actual StartsAt context (initialContext), which a generated machine uses verbatim. Shape-only machines with an all-defaults initial (turnstile) just gain "initialContext":{}.

IrExporter derived nothing for the initial context, so a generated runtime rebuilt it from the
schema via defaults. That is wrong for a field with a constrained default: a legislature enum
defaulting to "" fails its own OneOf, so every Reset()/initial snapshot lands invalid. The IR now
carries the actual StartsAt context (initialContext), which a generated machine uses verbatim.
Shape-only machines with an all-defaults initial (turnstile) just gain "initialContext":{}.
@codecov

codecov Bot commented Aug 12, 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 404eaab into main Aug 12, 2026
3 checks passed
@Theauxm
Theauxm deleted the fix/ir-initial-context branch August 12, 2026 19:42
@github-actions

Copy link
Copy Markdown

This PR is included in version 1.48.1

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