Skip to content

Tests the Journey access design end to end - #276

Merged
johnnyt merged 1 commit into
mainfrom
se-uea8-end-to-end-access
Nov 27, 2026
Merged

johnnyt merged 1 commit into
mainfrom
se-uea8-end-to-end-access

Conversation

@johnnyt

@johnnyt johnnyt commented Nov 27, 2026

Copy link
Copy Markdown
Member

Adds one test module that proves the Journey page's access design end to end on the app's SQLite database (the suite's own StatifierExamples.Repo sandbox; no second database setup). Tests only: nothing under lib/ changes.

What it proves

  • A person outside a Journey's scope cannot mount it: the branch onboarding, the setup it runs (named by its own id) and a patron's registration are each refused, with the one refusal and no execution id, to a librarian of another branch, to a visitor who is no librarian, or to a visitor of another session.
  • A person outside the scope cannot submit or go back. The press is refused and the stored execution does not move.
  • A setup the onboarding runs as a durable child is checked against the branch scope it inherited: a page mounted on the onboarding presents the child, the component holds the child's recorded scope, a librarian of another branch is refused the press, and another librarian of the same branch is let through.
  • The patron registration's PIN reaches no HTML the page draws: the screen as first drawn, re-presented after the PIN is typed, drawn with the findings of a refused press, the next screen with the collected responses, and that screen on a fresh mount.

How an outsider's submit and back are driven

An outsider is never drawn the form or the Back control, because RiddlerLiveView.Journey asks the access module before it draws. Pressing on a page an outsider loaded would test a missing form. So a member mounts the page and is drawn the form, and the test then replaces the actor the component holds with an outsider's before the press (:sys.replace_state on the LiveView process). The screen, form, button and Journey are unchanged, so the component's Riddler.Journey.Access.check/4 for :submit or :back is the only thing between the press and the host. The same replacement with another member of the scope goes through, so the replacement alone is not what refuses. It stands in for an access answer that changes mid-Journey; this app's actor comes from the session, which does not change under a running page.

What is not covered, and why

No Path this app runs offers Back to or from the screen that asks the PIN, so the secret test has no Back step. A fresh mount after the PIN is stored stands in for it. Adding such a Path would mean a new fixture, and this change adds none.

Sabotage notes (each run, each restored byte-equal)

  • JourneyAccess.member?/2 answering true for every scope: the mount, submit and back tests each went red on their refusal assertion.
  • The driver's inherited_metadata_keys: set to []: the child recorded no scope, the riverside librarian's page was refused the setup's screen, and the submit test went red.
  • The seal step in Signup.Journey answering the responses unsealed: a page drawn after the press carried the PIN, and the secret test went red.

Gate and review

Full mix quality green on the committed tree. Review tier: gate (tests only, under the size threshold). The pre-request review round (diff critic, test critic) ran on the branch before this request opened.

One test module drives the Journey page on SQLite. A person outside
a Journey's scope cannot mount it, submit on it or go back on it. A
setup the branch onboarding runs as a durable child is checked
against the branch scope it inherited. The patron registration's PIN
reaches no HTML the page draws.

An outsider is never drawn the form, so a submit or a back request is
driven by replacing the actor the component holds, on a page a member
mounted, with an outsider's; another member put in the same way is
let through.

Refs: se-uea8
@johnnyt
johnnyt merged commit 1b7db81 into main Nov 27, 2026
4 checks passed
@johnnyt
johnnyt deleted the se-uea8-end-to-end-access branch November 27, 2026 22:04
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