fix(auth): a member keeps the session a reset signed in when its notice comes late

A member remembers the session issueSessionAfter made, by the account and
the register's moment, and keeps it when the register's notice of that
moment arrives (the short reading's M2). The notice's moment, taken by the
member's clock, is later by its way there; when that took longer than the
reset's answer took to come back and the session to be made, the notice
ended the very session the reset had signed in, and the device had to sign
in again.

Kept in memory for a day, 10,000 at most: notices go out at once and
hourly until confirmed. A member restarted in between ends that session as
before. endSessionsHere takes a set of sessions to keep.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-21 17:45:43 +02:00
commit b83fa04594
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -453,8 +453,9 @@ Future<InstanceAnswer> answerRegister(
/// A member answering the register that [body]'s account's sessions ended
/// ([sessionsEndedPath], ADR 0017): those here created before the moment it
/// names end, but the one it keeps, and the register is told so. On the
/// register itself, nothing is answered.
/// names end, but the one it keeps and the one made here for that moment
/// (`sessionMadeAfter`), and the register is told so. On the register
/// itself, nothing is answered.
Future<InstanceAnswer> answerSessionsEnded(
Session session,
String body, {
@ -488,7 +489,10 @@ Future<InstanceAnswer> answerSessionsEnded(
session,
account,
endedBefore: _byThisClock(endedBefore, sentAt: sentAt),
keepSession: keepSession,
keepSessions: {
?keepSession,
?sessionMadeAfter(account, endedBefore),
},
);
return (status: 200, body: const <String, Object?>{});
}