The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
fix(mobile): the welcome screen and pairing scroll instead of overflowing
deeb4bd2c73ea23
diff --git a/mobile/lib/phone/welcome/pairing_with_code.dart b/mobile/lib/phone/welcome/pairing_with_code.dartindex 36c8d888e..754a0bca3 100644--- a/mobile/lib/phone/welcome/pairing_with_code.dart+++ b/mobile/lib/phone/welcome/pairing_with_code.dart@@ -74,28 +74,44 @@ class _PairingWithCodeState extends State<PairingWithCode> {body: SafeArea(child: Padding(padding: const EdgeInsets.fromLTRB(Tty.origin, 48, Tty.origin, 24),- child: Column(- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- Text(- error == null ? 'Connecting to\n$name…' : 'Couldn’t connect',- style: tty- .style(size: TtySize.display, weight: FontWeight.w600)- .copyWith(height: 34 / 28, letterSpacing: -0.6),- ),- const SizedBox(height: 12),- TtyText(- error ?? 'Keep “Add phone” open on your Mac.',- color: error == null ? tty.faint : tty.red,- size: TtySize.row,- ),- const Spacer(),- if (error != null)- TtyPrimaryButton(- label: 'Use its password instead',- onPressed: _usePassword,+ // Scrolls when it does not fit — a long computer name at a large text size is more lines+ // than a small phone has, and the button was pushed off the foot of an overflowing column.+ child: LayoutBuilder(+ builder: (context, box) => SingleChildScrollView(+ child: ConstrainedBox(+ constraints: BoxConstraints(minHeight: box.maxHeight),+ child: IntrinsicHeight(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Text(+ error == null+ ? 'Connecting to\n$name…'+ : 'Couldn’t connect',+ style: tty+ .style(+ size: TtySize.display,+ weight: FontWeight.w600,+ )+ .copyWith(height: 34 / 28, letterSpacing: -0.6),+ ),+ const SizedBox(height: 12),+ TtyText(+ error ?? 'Keep “Add phone” open on your Mac.',+ color: error == null ? tty.faint : tty.red,+ size: TtySize.row,+ ),+ const Spacer(),+ if (error != null)+ TtyPrimaryButton(+ label: 'Use its password instead',+ onPressed: _usePassword,+ ),+ ],+ ),),- ],+ ),+ ),),),),diff --git a/mobile/lib/phone/welcome/phone_welcome.dart b/mobile/lib/phone/welcome/phone_welcome.dartindex a74ef18fd..26cf58654 100644--- a/mobile/lib/phone/welcome/phone_welcome.dart+++ b/mobile/lib/phone/welcome/phone_welcome.dart@@ -333,45 +333,57 @@ class _Hello extends StatelessWidget {.copyWith(height: 34 / 28, letterSpacing: -0.6);return Padding(padding: const EdgeInsets.fromLTRB(Tty.origin, 24, Tty.origin, 24),- child: Column(- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- GestureDetector(- key: const ValueKey('welcome-wordmark'),- behavior: HitTestBehavior.opaque,- onLongPress: onSample,- child: Row(- children: [- TtyText(- 'harness',- size: TtySize.title,- weight: FontWeight.w600,- ),- Container(- width: 9,- height: 18,- margin: const EdgeInsets.only(left: 2),- color: tty.green,- ),- ],+ // ⚠️ **Scrolls when it does not fit.** The spacer holds the question at the foot where there+ // is room; on a small phone at a large text size the headline alone outgrew the screen, and+ // the column overflowed with both answers — the only ways on — pushed off its foot.+ child: LayoutBuilder(+ builder: (context, box) => SingleChildScrollView(+ child: ConstrainedBox(+ constraints: BoxConstraints(minHeight: box.maxHeight),+ child: IntrinsicHeight(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ GestureDetector(+ key: const ValueKey('welcome-wordmark'),+ behavior: HitTestBehavior.opaque,+ onLongPress: onSample,+ child: Row(+ children: [+ TtyText(+ 'harness',+ size: TtySize.title,+ weight: FontWeight.w600,+ ),+ Container(+ width: 9,+ height: 18,+ margin: const EdgeInsets.only(left: 2),+ color: tty.green,+ ),+ ],+ ),+ ),+ const SizedBox(height: 48),+ Text(+ 'Claude Code and Codex\nrun on your computer.\nDrive them from here.',+ style: hero,+ ),+ const Spacer(),+ TtyText(+ 'Is Harness on your computer?',+ color: tty.faint,+ size: TtySize.row,+ ),+ const SizedBox(height: 12),+ _Answer(label: 'Yes — scan to connect', onTap: onScan),+ const SizedBox(height: 10),+ _Answer(label: 'Not yet — set it up', onTap: onSetUp),+ ],+ ),),),- const SizedBox(height: 48),- Text(- 'Claude Code and Codex\nrun on your computer.\nDrive them from here.',- style: hero,- ),- const Spacer(),- TtyText(- 'Is Harness on your computer?',- color: tty.faint,- size: TtySize.row,- ),- const SizedBox(height: 12),- _Answer(label: 'Yes — scan to connect', onTap: onScan),- const SizedBox(height: 10),- _Answer(label: 'Not yet — set it up', onTap: onSetUp),- ],+ ),),);}diff --git a/mobile/test/phone_edge/edge_fixture.dart b/mobile/test/phone_edge/edge_fixture.dartindex b09bb1f1a..1dda844a1 100644--- a/mobile/test/phone_edge/edge_fixture.dart+++ b/mobile/test/phone_edge/edge_fixture.dart@@ -313,13 +313,16 @@ Future<void> expectNoLayoutErrors(setPhone(tester, phone);final before = grid.AppTheme.brightness.value;grid.AppTheme.brightness.value = brightness;+ final where = '$name ×${scale.toStringAsFixed(2)} ${brightness.name}';try {final errors = await collectErrors(() => pump(scale, brightness));for (final error in errors.toSet()) {- failures.add(- '$name ×${scale.toStringAsFixed(2)} ${brightness.name}: $error',- );+ failures.add('$where: $error');}+ } on Object catch (error) {+ // A step of the test that could not be taken — a control the layout pushed out of+ // reach — says which phone it was on.+ fail('$where: $error');} finally {grid.AppTheme.brightness.value = before;}@@ -365,6 +368,22 @@ Future<void> loadRealFontsIfAsked() async {}}+/// Taps [finder] once it is scrolled into view — on a small phone at a large text size, most of+/// a screen is below the fold.+Future<void> tapInView(WidgetTester tester, Finder finder) async {+ // Not even built yet: a list builds only a screen's worth past what it shows.+ if (finder.evaluate().isEmpty) {+ await tester.scrollUntilVisible(+ finder,+ 200,+ scrollable: find.byType(Scrollable).first,+ );+ }+ await tester.ensureVisible(finder);+ await tester.pump();+ await tester.tap(finder);+}+/// Takes the screen down and runs its clocks out, so no timer outlives the test.Future<void> unmount(WidgetTester tester) async {await tester.pumpWidget(const SizedBox());diff --git a/mobile/test/phone_edge/welcome_layout_test.dart b/mobile/test/phone_edge/welcome_layout_test.dartnew file mode 100644index 000000000..56247d37f--- /dev/null+++ b/mobile/test/phone_edge/welcome_layout_test.dart@@ -0,0 +1,228 @@+import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness_mobile/core/models.dart';+import 'package:harness_mobile/phone/tty.dart';+import 'package:harness_mobile/phone/welcome/connect_computer.dart';+import 'package:harness_mobile/phone/welcome/focus_hints.dart';+import 'package:harness_mobile/phone/welcome/how_it_works.dart';+import 'package:harness_mobile/phone/welcome/pairing_with_code.dart';+import 'package:harness_mobile/phone/welcome/phone_boot.dart';+import 'package:harness_mobile/phone/welcome/phone_welcome.dart';+import 'package:harness_mobile/phone/welcome/pick_up_page.dart';+import 'package:harness_mobile/phone/welcome/scan_to_connect.dart';+import 'package:harness_mobile/phone/welcome/unlock_computer.dart';+import 'package:harness_mobile/state/app_state.dart';++import '../voice_fakes.dart';+import 'edge_fixture.dart';++/// The first-run flow — every screen somebody meets before their first harness — laid out at every+/// phone, scale and brightness, with an account and a computer whose names are long. None may+/// report an overflow.+///+/// ⚠️ Nothing here reaches anything real: the downloads manifest, the camera, the account service+/// and the computer are all stand-ins, and no screen is left up long enough for a poll to fire.+void main() {+ setUpAll(loadRealFontsIfAsked);++ Future<void> pump(+ WidgetTester tester,+ Widget screen,+ double scale,+ Brightness brightness,+ ) async {+ await tester.pumpWidget(+ phoneApp(screen, textScale: scale, brightness: brightness),+ );+ await frames(tester);+ }++ Widget welcome(AppNotifier app) => PhoneWelcome(+ notifier: app,+ onTrySample: (_) async => null,+ sendCode: (_) async {},+ signIn: (_, _) async => throw Exception(+ 'That code has expired. Ask for a new one and try again within ten minutes.',+ ),+ signInWithScan: (_) async {},+ scanCamera: const SizedBox(),+ loadDownloads: () async => const {},+ );++ testWidgets('the first screen', (tester) async {+ await expectNoLayoutErrors(tester, (scale, brightness) async {+ final app = edgeApp(noMachines: true);+ addTearDown(app.dispose);+ await pump(tester, welcome(app), scale, brightness);+ expect(find.text('Yes — scan to connect'), findsOneWidget);+ });+ });++ testWidgets('scan, then email, then a code that fails', (tester) async {+ await expectNoLayoutErrors(tester, (scale, brightness) async {+ final app = edgeApp(noMachines: true);+ addTearDown(app.dispose);+ await pump(tester, welcome(app), scale, brightness);+ await tapInView(tester, find.text('Yes — scan to connect'));+ await frames(tester);+ await tapInView(tester, find.text('Use email instead'));+ await frames(tester);+ await tester.enterText(+ find.byType(TextField),+ '[email protected]',+ );+ raiseKeyboard(tester);+ await frames(tester);+ // The keyboard's own `go`: with it up on a small phone, the button can be below the fold.+ await tester.testTextInput.receiveAction(TextInputAction.go);+ await frames(tester);+ await tester.enterText(find.byType(TextField), '1234');+ await frames(tester);+ expect(find.textContaining('expired'), findsOneWidget);+ lowerKeyboard(tester);+ await frames(tester);+ });+ });++ testWidgets('the set-up page', (tester) async {+ await expectNoLayoutErrors(tester, (scale, brightness) async {+ final app = edgeApp(noMachines: true);+ addTearDown(app.dispose);+ await pump(tester, welcome(app), scale, brightness);+ await tapInView(tester, find.text('Not yet — set it up'));+ await frames(tester);+ await tester.drag(find.byType(ListView), const Offset(0, -2000));+ await frames(tester);+ });+ });++ testWidgets('scanning, signing in', (tester) async {+ await expectNoLayoutErrors(tester, (scale, brightness) async {+ await pump(+ tester,+ Scaffold(+ body: SafeArea(+ child: ScanToConnectPage(+ onCode: (_) {},+ onUseEmail: () {},+ onBack: () {},+ signingIn: true,+ camera: const SizedBox(),+ ),+ ),+ ),+ scale,+ brightness,+ );+ });+ });++ testWidgets('set up your computer, signed in, both ways', (tester) async {+ await expectNoLayoutErrors(tester, (scale, brightness) async {+ final app = edgeApp(noMachines: true);+ addTearDown(app.dispose);+ app.currentUser = const CurrentUserProfile(+ id: 'u',+ name: longName,+ email:+ '[email protected]',+ );+ // ⚠️ Kept under five seconds of the test's clock: the page re-reads the account's machines+ // every five, and that read is the real service's.+ await pump(+ tester,+ ConnectComputerPage(+ notifier: app,+ onBack: () {},+ onTrySample: (_) async => null,+ ),+ scale,+ brightness,+ );+ await tapInView(tester, find.text('Mac app'));+ await frames(tester, count: 1);+ await tester.drag(find.byType(ListView), const Offset(0, -2000));+ await frames(tester, count: 1);+ });+ });++ testWidgets('unlocking a computer with a long name', (tester) async {+ await expectNoLayoutErrors(tester, (scale, brightness) async {+ final app = edgeApp(machineName: longMachine);+ addTearDown(app.dispose);+ await pump(+ tester,+ Scaffold(+ body: UnlockComputer(notifier: app, machineState: app.stateOf('m')!),+ ),+ scale,+ brightness,+ );+ await tapInView(tester, find.text('Unlock'));+ await frames(tester, count: 1);+ expect(find.text('✗ Enter the password first.'), findsOneWidget);+ });+ });++ testWidgets('pairing with a code, and failing', (tester) async {+ await expectNoLayoutErrors(tester, (scale, brightness) async {+ final app = edgeApp(machineName: longMachine);+ addTearDown(app.dispose);+ await pump(+ tester,+ PairingWithCode(notifier: app, machineId: 'm', code: '123456'),+ scale,+ brightness,+ );+ });+ });++ for (final count in [0, 1, 200]) {+ testWidgets('pick up where you left off, $count sessions', (tester) async {+ await expectNoLayoutErrors(tester, (scale, brightness) async {+ final app = count == 0+ ? edgeApp(agents: [])+ : edgeApp(+ machineName: longMachine,+ agents: manyAgents(count, firstName: longName),+ );+ addTearDown(app.dispose);+ await pump(tester, PickUpPage(notifier: app), scale, brightness);+ });+ });+ }++ testWidgets('how Harness works', (tester) async {+ await expectNoLayoutErrors(tester, (scale, brightness) async {+ await pump(tester, const HowItWorksPage(), scale, brightness);+ await tester.drag(find.byType(ListView), const Offset(0, -3000));+ await frames(tester);+ });+ });++ testWidgets('starting up', (tester) async {+ await expectNoLayoutErrors(tester, (scale, brightness) async {+ await pump(tester, const PhoneBoot(), scale, brightness);+ });+ });++ testWidgets('the first-time hints over Focus', (tester) async {+ await expectNoLayoutErrors(tester, (scale, brightness) async {+ await pump(+ tester,+ Builder(+ builder: (context) => ColoredBox(+ color: Tty.of(context).ground,+ child: FocusHints(+ micBottom: 34 + 4 + 30,+ store: FocusHintsSeen(storage: MemoryKeyValueStore()),+ ),+ ),+ ),+ scale,+ brightness,+ );+ expect(find.text('→ swipe right'), findsOneWidget);+ });+ });+}