Cross Events 3.0.0: sign-in through the church's Accounts

Settings -> Sign-in: check, move (everyone into Accounts with their password
hashes and authenticator apps, count/hash check, then switch) and undo for
14 days. Sign-in through auth-client with a one-time handoff to Events' own
token; staff roles stepped up to mfa; sign-out and back-channel logout;
user.updated/export/deleted; admin 2FA reset, unlock and profile changes via
Accounts; /login, /register, /forgot-password forward once moved; Events'
own sign-in endpoints answer SIGN_IN_MOVED. User.accountId, AccountsSignIn.

npm run test:accounts runs Events' code against the real Accounts app (11
tests); 5 new Jest tests. MIGRATING-TO-3.md, plan "Changes while building".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 14:10:30 +02:00
co-authored by Claude Opus 5.5
parent 56cbef1d9b
commit c627c61de1
49 changed files with 4094 additions and 245 deletions
+36 -2
View File
@@ -52,8 +52,9 @@ connected before its Events can move.
12. [What changes in each repo](#11-what-changes-in-each-repo)
13. [Testing](#12-testing)
14. [Releasing and rolling it out](#13-releasing-and-rolling-it-out)
15. [Decisions](#decisions)
16. [Still open](#still-open)
15. [Changes while building](#changes-while-building)
16. [Decisions](#decisions)
17. [Still open](#still-open)
---
@@ -418,6 +419,39 @@ only for a connected product:
login events, Events' audit log) → after 14 days the Undo window closes and the old secrets are
cleared. **The demo site first, then Hope Family Church**, then the rest.
## Changes while building
1. **One request schema for product → Accounts:** `crosscode.identity-request/1` at
`POST /api/accounts/v1/requests` carries both `import.*` and `people.*` (contracts 1.8.0), so
`crosscode.identity/1` (Accounts → product) is unchanged. The `people.*` names: `ensure`,
`update`, `resetTwoFactor`, `unlock`, `setActive`, `newsOff`. A request id seen before gets its
first answer.
2. **`import.finish` hashes the subs Accounts gave back**, not the Events ids, so people linked to an
account they already had count too. Accounts compares it with the people it holds as moved from
that product (`ProductPerson`).
3. **Notice versions are shifted by one:** Accounts' built-in notice is version 1, Events' is 0, so
Events' version *n* is Accounts' *n + 1* (acceptances too). "Use Cross Events' notice" when
Accounts already has its own isn't offered yet: the admin keeps Accounts' notice, or removes it
in Accounts first.
4. **The setup wizard still makes a local first admin** (§9 is not built): a new install starts in
`local`, and its admin moves sign-in once Accounts is connected (a one-person move takes seconds).
That avoids a setup that depends on Accounts being connected first. Signing in through Accounts
from the wizard can come with Hub 2.5.0's automatic Connect.
5. **People who never activated** (`isActive` false and never signed in) move as active accounts
without a password: Accounts' "Forgot your password?" sets one. Everyone else who is deactivated
moves as deactivated.
6. **`/login` forwards instead of a new `signInHref` in every link:** every existing
`/login?redirect=` link (and `useRequireAuth`, which now passes the current page) goes through it,
so the 49 files that link to `/login` didn't change.
7. **Events' own sign-in endpoints answer 409 `SIGN_IN_MOVED`** from one guard
(`src/accounts/guard.ts`) rather than in each controller. The guard only passes an admin's change
of someone's name, email or phone to Accounts for a valid, current admin token with its second step.
8. **The `auth-client` loader** uses a real dynamic `import()` (`src/accounts/client.ts`), since the
backend compiles to CommonJS and deploys still allow Node 20.
9. **Tests:** `npm run test:accounts` runs Events' own code (move, sign-in, sign-out, back-channel
logout, `user.updated`, Undo) against the whole Accounts app on real ports, each with an in-memory
database (11 tests). `user.export` and `user.deleted` are Jest tests (`tests/accountsCalls.test.ts`).
## Decisions
Confirmed by Joshua on 2026-11-19, all as proposed.
+1 -1
View File
@@ -32,7 +32,7 @@ every release).
| 1d | Agent 1.0.x + Hub 2.1.x (+ contracts 1.3.0) | **Released** 2026-11-17 (`agent@1.0.0`, `contracts@1.3.0`, Hub `v2.1.0`). **VM tested** end to end (AGENT-1.0-PLAN §13: joins, installs behind frp, scheduled / batch / missed updates, uninstall with export and purge, forged and replayed jobs). 2026-11-18: **`agent@1.0.1`** (the agent answers status on the central server itself) and Hub **`v2.1.1`** (adopt passes the church's address; Link takes the short name as a name). **Not rolled out**: use agent 1.0.1 and Hub 2.1.1 |
| 2 | Cross Events 2.4.0: protocol v2, Linked products, event feed, `packages/seo` (+ contracts 1.4.0, Hub 2.2.0) | **Released** 2026-11-18 (`events@2.4.0`, `contracts@1.4.0`, Hub `v2.2.0`, crosscode-site `v1.4.0`; [EVENTS-2.4-PLAN.md](./EVENTS-2.4-PLAN.md)). **Before any church gets it:** the Events e2e run on Postgres and the VM test (EVENTS-2.4-PLAN §8) |
| 3 | Accounts 1.0.0 (+ contracts 1.5.0, agent 1.1.0, Hub 2.3.0) | **Released** 2026-11-18 (`accounts@1.0.0`, `contracts@1.5.0`, `agent@1.1.0`, Hub `v2.3.0`, crosscode-site `v1.5.0`; [ACCOUNTS-1.0-PLAN.md](./ACCOUNTS-1.0-PLAN.md)). 37 backend and 8 Playwright tests pass without Postgres. **Before installing it for a church:** the VM test and a run on real Postgres; a Hub release source for `accounts@` tags |
| 4 | Cross Events 3.0.0: sign-in through Accounts, users migrated with their password hashes and 2FA | **Next.** Moved before the Website on 2026-11-19 (ROADMAP decision 38). Planned: [EVENTS-3.0-PLAN.md](./EVENTS-3.0-PLAN.md) (with contracts 1.8.0, Accounts 1.1.0, Hub 2.5.0); decisions confirmed 2026-11-19; being built on `feat/events-3.0` |
| 4 | Cross Events 3.0.0: sign-in through Accounts, users migrated with their password hashes and 2FA | **Next.** Moved before the Website on 2026-11-19 (ROADMAP decision 38). **Built** on `feat/events-3.0` (2026-11-19, not tagged): contracts 1.8.0, Accounts 1.1.0, Events 3.0.0 ([EVENTS-3.0-PLAN.md](./EVENTS-3.0-PLAN.md), "Changes while building"). `npm run check` passes; `npm run test:accounts` (Events against the real Accounts) 11/11. **Still to do:** Hub 2.5.0 (New install of Events 3.x adds Accounts first and connects), the Events Playwright run with Accounts, the VM test and real Postgres, crosscode-site 1.6.0 |
| 5–7 | Website 1.0.0 → App 1.0.0 → App 1.x | Not started |
## Next up