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

View file

@ -288,9 +288,22 @@ void main() {
);
expect(await remote.personWithHandle(session, 'ANNA'), anna);
expect((await remote.profilesOf(session, {anna, ben})).keys, [anna]);
expect(await remote.checkHandle(session, anna, 'Anna'), isNull);
expect(
await remote.checkHandle(session, ben, 'anna'),
await remote.checkHandle(
session,
anna,
'Anna',
network: '203.0.113.7',
),
isNull,
);
expect(
await remote.checkHandle(
session,
ben,
'anna',
network: '203.0.113.7',
),
ProfileRefusal.handleTaken,
);
await expectLater(
@ -314,6 +327,57 @@ void main() {
);
});
test("not public yet are nobody's to a member's apps, while its code "
'still finds whose a handle is (D5)', () async {
final anna = const Uuid().v7obj();
await remote.saveProfile(
session,
anna,
handle: 'Anna',
displayName: '',
bio: '',
links: const [],
network: '198.51.100.7',
);
expect(await remote.profileByHandle(session, 'anna'), isNull);
expect(await remote.personWithHandle(session, 'anna'), anna);
expect((await remote.profileOf(session, anna))!.handle, 'Anna');
});
test("count a member's answers about handles on the register, by "
"the person and the visitor's network", () async {
final anna = const Uuid().v7obj();
await remote.saveProfile(
session,
anna,
handle: 'Anna',
displayName: '',
bio: '',
links: const [],
network: '198.51.100.7',
);
await remote.checkHandle(
session,
anna,
'Anna_G',
network: '198.51.100.7',
);
final counted = await RateLimitedRequestAttempt.db.find(
session,
where: (t) => t.domain.equals('profile'),
);
expect(
counted.map((note) => (note.source, note.key)).toSet(),
{
('handle_checks', anna.uuid),
('handle_checks_per_network', '198.51.100.7'),
},
);
expect(counted, hasLength(4));
});
test('missing are said to be so', () async {
final nobody = const Uuid().v7obj();
@ -639,6 +703,7 @@ void main() {
attempt: start.attempt,
handle: 'carla',
setup: device.setup(),
network: '203.0.113.0/24',
);
expect(
@ -699,6 +764,7 @@ void main() {
attempt: start.attempt,
handle: 'admin',
setup: device.setup(),
network: '203.0.113.0/24',
),
refused(ProfileRefusal.handleReserved),
);
@ -708,6 +774,7 @@ void main() {
attempt: const Uuid().v7obj(),
handle: 'carla',
setup: device.setup(),
network: '203.0.113.0/24',
),
refused(OidcRefusal.unknownAttempt),
);
@ -720,6 +787,7 @@ void main() {
attempt: start.attempt,
handle: 'carla',
setup: device.setup(),
network: '203.0.113.0/24',
);
await expectLater(
remote.unlockKeys(
@ -771,6 +839,7 @@ void main() {
person: ben,
attempt: attempt,
setup: device.setup(),
network: '203.0.113.0/24',
),
refused(ProfileRefusal.handleInvalid),
);
@ -780,6 +849,7 @@ void main() {
person: ben,
attempt: const Uuid().v7obj(),
setup: device.setup(),
network: '203.0.113.0/24',
handle: 'ben',
),
refused(OidcRefusal.unknownAttempt),
@ -789,6 +859,7 @@ void main() {
person: ben,
attempt: attempt,
setup: device.setup(),
network: '203.0.113.0/24',
handle: 'ben',
);
@ -800,6 +871,7 @@ void main() {
person: ben,
attempt: await signedInAgain(ben, 'sl-ben'),
setup: device.setup(),
network: '203.0.113.0/24',
),
refused(PasswordRefusal.passwordExists),
);
@ -829,6 +901,7 @@ void main() {
attempt: start.attempt,
handle: 'carla',
setup: device.setup(),
network: '203.0.113.0/24',
);
final keepSession = const Uuid().v7obj();
@ -931,6 +1004,7 @@ void main() {
attempt: first.attempt,
handle: 'Dora',
setup: device.setup(),
network: '203.0.113.0/24',
);
final start = await remote.beginSimpleLogin(
session,