Add XState v5 descriptor and target parity - #41
Merged
Conversation
JovaniPink
marked this pull request as ready for review
August 24, 2026 18:14
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.
Summary
Bring event descriptor selection and relative target resolution into stable XState v5 parity while preserving the W3C SCXML run-to-completion core.
Rationale
XState 5.32 clarified that a failed exact descriptor guard must fall through to matching partial wildcard descriptors. The existing Python selector performed exact equality only, which skipped catch-all and partial descriptors entirely. The target parser also accepted IDs and single-segment siblings but rejected common XState paths such as
on.hist.This change keeps XState descriptor matching separate from W3C bare-prefix descriptor semantics. A bare
errordescriptor remains exact and does not matcherror.platform.Scope
event.*for botheventand dotted descendants.target: "on.hist".Non-scope
Validation
Local Python 3.14:
poetry run python -m pytest tests/ --ignore=tests/test_scxml.py: 459 passed.poetry run python -m pytest tests/test_scxml.py: 57 passed.poetry run mypy src/xstate/: passed.poetry run mypy --strict src/xstate/algorithm.py: passed.poetry check --lock: passed.poetry build: passed.poetry run python scripts/validate_distribution.py: installed-wheel smoke passed.Hosted exact head
6468d8363d49715ceb8f1efc2260907aa736289b:Risks and rollback
The main risk is event selection changing for configurations that already contain wildcard-looking keys. Coverage locks exact priority, guard fallback, invalid wildcard forms, ancestor fallback, and parallel region independence. Target resolution is limited to explicit dotted traversal through configured child keys.
Rollback is a revert of this PR. No persisted data, migration, dependency, or release artifact is changed.
Review focus
select_transitions.event.*semantics and exact bare descriptors.Stack and merge order
This is PR 1 of 3 and targets
master. Merge it beforebounded-microstep-traces, thenactor-ref-boundary.