Skip to content

Lets a setup end more than one way - #280

Merged
johnnyt merged 1 commit into
mainfrom
se-qb73-setup-outcomes
Nov 27, 2026
Merged

johnnyt merged 1 commit into
mainfrom
se-qb73-setup-outcomes

Conversation

@johnnyt

@johnnyt johnnyt commented Nov 27, 2026

Copy link
Copy Markdown
Member

Refs: se-qb73

What changes

  • A setup can end more than one way. A new host block type, myapp.setup (StatifierExamples.Library.Setup), is a composite: a core.group whose body is exposed as a pass-through slot for the setup's myapp.step blocks, and whose rail holds one core.on_event when the config names an ending. Its params are ending (the outcome), ending_on (the button whose press can end it) and ending_when (a condition on what the press carried). declared_outcomes/1 answers done and then the ending, so a compile for use as a child gives the document both root outcomes. The step records the press first; the handler then abandons the group with the ending's outcome.
  • The card-reader setup uses it. Its root moves from core.sequence to myapp.setup with ending: site_visit_needed, raised when the test-card screen's Finish reports not_read. The catalogue sync and the reading-list import keep their core.sequence roots and finish as before.
  • Library.Setups.outcomes/1 answers the set: ["done", "site_visit_needed"] for the card-reader setup, ["done"] for the other two.
  • The onboarding reads how a setup ended. Its subchart declares both outcomes (the package refuses a child whose root declares one the block does not) and writes what each setup finished with to a new datamodel root, last_setup.
  • The Journey page names the running Path. Its heading and its notice for a press that did not land read the Path's own document name ("Card-reader setup", "This card-reader setup had already ended"). The signup Path keeps "Signup journey" and "This signup"; no test built on the signup fixtures changed.
  • The settings page shows a sentence for a librarian per setup, kept in Library.Setups (description/1) beside the one list, in place of each document's own metadata description, which is written for whoever edits the document.

Provenance

  • The ending is a condition on an existing button rather than a new button. Adding a button to card_reader_setup_screens.json would change a file UpgradedScreensTest pins as the upgrade task's byte-for-byte rewrite, so the screens documents are unchanged.
  • One ending per setup: enough for the setups this app ships. A list of endings is a later widening of the params.
  • The reader-facing sentence lives in Library.Setups rather than in the documents: the list of setups and how a page offers them is that module's.
  • myapp.setup is registered through a new StatifierExamples.Library.block_types/0, as the card and signup domains register theirs.

Tests

  • Library.SetupsTest: the declared outcomes per setup; a test-only copy whose ending is on the first step ends there under its condition and moves on otherwise; each librarian sentence names no block type or file; doctests of Library.Setup.
  • Library.OnboardingTest, "how a setup ended": the card-reader child finishes with site_visit_needed on a card it did not read and with done on one it read, and the onboarding's last_setup holds that outcome before it moves on to the next pick.
  • SettingsLiveTest: the librarian sentence is drawn and the document's description is not; the Journey page's heading and ended notice name the card-reader setup.
  • Each new test carries a sabotage note; every mutation was run, turned its test red on an assertion and was restored byte for byte.

Gate

Full mix quality green on the committed tree (format, compile with warnings as errors, deps, credo, dialyzer, the full suite at 88.2% coverage). The commit is the staged tree that run went green on, with the gate lock and a machine slot held across both, so the commit did not re-run it.

Review tier

More than 300 changed lines outside docs and test fixtures, so this takes a cold review pass before it merges.

A myapp.setup root runs a setup's steps and declares done plus one
ending, raised when a named button's press meets a condition. The
card-reader setup uses it: a test card the reader did not read ends
the setup with site_visit_needed. Library.Setups' outcomes answer
the new set, and the onboarding's subchart declares it and writes
what each setup finished with to last_setup.

The Journey page's heading and ended notice name the Path's own
document; the signup Path keeps its wording. The settings page
draws a sentence per setup written for a librarian, kept in
Library.Setups beside the one list.

Refs: se-qb73
@johnnyt
johnnyt merged commit 48f182e into main Nov 27, 2026
4 checks passed
@johnnyt
johnnyt deleted the se-qb73-setup-outcomes branch November 27, 2026 23:46
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