# Reviewer prompt for the builder

This note is for the builder who will later turn the locked ATO page and the school data into one page per school. It is not a go-ahead to change the look, run the generator, merge, or put anything live.

Call this work the **waiting-for-database ATO page pack**. Branch: `waiting-db/ato-page-generator-10nov`. Locked look: tag `locked/ato-page-final-v2-10nov` at `b18669e9`.

Do not name outside tools in notes back to MT. Do not contact SACAA. Do not put secrets in chat or in the repo. Do not touch `gate.ts`, `appdata/`, auth, `wm-core.js`, `wm-shell.css` or `wm-shell.js`. Do not force-push. Do not merge to `main`. Do not deploy production.

---

## How the generator idea works

One locked template plus one school’s data gives one page per school.

1. **The locked template** is `site/ato-v6.html` and `site/ato-v6/`. That look is finished. Do not change stars, sweep, layout, type, colours or spacing. Pictures that prove the look are in `docs/box-copy/pictures/ato-number-sweep/` (the approved lock) and `docs/box-copy/pictures/ato-category-rows-v2/` (history).
2. **The school data** is `docs/ato-master/` (277 schools) and the SACAA list already at `site/c/atp/d/`. A slug comes from the school name (`/ato/4-aviators`). If there is no name, the slug is the certificate digits only (`/ato/1132`). Each school has exactly one page, even with several certificates (`ATO-19`, `REV-023`).
3. **The draft generator** lives in `ato-generator/`. It is **not to be used** until MT confirms the themes. Do not run it to produce pages. Its README says this at the top.
4. When MT later says the generator may run, it should write only the page body. The top bar and logo stay in one shared file (`ATO-20`). `site/ga-page-header.css` is already in the tree. Changing the top bar once should update every school page, with no need to regenerate the bodies.
5. Base links on a school page are `/ad/{CODE}` (for example `/ad/FACT`). Until a generated aerodrome page exists, `/ad/FACT` forwards to `/fact.html`. A base with no known code stays plain text and must be flagged in the data check.
6. Every school gets a public page, including DTOs and schools whose approvals have expired (`ATO-21`). Expired is a certificate pill, not a reason to hide the page or lock reviews.
7. Do not copy example reviews from `site/ato-v6/v6-data.js` or any `ex*` samples into live school data (`REV-022`).

The design copy at `/ato-v6.html` is the full interactive mock (guest, Free, Pro, Trial, Founding, School, Anonymous). A generated guest page, when it is allowed to be built, is the guest view only: the body, the rating card, and the top helpful reviews, then a sign-in gate. The write form, votes and the rest of the reviews come after sign-in, once the database exists.

---

## What each user type can and cannot do on the ATO page

Rights below follow `docs/box-copy/ato-review-code-pack-10nov/PERMISSIONS.md` and the rules master at `c5de1c6a` (`DEC-010`, `DEC-011`, `REV-040`–`REV-061`). Newer MT decisions win (`MT-01`). The design copy shows these rules; it does not send anything.

Gifted Premium is a school state, not a member plan. DFE is a mark on a member, not a plan. Super Admin is the private owner console, not a badge on this page.

### Guest

- Can see the same rating card and the seven category averages as members. A category is a dash until it has 3 ratings.
- Can read the top 3 written, published reviews, ranked by counted upvotes, newest on a tie, then a sign-in gate. They do not see other people’s stars-only cards.
- Cannot write, reply or vote.
- Can report. The form needs name, cell, reason and a private email. The email is never shown on the page.
- Can read official replies that already sit under the top 3, including older replies from other schools.
- Sees other people’s public badges. An Anonymous post shows only the word Anonymous — no avatar.

### Free member

- Sees the full review list, not only the top 3. They see their own stars-only card; other people’s stay hidden.
- Can write a review, including of their own or employer’s school. 5 new reviews per SAST month. One review per school; replace after 6 calendar months. Delete does not give a slot back. A replace does not use a slot.
- Cannot edit a published review. Can add written text later to their own stars-only review. Stars stay locked. Adding text uses no extra quota.
- Can vote on any review or reply except their own. A counted vote needs an account older than 7 days, at most 20 counted votes per SAST day.
- Can report, same four fields.
- Cannot post an official reply.
- Cannot post anonymously. Free posts are always named.
- Shows grey licence and rating chips only. No Pro badge, no Trial badge, no Founding compass.
- May reply only inside the thread of their own review.

### Trial member

- Same as Free for reading, voting and reporting, but 20 new reviews a month.
- Can edit for 15 minutes, then the review locks and shows “Edited” plus the date.
- Can reply on any review, with no review of this school needed.
- Can post anonymously after ticking the agreement. Once Anonymous, it stays Anonymous forever.
- No Trial badge.

### Pro member

- Same rights as Trial (20 a month, 15-minute edit, reply anywhere, anonymous after the agreement).
- Pro gets a badge, but the look is not picked yet — do not invent one. Rights come from the plan, not from showing a badge.
- The Founding compass appears only if they are also Founding.

### Founding member

- Same rights as Trial and Pro (20 a month, 15-minute edit, reply anywhere, anonymous after the agreement).
- Named posts show the compass rose only — no “Founding” text. If they are also a verified DFE, show `name.dfe` and the blue DFE tick, and hide the compass. The Founding seat is still kept. The compass ends when Founding ends. No compass on an anonymous post.

### Gifted Premium (school page state)

- The school name gets the gold tick, the same as paid Premium, plus `.official` if the school is verified.
- The school account cannot write star reviews.
- It can vote anywhere except on its own post.
- It can post an official reply on its own page only.
- It cannot post anonymously.
- A gift must not be worded as SACAA approval.

### Verified school / ATO

- Cannot write star reviews of itself or of another school.
- Cannot edit or delete member reviews, or buy removal.
- Can vote on any review or reply, including on its own page, except its own post.
- Can report.
- Can post a new official reply on its own ATO page only, as `username.official`. Other schools’ old official replies stay visible to read.
- Gold tick when Premium is paid or gifted. Unpaid verified schools get `.official` only. Unclaimed schools get neither.

### DFE

- Rights follow their member plan. DFE status itself does not grant paid rights.
- On named posts, after Super Admin approval: `name.dfe`, with `.dfe` in blue, plus the blue DFE tick. A verified DFE who does not pay should get the non-blue DFE mark only, not the blue tick — that unpaid mark is not built yet.
- No DFE marks on an anonymous post.

### Banned or deleted member

- Can still read the public page.
- Cannot write new reviews or cast new votes while banned.
- Can still use the report form.
- Old named posts keep their badges. The public name is “Banned user” or “Deleted user”.
- Old anonymous posts stay “Anonymous”, with no badges and no Banned or Deleted hint.
- This banned/deleted behaviour is not built on the design copy yet.

### Super Admin

- Sees the same public page as any other visitor. What they can do follows however they are signed in.
- No Super Admin badge on the page.
- Looking up an anonymous author is off this page.

---

## What is missing

See `docs/waiting-db/TODAY-AGREEMENTS-CHECK.md` for the scored list. The short version:

- The database, member sign-in, and actually saving reviews, replies, votes and reports.
- 277 generated school pages (the generator is a draft; do not run it until MT confirms the themes).
- Forwards for `/ad/{CODE}` other than FACT.
- Banned / deleted labels, and keeping historic badges on those named posts.
- Follow ATOs.
- An A–Z school list / directory.
- The Pro badge look (do not invent one).
- The non-blue DFE mark for a verified DFE who does not pay.
- A hard cap of 3 grey chips in code (examples already stay at 3).

---

## Tests to run

Before any preview:

1. `node --check site/ato-v6/v6.js site/ato-v6/v6-data.js site/ato-v6/v6-parts.js`
2. The headless check: `/workspace/tools/browser-playwright/chk.mjs` with `/usr/bin/google-chrome`, against `site/ato-v6.html`.
3. Take 390px Amethyst night and Champagne day pictures. Compare the Amethyst night shot with `/workspace/ato-number-sweep/phone-390-amethyst-night.png`. The look must match. The only expected behaviour change in anonymous cards is that the “?” avatar is gone.

Do not run `ato-generator/generator.py` to produce pages. Do not run a production deploy. A files-only preview (functions moved aside, then restored) is the safe way to show the page.

If MT later confirms the themes and asks for generated pages, then and only then run the generator tests (`python3 -m pytest -q` inside `ato-generator/`) and check slugs, `/ad/{CODE}` links, Current/Expired from the expiry date, no fake reviews, and that a school with no reviews still builds.

---

## How to tighten security later

These are rules for when the database and sign-in exist. They are not a request to add server code now.

- Guests may read the public body and the top 3 reviews only. Never send the hidden review text to a guest.
- Write, reply, edit and vote need a signed-in member. Guests may report.
- Check name, cell, reason and a valid email on every report, on the server, not only in the page. Keep that email private. Never show it on the page.
- Strip name, avatar, badges, licences and profile links from any anonymous post. Anonymous stays anonymous forever, including after a ban or deletion.
- A school account cannot write star reviews and cannot edit member reviews.
- Counted votes need an account older than 7 days. Do not count your own post.
- Free has 5 new reviews a month; Trial, Pro and Founding have 20. A six-month replace and adding text later do not use a slot. Delete does not give a slot back.
- Form slugs with the allow-list `^[a-z0-9]+(?:-[a-z0-9]+)*$`. Keep generated files inside the output folder. Unknown slugs get a normal “School not found” page.
- Do not import example or `ex*` reviews. Do not invent ratings.
- Do not store members or reviews in the weather KV namespace.
- Do not put secrets, tokens or passwords in the repo or in chat.
- Do not contact SACAA or any school for this work.

---

## Open clashes

Fixed on this branch (behaviour only, not the locked look):

- Anonymous cards no longer show a “?” avatar.
- Example bases use `/ad/{CODE}`.
- Gifted Premium gets the gold tick.
- Guest gate copy no longer promises bars and categories after sign-in.
- Edit / Delete ids are escaped.
- Trial, Pro and Founding are no longer told to write a review before they can reply.

Still open:

- Nothing is saved or sent until the database exists.
- Four-field report checks, counted aged upvotes, and “Edited” / “Text added” on a future server.
- Free “cannot edit” must be enforced when writes go live (already true in the design copy).
- Banned / deleted labels and historic badges.
- Follow ATOs and the A–Z directory.
- Generating the 277 pages, and `/ad/{CODE}` forwards other than FACT.
- `REV-061` in the rules master still cites `7011ad23`; the look lock MT chose later is `b18669e9`. Do not edit the rules master on this branch.

If a new MT decision clashes with an older rule, patch or supersede the old rule and tell MT which rules clashed (`MT-01`). Do not change the locked page look unless MT unlocks it.
