Skip to content

Adds Back through a plain returnable step - #264

Merged
johnnyt merged 1 commit into
mainfrom
se-6b57-returnable-step
Nov 22, 2026
Merged

johnnyt merged 1 commit into
mainfrom
se-6b57-returnable-step

Conversation

@johnnyt

@johnnyt johnnyt commented Nov 22, 2026

Copy link
Copy Markdown
Member

What this does

Back through the engine, in the reference embedder, through a plain returnable host step type.

  • myapp.step (StatifierExamples.Signup.ReturnableStep): a plain, non-composite block type registered in the host's palette beside the composite myapp.screen. It declares statifier_blocks' optional returnable?/1 callback (always true), so a document built from it compiles with a trail and answers the reserved back event. Its config names the screen it shows, its buttons' outcomes (each finishes the step) and its questions' keys (each written to responses.<key> only where the press carried it). It does not read a screens document, so a second document reuses it by naming it.
  • Journey: a view now carries back, read from StatifierBlocks.Runtime.Back.offered?/3 over the execution's datamodel and active leaf states and passed to riddler as the screen status's "back", so it is riddler's moves' own. Journey.back/3 decodes the client's request with Riddler.Journey.decode_submit/1, checks it names the screen the execution is on and that Back is offered, and raises statifier_blocks.back on the execution. Nothing typed on the screen left is sent; held responses stay. A myapp.step block parks on its own block id.
  • The Journey page (signup_journey_live.ex) draws a Back control wherever the view's back is true and nowhere else, sends riddler's back request {"screen": key, "back": true}, and starts the re-shown screen's draft from the values riddler presents, so Continue there sends what the reader gave before. ?path=patron_registration_steps runs the proof document; the page's Back handling reads the view, never the Path's name.
  • The proof document: patron registration in steps (priv/fixtures/patron_registration_steps.json: the patron's name, the card, the home branch, each a myapp.step block, and its screens document patron_registration_steps_screens.json), run as a supplied Path through StatifierExamples.Library.RegistrationSteps. It is not one of the fixtures Charts.fixtures/0 lists.

The signup Path is unchanged

The signup Path keeps its composite myapp.screen type and its authored back edge, the on_went_back slot in signup_path.json; neither file changes. A composite cannot be declared a returnable step (statifier_blocks ADR-0002, C12b), so Back through the engine is shown with the plain step type instead: ruled by the operator, 2026-11-22. Its Back reader answers false on every screen, so the page draws no engine Back control there and the plan screen's own Back button is still the one shown.

The compiled bytes of signup_path and patron_registration are pinned in the new test at their values on main before this change, and they do not move: neither uses the new type.

No statifier_blocks change and no new release; the dependency versions are as on main.

Provenance

  • The type's config lists its buttons' outcomes and its questions' keys rather than reading a screens document, so one type serves any screens document; a step finishes as done whichever button was pressed.
  • The page's draft after Back starts from the presented values, the same rule the screen editor's Try already uses; a secret question is never held, so it is typed again.
  • statifier_blocks spells the reserved back event only inside its compiler, so the host spells it once, in Journey.back_event/0.
  • Updated pinned lists for the new palette entry (charts_test.exs, signup_test.exs), and named the new screens document among the files that are not block documents (block_schema_test.exs). The new type leads its schema with the shared label field, as every host type does.

Tests

test/statifier_examples/signup/returnable_step_test.exs (the type, the Journey walking the steps back and forth, the refusals, the signup Path) and a new describe block in signup_journey_live_test.exs (the page). Every new test carries a sabotage note from a run: each mutation applied, the named test failed on an assertion, and the file was restored byte-equal from a copy before the next.

Full mix quality green on SQLite.

Registers myapp.step, a plain host block type beside the composite
myapp.screen, that declares statifier_blocks' returnable?/1, so a Path
built from it compiles with a trail and answers the reserved back
event. Journey reads Back from Runtime.Back.offered?/3 into riddler's
moves, and Journey.back/3 decodes riddler's back request and raises
the event. The Journey page draws a Back control from the view and
runs a small patron registration Path in three steps under ?path=.

The signup Path keeps its composite screens and its authored back
edge; its compiled bytes, and patron registration's, are unchanged.

Refs: se-6b57
@johnnyt
johnnyt merged commit d4a1d2f into main Nov 22, 2026
4 checks passed
@johnnyt
johnnyt deleted the se-6b57-returnable-step branch November 22, 2026 15:30
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