# Screen and condition tree

[Index](index.md) | [README](README.md) | [Checklist](traceability.md) | Interactive version (clickable, pan/zoom): [tree.html](tree.html)

VSCode needs a Mermaid-capable Markdown preview extension to render the diagram below; otherwise open tree.html.

```mermaid
flowchart TD
  START(["Visitor or customer<br/>all scenarios"])
  GCO["Checkout success, guest<br/>'You need an account to download PDFs…'<br/>A27"]
  OMAIL["Order email in Mailpit<br/>'You will need to log in to your account…'<br/>A28"]
  GDL["route=account/guest_download<br/>404 'page you requested cannot be found'<br/>A29"]
  REG["Register form<br/>core /create-account/ or Simple /simpleregister/<br/>A01 A03 A04 A05 A06 A34 A35"]
  ACS["Account created page<br/>'Your Account Has Been Created!' + info@owl-crafts.com<br/>A02"]
  WEL["Mailpit: welcome mail only<br/>A03 A04 A05 A06 A35"]
  MREG["Mailpit: confirmation mail, register copy<br/>'An account was created at …'<br/>A01 A34 A39 A43"]
  LOGIN0["Login page<br/>A07 A10 A11"]
  ACCN["My Account / Order History / Downloads<br/>no notice<br/>A03-A06 A11 A10 A36 A38"]
  NOTICE["Notice: 'Ordered from us before without signing in?'<br/>button 'Email me a confirmation link'<br/>A07 desktop + 375px"]
  FLASH["Flash 'Done! We've sent a confirmation link to …'<br/>A08 A37 A40"]
  SENT["Sent state: 'Send the link again' disabled<br/>'You can request another link in 10 min.'<br/>A08 A38 A39"]
  COOL["Warning: 'Please wait 10 min…'<br/>A12"]
  DAILY["'You've requested too many links today…'<br/>A13"]
  CSRF1["Danger: 'Your session has expired…'<br/>A14"]
  MREQ["Mailpit: confirmation mail, request copy<br/>'You asked us to add your earlier guest orders…'<br/>A09"]
  LINK{{"Click link: token moved to session,<br/>redirect to clean account/order_link/confirm<br/>A10 A15-A22 A26"}}
  INVALID["'This link is invalid or has expired…'<br/>A15 A16 A17"]
  USED["'This link has already been used…'<br/>A18 A01 A37"]
  LOGINR["Login page (redirect back after sign-in)<br/>A10 A26"]
  WRONG["'This link was sent for a different account…'<br/>A19"]
  EMCH["'The email address on your account has changed…'<br/>A20 A37"]
  ATK["Attacker page auto-logs victim into account X<br/>A22"]
  PW["Password step: 'You're signed in as … please enter your account password'<br/>A01 A10 A19 A22 A34 A37 A38 A39 A41 A43"]
  PWERR["'The password is incorrect. Please try again.'<br/>A23 A41"]
  LOCK["'Too many incorrect password attempts…'<br/>A24"]
  CSRF2["'Your session has expired…' on confirm<br/>A25"]
  OUT["Signed out<br/>A26"]
  OK["Result: 'Orders added to your account: N'<br/>A01 A10 A19 A22 A34 A37 A38 A39 A41 A42 A43"]
  NONE["Result: 'There was nothing left to add…'<br/>A21"]
  HIST["Order History lists the orders, Downloads lists the PDF<br/>A01"]
  ADMIN["Admin Customer Activity, filtered to the fake customer<br/>A30"]
  SHEET["Copy sheet EN/RU/UA + live RU and UA screens<br/>A31 A32 A33"]

  START -->|"buys as guest"| GCO
  GCO -->|"order confirmed (status 0 to 2)"| OMAIL
  GCO -.->|"no guest download link exists"| GDL
  OMAIL -->|"creates an account with the order email"| REG
  START -->|"registers"| REG
  REG -->|"Create"| ACS
  ACS -->|"no orders / only account-owned / look-alike / status-0 only"| WEL
  WEL --> ACCN
  ACS -->|"email matches unlinked guest orders"| MREG
  ACS -->|"My Account, link already sent"| SENT
  START -->|"has an account, signs in"| LOGIN0
  LOGIN0 -->|"no unlinked guest orders"| ACCN
  LOGIN0 -->|"unlinked guest orders for the account email"| NOTICE
  NOTICE -->|"Email me a confirmation link"| FLASH
  FLASH -->|"reload"| SENT
  FLASH --> MREQ
  NOTICE -->|"stale tab, link sent under 10 min ago"| COOL
  SENT -->|"5 links in 24 h"| DAILY
  NOTICE -->|"forged or stale form token"| CSRF1
  MREG -->|"click link"| LINK
  MREQ -->|"click link"| LINK
  ATK -->|"victim clicks the genuine link"| LINK
  LINK -->|"random, malformed or expired token"| INVALID
  LINK -->|"token already used"| USED
  LINK -->|"not signed in"| LOGINR
  LOGINR -->|"signs in as the owner"| PW
  LINK -->|"signed in as another account"| WRONG
  WRONG -->|"sign out, sign in as owner, reopen confirm"| PW
  LINK -->|"account email changed"| EMCH
  LINK -->|"signed in as the owner"| PW
  PW -->|"wrong or empty password"| PWERR
  PWERR -->|"retry"| PW
  PW -->|"login attempts at the limit"| LOCK
  PW -->|"form token mismatch"| CSRF2
  PW -->|"sign out link"| OUT
  OUT --> LOGINR
  PW -->|"right password, orders still unlinked"| OK
  PW -->|"right password, nothing left to link"| NONE
  OK --> HIST
  OK -->|"notice gone"| ACCN
  MREG -.->|"activity order_link_request"| ADMIN
  MREQ -.->|"activity order_link_request"| ADMIN
  OK -.->|"activity order_link"| ADMIN
  NOTICE -.->|"same screens in RU and UA"| SHEET
  STALE["Stale tab, everything already linked<br/>'There are no guest orders left to add to your account.'<br/>A36"]
  STALECD["Stale tab within 10 min of the last link<br/>'We've just sent you a link. Please wait N min…' (O2)<br/>A36"]
  EDIT["Account form: email changed<br/>A37 A38"]
  NOTICE2["Notice names the NEW address: request form, not 'sent';<br/>button disabled by the per-account cooldown<br/>A37"]
  CHK["Core checkout: 'Register Account'<br/>A39"]
  RET["Send on Order History / Downloads returns there;<br/>tampered return → My Account; GET or logged-out POST sends nothing<br/>A40"]
  MD5["Old account with a legacy MD5 password signs in<br/>A41"]
  TOK["Token evidence: hash-only row, 7-day TTL, 90-day purge,<br/>noindex + no-referrer headers<br/>A42"]
  NORM["Registers with a Mixed-Case email; order email padded / upper-case<br/>A43"]
  INFRA["Dev infra evidence (no browser): loopback ports, mail guard, Mailpit,<br/>schema, stub probe, docs<br/>A44 A45 A46 A47 A48"]

  NOTICE -->|"tab 2 linked everything; tab 1 clicks after > 10 min"| STALE
  NOTICE -->|"same, within 10 min"| STALECD
  STALE -->|"reload"| ACCN
  SENT -->|"changes email in the account form"| EDIT
  EDIT -->|"new address has unlinked guest orders"| NOTICE2
  EDIT -->|"new address has none"| ACCN
  ACCN -->|"changes the email back (open link matches again)"| SENT
  NOTICE2 -->|"cooldown over: Email me a confirmation link"| FLASH
  LINK -->|"old link after the email change"| EMCH
  OK -->|"older open link reopened (invalidated)"| USED
  START -->|"checks out as a new customer"| CHK
  CHK -->|"email matches unlinked guest orders"| MREG
  CHK -->|"My Account right after (register link counts for the cooldown)"| SENT
  NOTICE -->|"Send on Order History or Downloads"| RET
  RET --> FLASH
  START -->|"old account, MD5 password"| MD5
  MD5 --> PW
  PW -->|"empty password (required removed)"| PWERR
  START -->|"registers with a Mixed-Case email"| NORM
  NORM --> MREG
  LINK -.->|"evidence"| TOK
  START -.-> INFRA
```

## Legend

- Rounded node: entry point. Rectangle: screen or message. Hexagon: the confirmation-link route (token moves to the session and the URL is cleaned).
- Solid arrow: user action or system transition, labelled with the condition. Dashed arrow: side effect (no guest download, admin activity rows, same screens in other languages, evidence).
- The last line of a node lists the scenario IDs that show it. Ranges such as A03-A06 mean every ID in the range. A44-A48 (dev infra evidence) hang off the "Dev infra evidence" node.
- `tree.html` renders the same diagram with clickable nodes, pan and zoom, and a plain list of nodes for phones.

## Node to scenarios to key screenshots

| Node | Scenario IDs | Key screenshots |
|---|---|---|
| Visitor or customer (`START`) | all | - |
| Checkout success, guest (`GCO`) | [A27](flows/G6.md#a27) | [A27](media/G6/A27-01-guest-success-page.png) |
| Order email in Mailpit (`OMAIL`) | [A28](flows/G6.md#a28) | [A28](media/G6/A28-01-order-confirmation-mail-download-note.png) |
| route=account/guest_download (`GDL`) | [A29](flows/G6.md#a29) | [A29](media/G6/A29-01-guest-download-route-404.png) |
| Register form (`REG`) | [A01](flows/G1.md#a01) [A03](flows/G1.md#a03) [A04](flows/G1.md#a04) [A05](flows/G1.md#a05) [A06](flows/G1.md#a06) [A34](flows/G8.md#a34) [A35](flows/G8.md#a35) | [A01](media/G1/A01-01-register-form-filled.png) [A03](media/G1/A03-01-account-created.png) [A04](media/G1/A04-01-account-created.png) |
| Account created page (`ACS`) | [A02](flows/G1.md#a02) | [A02](media/G1/A01-02-account-created-page.png) |
| Mailpit: welcome mail only (`WEL`) | [A03](flows/G1.md#a03) [A04](flows/G1.md#a04) [A05](flows/G1.md#a05) [A06](flows/G1.md#a06) [A35](flows/G8.md#a35) | [A03](media/G1/A03-01-account-created.png) [A04](media/G1/A04-01-account-created.png) [A05](media/G1/A05-01-account-created.png) |
| Mailpit: confirmation mail, register copy (`MREG`) | [A01](flows/G1.md#a01) [A34](flows/G8.md#a34) [A39](flows/G9.md#a39) [A43](flows/G9.md#a43) | [A01](media/G1/A01-01-register-form-filled.png) [A34](media/G8/A34-01-simple-register-form.png) [A39](media/G9/A39-01-product-added-to-cart.png) |
| Login page (`LOGIN0`) | [A07](flows/G2.md#a07) [A10](flows/G2.md#a10) [A11](flows/G2.md#a11) | [A07](media/G2/A07-01-my-account-notice.png) [A10](media/G2/A10-01-logged-out-in-first-browser.png) [A11](media/G2/A11-01-my-account-no-notice.png) |
| My Account / Order History / Downloads (`ACCN`) | [A03](flows/G1.md#a03) [A04](flows/G1.md#a04) [A05](flows/G1.md#a05) [A06](flows/G1.md#a06) [A11](flows/G2.md#a11) [A10](flows/G2.md#a10) [A36](flows/G9.md#a36) [A38](flows/G9.md#a38) | [A03](media/G1/A03-01-account-created.png) [A04](media/G1/A04-01-account-created.png) [A05](media/G1/A05-01-account-created.png) |
| Notice: 'Ordered from us before without signing in?' (`NOTICE`) | [A07](flows/G2.md#a07) | [A07](media/G2/A07-01-my-account-notice.png) |
| Flash 'Done! We've sent a confirmation link to …' (`FLASH`) | [A08](flows/G2.md#a08) [A37](flows/G9.md#a37) [A40](flows/G9.md#a40) | [A08](media/G2/A08-01-notice-before-request.png) [A37](media/G9/A37-01-sent-state-for-old-email-e1.png) [A40](media/G9/A40-01-send-on-downloads-returns-to-downloads.png) |
| Sent state: 'Send the link again' disabled (`SENT`) | [A08](flows/G2.md#a08) [A38](flows/G9.md#a38) [A39](flows/G9.md#a39) | [A08](media/G2/A08-01-notice-before-request.png) [A38](media/G9/A38-01-link-sent-to-e1.png) [A39](media/G9/A39-01-product-added-to-cart.png) |
| Warning: 'Please wait 10 min…' (`COOL`) | [A12](flows/G3.md#a12) | [A12](media/G3/A12-01-tab-1-notice-before-any-request.png) |
| 'You've requested too many links today…' (`DAILY`) | [A13](flows/G3.md#a13) | [A13](media/G3/A13-01-tab-2-stale-notice-send-enabled.png) |
| Danger: 'Your session has expired…' (`CSRF1`) | [A14](flows/G3.md#a14) | [A14](media/G3/A14-01-notice-before-forged-click.png) |
| Mailpit: confirmation mail, request copy (`MREQ`) | [A09](flows/G2.md#a09) | [A09](media/G2/A09-01-request-mail-copy.png) |
| Click link: token moved to session, (`LINK`) | [A15](flows/G4.md#a15) [A16](flows/G4.md#a16) [A17](flows/G4.md#a17) [A18](flows/G4.md#a18) [A19](flows/G4.md#a19) [A20](flows/G4.md#a20) [A21](flows/G4.md#a21) [A22](flows/G5.md#a22) [A10](flows/G2.md#a10) [A26](flows/G5.md#a26) | [A15](media/G4/A15-01-invalid-link.png) [A16](media/G4/A16-01-invalid-link-malformed-token.png) [A17](media/G4/A17-01-expired-link-invalid.png) |
| 'This link is invalid or has expired…' (`INVALID`) | [A15](flows/G4.md#a15) [A16](flows/G4.md#a16) [A17](flows/G4.md#a17) | [A15](media/G4/A15-01-invalid-link.png) [A16](media/G4/A16-01-invalid-link-malformed-token.png) [A17](media/G4/A17-01-expired-link-invalid.png) |
| 'This link has already been used…' (`USED`) | [A18](flows/G4.md#a18) [A01](flows/G1.md#a01) [A37](flows/G9.md#a37) | [A18](media/G4/A18-01-already-used-link.png) [A01](media/G1/A01-01-register-form-filled.png) [A37](media/G9/A37-01-sent-state-for-old-email-e1.png) |
| Login page (redirect back after sign-in) (`LOGINR`) | [A10](flows/G2.md#a10) [A26](flows/G5.md#a26) | [A10](media/G2/A10-01-logged-out-in-first-browser.png) [A26](media/G5/A26-01-not-you-line.png) |
| 'This link was sent for a different account…' (`WRONG`) | [A19](flows/G4.md#a19) | [A19](media/G4/A19-01-wrong-customer-logged-in-as-b.png) |
| 'The email address on your account has changed…' (`EMCH`) | [A20](flows/G4.md#a20) [A37](flows/G9.md#a37) | [A20](media/G4/A20-01-email-changed-notice.png) [A37](media/G9/A37-01-sent-state-for-old-email-e1.png) |
| Attacker page auto-logs victim into account X (`ATK`) | [A22](flows/G5.md#a22) | [A22](media/G5/A22-01-victim-signed-in-to-own-account.png) |
| Password step: 'You're signed in as … please enter your account password' (`PW`) | [A01](flows/G1.md#a01) [A10](flows/G2.md#a10) [A19](flows/G4.md#a19) [A22](flows/G5.md#a22) [A34](flows/G8.md#a34) [A37](flows/G9.md#a37) [A38](flows/G9.md#a38) [A39](flows/G9.md#a39) [A41](flows/G9.md#a41) [A43](flows/G9.md#a43) | [A01](media/G1/A01-01-register-form-filled.png) [A10](media/G2/A10-01-logged-out-in-first-browser.png) [A19](media/G4/A19-01-wrong-customer-logged-in-as-b.png) |
| 'The password is incorrect. Please try again.' (`PWERR`) | [A23](flows/G5.md#a23) [A41](flows/G9.md#a41) | [A23](media/G5/A23-01-wrong-password-error.png) [A41](media/G9/A41-01-md5-account-signed-in.png) |
| 'Too many incorrect password attempts…' (`LOCK`) | [A24](flows/G5.md#a24) | [A24](media/G5/A24-01-lockout-message-right-password-refused.png) |
| 'Your session has expired…' on confirm (`CSRF2`) | [A25](flows/G5.md#a25) | [A25](media/G5/A25-01-password-step.png) |
| Signed out (`OUT`) | [A26](flows/G5.md#a26) | [A26](media/G5/A26-01-not-you-line.png) |
| Result: 'Orders added to your account: N' (`OK`) | [A01](flows/G1.md#a01) [A10](flows/G2.md#a10) [A19](flows/G4.md#a19) [A22](flows/G5.md#a22) [A34](flows/G8.md#a34) [A37](flows/G9.md#a37) [A38](flows/G9.md#a38) [A39](flows/G9.md#a39) [A41](flows/G9.md#a41) [A42](flows/G9.md#a42) [A43](flows/G9.md#a43) | [A01](media/G1/A01-01-register-form-filled.png) [A10](media/G2/A10-01-logged-out-in-first-browser.png) [A19](media/G4/A19-01-wrong-customer-logged-in-as-b.png) |
| Result: 'There was nothing left to add…' (`NONE`) | [A21](flows/G4.md#a21) | [A21](media/G4/A21-01-password-step.png) |
| Order History lists the orders, Downloads lists the PDF (`HIST`) | [A01](flows/G1.md#a01) | [A01](media/G1/A01-01-register-form-filled.png) |
| Admin Customer Activity, filtered to the fake customer (`ADMIN`) | [A30](flows/G6.md#a30) | [A30](media/G6/A30-01-activity-report-rows.png) |
| Copy sheet EN/RU/UA + live RU and UA screens (`SHEET`) | [A31](flows/G7.md#a31) [A32](flows/G7.md#a32) [A33](flows/G7.md#a33) | [A31](media/G7/A31-01-full-copy-sheet.png) [A32](media/G7/A32-01-notice.png) [A33](media/G7/A33-01-notice.png) |
| Stale tab, everything already linked (`STALE`) | [A36](flows/G9.md#a36) | [A36](media/G9/A36-01-three-tabs-open.png) |
| Stale tab within 10 min of the last link (`STALECD`) | [A36](flows/G9.md#a36) | [A36](media/G9/A36-01-three-tabs-open.png) |
| Account form: email changed (`EDIT`) | [A37](flows/G9.md#a37) [A38](flows/G9.md#a38) | [A37](media/G9/A37-01-sent-state-for-old-email-e1.png) [A38](media/G9/A38-01-link-sent-to-e1.png) |
| Notice names the NEW address: request form, not 'sent'; (`NOTICE2`) | [A37](flows/G9.md#a37) | [A37](media/G9/A37-01-sent-state-for-old-email-e1.png) |
| Core checkout: 'Register Account' (`CHK`) | [A39](flows/G9.md#a39) | [A39](media/G9/A39-01-product-added-to-cart.png) |
| Send on Order History / Downloads returns there; (`RET`) | [A40](flows/G9.md#a40) | [A40](media/G9/A40-01-send-on-downloads-returns-to-downloads.png) |
| Old account with a legacy MD5 password signs in (`MD5`) | [A41](flows/G9.md#a41) | [A41](media/G9/A41-01-md5-account-signed-in.png) |
| Token evidence: hash-only row, 7-day TTL, 90-day purge, (`TOK`) | [A42](flows/G9.md#a42) | [A42](media/G9/A42-01-confirm-page-password-step.png) |
| Registers with a Mixed-Case email; order email padded / upper-case (`NORM`) | [A43](flows/G9.md#a43) | [A43](media/G9/A43-01-register-form-mixed-case-email.png) |
| Dev infra evidence (no browser): loopback ports, mail guard, Mailpit, (`INFRA`) | [A44](flows/G10.md#a44) [A45](flows/G10.md#a45) [A46](flows/G10.md#a46) [A47](flows/G10.md#a47) [A48](flows/G10.md#a48) | - |
