WIP 2.0.0: v1 removed; Argon2id passwords; node-fetch gone

- /api (v1) answers 410 API_V1_REMOVED, except provider webhooks
  (/api/webhooks/*, /api/whatsapp/webhook) and links in sent messages
  (308s, one-click POST). 43 v1 route files and deprecation.ts removed;
  /docs redirects to /docs/v2; API_DOCUMENTATION.md points there.
- Read-only and impersonation lists name v2 paths only. The campus
  scope route test now runs over v2 routes (v2CampusScope.test.ts).
- Passwords hashed with Argon2id (@node-rs/argon2); bcrypt hashes still
  sign in and are re-hashed at the next sign-in.
- e2e on /api/v2 only (v2() helper); Playwright waits on /api/v2.
- MIGRATING-TO-2.md with the full v1 -> v2 table.
- Two documented response shapes corrected.

Backend 690 tests and e2e 102/102 (PayFast sandbox skipped) pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-02 16:35:06 +02:00
co-authored by Claude Opus 5.5
parent 57b3c41067
commit 3f59164ab2
97 changed files with 1099 additions and 4398 deletions
+28
View File
@@ -49,6 +49,34 @@ and this project follows [Semantic Versioning](https://semver.org/).
editor.
- `npm run ai:eval` (backend): the helpers' eval set — fixed examples run through the site's Hub
connection, with automatic checks on the facts and every answer printed to read.
- **MIGRATING-TO-2.md:** what changes for integrations and for whoever runs the server, with every
v1 address and its v2 replacement.
### Removed
- **API v1** (`/api/…`). Every screen has used `/api/v2` since 1.51.16. Any v1 address now answers
`410 Gone` with `code: "API_V1_REMOVED"`, except what outside senders still use: the provider
webhooks (`/api/webhooks/yoco|payfast|whatsapp` and WAWP's oldest `/api/whatsapp/webhook`) and
the links in messages already sent (calendar files and one-click unsubscribe answer `308` with
their v2 address; a mail app's one-click POST to the old address is still handled) —
`legacyV1Router` and `v1Removed` in `src/v2/links.ts`. The 43 v1 route files are gone (the
controllers stay: `v1Route` runs them behind v2 routes); so are the `Deprecation` headers
(`src/v2/deprecation.ts`), the v1 reference at `/docs` (it redirects to `/docs/v2`) and the
hand-written `backend/API_DOCUMENTATION.md` (now a pointer to `/docs/v2`).
- `node-fetch` from the backend's dependencies (nothing used it since the move to native `fetch`).
### Changed
- **Passwords are hashed with Argon2id** (`@node-rs/argon2`, 19 MiB, 2 passes) instead of bcrypt.
bcrypt hashes still sign in, and are re-hashed with Argon2id the first time each person signs in
(`needsRehash` in `src/config/auth.js`, used by `logIn`). `bcryptjs` stays only to check those.
- The campus-scope route test runs over the v2 routes (`tests/v2CampusScope.test.ts`): each staff
or supervisor route needs a campus-scope middleware or must be on the list of routes whose
service checks campuses itself. The read-only and impersonation lists name v2 paths only.
- e2e tests call `/api/v2` only (`v2()` in `e2e/fixtures.ts` returns the answer's `data`);
Playwright waits for `/api/v2/setup/needed`.
- Documented shapes corrected: the access log's `actions` (action → label) and a cash-up's
`cashDenominations` (notes and coins).
## [1.52.3] - 2026-11-02