# Issue #4 acceptance review: verified guest-order linking

Start here. Open `index.html` (or `index.md`) for the scenario table and `tree.html` (or `tree.md`) for the screen map.

## What feature #4 is

1. A guest who later registers (or already has an account) can get their earlier guest orders added to the account.
2. Nothing is linked silently: a one-time confirmation link is emailed to the address, valid 7 days, usable once.
3. Opening the link needs a signed-in session as the owning account plus the account password (this defeats login-CSRF).
4. Registering with a guest-order email triggers the mail automatically (register copy); existing customers see a notice on My Account, Order History and Downloads and can request it (request copy, #54).
5. Limits: one link per 10 minutes, 5 per 24 hours, request forms are CSRF-protected, password attempts share the login lockout.
6. Folded #53: guest downloads are gone; checkout success page and the order email say a PDF needs an account (no guest download route, it returns 404).
7. Folded #54: the request mail has its own wording ("You asked us to add ...").
8. Folded #55: the account-created page names the shop mailbox (info@owl-crafts.com), also on the Simple register page.
9. Admin Customer Activity shows when a link was requested and when orders were added.
10. All strings exist in English, Russian and Ukrainian.

## Pull requests

- Code: https://github.com/hpopov/owl-crafts-shop/pull/45 (tip `24cd086`)
- E2E specs: https://github.com/hpopov/owl-crafts-shop-e2e/pull/2 (tip `8d4b96b`)
- Nothing was merged. `main` deploys to production, so merging is the owner's call.

## How to review

1. Open `index.html` in a browser (or `index.md` in the VSCode Markdown preview). 35 scenarios A01-A35, all PASS, in 8 groups.
2. Open `tree.html` for the screen/condition tree. Nodes are clickable and lead to the flow pages. It loads Mermaid from a CDN, so it needs network access. `tree.md` has the same diagram and a node table.
3. Each group has a flow page `flows/G1..G8.html` (and `.md`): story, numbered screenshots, videos. Videos play in the HTML pages (VSCode Markdown preview shows only links).
4. `results/README.md` records the repo's automated suite run.

## Folder map

| Path | Content |
|---|---|
| `index.html`, `index.md` | all scenarios with status and media links |
| `tree.html`, `tree.md` | screen and condition tree, node to scenario table |
| `flows/G1..G8.{html,md}` | per-group stories, screenshots, videos |
| `assets/style.css` | shared style |
| `media/<group>/` | captured screenshots (.png) and videos (.webm), named by scenario ID |
| `scenarios/` | PLAN.md (inventory, tree, safety rules), G1..G8.md capture logs, A31-copy-sheet.md |
| `scripts/` | the Playwright capture scripts and their config |
| `results/` | automated suite output and summary |
| `proposed-harness/` | draft harness changes (written by a separate session) |
| `PROGRESS.md` | run log |

## How the scenarios were produced

Automated Playwright captures, one spec per group, run serially against the local stack of the worktree (http://localhost:8010, Mailpit http://localhost:8026), with fake seeded data tagged `e2e-issue4-<runId>` that is deleted afterwards. Most states are reached through the real UI. These were reached by DB or DOM manipulation (from the G*.md logs):

- A13 daily limit: earlier link aged 1 h and 4 extra link rows inserted. A14 and A25: hidden csrf field set to "forged" in the DOM.
- A17 expired, A18 used, A19 wrong customer, A21 nothing left, A22, A25, A26: the link row was inserted directly instead of read from a mail. A20: customer email updated after the link was made. A21: order assigned to the customer after the link row existed.
- A22: both accounts renamed (VICTIM, ATTACKER) for readability; the attacker page is served by a Playwright route at a fake origin.
- A24: the failed-login counter set by DB (1000, then 2).
- A27: guest success page rendered by a direct GET, not after a real checkout (Simple checkout cannot run on localhost). A28: status 0 to 2 via the order history API; rows removed afterwards.
- A32, A33: temporary local-only language rows (removed, `oc_language` back to 1 row). A31: a local HTML page built from the shipped language files.
- A34, A35: the isolated Simple-local mode (below), turned OFF afterwards and verified (302).

## Safety notes

- Fake data only. A PII guard in the capture library keeps real customer data out of screenshots and videos; the local DB (a production copy) was only touched for rows tagged with the run id.
- Mail goes only to the local Mailpit catcher; no real SMTP relay was configured.
- Simple-local mode (G8) ran loopback-only: the local stack answered under the licensed name owl-crafts.com via `extra_hosts`, the browser mapped that name to 127.0.0.1 and everything else to NOTFOUND, with an origin route guard. Production was never contacted. The mode was turned off afterwards.
- Nothing was pushed to or merged into `main`.

## Caveats and observations

- The local modification cache is empty, so the stack runs the stock files without OCMODs. Production applies OCMODs; this is the state in which the repo spec passed 11/11.
- Only English is installed locally and in production (the header "Select Language" is a gtranslate widget). RU and UA are shown via temporary local languages (A32, A33) and a copy sheet (A31); that shows how the shipped files would render, not what production visitors see today.
- Mixed-language theme strings (parts of the theme staying English in RU/UA) are not part of #4.
- The Mailpit sidebar in some shots lists mails from the run.
- Links inside mails point to localhost (or http://owl-crafts.com:8010, the local stack under the licensed name, in G8), not to production.
- Third-party icon fonts (social buttons) are blocked in the Simple-local capture and render as placeholders.
- The A30 customer-link hover shot is weak (hover only, no visible tooltip).
- The automated suite run has one expected failure (PayPal sandbox secrets missing) and two opt-in skips; see `results/README.md`.
- [Code review](results\/code-review.md): APPROVE, 4 low findings.
