Repository navigation
test(e2e): the browser journey of the sign-in by code, and a second e2e suite for the screens that need mail - #238
Merged
Merged
Conversation
… the journey of the sign-in by code D-042's code form had every proof but a browser's: the app draws "Sign in with unique code" only where the instance says mail is on, and the first e2e suite holds that its target has none (m2-sign-in-methods asserts the button is absent, the pinned Plane has no mail, and the count guard holds every file of e2e/journeys/ to a pass on every run). So the journeys that need mail are a suite of their own, e2e/journeys-mail/, run by a pass of its own. - scripts/contract.sh: the `e2e-mail` pass (Worker targets): the e2e pass's app and CSRF default, the `mail` pass's mail service (the send_email binding as wrangler dev simulates it, THRUST_PUBLIC_BASE_URL, THRUST_MAIL_WRANGLER_LOG for the browser run to inherit), the vacuity guard (is_smtp_configured must be true here and false everywhere else), and an arm that runs scripts/e2e.sh with E2E_SUITE=mail. - scripts/e2e.sh: `<target> [mail] [controls]`; the count guard counts the suite's directory; E2E_RECORD_HAR and plane-oracle are refused for the mail suite (a HAR would hold a live code; the pin writes its code to its Valkey and has no mail sink); the mail suite's controls. - e2e/support/mail.ts reads the simulator's log (colours stripped, polled until the message is there: the lines reach the log after the response) and takes the code from the subject; account.ts is the sign-up and onboarding the journey starts with; assertMailTarget refuses a target without mail; controls.ts gains smtp-off, code-dropped and mail-unread. - The journey: sign up, new visit, "Sign in with unique code", read the mailed code, a wrong code (302 to 5090, the banner, the code step again), Resend (a second code), the first code refused, the second signs in, a reload stays in the workspace on a HttpOnly Secure __Host-thrust_session cookie; the network log holds two 200s and three 302s, no 404, no 5xx. Measured: `scripts/e2e.sh worker-cf mail controls` is VERDICT: PASS (the journey 5 of 5 runs; each control fails it by its words; slow-page passes; the count guard refuses a skip); `scripts/e2e.sh worker-cf controls` (the first suite) is unchanged and green; contract.sh worker-cf mail 7/7 and main 71/71 with the edited script. Refs: #46 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Registers the mail suite's pass as a cell of the matrix, so a pull request runs it and the gate holds it. - scripts/contract-all.sh: `run worker-cf e2e-mail` (26 cells; plan-cells.sh reads the list). - plan-ci.py: the rules that run the e2e pass (e2e/, web/, scripts/e2e.sh, the e2e tools and the compat recorder) run both e2e passes; the two suites share e2e/support/ and the runner, so a change to either is not told apart. A change of the Worker's crates already selects every cell of worker-cf. test_plan_ci.py: the cell is in its CELLS, its named cases and its command-line cases; with the rule's extra pass taken out, 5 of its checks fail. - .github/actions/contract-pass-tools: Node, the built app, the browser and the preflight tools for e2e-mail as for e2e. - contract-cell.yml and flake-hunt.yml name the pass; test-check-flake-hunt-cell.sh holds flake-hunt.yml's list equal to the matrix's (133 checks). - e2e-schedule.yml: a second job for the cell, so one suite failing does not hide the other. Refs: #46 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
- app-and-e2e.md: the mail suite (why it is a suite of its own, what reads the mail, what it does not have) and its three controls; running.md: the pass; infra.md: the form has a browser journey on Thrust now, and none on the pin. - status.md: G-44 (what was measured and what is not covered); G-37's and G-42's "not covered: a browser journey" sentences say what changed. - TRACEABILITY.md: F-A04's evidence, the journeys table's new row (the pinned-Plane column says "not run, by design"), and the rule that a journey that needs mail is in e2e/journeys-mail/. - cicd.md: 26 cells (23 contract and 3 oracle), the planner's rules, and the examples table re-run on this repository: a change of thrust-adapters-cloudflare keeps 16 worker cells (the table said 13: it was 15 before this cell) and a change that everything depends on keeps all 26 (it said 23). Refs: #46 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
# Conflicts: # docs/src/testing/status.md
aRustyDev
added a commit
that referenced
this pull request
Nov 16, 2026
…ants by pattern main moved again while CI ran on the last merge: #238, a second e2e suite, adds the pass `e2e-mail` to four planner rules. Two of this branch's mutants named those rules by the exact text of their pass list, so in CI mutate_gate.py reported 2 BROKEN (the text to replace was found 0 times) and ci-scripts failed, as it should when a mutant tests nothing. This merge carries the fix, which is why it is more than a merge: the four mutants of a rule's effect (web/, the CA root, e2e.sh, the oracle) now find the rule by its pattern and change its effect, so a rule that gains a pass or a job no longer breaks them. Each regex was checked to match exactly once in the planner before #238 and after it. A rule that is renamed or removed still breaks its mutant, which is the signal. Tested on the merged tree before this commit: - test_plan_ci.py: 6,763 checks pass - test-ci-scripts.sh under dash: 173 cases pass - mutate_gate.py: 53 of 53 mutants killed, none broken, both equivalent mutants survive - lint-all-workflows.sh exits 0 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
6 tasks
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
The browser journey of the sign-in by code (D-042, F-A04, issue #46), and the second e2e suite it needed.
e2e/journeys-mail/m2-sign-in-by-code.spec.ts, in a real Chromium against a Worker that serves the stock app and has a mail service: a person signs up and makes a workspace; in a new visit they give their email and take "Sign in with unique code" at the password step; the app asks for the code itself; the code is read from the mail the Worker was asked to send; a wrong code is a 302 to/?error_code=5090and the app shows the code step again with its banner and the address filled in; Resend mails a second code; the first code, posted after that, is refused; the second signs in, and a reload stays in the workspace on a HttpOnly, Secure__Host-thrust_sessioncookie. The network log holds two 200s for the request and three 302s for the form, and no 404 or 5xx.These are the things that only a browser shows and that the contract suite, the parity fixtures and the generated models cannot: the form's hidden
csrfmiddlewaretokenand the__Host-thrust_csrfcookie agreeing in a real page, the app's own step after a refusal, and the session cookie being the one the app goes on with.Why a suite of its own
The first suite holds that its target has no mail:
m2-sign-in-methodsasserts the button is absent and that the page calls no magic route, the pinned Plane has no mail either, and the count guard holds every file ofe2e/journeys/to a pass on every run (a skip is refused), so a journey that needs mail would fail every run without it. So the journeys that need mail are ine2e/journeys-mail/, run by a pass of its own (scripts/contract.sh <target> e2e-mail, theworker-cf e2e-mailcell,scripts/e2e.sh <target> mail). Its Worker gets themailpass's mail service (thesend_emailbinding aswrangler devsimulates it) and the path of the simulator's log,THRUST_MAIL_WRANGLER_LOG, which the browser run inherits.e2e/support/mail.tsreads that log the waysimulated_mailsin the contract suite does (colours stripped, the lines after the announce line) and polls until the message it needs is there, because the lines reach the log a few milliseconds after the response. The code is the last word of the subject.How it was checked
scripts/e2e.sh worker-cf mail controlsisVERDICT: PASS):smtp-off(the browser says no mail is configured) fails it at "ask for a code";code-dropped(the browser changes the code in the form to 000000, and the real server refuses it) fails it at "the code signs in";mail-unread(the journey looks for the mail of an address that was never mailed) fails it at "read the code from the mail";wrong-targetfails it atTARGET GUARD (plane);slow-page(CPU 6x) passes it; the count guard refuses a skipped journey ("0 journeys passed, and there are 1; skipped is 1").scripts/e2e.sh worker-cf controlsis 3 of 3 journeys, its six controls and its count guard.scripts/contract.sh worker-cf mail7 of 7 andmain71 of 71.test_plan_ci.py(5,024 checks; its new cases fail 5 ways with the rule that routes the mail cell taken out),test-check-flake-hunt-cell.sh(133), and all 52 script steps of thedepsandci-scriptsjobs, run on the tree with main merged in; the book builds.CI
scripts/contract-all.sh(26 cells), so this PR runs it and the gate holds it.plan-ci.pyruns both e2e passes fore2e/,web/,scripts/e2e.shand the e2e tools (the suites sharee2e/support/and the runner),contract-pass-toolsprepares Node, the app and the browser for it,flake-hunt.ymloffers it, ande2e-schedule.ymlruns it daily as a second job.docs/src/architecture/cicd.md: 26 cells (23 contract and 3 oracle), and its examples table re-run on this repository: a change ofthrust-adapters-cloudflarekeeps 16 worker cells (the table said 13; it was 15 before this cell) and a change everything depends on keeps all 26 (it said 23).Not covered (G-44 says the same)
EMAIL_HOSTset, the magic switch on and a way to read its code. The journeys table says "not run, by design".worker-memory(by hand, ase2e); a browser onlocalhost(the journey's origin ishttp://127.0.0.1, where the__Host-cookies are shown to work).support/mail.tsis what a journey of them would use).E2E_RECORD_HARis refused for this suite, because it would hold a live code.Refs: #46
🤖 Generated with Claude Code