fix(app): GitHub's refusals say why, and no hint adds GitHub where passwords are offered

Where an instance offers password sign-in, GitHub is added to nobody (ADR
0017, D2), yet the start screen still said "then add GitHub" after a GitHub
account nobody has, and every refusal but an unknown account read
"Couldn't sign in with GitHub." (the end-to-end test of 21 Oct).

- The gateway tells from one read of the basics whether GitHub signs in and
  whether it is added to people (`gitHubOffer`, in place of
  `gitHubClientId`); the GitHub bloc keeps it (`Ready.linking`) for the
  profile, with why an attempt failed (`Ready.problem`).
- The instance's `usePassword`, `deprecated` and `ended` become problems of
  their own (`gitHubSignInProblemOf`), worded by `gitHubProblemText` and on
  the start screen; an anonymous person refused a link is told the GitHub
  account is nobody's and offered the password instead.
- Where passwords are offered, the start screen offers an account to create
  in place of the app's hint on adding GitHub.

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 19:19:28 +02:00
commit 19aabb0266
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -98,7 +98,8 @@ void main() {
});
testWidgets('from there, GitHub signs in its person; a GitHub account '
'nobody here has yet is said so', (tester) async {
'nobody here has yet is said so, with an account to create in its '
'place where passwords are offered (ADR 0017)', (tester) async {
await dependencies.signedOut.write(signedOut: true);
await start(tester);
@ -109,12 +110,16 @@ void main() {
await tester.pumpAndSettle();
expect(
find.text(
// The package's sentence, then the app's on where GitHub is added.
'No account here signs in with this GitHub account yet. Start '
'without an account, then add GitHub in Settings.',
'No account here signs in with this GitHub account yet. Create an '
'account with your email address and a password instead.',
),
findsOneWidget,
);
expect(
find.textContaining('add GitHub'),
findsNothing,
reason: 'GitHub is added to nobody where passwords are offered',
);
gateway.gitHubError = null;
await tester.tap(find.text('Sign in with GitHub'));
@ -140,6 +145,55 @@ void main() {
expect(find.text('App of github-person'), findsOneWidget);
});
testWidgets('where no passwords are offered, a GitHub account nobody here '
'has yet is said so with where the app adds GitHub', (tester) async {
dependencies.passwordGateway.offered = false;
await dependencies.signedOut.write(signedOut: true);
await start(tester);
gateway.gitHubError = const GitHubSignInFailed(
GitHubSignInProblem.unknownAccount,
);
await tester.tap(find.text('Sign in with GitHub'));
await tester.pumpAndSettle();
expect(
find.text(
// The package's sentence, then the app's on where GitHub is added.
'No account here signs in with this GitHub account yet. Start '
'without an account, then add GitHub in Settings.',
),
findsOneWidget,
);
});
testWidgets('an account that signs in with its password, and GitHub having '
'ended, are each said so', (tester) async {
await dependencies.signedOut.write(signedOut: true);
await start(tester);
gateway.gitHubError = const GitHubSignInFailed(
GitHubSignInProblem.usePassword,
);
await tester.tap(find.text('Sign in with GitHub'));
await tester.pumpAndSettle();
expect(
find.text(
'This account signs in with its email address and password now, '
'not with GitHub.',
),
findsOneWidget,
);
gateway.gitHubError = const GitHubSignInFailed(GitHubSignInProblem.ended);
await tester.tap(find.text('Sign in with GitHub'));
await tester.pumpAndSettle();
expect(
find.text('Sign-in with GitHub has ended on this instance.'),
findsOneWidget,
);
expect(find.text("Couldn't sign in with GitHub."), findsNothing);
});
testWidgets('offers only the ways the instance has', (tester) async {
gateway.offersGitHub = false;
dependencies.passwordGateway.offered = false;