mirror of
https://github.com/block/buzz.git
synced 2026-10-27 12:40:30 +00:00
## Summary Enter a desktop-only, random six-digit code on mobile to pair without a desktop confirmation click. Verification uses the encrypted session, limits guesses to five, and never treats the QR-derived transcript as approval. Older clients retain desktop confirmation. Adds digit-only error shakes and native haptics, a separate biometrics choice, and a direct community-icon arrival animation. Fixes dropped early offers and resets completed pairing so reopening or signing out cannot get stuck. ### Related issue Related: #8060; no duplicate code-entry PR found. <img width="780" height="1688" alt="01-enter-code" src="https://github.com/user-attachments/assets/a99ced3e-4305-4ac6-a6cc-d598ced423e7" /> <img width="780" height="1688" alt="02-incorrect-code" src="https://github.com/user-attachments/assets/19cdb109-1f10-40a9-a661-1d7ba89c81c1" /> <img width="780" height="1688" alt="03-biometrics" src="https://github.com/user-attachments/assets/af1b2924-9ab6-4d1a-b4b1-fccfdf446404" /> <img width="780" height="1688" alt="04-community-loading" src="https://github.com/user-attachments/assets/84145d82-843a-4c25-aef7-6492fc241d4b" /> <img width="897" height="388" alt="05-desktop-code" src="https://github.com/user-attachments/assets/d8a2e469-7e42-466a-988f-bab6b1df85fc" /> ### Release order Deploy the updated pairing relay first, then desktop, then mobile. The relay now allows eight events per connection (seven for a successful fifth guess plus room for cancellation), with a corresponding bounded delivery budget. Existing clients remain supported; older client combinations keep desktop confirmation. ### Testing - 103 mobile pairing tests, 270 core tests, 51 relay integration tests, and the new real-relay fifth-guess flow passed. - The real-relay regression verifies proof, decrypted identity import, and completion after four wrong guesses. Restoring the old six-event cap makes it fail. - A paused-clock desktop regression confirms slow readiness cannot extend the visible QR beyond protocol expiry. Mobile regression covers typing before negotiation completes. - Core/pair-relay Clippy and full native desktop Clippy/workspace tests passed. Mobile analysis passed; broad mobile runs each hit an unrelated failure (a gateway-script timeout and a native-menu missing-plugin error), and both affected test files passed separately. - Repository-wide Rust testing exhausted local disk space while compiling unrelated packages. The final push omitted that resource-blocked hook and avoided repeating the desktop/mobile runs above; hosted CI remains required. --------- Signed-off-by: kenny lopez <klopez4212@gmail.com>
121 lines
3.7 KiB
Dart
121 lines
3.7 KiB
Dart
import 'dart:async';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:buzz/shared/community/paired_community_landing.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
import 'package:buzz/app.dart';
|
|
import 'package:buzz/features/age_gate/age_signal_provider.dart';
|
|
import 'package:buzz/shared/auth/auth.dart';
|
|
import 'package:buzz/shared/theme/theme_provider.dart';
|
|
|
|
void main() {
|
|
testWidgets('pairing loading cover blocks hidden input and semantics', (
|
|
tester,
|
|
) async {
|
|
SharedPreferences.setMockInitialValues({});
|
|
final prefs = await SharedPreferences.getInstance();
|
|
final container = ProviderContainer(
|
|
overrides: [
|
|
authProvider.overrideWith(() => _FakeAuthNotifier()),
|
|
ageSignalProvider.overrideWith(() => _AllowedAgeSignalNotifier()),
|
|
savedPrefsProvider.overrideWithValue(prefs),
|
|
],
|
|
);
|
|
addTearDown(container.dispose);
|
|
final semantics = tester.ensureSemantics();
|
|
String semanticsTree() => tester
|
|
.binding
|
|
.renderViews
|
|
.single
|
|
.owner!
|
|
.semanticsOwner!
|
|
.rootSemanticsNode!
|
|
.toStringDeep();
|
|
await tester.pumpWidget(
|
|
UncontrolledProviderScope(container: container, child: const App()),
|
|
);
|
|
await tester.pump();
|
|
var taps = 0;
|
|
final navigator = tester.state<NavigatorState>(
|
|
find.byType(Navigator).first,
|
|
);
|
|
unawaited(
|
|
navigator.push(
|
|
MaterialPageRoute<void>(
|
|
builder: (_) => Scaffold(
|
|
body: Align(
|
|
alignment: Alignment.topLeft,
|
|
child: TextButton(
|
|
onPressed: () => taps++,
|
|
child: const Text('Hidden action'),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
final button = find.text('Hidden action');
|
|
final location = tester.getCenter(button);
|
|
expect(semanticsTree(), contains('Hidden action'));
|
|
container
|
|
.read(pairedCommunityLandingProvider.notifier)
|
|
.request(
|
|
Community(
|
|
id: 'test',
|
|
addedAt: DateTime(2026),
|
|
name: 'Test',
|
|
relayUrl: 'https://relay.test',
|
|
),
|
|
);
|
|
await tester.pump();
|
|
await tester.tapAt(location);
|
|
expect(taps, 0);
|
|
expect(semanticsTree(), isNot(contains('Hidden action')));
|
|
container.read(pairedCommunityLandingProvider.notifier).clear();
|
|
await tester.pump();
|
|
expect(semanticsTree(), contains('Hidden action'));
|
|
await tester.tapAt(location);
|
|
expect(taps, 1);
|
|
await tester.pumpWidget(const SizedBox.shrink());
|
|
semantics.dispose();
|
|
});
|
|
|
|
testWidgets('App renders pairing page when unauthenticated', (
|
|
WidgetTester tester,
|
|
) async {
|
|
SharedPreferences.setMockInitialValues({});
|
|
final prefs = await SharedPreferences.getInstance();
|
|
|
|
await tester.pumpWidget(
|
|
ProviderScope(
|
|
overrides: [
|
|
authProvider.overrideWith(() => _FakeAuthNotifier()),
|
|
ageSignalProvider.overrideWith(() => _AllowedAgeSignalNotifier()),
|
|
savedPrefsProvider.overrideWithValue(prefs),
|
|
],
|
|
child: const App(),
|
|
),
|
|
);
|
|
await tester.pump();
|
|
expect(find.bySemanticsLabel('Buzz'), findsOneWidget);
|
|
expect(find.text('Scan a QR code'), findsOneWidget);
|
|
});
|
|
}
|
|
|
|
class _AllowedAgeSignalNotifier extends AgeSignalNotifier {
|
|
@override
|
|
AgeSignalState build() => AgeSignalState.allowed;
|
|
|
|
@override
|
|
Future<void> request() async {}
|
|
}
|
|
|
|
class _FakeAuthNotifier extends AuthNotifier {
|
|
@override
|
|
Future<AuthState> build() async {
|
|
return const AuthState(status: AuthStatus.unauthenticated);
|
|
}
|
|
}
|