mirror of
https://github.com/block/buzz.git
synced 2026-11-25 18:52:52 +00:00
An empty Bestie slot cycles still posters from Fuzzies, Gloopies and Figgies every five seconds, without creating video players. The next poster is precached; reduced motion and hidden-screen pauses are preserved. The launcher uses the neutral “Bestie” label until a selection is available, then “Chat with …”. For supported communities with no owned agents, tapping opens Create agent directly. A successful first-agent setup saves that agent as Bestie without replacing an existing preference; existing-agent and unsupported-community paths keep the Agents list. Verified Builderlab registrations can show sleeping remote agents as Online. Owner-scoped saved runtime availability now prevents a known absent or deleted runtime from returning Online after Builderlab sign-out or a fresh load, even when another community retains its registration. Validation: mobile static checks; 4,274 Flutter tests passed with hosted flows enabled; launcher → cancel → create → Home “Chat with Scout”, including encrypted persisted selection; sign-out, fresh-load, owner isolation and deletion regressions. Restoring the old carousel produced three video-player requests; removing the saved-availability guard reproduced incorrect Online after sign-out. The earlier iPhone recording below shows the original carousel and entry flow and stops before creation. The new poster-only behavior and completed creation are covered by widget tests, not a new device recording. https://github.com/user-attachments/assets/94fcff72-967a-44c2-99d5-27c715e196a2 --------- Signed-off-by: kenny lopez <klopez4212@gmail.com> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
69 lines
2.2 KiB
Dart
69 lines
2.2 KiB
Dart
import 'package:buzz/shared/agents/first_agent_bestie.dart';
|
|
import 'package:buzz/shared/me/default_agent.dart';
|
|
import 'package:buzz/shared/me/me_sync.dart';
|
|
import 'package:buzz/shared/relay/relay.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:nostr/nostr.dart' as nostr;
|
|
import '../../helpers/remote_agents_fixture.dart';
|
|
import '../me/me_sync_test.dart' show FakeRelay;
|
|
import 'owned_agent_directory_test.dart' show registration;
|
|
|
|
class _Relay extends FakeRelay {
|
|
List<nostr.Keys> agents = [fakeAgentKeys];
|
|
bool fail = false;
|
|
@override
|
|
Future<List<NostrEvent>> fetchHistory(
|
|
NostrFilter filter, {
|
|
Duration timeout = const Duration(seconds: 8),
|
|
}) async {
|
|
if (fail) throw StateError('Offline');
|
|
if (filter.kinds.contains(30177)) {
|
|
return agents.map((agent) => registration(agent.public)).toList();
|
|
}
|
|
if (filter.kinds.contains(0)) {
|
|
return agents
|
|
.map((agent) => signedAgentProfile(agent, fakeOwner))
|
|
.toList();
|
|
}
|
|
return super.fetchHistory(filter, timeout: timeout);
|
|
}
|
|
}
|
|
|
|
void main() {
|
|
MeSync sync(_Relay relay) =>
|
|
MeSync(relay, RelayConfig(baseUrl: 'https://test', nsec: fakeOwner.nsec));
|
|
test(
|
|
'first created agent becomes Bestie and retries are idempotent',
|
|
() async {
|
|
final relay = _Relay();
|
|
final service = sync(relay);
|
|
await makeFirstAgentBestie(service, fakeAgent);
|
|
expect(decodeDefaultAgent(relay.events.single, service), fakeAgent);
|
|
await makeFirstAgentBestie(service, fakeAgent);
|
|
expect(relay.events, hasLength(1));
|
|
},
|
|
);
|
|
test('a second agent does not become Bestie automatically', () async {
|
|
final relay = _Relay()..agents.add(nostr.Keys('0' * 63 + '3'));
|
|
await makeFirstAgentBestie(sync(relay), fakeAgent);
|
|
expect(relay.writes, 0);
|
|
});
|
|
test(
|
|
'unknown directory and incomplete registration remain retryable',
|
|
() async {
|
|
final relay = _Relay()..fail = true;
|
|
await expectLater(
|
|
makeFirstAgentBestie(sync(relay), fakeAgent),
|
|
throwsStateError,
|
|
);
|
|
relay.fail = false;
|
|
relay.agents = [];
|
|
await expectLater(
|
|
makeFirstAgentBestie(sync(relay), fakeAgent),
|
|
throwsStateError,
|
|
);
|
|
expect(relay.writes, 0);
|
|
},
|
|
);
|
|
}
|