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
Phone: calmer Swarm Home and full chat skeleton (#2354)
tony496s8cbfdbcf8ec1
diff --git a/mobile/lib/swarm/swarm_conversation_page.dart b/mobile/lib/swarm/swarm_conversation_page.dartindex 00b0b1894..47fca529b 100644--- a/mobile/lib/swarm/swarm_conversation_page.dart+++ b/mobile/lib/swarm/swarm_conversation_page.dart@@ -2379,19 +2379,18 @@ class SwarmChatSkeleton extends StatelessWidget {@overrideWidget build(BuildContext context) => Semantics(label: 'Loading messages',- child: SingleChildScrollView(+ child: ListView.builder(key: const ValueKey('swarm-chat-skeleton'),- // From the foot, as the messages are; those that do not fit are cut- // off at the top.+ // From the foot, as the messages are, the bubbles over and over: any+ // screen is full up to its top, where the last one is cut off.reverse: true,physics: const NeverScrollableScrollPhysics(),padding: _listPadding,- child: Column(- children: [- for (final (lines, width) in _bubbles)- _SkeletonBubble(lines: lines, width: width),- ],- ),+ itemBuilder: (_, i) {+ final (lines, width) =+ _bubbles[(_bubbles.length - 1 - i) % _bubbles.length];+ return _SkeletonBubble(lines: lines, width: width);+ },),);}diff --git a/mobile/lib/swarm/swarm_home_top.dart b/mobile/lib/swarm/swarm_home_top.dartindex 6a91e21a0..13cc787ec 100644--- a/mobile/lib/swarm/swarm_home_top.dart+++ b/mobile/lib/swarm/swarm_home_top.dart@@ -7,7 +7,6 @@ import 'package:harness_mobile/phone/fzf.dart' show fzfAge;import 'package:harness_mobile/shared/theme/app_space.dart';import 'package:harness_mobile/shared/theme/app_theme.dart';import 'package:harness_mobile/shared/theme/app_type.dart';-import 'package:harness_mobile/shared/widgets/touch_target.dart';import 'package:harness_mobile/theme/app_theme.dart' show AppColors;import 'model.dart';@@ -20,9 +19,8 @@ import 'swarm_start.dart';import 'swarm_style.dart';/// The top of Swarm Home, direction C, as Tony's prototype C1 draws it-/// (2026-10-30): the Swarm switcher in its title ([showSwarmSwitcher]),-/// Jump to… under it ([SwarmJumpField]), and While you were away-/// ([SwarmAwayCard]).+/// (2026-10-30): the Swarm switcher in its title ([showSwarmSwitcher]) and+/// While you were away ([SwarmAwayCard])./// Whether Home offers Swarm [swarmId]: the account's, and its read not/// taken away, though the list may still have it until it is read again.@@ -189,53 +187,6 @@ class _Glyph extends StatelessWidget {);}-/// Jump to…: a search field's look over Home's list, a button that opens-/// the search ([onTap]).-class SwarmJumpField extends StatelessWidget {- const SwarmJumpField({super.key, required this.onTap});-- final VoidCallback onTap;-- @override- Widget build(BuildContext context) {- AppTheme.watch(context);- return Semantics(- button: true,- label: 'Jump to',- excludeSemantics: true,- onTap: onTap,- child: Material(- color: AppPalette.swarmSearchSurface,- borderRadius: BorderRadius.circular(AppCard.radius),- child: InkWell(- borderRadius: BorderRadius.circular(AppCard.radius),- onTap: onTap,- child: ConstrainedBox(- constraints: const BoxConstraints(minHeight: minTouchTarget),- child: Padding(- padding: const EdgeInsets.symmetric(horizontal: AppSpace.m),- child: Row(- children: [- Icon(- LucideIcons.search300,- size: 20,- color: AppPalette.textFaint,- ),- const SizedBox(width: AppSpace.s),- Text(- 'Jump to…',- style: AppType.body(color: AppPalette.textFaint),- ),- ],- ),- ),- ),- ),- ),- );- }-}-/// How many tasks of [snapshot] their agents said Done after [since]: work/// done holds no time of its Done, which comes at or after its last/// progress ([swarmProgressAt]), so what this counts is a floor, as Donediff --git a/mobile/lib/swarm/swarm_inbox.dart b/mobile/lib/swarm/swarm_inbox.dartindex 7bc468b65..e26ffeffc 100644--- a/mobile/lib/swarm/swarm_inbox.dart+++ b/mobile/lib/swarm/swarm_inbox.dart@@ -3,6 +3,7 @@ import 'dart:async';import 'package:flutter/foundation.dart';import '../core/local_key_value_store.dart';+import '../logging/app_log.dart';import 'model.dart';import 'swarm_asks.dart';import 'swarm_buddy.dart';@@ -368,11 +369,28 @@ class SwarmInbox extends ChangeNotifier {]);} on SuperTabFailure catch (failure) {if (_disposed) return;+ // Once per failure, not once per poll.+ if (error != failure.message) {+ appLog.warn(+ 'swarm',+ 'Swarm list not read: ${failure.code} ${failure.statusCode}',+ error: failure,+ );+ }error = failure.message;_away = failure.code == 'MACHINE_UNAVAILABLE' ? _sooner() : null;- } catch (_) {+ } catch (failure, stack) {if (_disposed) return;- error = 'Could not load your Swarms. Try again.';+ const unread = 'Could not load your Swarms. Try again.';+ if (error != unread) {+ appLog.failure(+ 'swarm',+ 'Swarm list not read',+ error: failure,+ stackTrace: stack,+ );+ }+ error = unread;_away = null;} finally {_polling = false;diff --git a/mobile/lib/swarm/swarm_jump_page.dart b/mobile/lib/swarm/swarm_jump_page.dartdeleted file mode 100644index dcc94631c..000000000--- a/mobile/lib/swarm/swarm_jump_page.dart+++ /dev/null@@ -1,204 +0,0 @@-import 'dart:async';--import 'package:flutter/material.dart';--import 'package:harness_mobile/phone/out_of_sight.dart';-import 'package:harness_mobile/phone/phone_navigation.dart';-import 'package:harness_mobile/phone/tty.dart';-import 'package:harness_mobile/shared/theme/app_space.dart';-import 'package:harness_mobile/shared/theme/app_theme.dart';-import 'package:harness_mobile/shared/theme/app_type.dart';-import 'package:harness_mobile/shared/widgets/touch_target.dart';--import 'swarm_page.dart' show swarmHomeListed;-import 'swarm_project_page.dart';-import 'swarm_row.dart';-import 'swarm_session.dart';-import 'swarm_style.dart';--/// Opens Jump to over Home. A new message starts from Home's + instead-/// (`swarm_new_message_sheet.dart`).-void openSwarmJump(BuildContext context) => unawaited(- Navigator.of(context)- .push(phoneRoute((_) => const SwarmJumpPage(), listensForItself: true)),-);--/// Jump to…, from Swarm Home (Tony's prototype C1, 2026-10-30): every-/// project of the account's Swarms that can be read, by name, narrowed as-/// the person types; one picked opens on its chat, in place of this page.-/// A Swarm the account loses, or whose read is taken away, leaves the list-/// as it goes, and a tap on one of its projects opens nothing. A Swarm that-/// could not be read says so, never that there is no project.-class SwarmJumpPage extends StatefulWidget {- const SwarmJumpPage({super.key});-- @override- State<SwarmJumpPage> createState() => _SwarmJumpPageState();-}--class _SwarmJumpPageState extends State<SwarmJumpPage> {- final _query = TextEditingController();-- @override- void dispose() {- _query.dispose();- super.dispose();- }-- void _open(SwarmSession session, String swarmId, String projectId) {- if (!swarmHomeListed(session.inbox, swarmId, projectId)) return;- openSwarmProject(- context,- swarmId: swarmId,- projectId: projectId,- replace: true,- );- }-- @override- Widget build(BuildContext context) {- AppTheme.watch(context);- final session = SwarmScope.of(context);- return Scaffold(- backgroundColor: Tty.of(context).ground,- body: SafeArea(- bottom: false,- child: Column(- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- Padding(- padding: const EdgeInsets.fromLTRB(- AppSpace.m,- AppSpace.xs,- AppSpace.xs,- AppSpace.s,- ),- child: Row(- children: [- Expanded(- child: TextField(- key: const ValueKey('swarm-jump-query'),- controller: _query,- autofocus: true,- textInputAction: TextInputAction.search,- onChanged: (_) => setState(() {}),- style: AppType.body(color: AppPalette.textPrimary),- decoration: InputDecoration(- hintText: 'Jump to…',- hintStyle: AppType.body(color: AppPalette.textFaint),- filled: true,- fillColor: AppPalette.swarmSearchSurface,- isDense: true,- contentPadding: const EdgeInsets.symmetric(- horizontal: AppSpace.m,- vertical: AppSpace.m,- ),- border: OutlineInputBorder(- borderRadius: BorderRadius.circular(AppCard.radius),- borderSide: BorderSide.none,- ),- ),- ),- ),- ConstrainedBox(- constraints: const BoxConstraints(- minWidth: minTouchTarget,- minHeight: minTouchTarget,- ),- child: TextButton(- key: const ValueKey('swarm-jump-cancel'),- onPressed: () => Navigator.of(context).maybePop(),- child: Text(- 'Cancel',- style: AppType.body(color: AppPalette.textSecondary),- ),- ),- ),- ],- ),- ),- Expanded(- child: session == null- ? const SizedBox.shrink()- : ListenWhileInSight(- listenable: Listenable.merge([session, session.inbox]),- builder: (context) => ListView(- keyboardDismissBehavior:- ScrollViewKeyboardDismissBehavior.onDrag,- padding: EdgeInsets.fromLTRB(- AppSpace.m,- 0,- AppSpace.m,- MediaQuery.paddingOf(context).bottom + AppSpace.xl,- ),- children: _rows(session),- ),- ),- ),- ],- ),- ),- );- }-- List<Widget> _rows(SwarmSession session) {- final inbox = session.inbox;- final swarms = inbox.swarms;- final several = swarms.length > 1;- final query = _query.text.trim().toLowerCase();- final found = <({String swarmId, String swarm, String id, String name})>[];- // The list, or a Swarm on it, that could not be read: not "no project".- var failed = !inbox.loaded && (inbox.error != null || inbox.noComputer);- var reading = !inbox.loaded && !failed;- for (final swarm in swarms) {- final reader = inbox.reader(swarm.id);- if (reader == null || reader.accessRevoked) continue;- if (reader.loading) reading = true;- if (reader.snapshot == null && reader.error != null) failed = true;- for (final project in reader.snapshot?.projects ?? const []) {- if (query.isNotEmpty && !project.name.toLowerCase().contains(query)) {- continue;- }- found.add((- swarmId: swarm.id,- swarm: swarm.name,- id: project.id,- name: project.name,- ));- }- }- found.sort((a, b) => a.name.toLowerCase().compareTo(b.name.toLowerCase()));- Widget line(String text, String key) => Padding(- padding: const EdgeInsets.all(AppSpace.xs),- child: SwarmRow.line(text, key: ValueKey(key), lines: 2),- );- const unread =- 'Some projects could not be loaded. Pull down on Home to '- 'try again.';- if (found.isEmpty) {- if (reading) return [SwarmSkeletonRows(id: 'swarm-jump-loading')];- if (failed) return [line(unread, 'swarm-jump-unread')];- return [- line(- query.isEmpty ? 'No project yet.' : 'No project matches.',- 'swarm-jump-none',- ),- ];- }- return [- SwarmGroup(- children: [- for (final p in found)- SwarmRow(- key: ValueKey('swarm-jump-${p.swarmId}-${p.id}'),- leading: SwarmProjectTile(p.name),- title: p.name,- detail: several ? SwarmRow.line(p.swarm) : null,- onTap: () => _open(session, p.swarmId, p.id),- ),- ],- ),- if (failed) line(unread, 'swarm-jump-unread'),- ];- }-}diff --git a/mobile/lib/swarm/swarm_page.dart b/mobile/lib/swarm/swarm_page.dartindex 88a3974ed..d376fa589 100644--- a/mobile/lib/swarm/swarm_page.dart+++ b/mobile/lib/swarm/swarm_page.dart@@ -9,16 +9,13 @@ import 'package:harness_mobile/phone/tty.dart';import 'package:harness_mobile/shared/theme/app_space.dart';import 'package:harness_mobile/shared/theme/app_theme.dart';import 'package:harness_mobile/shared/theme/app_type.dart';-import 'package:harness_mobile/theme/app_theme.dart' show AppColors;import 'swarm_connection_notice.dart';import 'swarm_conversation_page.dart' show openSwarmConversation;-import 'swarm_home_keeper.dart';import 'swarm_home_list.dart';import 'swarm_home_rows.dart';import 'swarm_home_top.dart';import 'swarm_inbox.dart';-import 'swarm_jump_page.dart';import 'swarm_needs_page.dart';import 'swarm_new_message_sheet.dart';import 'swarm_new_project_sheet.dart';@@ -56,8 +53,8 @@ bool swarmHomeListed(SwarmInbox inbox, String swarmId, String projectId) {/// Swarm Home, direction C (Tony's prototype C1, 2026-10-30), the Home tab:/// its title the Swarm shown, with a switcher to every Swarm, All Swarms and-/// Join or create ([showSwarmSwitcher]); Jump to…; While you were away, once-/// the person has been gone a while ([SwarmAwayCard]); then the projects+/// Join or create ([showSwarmSwitcher]); While you were away, once the person+/// has been gone a while ([SwarmAwayCard]); then the projects/// they pinned on this phone, then the others by their latest activity,/// those quiet for a day folded under "Other projects" ([swarmHomeLists])./// Every Swarm's, or the one picked ([SwarmHomePrefs.swarmId]). A round +@@ -234,11 +231,7 @@ class _SwarmPageState extends State<SwarmPage> {elseListenWhileInSight(listenable: listens!,- builder: (context) => _topBar(- context,- pushed: pushed,- updating: _updating(session.inbox),- ),+ builder: (context) => _topBar(context, pushed: pushed),),Expanded(child: session == null@@ -276,13 +269,7 @@ class _SwarmPageState extends State<SwarmPage> {/// Home's top bar. At the root, the tab's title: the Swarm shown and a/// button to switch it; pushed over another page, back and "Swarm".- /// Either has a quiet "Updating…" under it while it shows the Home kept- /// ([_updating]).- Widget _topBar(- BuildContext context, {- required bool pushed,- bool updating = false,- }) {+ Widget _topBar(BuildContext context, {required bool pushed}) {final session = _session;if (pushed) {return SwarmTopBar(@@ -290,7 +277,6 @@ class _SwarmPageState extends State<SwarmPage> {onPressed: () => Navigator.of(context).maybePop(),),title: 'Swarm',- subtitle: updating ? 'Updating…' : null,);}if (session == null) return const SwarmTabHeader('Swarm');@@ -302,7 +288,6 @@ class _SwarmPageState extends State<SwarmPage> {title,leading: named == null ? null : SwarmProjectTile(named.name),titleLabel: 'Swarm: $title. Switch Swarm',- subtitle: updating ? 'Updating…' : null,onTitle: () => unawaited(showSwarmSwitcher(context, session)),);}@@ -322,21 +307,33 @@ class _SwarmPageState extends State<SwarmPage> {List<Widget> _body(BuildContext context, SwarmSession session) {final inbox = session.inbox;// No computer answering: a card that says so over what Home has, never a- // screen in its place, and no red line besides.+ // screen in its place.final notice = inbox.noComputer? SwarmConnectionNotice(inbox: inbox,computers: SwarmScope.computersOf(context),): null;- final error = notice == null ? inbox.error : null;- // Before the list there is nothing to read, unless a Home was kept; a- // list that could not be read says so alone, without rows on their way.+ // A list that could not be read says nothing here: it is in the app's log+ // and read again by the next poll, Home as it was until then. Only a+ // server without the list says so, as no poll will ever bring its rows.if (!inbox.loaded && inbox.swarms.isEmpty) {return [?notice,- if (error != null)- _error(error, key: 'swarm-error')+ if (notice == null && inbox.error == swarmServerTooOld)+ Padding(+ padding: const EdgeInsets.fromLTRB(+ AppSpace.xs,+ AppSpace.s,+ AppSpace.xs,+ 0,+ ),+ child: SwarmRow.line(+ swarmServerTooOld,+ key: const ValueKey('swarm-too-old'),+ lines: 3,+ ),+ )else..._reading(first: notice == null),];@@ -346,21 +343,17 @@ class _SwarmPageState extends State<SwarmPage> {? shown.single.id: null;final now = widget.now();+ final away = _awayCard(context, session, shown, picked, now);return [?notice,- if (error != null) _error(error, key: 'swarm-error'),- Padding(- padding: EdgeInsets.only(- top: notice == null ? AppSpace.xs : AppSpace.m,- bottom: AppSpace.xs,- ),- child: SwarmJumpField(- key: const ValueKey('swarm-jump'),- onTap: () => openSwarmJump(context),- ),+ ?away,+ ..._projects(+ context,+ session,+ shown,+ now,+ first: notice == null && away == null,),- ?_awayCard(context, session, shown, picked, now),- ..._projects(context, session, shown, now),];}@@ -418,17 +411,19 @@ class _SwarmPageState extends State<SwarmPage> {/// Pinned, then Projects: every project of the Swarms shown, grouped by/// [swarmHomeLists]; a Swarm still to be read has rows on their way, one- /// that could not be read says so.+ /// that could not be read says so. The first caption is the screen's+ /// [first] thing, with nothing over it.List<Widget> _projects(BuildContext context,SwarmSession session,List<SwarmListing> shown,- DateTime now,- ) {+ DateTime now, {+ required bool first,+ }) {final inbox = session.inbox;if (inbox.swarms.isEmpty) {return [- const SwarmCaption('Projects'),+ SwarmCaption('Projects', first: first),Padding(padding: const EdgeInsets.symmetric(horizontal: AppSpace.xs),child: SwarmRow.line(@@ -488,14 +483,14 @@ class _SwarmPageState extends State<SwarmPage> {: null;return [if (lists.pinned.isNotEmpty) ...[- const SwarmCaption('Pinned'),+ SwarmCaption('Pinned', first: first),SwarmGroup(children: [for (final p in lists.pinned) row(p)]),],if (lists.recent.isNotEmpty ||quiet.isNotEmpty ||empty ||create != null) ...[- const SwarmCaption('Projects'),+ SwarmCaption('Projects', first: first && lists.pinned.isEmpty),SwarmGroup(children: [if (empty) const SwarmRow(title: 'No project yet', onTap: null),@@ -514,7 +509,7 @@ class _SwarmPageState extends State<SwarmPage> {],),] else if (reading.isNotEmpty || failed.isNotEmpty)- const SwarmCaption('Projects'),+ SwarmCaption('Projects', first: first && lists.pinned.isEmpty),for (final (i, id) in reading.indexed) ...[if (projects.isNotEmpty || i > 0) const SizedBox(height: 8),SwarmSkeletonRows(id: 'swarm-projects-loading-$id'),@@ -583,27 +578,8 @@ class _SwarmPageState extends State<SwarmPage> {SwarmSkeletonRows(id: 'swarm-projects-loading'),];- /// What went wrong, in the danger colour, up to three lines.- Widget _error(String text, {required String key, double top = 6}) => Padding(- padding: EdgeInsets.fromLTRB(AppSpace.xs, top, AppSpace.xs, 0),- child: SwarmRow.line(- text,- key: ValueKey(key),- lines: 3,- color: AppColors.danger,- ),- );}-/// Home shows the Home kept, not read again yet: the list not read, or a-/// Swarm on it holding only what was kept. Not while no computer answers:-/// the card says so then ([SwarmConnectionNotice]).-bool _updating(SwarmInbox inbox) =>- inbox.swarms.isNotEmpty &&- !inbox.noComputer &&- (!inbox.loaded ||- inbox.swarms.any((swarm) => swarmHomeKept(inbox.reader(swarm.id))));-/// Whether what waits on the person in every Swarm [shown] is read: the/// Swarm, and what waits in it since it was last read in full.bool _needsRead(SwarmInbox inbox, List<SwarmListing> shown) => shown.every(diff --git a/mobile/test/swarm/swarm_chat_test.dart b/mobile/test/swarm/swarm_chat_test.dartindex 0de700099..312290749 100644--- a/mobile/test/swarm/swarm_chat_test.dart+++ b/mobile/test/swarm/swarm_chat_test.dart@@ -1,4 +1,5 @@import 'dart:async';+import 'dart:math' as math;import 'package:dio/dio.dart' show CancelToken;import 'package:flutter/material.dart';@@ -2770,15 +2771,55 @@ void main() {const parts = '/api/super-tabs/$tab/parts';const notOpen = 'This chat is not open to you.';- /// Skeleton bubbles fill the chat: six to eight of them.+ /// Skeleton bubbles fill the chat, from its foot up to its top.void skeleton(WidgetTester tester) {expect(key('swarm-chat-skeleton'), findsOneWidget);+ // Those built just past the top count: one ending right at it is full.+ final bubbles = find.byKey(+ const ValueKey('swarm-skeleton-bubble'),+ skipOffstage: false,+ );+ final tops = [+ for (final bubble in bubbles.evaluate())+ tester+ .getTopLeft(+ find.byElementPredicate(+ (e) => e == bubble,+ skipOffstage: false,+ ),+ )+ .dy,+ ];expect(- tester.widgetList(key('swarm-skeleton-bubble')).length,- inInclusiveRange(6, 8),+ tops.reduce(math.min),+ lessThanOrEqualTo(tester.getTopLeft(key('swarm-chat-skeleton')).dy),+ reason: 'no gap above the first bubble',);}+ for (final (name, size) in [+ ('a small phone', const Size(320, 568)),+ ('an iPhone 14', const Size(390, 844)),+ ('a tablet', const Size(1024, 1366)),+ ]) {+ testWidgets('on $name the skeleton leaves no gap at the top', (+ tester,+ ) async {+ tester.view.physicalSize = size;+ tester.view.devicePixelRatio = 1;+ addTearDown(tester.view.reset);+ final fake = backend([message('m1', 1, text: 'The plan')]);+ final page = Completer<Object?>();+ fake.routes[messages] = (_) => page.future;++ await pump(tester, fake, settle: false);++ skeleton(tester);+ page.complete({'messages': <Object>[], 'next': null});+ await tester.pumpAndSettle();+ });+ }+testWidgets('the first page shows skeleton bubbles, and nothing says the ''chat is empty or not open', (tester) async {final fake = backend([message('m1', 1, text: 'The plan')]);diff --git a/mobile/test/swarm/swarm_home_instant_test.dart b/mobile/test/swarm/swarm_home_instant_test.dartindex 6942a4731..5b94c95fb 100644--- a/mobile/test/swarm/swarm_home_instant_test.dart+++ b/mobile/test/swarm/swarm_home_instant_test.dart@@ -372,7 +372,7 @@ void main() {});testWidgets(- 'the Home kept says it is updating until its Swarm is read again',+ 'the Home kept says nothing of being read again, before or after',(tester) async {final answer = Completer<Object?>();final (:host, fake: _) = await coldStart(@@ -380,7 +380,8 @@ void main() {list: (_) => answer.future,);- expect(updating(), findsOneWidget, reason: 'under the title, quiet');+ expect(key('swarm-project-$tab-$project'), findsOneWidget);+ expect(updating(), findsNothing, reason: 'the kept rows are enough');expect(key('swarm-connection'), findsNothing);answer.complete({@@ -393,6 +394,7 @@ void main() {await tester.pump();await tester.pump();+ expect(key('swarm-project-$tab-$project'), findsOneWidget);expect(updating(), findsNothing);stopReads(host);},@@ -432,8 +434,8 @@ void main() {});testWidgets(- 'a first read of the Swarm that fails keeps Home Updating… until a read '- 'gets through',+ 'a first read of the Swarm that fails leaves the Home kept as it is, '+ 'with no line, until a read gets through',(tester) async {final answer = Completer<Object?>();final (:host, :fake) = await coldStart(@@ -455,13 +457,15 @@ void main() {expect(inbox.loaded, isTrue);expect(inbox.reader(tab)!.error, isNotNull, reason: 'the read failed');- expect(updating(), findsOneWidget);+ expect(key('swarm-project-$tab-$project'), findsOneWidget);+ expect(updating(), findsNothing);fake.routes['/api/super-tabs/$tab/parts'] = (_) => firstLoad();await inbox.refresh();await tester.pump();await tester.pump();+ expect(key('swarm-project-$tab-$project'), findsOneWidget);expect(updating(), findsNothing);stopReads(host);},@@ -474,8 +478,8 @@ Finder key(String value) => find.byKey(ValueKey(value));/// answers, stop.void stopReads(SwarmHost host) => host.foreground = false;-/// Home's quiet "Updating…" under its title.-/// "Updating…" under Home's title: the tab's, or the top bar's when pushed.+/// "Updating…" under Home's title, which is no longer drawn: the tab's, or+/// the top bar's when pushed.Finder updating() => find.descendant(of: find.byWidgetPredicate((widget) => widget is SwarmTabHeader || widget is SwarmTopBar,diff --git a/mobile/test/swarm/swarm_home_test.dart b/mobile/test/swarm/swarm_home_test.dartindex 813d374a1..bceeb91d7 100644--- a/mobile/test/swarm/swarm_home_test.dart+++ b/mobile/test/swarm/swarm_home_test.dart@@ -14,7 +14,6 @@ import 'package:harness_mobile/shared/theme/app_theme.dart'import 'package:harness_mobile/swarm/swarm_conversation_page.dart';import 'package:harness_mobile/swarm/swarm_home_rows.dart';import 'package:harness_mobile/swarm/swarm_inbox.dart';-import 'package:harness_mobile/swarm/swarm_jump_page.dart';import 'package:harness_mobile/swarm/swarm_leaderboard.dart';import 'package:harness_mobile/swarm/swarm_needs_page.dart';import 'package:harness_mobile/swarm/swarm_new_message_sheet.dart';@@ -353,9 +352,9 @@ void main() {group("Home's top", () {testWidgets('as C1 draws it: the Swarm shown is the title, a button with '- 'its tile, and nothing at its end; Jump to under it, then the '- "projects, New message's + floating over them; no menu, no Needs "- 'you, no Buddies', (tester) async {+ 'its tile, and nothing at its end; the projects under it, New '+ "message's + floating over them; no Jump to, no menu, no Needs you, "+ 'no Buddies', (tester) async {await pump(tester, backend(buddy: true));expect(@@ -372,11 +371,9 @@ void main() {);expect(key('swarm-menu'), findsNothing);expect(key('tty-back'), findsNothing, reason: 'Home is the root');- for (final k in ['swarm-title-button', 'swarm-jump']) {- final size = tester.getSize(key(k));- expect(size.height, greaterThanOrEqualTo(44), reason: k);- expect(size.width, greaterThanOrEqualTo(44), reason: k);- }+ final size = tester.getSize(key('swarm-title-button'));+ expect(size.height, greaterThanOrEqualTo(44));+ expect(size.width, greaterThanOrEqualTo(44));expect(key('swarm-compose'),findsNothing,@@ -388,13 +385,9 @@ void main() {);expect(y(tester, 'swarm-title-button'),- lessThan(y(tester, 'swarm-jump')),- );- expect(- y(tester, 'swarm-jump'),lessThan(y(tester, 'swarm-project-$tab-$project')),);- expect(inside('swarm-jump', find.text('Jump to…')), findsOneWidget);+ expect(find.text('Jump to…'), findsNothing);expect(find.text('Needs you'), findsNothing, reason: "Activity's now");expect(find.text('Ship it behind a flag?'), findsNothing);expect(key('swarm-away'), findsNothing, reason: 'the person never left');@@ -444,56 +437,6 @@ void main() {expect(find.text('Join or create a Swarm'), findsNothing);});- testWidgets('Jump to lists every project by name; typing narrows it; a '- 'pick opens the project in its place, and back is Home', (- tester,- ) async {- await pump(tester, backend());- await tester.tap(key('swarm-jump'));- await tester.pumpAndSettle();-- expect(find.byType(SwarmJumpPage), findsOneWidget);- expect(find.text('Jump to…'), findsOneWidget, reason: 'its field');- expect(- y(tester, 'swarm-jump-$tab-$project'),- lessThan(y(tester, 'swarm-jump-$tab-$web')),- reason: 'Mobile, then Web',- );- expect(inside('swarm-jump-$tab-$web', find.text('Web')), findsOneWidget);- expect(- inside('swarm-jump-$tab-$web', find.text('Phone Swarm')),- findsNothing,- reason: 'one Swarm: its name is not on each row',- );-- await tester.enterText(key('swarm-jump-query'), 'WE');- await tester.pump();- expect(key('swarm-jump-$tab-$project'), findsNothing);- expect(key('swarm-jump-$tab-$web'), findsOneWidget);-- await tester.enterText(key('swarm-jump-query'), 'nothing like it');- await tester.pump();- expect(- tester.widget<Text>(key('swarm-jump-none')).data,- 'No project matches.',- );-- await tester.enterText(key('swarm-jump-query'), 'web');- await tester.pump();- await tester.tap(key('swarm-jump-$tab-$web'));- await tester.pumpAndSettle();-- final page = tester.widget<SwarmProjectPage>(- find.byType(SwarmProjectPage),- );- expect((page.swarmId, page.projectId), (tab, web));- expect(find.byType(SwarmJumpPage), findsNothing, reason: 'in its place');- await tester.tap(key('tty-back'));- await tester.pumpAndSettle();- expect(find.byType(SwarmProjectPage), findsNothing);- expect(key('swarm-title-button'), findsOneWidget);- });-testWidgets("+ asks where the new message goes, over the same ""projects' chats; ✕ goes back to Home", (tester) async {await pump(tester, backend());@@ -501,7 +444,6 @@ void main() {await tester.pumpAndSettle();expect(find.byType(SwarmNewMessageSheet), findsOneWidget);- expect(find.byType(SwarmJumpPage), findsNothing);expect(key('swarm-new-message-$tab-$leadChat'), findsOneWidget);expect(key('swarm-new-message-$tab-$webLead'), findsOneWidget);expect(@@ -515,22 +457,100 @@ void main() {expect(find.byType(SwarmNewMessageSheet), findsNothing);expect(key('swarm-title-button'), findsOneWidget);});+ });++ group('a list that could not be read', () {+ const unread = 'Could not load your Swarms. Try again.';+ Never broken(_) => throw const FormatException('Bad answer');++ testWidgets('before any read, Home stays on its skeleton with no words, '+ 'and the rows come once the list answers', (tester) async {+ final fake = backend();+ final listed = fake.routes['/api/super-tabs/list']!;+ fake.routes['/api/super-tabs/list'] = broken;+ final host = await pump(tester, fake, settle: false);++ expect(host.session!.inbox.error, unread);+ expect(key('swarm-projects-loading'), findsOneWidget);+ expect(find.text('Projects'), findsOneWidget);+ expect(find.text(unread), findsNothing);++ fake.routes['/api/super-tabs/list'] = listed;+ await host.session!.inbox.refresh();+ await tester.pumpAndSettle();++ expect(key('swarm-projects-loading'), findsNothing);+ expect(key('swarm-project-$tab-$project'), findsOneWidget);+ });- testWidgets('Jump to says a Swarm could not be read, never that there is '- 'no project, and leaves no skeleton', (tester) async {+ testWidgets("a server's own refusal is no line either", (tester) async {+ const moving = 'This Swarm is being moved. Try again in a moment.';final fake = backend()- ..routes['/api/super-tabs/$tab/parts'] = (_) =>- throw SuperTabFailure('INTERNAL', 'Broken', statusCode: 500);+ ..routes['/api/super-tabs/list'] = (_) => throw const SuperTabFailure(+ 'SWARM_MIGRATING',+ moving,+ statusCode: 503,+ );+ await pump(tester, fake, settle: false);++ expect(key('swarm-projects-loading'), findsOneWidget);+ expect(find.text(moving), findsNothing);+ });++ testWidgets('once read, the rows stay with no line over them', (+ tester,+ ) async {+ final fake = backend();+ final host = await pump(tester, fake);++ fake.routes['/api/super-tabs/list'] = broken;+ await host.session!.inbox.refresh();+ await tester.pumpAndSettle();++ expect(host.session!.inbox.error, unread);+ expect(find.text(unread), findsNothing);+ expect(key('swarm-project-$tab-$project'), findsOneWidget);+ });++ testWidgets('a server with no list at all says so, quietly, as no read '+ 'will bring its rows', (tester) async {+ final fake = backend()+ ..routes['/api/super-tabs/list'] = (_) => throw const SuperTabFailure(+ 'NOT_FOUND',+ 'This Super Tab is unavailable.',+ statusCode: 404,+ );await pump(tester, fake);- await tester.tap(key('swarm-jump'));++ expect(key('swarm-projects-loading'), findsNothing);+ final line = tester.widget<Text>(key('swarm-too-old'));+ expect(line.data, swarmServerTooOld);+ expect(line.style?.color, isNot(AppColors.danger));+ });+ });++ group("Home's first caption", () {+ bool first(WidgetTester tester, String text) => tester+ .widget<SwarmCaption>(+ find.byWidgetPredicate((w) => w is SwarmCaption && w.text == text),+ )+ .first;++ testWidgets('with nothing over it, Projects has the first room', (+ tester,+ ) async {+ await pump(tester, backend());++ expect(first(tester, 'Projects'), isTrue);+ });++ testWidgets('over Pinned, Projects has the usual room', (tester) async {+ final host = await pump(tester, backend());+ host.session!.home.pin(tab, project, true);await tester.pumpAndSettle();- expect(key('swarm-jump-loading'), findsNothing);- expect(key('swarm-jump-none'), findsNothing);- expect(- tester.widget<Text>(key('swarm-jump-unread')).data,- 'Some projects could not be loaded. Pull down on Home to try again.',- );+ expect(first(tester, 'Pinned'), isTrue);+ expect(first(tester, 'Projects'), isFalse);});});@@ -590,9 +610,8 @@ void main() {await tester.pumpAndSettle();expect(- y(tester, 'swarm-jump'),+ y(tester, 'swarm-title-button'),lessThan(y(tester, 'swarm-away')),- reason: 'under Jump to',);expect(y(tester, 'swarm-away'),@@ -1170,7 +1189,6 @@ void main() {expect(find.byType(SwarmPage), findsOneWidget);expect(key('swarm-title-button'), findsNothing);expect(key('swarm-new-message'), findsNothing);- expect(key('swarm-jump'), findsOneWidget, reason: 'Jump to stays');await tester.tap(key('tty-back'));await tester.pumpAndSettle();@@ -1191,16 +1209,6 @@ void main() {expectHomeCProject('Web');});- testWidgets("Jump to's pick opens Home C's project screen", (tester) async {- await pump(tester, backend());- await tester.tap(key('swarm-jump'));- await tester.pumpAndSettle();- await tester.tap(key('swarm-jump-$tab-$web'));- await tester.pumpAndSettle();-- expectHomeCProject('Web');- });-testWidgets("a new message to a project's chat opens that project on "'Home C too', (tester) async {final fake = backend();@@ -1512,48 +1520,6 @@ void main() {expect(find.text('Phone Swarm'), findsNothing);});- testWidgets("Jump to names each project's Swarm; a Swarm whose read is "- 'taken away while it is open leaves it at once, and a tap on its '- 'row as it goes opens nothing', (tester) async {- final fake = two();- final host = await pump(tester, fake);- await tester.tap(key('swarm-jump'));- await tester.pumpAndSettle();- expect(- inside('swarm-jump-$second-$project', find.text('Work Swarm')),- findsOneWidget,- );- expect(- inside('swarm-jump-$tab-$project', find.text('Phone Swarm')),- findsOneWidget,- reason: 'the same project id in two Swarms is two rows',- );- final stale = tester- .widget<SwarmRow>(key('swarm-jump-$second-$project'))- .onTap!;-- Never refused(_) => throw const SuperTabFailure(- 'FORBIDDEN',- 'You no longer have access to this Swarm.',- statusCode: 403,- );- fake.routes['/api/super-tabs/$second/changes'] = refused;- fake.routes['/api/super-tabs/$second/parts'] = refused;- await host.session!.inbox.reader(second)!.refresh();- expect(host.session!.inbox.reader(second)!.accessRevoked, isTrue);- await tester.pump();-- expect(key('swarm-jump-$second-$project'), findsNothing);- expect(find.textContaining('Backend'), findsNothing);- expect(find.text('Work Swarm'), findsNothing);- expect(key('swarm-jump-unread'), findsNothing, reason: 'nothing of it');-- stale();- await tester.pumpAndSettle();- expect(find.byType(SwarmProjectPage), findsNothing);- expect(find.byType(SwarmJumpPage), findsOneWidget);- });-testWidgets('a Swarm the account loses while Home is open: its rows ''leave Home, and its pin and pick leave the phone', (tester) async {final fake = two();@@ -2588,7 +2554,6 @@ void main() {reason: 'the switcher stays',);expect(tester.widget<Text>(key('swarm-title')).data, 'Phone Swarm');- expect(key('swarm-jump'), findsNothing);expect(find.text('Projects'), findsNothing);});@@ -2601,7 +2566,6 @@ void main() {await tester.pumpAndSettle();expect(find.byType(SwarmStartView), findsNothing);- expect(key('swarm-jump'), findsOneWidget);expect(find.text('Projects'), findsOneWidget);});@@ -2611,7 +2575,6 @@ void main() {await pump(tester, backend(), computers: _Computers(const [mac]));expect(find.byType(SwarmStartView), findsNothing);- expect(key('swarm-jump'), findsOneWidget);expect(find.text('Projects'), findsOneWidget);});});diff --git a/mobile/test/swarm/swarm_inbox_test.dart b/mobile/test/swarm/swarm_inbox_test.dartindex 45099bae5..b9d0633ad 100644--- a/mobile/test/swarm/swarm_inbox_test.dart+++ b/mobile/test/swarm/swarm_inbox_test.dart@@ -4,6 +4,7 @@ import 'dart:convert';import 'package:fake_async/fake_async.dart';import 'package:flutter/widgets.dart';import 'package:flutter_test/flutter_test.dart';+import 'package:harness_mobile/logging/app_log.dart';import 'package:harness_mobile/swarm/swarm_conversation.dart';import 'package:harness_mobile/swarm/swarm_inbox.dart';import 'package:harness_mobile/swarm/swarm_request.dart';@@ -722,6 +723,72 @@ void main() {expect(i.error, 'This Swarm is being moved. Try again in a moment.');});+ group('a list that could not be read goes in the log', () {+ late _Log log;++ setUp(() {+ final before = appLog;+ log = _Log();+ appLog = log;+ addTearDown(() => appLog = before);+ });++ test('what threw, with its stack, once however many polls fail, and '+ 'again after a read that worked', () async {+ final fake = backend({'a': []});+ final listed = fake.routes['/api/super-tabs/list']!;+ fake.routes['/api/super-tabs/list'] = (_) =>+ throw const FormatException('Bad answer');+ final i = inbox(fake);++ await i.refresh();+ await i.refresh();++ expect(log.events, hasLength(1));+ expect(log.events.single.level, AppLogLevel.error);+ expect(log.events.single.error, isA<FormatException>());+ expect(log.events.single.stackTrace, isNotNull);++ fake.routes['/api/super-tabs/list'] = listed;+ await i.refresh();+ expect(i.error, isNull);+ expect(log.events, hasLength(1), reason: 'a read that worked');++ fake.routes['/api/super-tabs/list'] = (_) =>+ throw const FormatException('Bad answer');+ await i.refresh();+ expect(log.events, hasLength(2));+ });++ test("a server's refusal is a warning naming its code, once for the "+ 'same words, again for other ones', () async {+ final fake = FakeSwarm();+ void refuse(String code, String words) =>+ fake.routes['/api/super-tabs/list'] = (_) =>+ throw SuperTabFailure(code, words, statusCode: 503);+ refuse('SWARM_MIGRATING', 'Being moved.');+ final i = inbox(fake);++ await i.refresh();+ await i.refresh();++ expect(log.events, hasLength(1));+ expect(log.events.single.level, AppLogLevel.warn);+ expect(log.events.single.message, contains('SWARM_MIGRATING 503'));++ refuse('INTERNAL', 'Broken.');+ await i.refresh();+ expect(log.events, hasLength(2));+ expect(log.events.last.message, contains('INTERNAL 503'));+ });++ test('a read that works logs nothing', () async {+ await inbox(backend({'a': []})).refresh();++ expect(log.events, isEmpty);+ });+ });+test('without a computer it asks again within seconds, on a backoff, ''not at the next poll', () {fakeAsync((async) {@@ -923,3 +990,29 @@ void main() {);});}++class _Log implements AppLog {+ final events =+ <+ ({+ AppLogLevel level,+ String message,+ Object? error,+ StackTrace? stackTrace,+ })+ >[];++ @override+ void record(+ AppLogLevel level,+ String category,+ String message, {+ Object? error,+ StackTrace? stackTrace,+ }) => events.add((+ level: level,+ message: message,+ error: error,+ stackTrace: stackTrace,+ ));+}diff --git a/mobile/test/swarm/swarm_screens_test.dart b/mobile/test/swarm/swarm_screens_test.dartindex deb594dc7..6e0ca2dfc 100644--- a/mobile/test/swarm/swarm_screens_test.dart+++ b/mobile/test/swarm/swarm_screens_test.dart@@ -212,7 +212,7 @@ void main() {.length;group('the Swarm page', () {- testWidgets('Jump to comes first, then its projects; what needs the '+ testWidgets('its projects come first, under the title; what needs the ''person is in Needs you', (tester) async {// An iPhone's screen: all of Home at once.tester.view.physicalSize = const Size(1170, 2532);@@ -226,7 +226,7 @@ void main() {reason: "the Activity tab's",);expect(- tester.getTopLeft(key('swarm-jump')).dy,+ tester.getTopLeft(key('swarm-title-button')).dy,lessThan(tester.getTopLeft(key('swarm-project-$tab-$project')).dy),);expect(diff --git a/mobile/test/swarm/swarm_tabs_shots_test.dart b/mobile/test/swarm/swarm_tabs_shots_test.dartindex 0aac3da7d..fe2fbf947 100644--- a/mobile/test/swarm/swarm_tabs_shots_test.dart+++ b/mobile/test/swarm/swarm_tabs_shots_test.dart@@ -20,8 +20,8 @@ import 'swarm_fixture.dart';/// Review screenshots of Swarm's tab bar, direction C, as Tony's prototype/// C1 draws it (2026-10-30), with the tabs main has screens for: Swarm Home/// as C1 draws it over the bar — back after two hours away — with what-/// waits on the person counted on Activity, its switcher and Jump to, each-/// touch area outlined; Activity's Needs you; and You as C4 draws it, on a+/// waits on the person counted on Activity and its switcher, each touch+/// area outlined; Activity's Needs you; and You as C4 draws it, on a/// 390-point phone in both phone themes, from made-up data only, to the/// folder `SWARM_TABS_SHOTS` names.final shots = Platform.environment['SWARM_TABS_SHOTS'];@@ -303,7 +303,6 @@ void main() {for (final key in ['swarm-title-button','swarm-new-message',- 'swarm-jump','swarm-away','swarm-project-$tab-p-oh',])@@ -325,16 +324,6 @@ void main() {tester.element(find.byKey(const ValueKey('swarm-switch-join'))),).pop();await tester.pumpAndSettle();- await tester.tap(find.byKey(const ValueKey('swarm-jump')));- await tester.pumpAndSettle();- await tester.enterText(- find.byKey(const ValueKey('swarm-jump-query')),- 'har',- );- await tester.pump();- await capture('jump');- await tester.tap(find.byKey(const ValueKey('swarm-jump-cancel')));- await tester.pumpAndSettle();await tester.tap(find.byKey(const ValueKey('swarm-tab-activity')));await tester.pumpAndSettle();await capture('activity');