feat(base): handles hidden until their people go public, every answer about a new handle counted (ADR 0020, D5)

A handle's page and profiles.byHandle answer as for a handle nobody has
until its person goes public: a handle fixed by a publish, or a display
name, a bio, a link or an avatar (isPublic). A person's own profile, and
the host's own lookups (personWithHandle), are unchanged.

So every answer about a new handle now tells that an account has it,
and countHandleCheck counts them together on the register, 30 an hour
per person (or attempt) and 60 per network, refused beyond with
ProfileRefusal.tooManyHandleChecks: profile.checkHandle and saving a
profile with a handle new for the person, simpleLogin.checkHandle and
signUp, keys.set with a handle, and Halkyon Learn's inbox.block and
unblock, which look people up by handle. A person's own handle and what
is no handle aren't counted. The SimpleLogin limiters of commit 3 give
way to it, so a network's 60 are shared between people signed in and
people new. The register's checkHandle, saveProfile,
signUpWithSimpleLogin and setFirstKeys carry the visitor's network from
the member that asked.

Halkyon Learn's handle dialog words the new refusal (English, German).

Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-23 22:39:14 +02:00
commit 7eb1961b9f
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64
2 changed files with 674 additions and 134 deletions

View file

@ -103,6 +103,27 @@ void main() {
expect(find.text('Saved'), findsOneWidget);
});
testWidgets('the dialog says when the instance answers no more about '
'handles this hour, and nothing can be chosen', (tester) async {
final profiles = FakeProfileGateway()..checksSpent = true;
await showProfile(tester, profiles);
await tester.tap(find.text('Choose a handle'));
await tester.pumpAndSettle();
await typeHandle(tester, 'raisondetredev');
expect(
find.text('Too many handles were tried. Try again in an hour.'),
findsOneWidget,
);
expect(
tester
.widget<FilledButton>(find.widgetWithText(FilledButton, 'Choose'))
.onPressed,
isNull,
);
});
testWidgets('a profile saves a field when it is left or Enter is pressed, '
'only what changed, without losing what is being written', (
tester,

View file

@ -39,13 +39,18 @@ class FakeProfileGateway({
/// The handles checked, in order.
final checked = <String>[];
/// Whether the instance answers no more about handles this hour.
bool checksSpent = false;
@override
Future<ProfileProblem?> checkHandle(String handle) async {
if (fail case final error?) {
throw error;
}
checked.add(handle);
return _problemOf(handle);
return checksSpent
? ProfileProblem.tooManyHandleChecks
: _problemOf(handle);
}
ProfileProblem? _problemOf(String handle) {