Skip to content

Adds the Back transitions and the trail clears - #777

Merged
johnnyt merged 1 commit into
mainfrom
sb-pkr8-back-transition
Nov 20, 2026
Merged

johnnyt merged 1 commit into
mainfrom
sb-pkr8-back-transition

Conversation

@johnnyt

@johnnyt johnnyt commented Nov 20, 2026

Copy link
Copy Markdown
Member

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.checkpoint row), 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.

  • L3, L4. The reserved event is 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", assigning T[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", assigning T[1][1], then a targetless, condition-free Back last.
  • L5. On an empty trail no condition holds and nothing is taken; inside a step with nothing behind it the catch-all is selected and does nothing.
  • L6. <assign expr="[]" location="T"/>, emitted only into a scope whose trail root is declared: in the <onentry> and <onexit> of a core.subchart, core.map, core.foreach or core.parallel state (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). The core.checkpoint row is left to the request that adds the checkpoint block.
  • L8. A document with no returnable step still comes back from the pass untouched, so its bytes and hash do not move; a boundary in a scope with no returnable step adds no clear.
  • L9. A Back on the scope state belongs to the step it targets; a Back on a step's state to that step; a boundary's clear to the boundary block; a body's or lane's entry clear and a scope's final clear to the block owning the scope state. All under the role :trail, no config key.

A changelog fragment (Added) is included.

Tests

Engine-driven, against the statifier version mix.lock resolves: 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

  • Where the record is silent on a clear's position inside an existing element, this takes one fixed position: a clear goes first in the element's first existing <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>.
  • When the root block is itself the one returnable step, its state is both the scope state and the step's state, every position is inside the step, so only L4's second family is emitted there (the first family on the same state would re-enter the step itself, which L4's "inside a returnable step ... it is the step below it" rules out).
  • The design was ruled by the operator, 2026-11-19 (the trail in the chart's own data, the boundaries that clear it, no switch). The clear on a scope's own final was decided by the conductor under a standing consent, 2026-11-20, and is in the record on main.
  • No accepts handling is added: the record leaves a document that declares accepts and 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 quality green on the committed tree.

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
@johnnyt
johnnyt merged commit 51cb2bc into main Nov 20, 2026
2 checks passed
@johnnyt
johnnyt deleted the sb-pkr8-back-transition branch November 20, 2026 14:33
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