fix(runtime): queue completion events in entry order - #456
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
A state's completion event is queued as its entry unit is performed, so the pool holds two regions' completions in the order the entry draw entered their sources (PSSM 8.5.9) rather than in region declaration order once the move settled. An entry that performs nothing but generates a completion is drawn as an alternative of the entry front, its place in the pool being observable; other silent entries keep riding. Time triggers are still scheduled once the move settles, and a completion held back by a running do behavior or a nested composite's regions keeps its timing. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
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.
What and why
When the entries of two orthogonal regions each generate a completion event, PSSM's pool holds them in generation order — the order the entries happened, which the entry draw decides (§8.5.9: a new completion event goes behind those already in the pool). The runtime queued them once the move had settled, leaf by leaf in region declaration order (
scheduleTransitionEvents), whatever the draw was: underdeclaredthe two coincide, underreverse,seed:<n>,checkandexplorethe pool's order and the draw disagreed. This is the "pool's order follows the entry draw" item ofdocs/internals/design/region-order-scheduling.md, now implemented.enterStateInto(state, branches, last)is told when it enters the last state of an entry path (a region's initial or restored state, a fork branch's or a transition's target, the state a shared path ends at). Where that state completes at once (completesAtEntry: a completion transition out of it and nothing below to enter) it callsscheduleCompletionTransitionsbefore returning, so event IDs follow the draw.scheduleTransitionEvents/scheduleFromLeafnow schedule the time triggers of the settled configuration and its ancestors only — a time trigger still counts from the state's entry, and nothing is double-scheduled.entryHead(state, leaf)makes an entry unit that queues a completion non-silent even when the state performs nothing, since its place in the pool is observable; ordinary silent entries keep riding with the neighboring performing unit. The speculative entry-ahead path (state_route.go) stays silent — it never ends an entry path.settleDoActions) and composite bodies completing throughcompleteIfDonekeep their timing.regionCompletenow checks that the completion vertex a region rests at is its own, not a nested composite'sdone, which the entry-time rule exposed (state_region_completes_at_own_done).Specification basis
PSSM 1.0 (ptc/18-11-06) §8.5.9, ordered completion-event pool; SysML v2 §7.18.1 / PSSM §8.5.5 for the concurrent entry.
docs/project/spec-compliance.md: the entry-order row's wording and coverage are extended; no status moves.precise-semantics-alignment.mdSM10 now agrees under every policy; finding 11 keeps its initial-transition, suite-defect and do-step parts.How it was verified
New fixtures under
internal/exec/runtime/testdata/conformance/, each with.expected.json,.check.expected.jsonand trace goldens (default,declared,seed-1):state_completion_pool_entry_order— two silently entered completing states in orthogonal regions; completion effects log"l r "underdeclared,"r l "underseed:1;checkreaches exactly both.state_completion_pool_history_order(shallow) andstate_completion_pool_deep_history_order(deep) — the same through a history restore.state_completion_pool_fork_order— through a fork's branches.state_region_completes_at_own_done— a nested composite'sdonecompletes its own region only.robustness_completion_order_test.go(TestRuntimeRobustnessCompletionOrder): a witness naming a completing state the front does not hold is refused before any completion is queued; both replayed draws dispatch in the draw's order with nothing left over; a witness ordering the pool after the draw is left over; a wide completing front beyond the run budget ends with the budget error.Goldens that moved (all reviewed;
declaredqueues what it queued, no default outcome moved)state_concurrent_do,state_concurrent_inline_do_bodies,state_anonymous_do_atomic.check.expected.json/.expected.jsongain415263 451263 415623 451623;seed-1trace reordersseqvalues is reached. Comment wording in the.sysmlupdated to matchstate_do_step_among_completionsdid r m,r did m,r m did)m1's andr1's completions dispatch in the entry draw's order; the do step still falls before, between or afterstate_call_trigger_regionsMutedbeforeDimmed)state_composite_region_deeper_first,state_composite_region_depth_orderseed-1outcomes'stateVisitsreorderrstartfirst, sorstart -> r1now dispatches beforelstart -> deep; the old order was the divergence this fixesstate_firing_units_interleavedchoice on accept Go: next l2(entry), r1(exit) (unordered; took l2(entry) first)l2has a completion transition, so its entry is a drawn alternative now; order taken is unchangedPSSM referee — observed vs predicted
No bucket moved: 51 pass / 13 fail / 38 not-expressible / 1 differs-by-design. Every movement is the one the design note's enumeration predicted:
S1(entry)::S2.2(entry)::S1.1(exit)::…),failon the suite's restore-step defectfail; runs 32 → 48Referee output is byte-identical for
-jobs 1,-jobs 8and a repeated-jobs 8(sha2569bf3e0b5…a537f).docs/project/omg-issues.mdunchanged: its History entry already states the two §8.5.9 orders now reached.Gates
Checklist
make testandmake lintpass locallychanges/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.mdmake docs-countsrun if a gate count moved (compliance rows need nothing: the census is counted at docs build)F4,K5) in the body, docs, or changelog