Web app conventions — what every screen does the same way¶
Rules for structure and behaviour that every screen of the web app (
frontend/app) follows. How it looks — shell, sidebar, components, tokens, the look of messages and of the confirmation question — is indesign.md, and is linked from here, not repeated. How a screen is tested is in the testing guide (docs/guides/testing.md).
1 Mockup first¶
Every new screen starts as an interactive mockup (a claude.ai artifact) that the owner approves, before the issue that implements it starts. The mockup is a private claude.ai artifact, linked from its issue and republished to the same link after each round; each round's decisions go into a comment on that issue.
- The screen's spec links the mockup in its Mockup row: illustration only — the spec governs. Where the two disagree, the spec is right, and the mockup is not updated after approval.
- A wish from the mockup round that is not already a requirement becomes one in the spec, with the
mockup round as its Source (
decision in issue #…). - Anything that applies to every screen goes into
design.mdor this file instead, so the next screen does not decide it again. The shell itself was settled this way, in #197.
2 Files¶
One screen is three things, named after the screen:
| What | Where |
|---|---|
| Route module | frontend/app/app/routes/<screen>.tsx, registered in app/routes.ts |
| Tests | frontend/app/tests/e2e/<screen>.spec.ts (Playwright); <screen>.test.tsx beside the route module (Vitest) when the screen has logic without a page |
| Page stories | <screen>.stories.tsx beside the route module: the screen in the shell, one story per state of its spec, with synthetic data and a fake backend (catalog (frontend/app/README.md), ADR-0017 (docs/adr/adr-0017-component-catalog-storybook.md)) |
| Spec | docs/specs/<issue>-<screen>.md, from the template _template-frontend.md (docs/specs/_template-frontend.md) |
What only this screen needs stays in its route module; a shared component moves to
app/components/ when a second screen needs it (design.md §2.2).
A route module is named after its screen, routes/<screen>.tsx — the first is routes/intake.tsx
(#200). The imported documents' page name
{action}.page.tsx is not used.
3 Navigation¶
- The shell — sidebar, header with section and title, the way back — is
design.md§2; a screen does not build its own. - Moving between screens is a real link with a real address (React Router's
<Link>, which renders an<a href>), never a button with a script. That keeps a new tab, a bookmark and the browser's back button working. A<button>acts, an<a>navigates (design.md§6, Controls). - What a person may never do has no element — not greyed out, not hidden behind a disabled
button. The same holds for screens that do not work yet: their entries are left out of the
sidebar (
design.md§2.1).
4 State in the address¶
What a person wants to share or find again is in the address.
- Parameters are named after the data contract's fields, so the address reads like the data:
?caseId=<id>for a selected case,?stage=<stage>for a filter on it. - A person's choice writes the address as a new history entry, and the back button restores
the state before it. Through React Router's
<Link>anduseSearchParams, not by hand withhistory.pushState. - Invalid values count as unset. An unknown filter value shows the unfiltered list; an ID that does not exist shows the not found message where the content would be (§5), and the rest of the screen stays usable. An invalid address is never an error page.
- Not in the address: an open dialog, half-written input — and anything personal or secret: no name, e-mail address, token or contract content. A case ID is an internal identifier and may be there.
5 Loading, empty, error¶
The same wording on every screen; the look is design.md §6, Messages, and the
component StatusMessage. A screen's spec applies the table to its own things in its section
States.
| State | Text | How |
|---|---|---|
| loading | Loading … | where the data will appear |
| empty | No |
muted text where the data would be |
| service does not respond | FeeCheck is not reachable. Nothing was loaded. | role="alert", a Reload button that tries again |
| screen fails | This screen could not be shown. — an error in the screen itself, not the backend's; the error's own text is not shown | the error Banner at the top of the content area, role="alert", a Try again button; the sidebar stays usable |
| not found | where the content would be | |
| action confirmed | role="status", above the content it concerns |
|
| action failed | the error, in the open confirmation question | nothing changes |
<things> is the plural the screen shows (cases, findings), <Thing> its singular with a
capital (Case). Where an action has no confirmation question, its failure is an alert
(role="alert") beside the control that started it — the reason the backend gave, or the
service does not respond text when there was no answer — and nothing changes either.
6 Actions with an effect¶
An action with an effect changes a state or reaches beyond the page: an upload, a decision, a release, an export.
- It is recorded in the audit trail, with the person. The backend records it, not the screen — but the spec names the audit line beside the endpoint (§7), so it is not forgotten when the endpoint is built. This holds whether or not the action asks first.
- It asks first when it cannot be taken back — the confirmation question of
design.md§6: a modal dialog, Cancel first, and the text of the button that opens it ends in "…" (… ). An action that can be taken back does not ask. Review's Accept / Correct / Reject are taken back with undo (design.md§5), so they do not ask: the keyboard-first flow of §1 there depends on that. - Release cannot be taken back and asks through its own confirmation box on the page
(
design.md§3, §5) instead of the dialog: the box shows what is released and with which versions — too much to read in a dialog — and the release button appears only once it is confirmed. One confirmation, never the box and the dialog both. The button's text does not end in "…", because it acts at once. - An upload does not ask: choosing or dropping a PDF starts its conversion (owner, 20 October
2026, in #199;
spec 204 (
docs/specs/204-contract-intake.md) §6). - Each spec lists its actions in its section Actions, with the column Confirmation: question, box or none, and for none why the action can be taken back.
7 Endpoints in specs¶
Every screen spec lists the endpoints the screen calls, in its section Data and backend, with a State column:
- ✅ exists — the backend has it; the screen can be built against it.
- ❌ proposal — the backend does not have it yet; the path and the answer are a proposal that
the backend issue settles. Until then, tests answer it with Playwright's
page.route(testing guide (docs/guides/testing.md)).
An action with an effect names its audit line in the same table (§6).
8 IDs in specs¶
| Prefix | Meaning |
|---|---|
R-n |
a requirement of the screen, with its source |
K-1 – K-4 |
the project-wide criteria below, applied to the screen |
<prefix>-n |
the screen's own acceptance criteria — a prefix registered in docs/specs/README.md (docs/specs/README.md) §2 before the spec uses it |
The project-wide criteria hold for every screen. Each spec lists them in its section Acceptance
criteria and says what they mean there; their standard tests are in the
testing guide (docs/guides/testing.md).
| ID | Criterion |
|---|---|
| K-1 | Keyboard. Every control is reached with Tab in reading order and used with Enter or Space; lists move with the arrow keys, beside a screen's own shortcuts (design.md §1: J/K, A/C/R, /); dialogs follow §6 there. |
| K-2 | Customer text is shown, never executed. Text from a document or a person appears literally; markup in it renders as text. |
| K-3 | Empty and error are visible on the page, in the wording of §5, and Reload works from the keyboard. |
| K-4 | Size. The screen's first load stays within a budget: every response body the browser receives from the backend until the screen and its fonts are ready, as served, at most 1 MB (1024 KB) — the owner's limit, set on 2026-11-17 (#616); the deploy fails only above it. The 600 KB watch line is not a test and never fails a build or a deploy: the weekly workflow first-load-check.yml (Mondays, also by hand) runs these K-4 tests, measures every screen the same way, and files one [Task] First load over 600 KB: <screen> issue per screen over the line — or comments on the one already open — with the measured size, the run link and the largest responses; nothing is filed while every screen is at or under it (#617). |
Test titles begin with the ID they check: X-3 · an unknown caseId shows "Case … does not exist.",
with the screen's registered prefix in place of X.