fix(app): no address in debug logs, and deleting goes on whatever reading the account met

The reading of the full reading's fixes found that SignInWaysState kept
Equatable's default text, which debug builds log with the address, and
that an unreadable sign_in.json logged its FormatException, whose message
holds the file's text; and that the account section's Delete caught only
refusals, so a keyring that couldn't be read escaped and the tap did
nothing.

The state says only whether an address is kept; the file's error logs its
type alone. Reading what keeps the account counts the keys as not here
where the keyring can't be read, and Delete goes on whatever the reading
met, failing as the session bloc says if it must.

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 16:38:36 +02:00
commit 28fb6c0309
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64
2 changed files with 77 additions and 4 deletions

View file

@ -0,0 +1,15 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:halkyon_app/halkyon_app.dart';
void main() {
test("what the sign-in ways' state logs never holds the address (the "
'reading of the fixes)', () {
const state = SignInWaysState(
loaded: true,
emailAddress: 'anna@example.org',
);
expect('$state', isNot(contains('anna')));
expect('$state', contains('loaded'));
});
}

View file

@ -1,8 +1,22 @@
import 'package:clock/clock.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:halkyon_app/halkyon_app.dart';
import 'package:halkyon_app/testing.dart';
/// A keyring the system won't read: locked, or its service gone.
final class _UnreadableKeys() implements AccountKeyStore {
@override
Future<void> keep(String person, UnlockedAccountKeys keys) async {}
@override
Future<UnlockedAccountKeys?> read(String person) =>
Future.error(PlatformException(code: 'locked'));
@override
Future<void> forgetAllBut(String? person) async {}
}
Matcher failsWith(PasswordProblem problem) => throwsA(
isA<PasswordFailed>().having((failed) => failed.problem, 'problem', problem),
);
@ -457,6 +471,23 @@ void main() {
expect(security.finished, isTrue);
expect(security.keysHere, isTrue);
});
test("says what keeps the account where the keyring can't be read, "
'the keys counted as not here (the reading of the fixes)', () async {
final unreadable = PasswordRepository(
gateway,
crypto,
_UnreadableKeys(),
auth,
addresses,
);
addTearDown(unreadable.dispose);
final security = await unreadable.security();
expect(security.hasPassword, isTrue);
expect(security.keysHere, isFalse);
});
});
});