Repository navigation
fix: enter history states by default without running the incoming effect twice - #693
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #693 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 53 53
Lines 5901 5900 -1
Branches 940 939 -1
=========================================
- Hits 5901 5900 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
fgmacedo
force-pushed
the
fgmacedo/uml-w2a_history
branch
from
October 15, 2026 00:50
d3fb0bc to
7cd2597
Compare
…ect twice A history state with no stored value and no default transition left the machine with an empty configuration; it now enters its parent by default. Entering through history no longer runs the incoming transition's actions a second time: only the history's own default transition is default history content, and only when nothing is stored. Refs #692 Signed-off-by: Fernando Macedo <fgmacedo@gmail.com>
History_001-A, History_002-A and History_002-C pass on both engines now. History_002-B no longer runs the incoming effect twice; it still fails on the interleaving of two regions' completions, so only that blocker stays. Signed-off-by: Fernando Macedo <fgmacedo@gmail.com>
fgmacedo
force-pushed
the
fgmacedo/uml-w2a_history
branch
from
October 15, 2026 00:52
7cd2597 to
71f1047
Compare
|
This was referenced Oct 15, 2026
This was referenced Oct 15, 2026
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.



Why
The engine set the default history content to the incoming transition unconditionally (
engines/base.py,_add_history_states_to_enter). Two bugs came from that one line:HistoryStatewith no stored value and no default transition left the machine with an empty configuration, silently. Its effective targets were empty too, so the transition domain wasNoneand ancestors of the history's parent were never entered.on=actions twice (once as transition content, once as "default history content" on entry of the parent), with a stored value and also with a default transition.Refs #692
What changes
get_effective_target_statesreturns the parent in that case, so the transition domain, exit set and ancestor entry are computed as for a transition to the parent. A missing default stays valid at definition time: the existing docs example declares none, and SCXML documents always have one.<initial>targeting a history, where the factory also adds an initial transition to the first child) only passed because of the double run removed above.docs/states.mddescribes first-visit behavior, with a doctest.Evidence
tests/test_statechart_history.py(TestHistoryDefaultEntry, shallow and deep, sync and async viasm_runner): empty-history default entry, entry of the parent's ancestors, entry from a sibling, incoming effect once with a stored value and with a default, default content skipped when a value is stored. All failed onmainbefore the fix.tests/uml/pssm/, after rebasing on feat: accept x- extension keys in native documents and run the OMG PSSM 1.0 test suite #697):History_001-A,History_002-A(B2) andHistory_002-C(B1) now pass on both engines and run unmarked.History_002-Bstill fails, so it stays in the xfail map: the incoming effect no longer runs twice (B2 is gone from its trace), but the library groups the completion transitions of its two regions into one microstep, while every expected trace runs each region's completion in its own microstep. Its reason now lists only that blocker (unclassified). No other entry changed.error.executionraised by the incoming effect, sync/async divergence, and ran every W3C file on bothmainand this branch (identical pass/fail sets). No material findings; every scenario it found differing frommainwas amainbug (empty configuration or doubled effect).--runxfailbefore and after the fix; the failing set differs by exactly the three removed cases on both engines, every remaining entry still fails on both, andHistory_002-B's traces confirm the doubled effect is gone and only the region interleaving remains. No material findings.Not verified