Repository navigation
Adds the Back transitions and the trail clears - #777
Merged
Merged
Conversation
A document with a returnable step now answers the reserved event statifier_blocks.back. The scope state carries one Back per step that re-enters the trail's top step and pops it; each step's state carries one Back per other step of its scope that re-enters the step below it, then a targetless catch-all, so Back with nothing behind a step does nothing. The trail clears on entering and leaving a core.subchart, core.map, core.foreach or core.parallel, on each loop iteration and lane entry, and on a scope's own final, so Back never crosses a boundary and a finished scope offers none. A document with no returnable step compiles to the same bytes. Refs: sb-pkr8
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
A document with a returnable step now answers Back. This builds L3, L4, L5 and L6 of ADR-0004's Amendment of 2026-11-20 (except L6's
core.checkpointrow), and the parts of L8 and L9 they touch, by extending the trail pass already on main (StatifierBlocks.Compiler.Trail) rather than adding a second pass.statifier_blocks.back. The scope state carries one Back per returnable step of its scope, in document order, after its existing transitions:cond="T[0] === 'S'",target="S",type="internal", assigningT[1]. Each returnable step's state carries one Back per other step of the same scope, in document order, right after the push and before what the step's type emitted:cond="T[1][0] === 'S'",target="S", assigningT[1][1], then a targetless, condition-free Back last.<assign expr="[]" location="T"/>, emitted only into a scope whose trail root is declared: in the<onentry>and<onexit>of acore.subchart,core.map,core.foreachorcore.parallelstate (the trail of the scope the block belongs to), in the loop body's and each lane region's<onentry>(their own trail), and in the<onentry>of each<final>child of a scope state (that scope's trail). Thecore.checkpointrow is left to the request that adds the checkpoint block.:trail, no config key.A changelog fragment (Added) is included.
Tests
Engine-driven, against the statifier version
mix.lockresolves: Back at the first step does nothing (an entry counter does not move); Back at the second step re-enters the first and pops; Back from a step that is not returnable re-enters the trail's top step; Back after a finished document, and in a finished lane while another runs, takes no transition; inside a loop body Back stays in the body and each iteration starts with an empty body trail; a loop is a boundary for its enclosing scope; inside a lane Back stays in the lane. Byte tests pin the transition shapes and placement, the sub-path clears, the body and lane entry clears, and that a boundary in a scope with no step adds nothing; a provenance test pins the owners. Each new test carries its sabotage note, and each was run.Provenance
<onentry>or<onexit>, ahead of what was there (a final's outcome raise included). A state with no<onentry>gets one holding only the clear, first among its children after its<data>; a state with no<onexit>gets one holding only the clear, right after its<onentry>.acceptshandling is added: the record leaves a document that declaresacceptsand has a returnable step undecided, and so does this request.Observation
Popping one entry (
T[1]) in place of two (T[1][1]) in a step's Back behaves the same in the engine, because re-entering the target runs the push, whose guard skips a step already on top. The emission follows the record's two pops; the byte test pins it.Gate
Full
mix qualitygreen on the committed tree.