Events 3.0: auto-connect, demo people in Accounts, e2e; import.finish checks the subs

- contracts 1.8.0 / Accounts 1.1.0: import.finish lists the subs the product
  relies on; Accounts checks each is held, not deleted and known to it (the
  count+hash failed a second move after Undo once someone had joined
  through Accounts).
- Events: connects to the church's Accounts once the Hub lists it;
  moveNewPeople (demo data, people added after the move); set-demo moves
  demo people; e2e/sign-in-accounts.spec.ts with Accounts in memory and an
  e2e-only /api rewrite. test:accounts 14/14; Jest auto-connect tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 14:28:54 +02:00
co-authored by Claude Opus 5.5
parent c627c61de1
commit 63d36c3ecf
24 changed files with 466 additions and 63 deletions
+17 -6
View File
@@ -426,17 +426,28 @@ only for a connected product:
`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`).
2. **`import.finish` lists every sub the product relies on** (all its linked users), and Accounts
checks each is an account it holds, not deleted, and known to that product (`ProductPerson`:
moved in, added, or signed in through it). A count and hash of the moved people (the first
version) failed a second move after Undo once anyone had joined through Accounts in between.
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.
That avoids a setup that depends on Accounts being connected first.
10. **Connect happens by itself** (§9): after a heartbeat that lists the church's Accounts, Events
connects to it if it isn't linked to one (`accounts/autoConnect.ts`), once: an admin's later
Disconnect stays. Hub 2.5.0 installs Accounts first for a new Events 3.x install (a batch:
Accounts, then Events once Accounts succeeded) on `accounts.<rest of the domain>` or the
form's Accounts domain, and refuses a church whose Accounts is older than the release needs.
11. **Demo data** (`set-demo.js`, `crosscode demo`): with sign-in through Accounts, the demo people
are moved there after seeding (`moveNewPeople`), with the demo password; a demo email that has
an account from an earlier demo is linked to it.
12. **e2e:** `e2e/sign-in-accounts.spec.ts` runs Accounts in memory (`e2e/support/accounts-server.mts`)
with its pages on 127.0.0.1:3221, and the Events site with its API on one address
(`E2E_API_PROXY`, a rewrite only the e2e frontend sets). Not run yet (needs the e2e Postgres).
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.
@@ -450,7 +461,7 @@ only for a connected product:
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`).
database (14 tests, including demo people and moving again after Undo). `user.export` and `user.deleted` are Jest tests (`tests/accountsCalls.test.ts`).
## Decisions