Events 3.6.0, Accounts 1.5.0, contracts 1.14.0: the nightly people check
- Contracts 1.14.0: people.check in crosscode.identity-request/1 (500 subs) and its reply (active / deactivated / deleted / unknown, profile for the first two). - Accounts 1.5.0: answers people.check with profiles only for people the product knows; the reply isn't stored. - Events 3.6.0: accounts-people-check job (04:30): fixes out-of-date copies, handles deleted accounts as user.deleted, counts unknown people and stops (changing nothing) when most of a page is unknown; skipped with an Accounts older than 1.5.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -199,6 +199,29 @@ describe('people.* from a product', () => {
|
||||
assert.equal(again.body.created, true);
|
||||
});
|
||||
|
||||
test('1.5.0 people.check: profiles of the product\'s people, deleted accounts, and unknown for the rest; never stored', async () => {
|
||||
const ensure = (name: string, email: string) => ask({ type: 'people.ensure', name, email, phone: null, returnUrl: 'https://events.hope.test/' }).then((r) => r.body.sub as string);
|
||||
const known = await ensure('Check Known', 'check.known@hope.test');
|
||||
const gone = await ensure('Check Gone', 'check.gone@hope.test');
|
||||
await h.db.account.update({ where: { id: gone }, data: { status: 'deleted' } });
|
||||
const off = await ensure('Check Off', 'check.off@hope.test');
|
||||
await h.db.account.update({ where: { id: off }, data: { status: 'deactivated' } });
|
||||
const stranger = (await h.makeAccount({ email: 'check.stranger@hope.test' })).id as string;
|
||||
const nobody = crypto.randomUUID();
|
||||
const requestId = crypto.randomUUID();
|
||||
const res = await ask({ type: 'people.check', subs: [known, gone, off, stranger, nobody] }, { requestId });
|
||||
assert.equal(res.status, 200, JSON.stringify(res.body));
|
||||
const bySub = Object.fromEntries((res.body.people as { sub: string; status: string; profile: { name: string } | null }[]).map((p) => [p.sub, p]));
|
||||
assert.equal(bySub[known]!.status, 'active');
|
||||
assert.equal(bySub[known]!.profile!.name, 'Check Known');
|
||||
assert.equal(bySub[gone]!.status, 'deleted');
|
||||
assert.equal(bySub[gone]!.profile, null);
|
||||
assert.equal(bySub[off]!.status, 'deactivated');
|
||||
assert.deepEqual([bySub[stranger]!.status, bySub[stranger]!.profile], ['unknown', null], 'not known through this product: no profile');
|
||||
assert.equal(bySub[nobody]!.status, 'unknown');
|
||||
assert.equal(await h.db.productRequest.findUnique({ where: { requestId } }), null, 'the reply holds profiles: not kept');
|
||||
});
|
||||
|
||||
test('a retry with the same request id gets the same answer; a bad signature is refused', async () => {
|
||||
const requestId = crypto.randomUUID();
|
||||
const body = { type: 'people.ensure', name: 'Retry', email: 'retry@hope.test', phone: null, returnUrl: 'https://events.hope.test/' };
|
||||
|
||||
Reference in New Issue
Block a user