feat(instance): the basics say when GitHub sign-in ends

ADR 0017, D2: GitHub sign-in is deprecated. Where the operator set
`GITHUB_SIGN_IN_ENDS`, `instance.basics()` names the day until it has
come, so apps can tell people who sign in with GitHub to add an
address, a password and an authenticator before then.

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-20 14:55:13 +02:00
commit 1daa1b649a
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -1,3 +1,4 @@
import 'package:clock/clock.dart';
import 'package:halkyon_base_server/base.dart';
import 'package:serverpod/serverpod.dart';
import 'package:test/test.dart';
@ -68,6 +69,32 @@ void main() {
expect(basics.gitHubClientId, isNull);
});
test('says when GitHub sign-in ends, until it has', () async {
final pod = sessionBuilder.build().serverpod;
final unauthenticated = sessionBuilder.copyWith(
authentication: AuthenticationOverride.unauthenticated(),
);
addTearDown(() => useGitHubSignInEnds(pod, null));
expect(basics.gitHubSignInEnds, isNull);
final ends = DateTime.utc(2027, 1, 22);
useGitHubSignInEnds(pod, ends);
expect(
(await withClock(
Clock.fixed(DateTime.utc(2026, 10, 22)),
() => endpoints.instance.basics(unauthenticated),
)).gitHubSignInEnds,
ends,
);
expect(
(await withClock(
Clock.fixed(ends),
() => endpoints.instance.basics(unauthenticated),
)).gitHubSignInEnds,
isNull,
);
});
test('offers email sign-in only where it can mail codes', () async {
final codes = EmailCodes.of(sessionBuilder.build().serverpod);
final unauthenticated = sessionBuilder.copyWith(