# Support playbook: reports about the new UI

One page for whoever answers a user who writes "something is wrong with the new design". The rules for how the two UIs share the
URLs are in `V3-PARITY-PLAN.md`, section 4; the status of every function is in section 5. This page only says what to do with a report.

## 1. Find out which UI the user really saw

Ask for the address and, if possible, a screenshot of the browser's network panel for the first request (the page itself). Two response
headers answer the question:

| Header | Meaning |
|---|---|
| `X-Kulibri-UI` | `legacy` (classic) or `v3` (the new UI) |
| `X-Kulibri-UI-Reason` | why: `query` (`?ui=` in the address), `cookie` (earlier choice in this browser), `user` (stored in the account), `default`, `poll-mode-classic` / `poll-mode-new` / `poll-mode-start` (the poll owner's setting), `poll-hidden`, `poll-features-legacy`, `poll-not-found`, `poll-lookup-failed` |

During the rollout of the new UI (`KULIBRI_UI_ROLLOUT=true`, `docs/ui-rollout.md`) a poll link gives these reasons instead of `query`, `cookie` and `user`: `poll-admin` (an admin of the poll: always the new UI), `admin-classic-once` (the admin's one-off `?classic=1`), `poll-mode-new` / `poll-mode-classic` (the view the poll's admins set; a poll without one is classic), `classic-once` (a participant's `?classic=1`), and `poll-course`, `poll-bringlist`, `poll-waitlist`, `poll-undated` (polls that only work in the new UI). Every other v3 path gives `rollout`. "My participants see the old version": the poll is set to classic, change it on the dashboard or at the top of the poll's settings.

Two environment switches decide the last group (operator only, in `.env`, then `php artisan config:clear`): `KULIBRI_UI_V3_HIDDEN_POLLS` (default true; false keeps hidden polls in classic, reason `poll-hidden`) and `KULIBRI_UI_V3_FEATURE_GUARD` (off since 16 Oct; true keeps polls with custom participant fields in classic, reason `poll-features-legacy`). If a poll with custom fields still opens in classic for a user who chose the new UI, the guard is on in that environment.

Without the panel: both UIs show a pill "New kulibri / Classic" in the header of the poll page and the dashboard (the chosen side is marked); the user menus have the same switch as an entry ("Classic kulibri", "Try the new kulibri"). Do not trust two
"identical" screenshots; both were classic once.

## 2. Reproduce it

1. Open the **same address** as the user, signed in as the same kind of person (owner, participant with an account, participant
   from a mail link, anonymous). Personal links (`/pr/{poll}/{participant}`) and admin links behave differently; see `docs/route-map.md`.
2. Add `?ui=v3` to force the new UI, `?classic=1` to see classic for that request only. Neither changes the account. `?ui=legacy` and
   `?ui=v3` are sticky (cookie and account), so tell the user when you use them in their browser.
3. Compare the two screens. If classic does the same, it is not a defect of the new UI; if only the new UI is wrong, it is a gap or a bug.
4. Check width (desktop and about 390 px phone) and language (German, English) when the report is about layout or wording.
5. Look at failed requests in the network panel (status, address, and the answer body). Saves can fail with HTTP 200 and an
   `error` key in the body (full options): the new UI shows a sentence for it, so a missing sentence is a bug.

## 3. Is it a known gap?

Check the row in `V3-PARITY-PLAN.md`, section 5, before filing a bug. The gaps users may notice today:

| What the user misses | Row | What to say |
|---|---|---|
| Seat limit per event or per participant, extra answers per cell | 3.11, 3.13 | Not in the new UI yet; use the classic view for such polls (`?classic=1`). |
| "Address already takes part" check when answering | 9.2 | The code step waits for a backend change; until then the old behaviour. |
| "Visited" marker of an invitation | 9.1 | Not built; its meaning is open. |
| Waiting list when a course is full | 3.4 | Built 16 Oct (a switch per poll, Premium to set; requests after the deadline). A poll with the waitlist is always served by the new UI. Freeing a seat promotes the next person on the server. |
| Filters in the grid, design and branding templates | 3.16, 6.8 | Partly built; compare with classic before reporting a bug. |
| Archive from inside the editor, "promotion shown" hint | 10.3.9, 1.11 | Not built; archive from the dashboard works. |
| Someone who signs up again with the same address is asked for a code (new UI) | 9.2 | Intended since 17 Oct: an address that already takes part needs proof; the person gets a six-digit mail code (valid 15 minutes) and then chooses to continue as an existing participant or to add a new one (a parent can add children under one address). No code mail: check the spam folder; at most 3 codes an hour per address and poll. A browser that signed up or confirmed the address before is recognised by a cookie and is not asked again; a new browser, a private window or cleared cookies ask for the code once more. See `docs/email-challenges.md`. |
| Poll opens in classic although the user chose the new UI | 3.7, 4.2 | Read the reason header: `poll-mode-classic` is the owner's setting; `poll-hidden` or `poll-features-legacy` is a switch in the environment (see above). |
| Pages such as membership, invoices details, unsubscribe | H4 | Opened in classic automatically (full page load). |

Everything in section 5 marked *Built* may still hide a difference that nobody has compared in a browser yet (the QA checks in
`docs/qa-checks.md` are the open work). Treat a difference from classic as a finding, not as a user error.

## 4. Give the user a way out

- **One page:** `?classic=1` at the end of the address.
- **Everything, for this user:** the pill "Classic" in the header, the user menu entry "Classic kulibri", or `?ui=legacy`. Poll owners with a poll mode set to *new* cannot be moved
  by this for participants; that is the owner's choice (row "View for participants" in the editor).
- **Participants of a poll that forces the new UI:** `?classic=1` always works and needs no login.
- **Everybody, at once:** `KULIBRI_UI_V3_ENABLED=false` in the environment serves classic to all visitors immediately, no deploy.
  `KULIBRI_UI_DEFAULT=legacy` decides what visitors who chose nothing get. Only the operator changes these; do it for a defect that
  loses data or blocks answering, not for a layout problem.

## 5. Collect the report

The new UI has "Feedback zum neuen kulibri" in the user menu (`POST /api/feedback`). It mails the text with the context added
automatically: the page, signed in or not, screen width and browser. It does not add the poll type or the two header values, so ask
for them. If a user writes by mail instead, ask for:

- the address (with the poll id, not a screenshot of it), the time, and the person's role in the poll;
- the two header values, or "Classic view / new design" as the user saw it;
- what they did, what they expected, what happened, and a screenshot;
- language and device.

File a bug when classic behaves correctly. File a gap (a new row or a note in the existing row of section 5) when classic has the
function and the new UI does not. Do not change the backend for a report without the agreement of the backend owner; findings go to
`SECURITY-BACKLOG.md` (security) or `V3-PARITY-PLAN.md`, section 6.5 (other backend items).

## 6. Data problems are not UI problems

*One-time dialogs.* "Willkommen im neuen kulibri" is remembered on the account (`user_notices`, `docs/notices.md`), so it appears once per account, not once per browser. A user who says they never saw it, or see it again: check the row for `whats-new`; to show it again, delete that row.

Some reports look like the new UI but are not: a person's answers missing after a mail link (check the invitation, row H1 and
`docs/route-map.md`), a booking taken away (an admin may have removed it; the person gets a mail), a poll that "disappeared"
from the dashboard (archived by the user: archive is per user since 15 Oct, so it can be in the archive tab). Check the data first
with the poll's admin before blaming the UI.
