# Claim flow audit: free ATO school page (21 Nov 2026, SAST)

Asked by MT (t451u): "I like the design, but I need to be auditing it." This audit covers the claim design on the unclaimed free page (PR #31) against the real claim logic in **go-around-launch-11nov `codex/17-owner-decisions` @ `43f8783`**. It also covers every claim state, copy accuracy, overflow and keyboard use.

Rules (MT t456u): no product code was changed and nothing is merged. Design fixes are made only in this folder (`components/ato-free-page/`). The Founding ATO idea is dropped, so nothing here mentions it.

Code links below are `file:line` at `43f8783` (prefix `cloudflare/lib/reviews/` unless shown).

**Legend:**
- **PASS**: the design matches the code.
- **FAIL**: the code or the design breaks a rule.
- **MISSING**: no code or design exists yet.
- **FIXED**: a design-side issue found here and fixed on PR #31.

## Totals

| | PASS | FAIL | MISSING | FIXED (design) |
|---|---|---|---|---|
| 1. Design vs code | 13 | 4 | 3 | 3 |
| 2. States and edge cases | 14 | 1 | 4 | 7 |
| 3. Copy, layout, keyboard | 20 | 0 | 0 | 5 |
| **All** | **47** | **5** | **7** | **15** |

All 5 FAILs and all 7 MISSINGs are in product code, which is out of scope here. They are listed for MT at the end. Every design-side issue that was found is now FIXED.

## 1. Design vs the code's claim logic

| # | Check | Result | Where |
|---|---|---|---|
| C-01 | Only a signed-in, active **member** can claim. A guest is asked to sign up first. | PASS | `data_school.mjs:372`; design: guest sheet = 3 steps + "Sign up free", no form |
| C-02 | The claim body is name (≤80), role (≤80), proof (≤1,000, required) and note (optional, ≤1,000). | PASS (after fix) | `data_school.mjs:374-377`, `functions/api/me/school-claims.js:2-3` |
| C-03 | Errors use the server's own words ("Give your name and your role at the school." / "Tell us how we can check that you speak for this school."). | PASS (after fix) | `data_school.mjs:376-377` |
| C-04 | A claim is never instant. It is sent as **Pending**, never "verified". | PASS | `data_school.mjs:388` |
| C-05 | One waiting claim per school (DB unique index plus a check). | PASS | `data_school.mjs:379-380, 387`; `migrations-v2/0044_school_merges.sql:91-92` |
| C-06 | A school with an owner is refused and offered "dispute this claim". | PASS | `data_school.mjs:378`, `:333-334` (EC-23) |
| C-07 | Turnstile human check and honeypot on the claim request. | PASS | `functions/api/me/school-claims.js:7` |
| C-08 | **MT / Super Admin approval:** by hand, and a reason is required for approve and for reject. | PASS | `data_school.mjs:418-421` |
| C-09 | Approve sets the school `verified` **and its handle** in one batch. The handle must match `^[a-z0-9][a-z0-9._-]{1,30}$` and be unique. | PASS | `data_school.mjs:441-444, 461` |
| C-10 | Approve makes the claimant the owner and sends "You're now the owner … Pick a plan to turn the seats on." | PASS | `data_school.mjs:446-452` |
| C-11 | Reject sends the reason and "You can send a new claim with new proof." | PASS | `data_school.mjs:436` |
| C-12 | **Pay only after approval:** checkout refuses a school that isn't verified or has no handle. | PASS | `data_pay.mjs:140-143`, `data.mjs:1136` |
| C-13 | **Verified flag vs badges:** `.official` needs approval + handle + a first Premium payment, and stays after a lapse. The gold tick shows only while paying. | PASS | `data.mjs:1042-1057`, `projection.mjs:41-47` |
| C-14 | **Handle on an approved, never-paid school:** the design shows the plain handle with no `.official`. The real pipeline turns an approved, unpaid school back into `unclaimed`, so the live page would still say "Not claimed by the school yet" and show the claim link. | FAIL (code) | `tools/reviews/export_for_generator.mjs:31`, `ato-generator/template/parts/hero.j2:9-10` |
| C-15 | **Gift on an unclaimed school gets no tick:** Super Admin can gift Premium to any school with no claim check, and the tick follows any running Premium. | FAIL (code) | `data_admin.mjs:412-416`, `projection.mjs:47`, `data_badge_holders.mjs:54` (also PR #30 ATO-03, UI-09) |
| C-16 | **Remove school** (Edit Premium page, MT 20 Nov) should reset the school "as if it never paid and was never verified", after a confirm step. There is no Remove action, and `schools.status` has no way back from `verified`. | MISSING (code) | `data_school.mjs:444` (one-way), `data.mjs:1049-1050` ("ever paid" would bring `.official` back) |
| C-17 | **A claim page to send from:** the template links to `/ato/claim?slug=…`, which doesn't exist (only the API does). | MISSING (code) | `ato-generator/generator.py:914-915`, `template/ato.html.j2:63` |
| C-18 | **"My claims" for the member:** the API exists, but no member screen shows pending, rejected (with reason) or approved. | MISSING (code) | `data_school.mjs:409-415`; no use in `site/me/` |
| C-19 | **Claim line on every unclaimed page (HE-04):** the generator shows it only when the page has a gap (missing contact, About, aerodrome, courses or expiry), so a complete unclaimed page can't be claimed. | FAIL (code) | `ato-generator/generator.py:910-913` |
| C-20 | **Claim line copy:** the template says "Add your info — claim this page", but a claimed free school can't edit anything (editing is Premium only). | FAIL (copy, template) | `ato-generator/template/ato.html.j2:63`; Notion *Edit Premium* "Who can edit" |
| D-01 | FIXED: the old claim sheet had no form, no Pending, no Rejected, no competing claim, no has-owner state and no Super Admin decision. | FIXED | `site/free/free.js` (CL module) |
| D-02 | FIXED: the claim link pointed at a missing `/ato/claim`, so a middle-click or a link opened in a new tab broke. It is now `#claim` and opens the sheet. | FIXED | `site/free/free.js` paint() |
| D-03 | FIXED: the design now always shows the claim line on the unclaimed preview (HE-04) and uses "Is this your school? Claim this page". | FIXED | `site/free/free.js` paint() |

## 2. Every state

| # | State | Result | Notes |
|---|---|---|---|
| S-01 | Unclaimed (guest / member / Super Admin) | PASS | Hero "Not claimed by the school yet". Members get the form. Super Admin sees "No claim waiting" and can't claim (`needActive` member, `data_school.mjs:372`). |
| S-02 | Claim pending (own) | PASS · FIXED | The page says "Your claim is pending · sent <date>", and nothing public changes. |
| S-03 | Claim pending (someone else's) = competing claim | PASS · FIXED | "Someone has already asked for this page. We are checking it." No form. |
| S-04 | Super Admin review | PASS · FIXED | Shows who, name, role, proof and note. Handle and reason checks match the server. "Check against the public SACAA list. Never contact SACAA." (`migrations-v2/0010_school_claim.sql:3`) |
| S-05 | Rejected | PASS · FIXED | The reason is shown. "Send a new claim" keeps name and role and asks for new proof (`data_school.mjs:436`). |
| S-06 | Approved, unpaid | PASS (design) · FAIL (code, C-14) | Plain handle, no `.official`, no tick. The owner gets the free page (dock + Premium sheet; payment allowed, C-12). |
| S-07 | Paid | PASS | Not on the free page. Premium sheet copy checked in §3. |
| S-08 | Lapsed | PASS (rule) · not in this preview | It keeps `.official` and loses the tick (`data.mjs:1051-1057`). The template's lapsed bar covers it (`generator.py:875`). |
| S-09 | Removed by Super Admin | MISSING (code, C-16) | Design: identical to the unclaimed page (this preview). |
| S-10 | Has an owner → dispute | PASS · FIXED | A dispute needs a reason (≤5,000) and allows one open dispute per person; nothing about the page changes (`data_school.mjs:391-407`). |
| S-11 | Claimant banned or deleted while waiting | PASS | The claim closes itself with the reason (`data_school.mjs:469-472, 489, 502`). |
| S-12 | Approve when the claimant is no longer active | PASS | Refused (`data_school.mjs:440`). |
| S-13 | Handle taken | PASS · FIXED | "That handle is taken." (`data_school.mjs:461`) |
| S-14 | **Staff vs owner** | PASS | Staff join only by the owner's invite (`data_school.mjs:4-5`), and a free school has no staff seats (the staff link falls back to Guest). |
| S-15 | One member owning many schools | MISSING (rule) | Nothing stops one member owning many schools. Question Q4. |
| S-16 | **Wrong email domain** | MISSING (code) | There is no domain check. Proof is free text checked by hand. Throwaway addresses are blocked at sign-up (`data_auth.mjs:394`). The design promises no domain check; the hint suggests a school address. Question Q2. |
| S-17 | **Abuse:** rate limit | PASS | 5 claims per account per day (`data_school.mjs:381`), 3 disputes per day (`:401`). |
| S-18 | **Abuse:** squatting | FAIL (code) | A junk pending claim blocks the real school with no expiry. The real owner can't claim or dispute (dispute needs an owner, `data_school.mjs:395`). Question Q3. |
| S-19 | **Abuse:** proof attachments | MISSING (code) | Proof is text only, ≤1,000. FIXED in design: the hint no longer mentions a letter. |

## 3. Copy accuracy, overflow, keyboard

| # | Check | Result | Where |
|---|---|---|---|
| K-01 | "Google or email, the same sign-up every pilot uses." | PASS | `functions/api/auth/google/start.js`, `data_auth.mjs:231` |
| K-02 | "Go Around checks it by hand against the public SACAA record." | PASS | `migrations-v2/0010_school_claim.sql:3` |
| K-03 | "Then you are the owner and your handle is set. Premium is optional." | PASS | `data_school.mjs:444-452` |
| K-04 | "Your handle shows as .official from your first Premium payment." | PASS · FIXED (added) | `data.mjs:1044-1057` |
| K-05 | "Claiming never removes or edits a review." | PASS | No review write in `claimSchool` / `decideSchoolClaim` |
| K-06 | "A quick human check runs when you send." | PASS | `functions/api/me/school-claims.js:7` |
| K-07 | "You get a notice when it is decided." | PASS | `data_school.mjs:436, 452` |
| K-08 | Premium sheet prices R 3,999 (2 seats) and R 4,999 (5 seats) a month, excl. VAT. | PASS | `migrations-v2/0012_launch.sql:9`, `0031_seat_plans.sql:15`, `data_pay.mjs:7` |
| K-09 | Premium sheet: "an enquiry form". | FIXED (removed) | There is no enquiry table or endpoint at `43f8783` (Notion *Edit Premium*, code check). |
| K-10 | Premium sheet: on cancel "the page goes back to this free page". It doesn't, because `.official` stays. | FIXED | Now: "the gold tick and the Premium sections stop, and your .official name stays" (`data.mjs:1049-1057`). |
| K-11 | "Your Premium content is kept and returns when you renew." | PASS (MT rule ST-04) · code gap | Kept as MT's rule. The code has no keep-and-hide rule yet (Notion code check). |
| K-12 | Owner card: "Schools don't write star reviews or vote on their own page." | PASS | RV-14. An unpaid school can't vote (`data.mjs:1044`) |
| K-13 | Demo bar said "one shared copy, saved on the server", but the static preview saves in this browser. | FIXED | `site/free/free.js` pageSwitch() |
| K-14 | The review page's Reset confirm said "for everyone". | FIXED | `build.sh` (patched copy of `live.js`; the PR #29 source is untouched) |
| K-15 | Overflow: 4 themes × 320/390/820/1440, normal and reduced motion, every claim state | PASS | `tests/audit_free.py` (numbers below) |
| K-16 | Every frame of every claim transition stays inside the screen | PASS | same |
| K-17 | Every field has a `<label for>`. Hints and errors are tied with `aria-describedby`, and wrong fields get `aria-invalid`. | PASS | `tests/e2e_claim.py` |
| K-18 | Focus goes to the first wrong field, and typing clears its error | PASS | same |
| K-19 | Enter on the claim line opens the sheet, focus starts on Close, and Escape closes it and returns focus to the claim line | PASS | same |
| K-20 | Tab never reaches the page behind the open sheet (native modal `<dialog>`) | PASS | same |
| K-21 | Status messages are in a polite live region (`role="status"`) | PASS | `site/free/free.js` sheet footer |
| K-22 | Touch targets: buttons are 44px tall in the sheet and links 40px | PASS | `page.css:654`, `free.css` |
| K-23 | Text contrast uses theme tokens only. Error red has a lighter tone on dark themes. | PASS | `site/free/free.css` |
| K-24 | No `!important` and no new fonts | PASS | `tests/free.test.mjs` |

## Tests

- `node --test tests/free.test.mjs`: 8/8
- `python3 tests/e2e_free.py`: 29/29
- `python3 tests/e2e_claim.py`: 38/38 (new; every state above, keyboard included)
- `python3 tests/audit_free.py`: 672 states (4 themes × 4 widths × normal/reduced motion, incl. 13 claim states), 0 violations; 960 transitions, 100,130 frames, 0 violations
- Re-run after rebasing on the PR #29 21 Nov round (`8c60692`): all 13 claim states and every claim transition stay at 0 violations (960 transitions, 97,063 frames). There are 8 static hits in one non-claim state: Pilot C with every thread open at 320 px, where the upstream reply button label ("Reply", `.ob-nrp`) sits outside its pill in all 4 themes. That control belongs to PR #29 and is not changed here; it is reported to that branch.

## Decisions 21 Nov (MT)

| # | Question | Decision | Status |
|---|---|---|---|
| Q3 | Should a pending claim expire? | **Yes. A pending claim expires after 14 days if Super Admin hasn't decided it.** The school can then be claimed again, and the claimant is told. This closes S-18 (squatting). | **LOCKED (MT)** |
| Q4 | Can one member own more than one school? | **No. One member owns one school only.** A member who already owns a school (or has a claim waiting) is refused with "You already own a school." This closes S-15. | **LOCKED (MT)** |
| Q1 | What does an approved, never-paid school show? | It shows the plain handle, with no `.official` and no gold tick (as this design does). | Designer default; MT skipped it and can change it |
| Q2 | Is a school-domain email required? | No, not required. A claim whose proof has no email on the school's own domain is **flagged to Super Admin** in the review. | Designer default; MT skipped it and can change it |

For Codex, two new code gaps follow from these decisions:
- 14-day expiry: `school_claims` needs `expires_at` and a nightly close with the reason "Expired: not reviewed in 14 days", plus a notice. The partial unique index then ignores expired rows (`migrations-v2/0044_school_merges.sql:92`).
- One school per member: `claimSchool` (`data_school.mjs:371-389`) and `decideSchoolClaim` (`:418-465`) must refuse a member who owns a school or has another claim waiting. `assignOwnerStmts` (`:325-334`) needs the same check.
- Q1 is gap 1 below (C-14). Q2 needs a "domain match / no domain match" flag in the Super Admin claim queue (`site/owner/owner-api.mjs:65`).

The design copy now shows the 14-day expiry and the one-school rule (claim sheet, see commit).

## Code-side gaps for MT (no product code changed)

1. **C-14:** an approved, unpaid school renders as unclaimed. `export_for_generator.mjs:31` needs a third state ("claimed, never paid": plain handle, no claim line).
2. **C-15:** a gift can give an unclaimed school the gold tick. The gift needs a claim check, or the tick must require `status='verified'`.
3. **C-16:** Remove school (and Remove DFE) is missing. It needs a confirm step with a reason, a way back to `unclaimed`, an end to entitlements, and old payments marked so they no longer count as "ever paid".
4. **C-17 / C-18:** there is no claim page and no "My claims" screen. The API exists (`POST/GET /api/me/school-claims`).
5. **C-19:** the claim line is hidden on complete unclaimed pages.
6. **C-20:** the template's claim copy promises editing ("Add your info").
7. **S-18:** pending claims never expire, so squatting is possible.
8. **S-16 / S-19:** there is no email-domain check and proof is text only.

## Questions for MT

- **Q1:** Should an approved, never-paid school show its plain handle (this design)? Or should it show only its name until it pays?
- **Q2:** Should a claim from an address on the school's own domain (website or SACAA email) be marked "domain match" for Super Admin, or required?
- **Q3:** Should a pending claim expire (for example after 14 days), or let a second claimant ask Super Admin to look sooner?
- **Q4:** Can one member own more than one school?
