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: project chat fills the screen; Leaderboard and Team open from a menu (#2341)
harness-for-autonomous[bot]8884bfcb60ac
diff --git a/mobile/lib/swarm/swarm_activity_page.dart b/mobile/lib/swarm/swarm_activity_page.dartindex 2bfab9331..c7156587c 100644--- a/mobile/lib/swarm/swarm_activity_page.dart+++ b/mobile/lib/swarm/swarm_activity_page.dart@@ -364,6 +364,10 @@ Future<bool> confirmSwarmApprove(: ' in #${decision.projectName}';final yes = await showDialog<bool>(context: context,+ // Over the page or sheet it asks from, on their navigator: what closes+ // them, as access is lost, finds it there. The shell's pages are on a+ // navigator of their own, under the app's.+ useRootNavigator: false,builder: (context) => AlertDialog(title: Text('Approve?',diff --git a/mobile/lib/swarm/swarm_choices.dart b/mobile/lib/swarm/swarm_choices.dartindex 60282c7e9..d5cec7630 100644--- a/mobile/lib/swarm/swarm_choices.dart+++ b/mobile/lib/swarm/swarm_choices.dart@@ -13,11 +13,11 @@ const swarmHomeMark = true;// (`swarm_page.dart`). Tony's answer, so no choice is left here.// 3. A project: Swarm Home C's (Tony, 2026-10-30) — its #name over its-// humans, agents and who is working, and two tabs, Chat and Team, with its-// tasks on top of Team (`swarm_project_page.dart`). Every way into a project-// opens these tabs (`SwarmProjectTab.current`); direction B's four (Chat,-// Buddy, Tasks, Leaderboard) stay built, opened by none. Tony's answer, so-// no choice is left here.+// humans, agents and who is working, its chat filling the screen, and ☰ for+// its Leaderboard and its Team in sheets (`swarm_project_page.dart`). Every+// way into a project opens this (`SwarmProjectTab.current`); direction B's+// four tabs (Chat, Buddy, Tasks, Leaderboard) stay built, opened by none.+// Tony's answer, so no choice is left here./// 4. Posting: text, @mentions and files — from the photo library, the camera/// or Files, by Desktop's limits (Tony, 2026-10-28). False: files are opened,diff --git a/mobile/lib/swarm/swarm_conversation_page.dart b/mobile/lib/swarm/swarm_conversation_page.dartindex b41c03e3b..84774dadc 100644--- a/mobile/lib/swarm/swarm_conversation_page.dart+++ b/mobile/lib/swarm/swarm_conversation_page.dart@@ -259,7 +259,15 @@ class _SwarmConversationPageState extends State<SwarmConversationPage>super.didChangeDependencies();// Off while a screen pushed over this one covers it._visible = TickerMode.valuesOf(context).enabled;- _conversation?.shown = _seen;+ // Uncovered, what came meanwhile is read, which tells the whole inbox:+ // not while this frame builds.+ if (_seen) {+ WidgetsBinding.instance.addPostFrameCallback((_) {+ if (mounted) _conversation?.shown = _seen;+ });+ } else {+ _conversation?.shown = false;+ }if (_voice == null) {if (SwarmScope.voiceOf(context) case final create?) {_voice = SwarmVoice(diff --git a/mobile/lib/swarm/swarm_leaderboard.dart b/mobile/lib/swarm/swarm_leaderboard.dartindex da8c0c1e6..a979290a7 100644--- a/mobile/lib/swarm/swarm_leaderboard.dart+++ b/mobile/lib/swarm/swarm_leaderboard.dart@@ -19,6 +19,145 @@ import 'swarm_row.dart';import 'swarm_session.dart';import 'swarm_style.dart';+/// The people of [project] in [snapshot]: everyone in the Swarm, or, for a+/// private project, only its owner and members — the people who read it.+List<SuperTabPerson> swarmProjectPeople(+ SuperTabSnapshot snapshot,+ SuperTabProject project,+) => [+ for (final person in snapshot.people)+ if (!project.isPrivate ||+ person.id == project.ownerId ||+ project.memberIds.contains(person.id))+ person,+];++/// One person on a project's board: their week's [score], if the board has+/// answered and lists them, and whether they are the viewer.+typedef SwarmProjectHuman = ({+ SuperTabPerson person,+ String name,+ SwarmScore? score,+ bool own,+});++/// [project]'s people ([swarmProjectPeople]) by this week's points on [board],+/// most first, then by name, letter case aside — all by name while there is no+/// board. Someone the board lists who does not read the project is not here.+/// Matched by id, never by name.+List<SwarmProjectHuman> swarmProjectHumans(+ SuperTabSnapshot snapshot,+ SuperTabProject project,+ SwarmLeaderboard? board, {+ required String viewer,+}) {+ final scores = {+ for (final score in board?.people ?? const <SwarmScore>[])+ score.personId: score,+ };+ final humans = [+ for (final person in swarmProjectPeople(snapshot, project))+ (+ person: person,+ name:+ scores[person.id]?.displayName ?? superTabPersonName(person.email),+ score: scores[person.id],+ own: person.id == viewer,+ ),+ ];+ String sortName(SwarmProjectHuman h) => h.name.toLowerCase();+ int points(SwarmProjectHuman h) => h.score?.points ?? 0;+ return humans..sort((a, b) {+ final byPoints = points(b).compareTo(points(a));+ if (byPoints != 0) return byPoints;+ final byName = sortName(a).compareTo(sortName(b));+ return byName != 0 ? byName : a.person.id.compareTo(b.person.id);+ });+}++/// A route for a sheet of the page under [context], with+/// [showModalBottomSheet]'s default options. A screen that keeps it can close+/// the sheet when it loses what the sheet shows, even between the tap and the+/// sheet's first frame.+ModalBottomSheetRoute<T> swarmSheetRoute<T>(+ BuildContext context, {+ required WidgetBuilder builder,+ bool isScrollControlled = true,+}) {+ final navigator = Navigator.of(context);+ final localizations = MaterialLocalizations.of(context);+ return ModalBottomSheetRoute<T>(+ capturedThemes: InheritedTheme.capture(+ from: context,+ to: navigator.context,+ ),+ isScrollControlled: isScrollControlled,+ barrierLabel: localizations.scrimLabel,+ barrierOnTapHint: localizations.scrimOnTapHint(+ localizations.bottomSheetLabel,+ ),+ backgroundColor: AppGlass.rowFill,+ showDragHandle: true,+ shape: AppControl.sheetShape,+ modalBarrierColor: Theme.of(context).bottomSheetTheme.modalBarrierColor,+ builder: builder,+ );+}++/// A sheet from a project's menu: ✕, its [title] and maybe a control at the+/// end ([trailing]) over its [child]; as tall whatever it holds, so its rows+/// are built as they come into view.+class SwarmProjectSheetFrame extends StatelessWidget {+ const SwarmProjectSheetFrame({+ super.key,+ required this.title,+ required this.closeKey,+ required this.child,+ this.trailing,+ });++ final String title, closeKey;+ final Widget? trailing;+ final Widget child;++ @override+ Widget build(BuildContext context) {+ AppTheme.watch(context);+ return SizedBox(+ height: MediaQuery.sizeOf(context).height * .82,+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Padding(+ padding: const EdgeInsets.symmetric(horizontal: AppSpace.xs),+ child: Row(+ children: [+ SwarmIconButton(+ key: ValueKey(closeKey),+ icon: LucideIcons.x300,+ label: 'Close',+ onPressed: () => Navigator.of(context).pop(),+ ),+ const SizedBox(width: AppSpace.xs),+ Expanded(+ child: Text(+ title,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: AppType.heading(color: AppPalette.textPrimary),+ ),+ ),+ ?trailing,+ ],+ ),+ ),+ Expanded(child: child),+ ],+ ),+ );+ }+}+/// One project's leaderboard, built as the design system's Numbers and/// rankings at phone sizes, the same structure as the desktop's Humans: the/// team's week first, as quiet text with the week picker beside it; then a row@@ -28,6 +167,10 @@ import 'swarm_style.dart';/// viewer's own row has the selected fill. A row opens the person's week in a/// sheet. No cups, medals or emoji.///+/// In a sheet from the project's menu ([sheet]) the people are the project's+/// own ([swarmProjectHumans]), without ranks: each shows at once, with their+/// points when the board answers.+////// People are named from the members its Swarm already read; the board/// itself is read on open, on a pull, on another week, and every few minutes/// while the app is in front ([SwarmLeaderboardReader]).@@ -37,6 +180,7 @@ class SwarmLeaderboardPage extends StatefulWidget {required this.swarmId,required this.projectId,this.header = true,+ this.sheet = false,this.now = DateTime.now,});@@ -46,6 +190,10 @@ class SwarmLeaderboardPage extends StatefulWidget {/// under the project's own header.final bool header;+ /// It is a sheet over the project's chat ([SwarmProjectSheetFrame]), the+ /// week picker in its top line; [header] does not count.+ final bool sheet;+/// What tells this week from the ones before.final DateTime Function() now;@@ -70,6 +218,9 @@ class _SwarmLeaderboardPageState extends State<SwarmLeaderboardPage> {/// or the project it was opened from is gone ([_closeWeek]).ModalRoute<void>? _week;+ /// The week picker, while it is up: it goes with the board.+ ModalRoute<void>? _picker;+@overridevoid didUpdateWidget(SwarmLeaderboardPage old) {super.didUpdateWidget(old);@@ -174,14 +325,17 @@ class _SwarmLeaderboardPageState extends State<SwarmLeaderboardPage> {_closeWeek();}- /// Closes the week open, if any: once this frame is done, as a page whose- /// reader goes away may not change the navigator while it builds.+ /// Closes the week open and the week picker, if any: once this frame is+ /// done, as a page whose reader goes away may not change the navigator while+ /// it builds.void _closeWeek() {- final week = _week;- _week = null;- if (week == null) return;+ final routes = [?_week, ?_picker];+ _week = _picker = null;+ if (routes.isEmpty) return;WidgetsBinding.instance.addPostFrameCallback((_) {- if (week.isActive) week.navigator?.removeRoute(week);+ for (final route in routes) {+ if (route.isActive) route.navigator?.removeRoute(route);+ }});}@@ -202,6 +356,7 @@ class _SwarmLeaderboardPageState extends State<SwarmLeaderboardPage> {final project = snapshot?.projects.where((p) => p.id == widget.projectId).firstOrNull;+ if (widget.sheet) return _inSheet(context, snapshot, project);final board = RefreshIndicator(onRefresh: _board?.refresh ?? () async {},child: ListView(@@ -240,6 +395,122 @@ class _SwarmLeaderboardPageState extends State<SwarmLeaderboardPage> {);}+ /// The board as a sheet: ✕, Leaderboard and the week shown on one line, then+ /// the team's week and the project's people.+ Widget _inSheet(+ BuildContext context,+ SuperTabSnapshot? snapshot,+ SuperTabProject? project,+ ) {+ final reader = _board;+ final current = swarmWeekOf(widget.now());+ return SwarmProjectSheetFrame(+ title: 'Leaderboard',+ closeKey: 'swarm-leaderboard-close',+ trailing: _WeekButton(+ label: swarmWeekName(reader?.week, current),+ onTap: reader == null+ ? null+ : () => unawaited(_pickWeek(context, reader, current)),+ ),+ child: RefreshIndicator(+ // The Swarm names its people, and the board scores them.+ onRefresh: () async {+ await Future.wait([?_board?.refresh(), ?_swarm?.refresh()]);+ },+ child: ListView(+ key: const ValueKey('swarm-leaderboard'),+ physics: const AlwaysScrollableScrollPhysics(),+ padding: EdgeInsets.fromLTRB(+ AppSpace.screenInset - AppSpace.s,+ 0,+ AppSpace.screenInset - AppSpace.s,+ MediaQuery.paddingOf(context).bottom + AppSpace.xl,+ ),+ children: _sheetBody(context, snapshot, project, current),+ ),+ ),+ );+ }++ List<Widget> _sheetBody(+ BuildContext context,+ SuperTabSnapshot? snapshot,+ SuperTabProject? project,+ int current,+ ) {+ final reader = _board;+ if (_session == null || _lost || snapshot == null || project == null) {+ return const [];+ }+ final board = reader?.board;+ final humans = swarmProjectHumans(+ snapshot,+ project,+ board,+ viewer: _swarm?.accountId ?? '',+ );+ final columns = _Columns.of(context, [for (final h in humans) ?h.score]);+ return [+ if (reader != null && reader.unavailable)+ Padding(+ padding: const EdgeInsets.all(AppSpace.s),+ child: SwarmRow.line(+ "This Swarm's server has no leaderboard yet.",+ key: const ValueKey('swarm-leaderboard-unavailable'),+ lines: 2,+ ),+ ),+ if (board != null)+ _TeamLine(+ week: swarmWeekName(reader?.week, current),+ shipped: board.shipped,+ before: board.shippedBefore,+ onWeek: null,+ picker: false,+ ),+ if (reader?.error case final error?)+ Padding(+ padding: const EdgeInsets.fromLTRB(+ AppSpace.s,+ 0,+ AppSpace.s,+ AppSpace.s,+ ),+ child: Row(+ children: [+ Expanded(+ child: SwarmRow.line(+ error,+ key: const ValueKey('swarm-leaderboard-error'),+ lines: 3,+ ),+ ),+ SwarmButton(+ key: const ValueKey('swarm-leaderboard-retry'),+ label: 'Try again',+ onPressed: () => unawaited(reader?.refresh()),+ ),+ ],+ ),+ ),+ for (final h in humans)+ _PersonRow(+ id: h.person.id,+ score: h.score,+ person: h.person,+ name: h.name,+ own: h.own,+ columns: columns,+ ranks: false,+ onTap: switch (h.score) {+ final score? => () => _openWeek(context, score, h.person, h.name),+ null => null,+ },+ ),+ ];+ }+List<Widget> _body(BuildContext context, SuperTabSnapshot? snapshot) {final reader = _board;final board = reader?.board;@@ -320,6 +591,7 @@ class _SwarmLeaderboardPageState extends State<SwarmLeaderboardPage> {elsefor (final score in board.people)_PersonRow(+ id: score.personId,score: score,person: personOf(score.personId),name: nameOf(score),@@ -362,11 +634,9 @@ class _SwarmLeaderboardPageState extends State<SwarmLeaderboardPage> {int current,) async {final shown = reader.week ?? current;- final week = await showModalBottomSheet<int>(- context: context,- backgroundColor: AppGlass.rowFill,- showDragHandle: true,- shape: AppControl.sheetShape,+ final route = swarmSheetRoute<int>(+ context,+ isScrollControlled: false,builder: (context) => _Sheet(title: 'Week',closeKey: 'swarm-leaderboard-week-close',@@ -382,6 +652,9 @@ class _SwarmLeaderboardPageState extends State<SwarmLeaderboardPage> {],),);+ _picker = route;+ final week = await Navigator.of(context).push(route);+ if (identical(_picker, route)) _picker = null;if (week == null || !mounted || !identical(reader, _board)) return;await reader.showWeek(week == current ? null : week);}@@ -399,23 +672,8 @@ Future<void> showSwarmPersonWeek(required String name,ValueChanged<ModalRoute<void>>? opened,}) {- // What showModalBottomSheet gives its route, with its default options.- final navigator = Navigator.of(context);- final localizations = MaterialLocalizations.of(context);- final route = ModalBottomSheetRoute<void>(- capturedThemes: InheritedTheme.capture(- from: context,- to: navigator.context,- ),- isScrollControlled: true,- barrierLabel: localizations.scrimLabel,- barrierOnTapHint: localizations.scrimOnTapHint(- localizations.bottomSheetLabel,- ),- backgroundColor: AppGlass.rowFill,- showDragHandle: true,- shape: AppControl.sheetShape,- modalBarrierColor: Theme.of(context).bottomSheetTheme.modalBarrierColor,+ final route = swarmSheetRoute<void>(+ context,builder: (context) => _Sheet(key: const ValueKey('swarm-leaderboard-sheet'),title: name,@@ -432,7 +690,7 @@ Future<void> showSwarmPersonWeek(),);opened?.call(route);- return navigator.push(route);+ return Navigator.of(context).push(route);}/// Figures of one width, so a column of numbers holds row under row.@@ -464,6 +722,7 @@ class _TeamLine extends StatelessWidget {required this.shipped,required this.before,required this.onWeek,+ this.picker = true,});/// "This week", "Last week", …: the week shown.@@ -473,6 +732,9 @@ class _TeamLine extends StatelessWidget {final int? shipped, before;final VoidCallback? onWeek;+ /// The week picker beside the line; a sheet has it in its top line.+ final bool picker;+@overrideWidget build(BuildContext context) {AppTheme.watch(context);@@ -492,7 +754,7 @@ class _TeamLine extends StatelessWidget {style: AppType.caption(color: AppPalette.textSecondary),),),- _WeekButton(label: week, onTap: onWeek),+ if (picker) _WeekButton(label: week, onTap: onWeek),],),);@@ -547,32 +809,37 @@ class _Columns {/// One person on the board: rank, face, name over their numbers, change/// against last week and points, at least a thumb tall; the viewer's own row-/// in the selected fill.+/// in the selected fill. A project's sheet has no [ranks], and until the board+/// answers, or for someone it does not list, no [score].class _PersonRow extends StatelessWidget {const _PersonRow({+ required this.id,required this.score,required this.person,required this.name,required this.own,required this.columns,required this.onTap,+ this.ranks = true,});- final SwarmScore score;+ final String id;+ final SwarmScore? score;+ final bool ranks;/// Null for someone who has left.final SuperTabPerson? person;final String name;final bool own;final _Columns columns;- final VoidCallback onTap;+ final VoidCallback? onTap;@overrideWidget build(BuildContext context) {AppTheme.watch(context);- final id = score.personId;- final numbers = swarmNumbers(score);- final trend = swarmTrend(score);+ final score = this.score;+ final numbers = score == null ? const <String>[] : swarmNumbers(score);+ final trend = score == null ? null : swarmTrend(score);Widget column(String kind, double width, Widget? child) => Padding(padding: const EdgeInsets.only(left: AppSpace.s),child: SizedBox(@@ -588,19 +855,24 @@ class _PersonRow extends StatelessWidget {clipBehavior: Clip.antiAlias,child: Semantics(key: ValueKey('swarm-leaderboard-person-$id'),- button: true,+ button: onTap != null,// What the row shows, the numbers in full: none at zero.label: [- '$name, place ${score.rank}, ${score.points} points',+ name,+ if (ranks && score != null) 'place ${score.rank}',+ if (score != null) '${score.points} points',...numbers,?trend,].join(', '),excludeSemantics: true,child: InkWell(borderRadius: radius,- onTap: () {- HapticFeedback.selectionClick();- onTap();+ onTap: switch (onTap) {+ final onTap? => () {+ HapticFeedback.selectionClick();+ onTap();+ },+ null => null,},child: ConstrainedBox(constraints: const BoxConstraints(minHeight: minTouchTarget),@@ -608,17 +880,19 @@ class _PersonRow extends StatelessWidget {padding: const EdgeInsets.all(AppSpace.s),child: Row(children: [- SizedBox(- key: ValueKey('swarm-leaderboard-rank-$id'),- width: columns.rank,- child: Text(- '${score.rank}',- maxLines: 1,- textAlign: TextAlign.right,- style: _rankStyle(),+ if (ranks && score != null) ...[+ SizedBox(+ key: ValueKey('swarm-leaderboard-rank-$id'),+ width: columns.rank,+ child: Text(+ '${score.rank}',+ maxLines: 1,+ textAlign: TextAlign.right,+ style: _rankStyle(),+ ),),- ),- const SizedBox(width: AppSpace.m),+ const SizedBox(width: AppSpace.m),+ ],SwarmAvatar(id: id,name: name,@@ -649,16 +923,18 @@ class _PersonRow extends StatelessWidget {column('trend-column',width,- trend == null ? null : _Trend(score: score),+ trend == null ? null : _Trend(score: score!),),column('points',columns.points,- Text(- '${score.points}',- maxLines: 1,- style: swarmPointsStyle(),- ),+ score == null+ ? null+ : Text(+ '${score.points}',+ maxLines: 1,+ style: swarmPointsStyle(),+ ),),],),diff --git a/mobile/lib/swarm/swarm_project_page.dart b/mobile/lib/swarm/swarm_project_page.dartindex 41c440e00..ce2854c8f 100644--- a/mobile/lib/swarm/swarm_project_page.dart+++ b/mobile/lib/swarm/swarm_project_page.dart@@ -10,6 +10,7 @@ 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/skeleton.dart';+import 'package:harness_mobile/shared/widgets/touch_target.dart';import 'package:harness_mobile/theme/app_theme.dart' show AppColors;import 'model.dart';@@ -272,11 +273,11 @@ class _SwarmOpenedChatState extends State<SwarmOpenedChat> {/// the end ([showSwarmProjectSheet]); under it four tabs/// ([SwarmProjectTab.homeB]) — its chat with everyone, the person's Buddy/// chat, its tasks ([SwarmProjectTasks]) and its leaderboard. Swarm Home C-/// (Tony, 2026-10-30) has two ([SwarmProjectTab.homeC]): its chat and its-/// team, under its #name over how many humans and agents it has and what-/// they are doing; the team is a tab there, so the header has no team-/// button. Only the tab shown is built: a chat out of sight reads nothing-/// and marks nothing read.+/// (Tony, 2026-10-30) is its chat alone ([SwarmProjectTab.homeC]), filling the+/// screen under its #name over how many humans and agents it has and what+/// they are doing; ☰ at the header's end opens its leaderboard and its team as+/// sheets. Only the tab shown is built: a chat out of sight reads nothing and+/// marks nothing read, a sheet over it counting as out of sight.class SwarmProjectPage extends StatefulWidget {const SwarmProjectPage({super.key,@@ -316,8 +317,8 @@ class _SwarmProjectPageState extends State<SwarmProjectPage> {? widget.tab: widget.tabs.first;- /// Swarm Home C's page: Chat and Team.- bool get _homeC => widget.tabs.contains(SwarmProjectTab.team);+ /// Swarm Home C's page: its chat alone, its leaderboard and team in sheets.+ bool get _homeC => widget.tabs.length == 1;/// Where the chat opens ([SwarmProjectPage.messageId]): forgotten once/// another tab is picked, so the chat shown again opens at its end.@@ -342,11 +343,17 @@ class _SwarmProjectPageState extends State<SwarmProjectPage> {/// what it shows itself.({Object inputs, Widget body})? _body;+ /// The sheet the menu opened, while it is up. What it shows is the+ /// project's: it closes with the page, and when the account, the read or+ /// the project is gone ([_closeSheet]).+ ModalRoute<void>? _sheet;+@overridevoid didChangeDependencies() {super.didChangeDependencies();final session = SwarmScope.of(context);if (session == _session) return;+ _closeSheet();_session?.inbox.removeListener(_inboxChanged);_session?.leave();_session = session?..enter();@@ -357,6 +364,7 @@ class _SwarmProjectPageState extends State<SwarmProjectPage> {@overridevoid dispose() {+ _closeSheet();_session?.inbox.removeListener(_inboxChanged);_session?.leave();_buddy?.dispose();@@ -425,11 +433,58 @@ class _SwarmProjectPageState extends State<SwarmProjectPage> {void _open(String conversationId) =>openSwarmConversation(context, widget.swarmId, conversationId);+ /// Opens one of the menu's sheets, on the page's own navigator, under the+ /// shell's [SwarmScope]: a chat opened from it goes over it, and back comes+ /// back to it. Kept from before it is pushed, so losing the project before+ /// its first frame still closes it.+ void _openSheet(WidgetBuilder builder) {+ if (_sheet != null || !mounted) return;+ final route = swarmSheetRoute<void>(context, builder: builder);+ setState(() => _sheet = route);+ unawaited(+ Navigator.of(context).push(route).whenComplete(() {+ if (mounted && _sheet == route) setState(() => _sheet = null);+ }),+ );+ }++ void _openLeaderboardSheet() => _openSheet(+ (_) => SwarmLeaderboardPage(+ swarmId: widget.swarmId,+ projectId: widget.projectId,+ sheet: true,+ ),+ );++ void _openTeamSheet() => _openSheet(+ (_) => SwarmProjectTeamSheet(+ swarmId: widget.swarmId,+ projectId: widget.projectId,+ onOpen: _open,+ ),+ );++ /// Closes the sheet open, if any, and a dialog or sheet over it, with what+ /// it shows (Approve's question): once this frame is done, as a page that+ /// lost its project, or is going away, may not change the navigator while+ /// it does.+ void _closeSheet() {+ final sheet = _sheet;+ _sheet = null;+ if (sheet == null) return;+ WidgetsBinding.instance.addPostFrameCallback((_) {+ if (!sheet.isActive) return;+ final navigator = sheet.navigator!;+ navigator.popUntil((top) => top == sheet || top is! PopupRoute);+ navigator.removeRoute(sheet);+ });+ }+/// The header: back, [project]'s name over its team — "Updating…" while/// counted from the Home kept, and with several Swarms which one — and the/// team at its end, after Remove Buddy on the Buddy tab. Swarm Home C/// writes the name as a channel's, #name, puts how many humans and agents- /// before the team's dots, and has no team button: Team is a tab.+ /// before the team's dots, and has ☰ in the team's place.Widget _header(SwarmSession session,SwarmReader reader,@@ -472,7 +527,12 @@ class _SwarmProjectPageState extends State<SwarmProjectPage> {children: [if (_tab == SwarmProjectTab.buddy && _buddy != null)SwarmBuddyMenuButton(actions: _buddy!),- if (!_homeC)+ if (_homeC)+ _ProjectMenu(+ onLeaderboard: _openLeaderboardSheet,+ onTeam: _openTeamSheet,+ )+ elseSwarmIconButton(key: const ValueKey('swarm-project-team'),icon: LucideIcons.users300,@@ -540,12 +600,6 @@ class _SwarmProjectPageState extends State<SwarmProjectPage> {projectId: project.id,header: false,),- SwarmProjectTab.team => SwarmProjectTeam(- session: session,- reader: reader,- projectId: project.id,- onOpen: _open,- ),};@override@@ -557,6 +611,7 @@ class _SwarmProjectPageState extends State<SwarmProjectPage> {onPressed: () => Navigator.of(context).maybePop(),);if (session == null) {+ _closeSheet();return _Frame(top: SwarmTopBar(leading: back, title: ''),);@@ -579,25 +634,32 @@ class _SwarmProjectPageState extends State<SwarmProjectPage> {_header(session, reader, snapshot, project, back),// The chat's news moves with the Lead's tags too: they build// the tabs alone.- ListenableBuilder(- listenable: asks ?? Listenable.merge(const []),- builder: (context, _) => SwarmProjectTabBar(- tabs: widget.tabs,- selected: _tab,- chatNews: chat == null || _tab == SwarmProjectTab.chat- ? swarmNoNews- : swarmChatNews(reader, asks, chat),- onSelect: (tab) => setState(() {- _tab = tab;- _messageId = _decisionId = null;- }),+ if (!_homeC)+ ListenableBuilder(+ listenable: asks ?? Listenable.merge(const []),+ builder: (context, _) => SwarmProjectTabBar(+ tabs: widget.tabs,+ selected: _tab,+ chatNews: chat == null || _tab == SwarmProjectTab.chat+ ? swarmNoNews+ : swarmChatNews(reader, asks, chat),+ onSelect: (tab) => setState(() {+ _tab = tab;+ _messageId = _decisionId = null;+ }),+ ),),- ),],),- body: _bodyOf(session, reader, project),+ // Under a sheet the chat is not seen, so nothing it gets is read.+ body: TickerMode(+ enabled: _sheet == null,+ child: _bodyOf(session, reader, project),+ ),);}+ // Nothing of the project to show: no sheet of it stays.+ _closeSheet();// Why there is no project to show: still reading, or a read that// failed or finished without it.final why = switch (reader) {@@ -663,6 +725,45 @@ class _Frame extends StatelessWidget {}}+/// ☰ at the end of a Swarm Home C project's header: a small menu, on the+/// design system's menu surface (the theme's), of its Leaderboard and its Team.+/// It goes with the header: losing the project closes it.+class _ProjectMenu extends StatelessWidget {+ const _ProjectMenu({required this.onLeaderboard, required this.onTeam});++ final VoidCallback onLeaderboard, onTeam;++ @override+ Widget build(BuildContext context) {+ AppTheme.watch(context);+ Widget row(String key, String label, VoidCallback onTap) => MenuItemButton(+ key: ValueKey(key),+ style: ButtonStyle(+ minimumSize: const WidgetStatePropertyAll(+ Size(AppSpace.xl * 6, minTouchTarget),+ ),+ foregroundColor: WidgetStatePropertyAll(AppPalette.textPrimary),+ textStyle: WidgetStatePropertyAll(AppType.body()),+ ),+ onPressed: onTap,+ child: Text(label),+ );+ return MenuAnchor(+ alignmentOffset: const Offset(0, AppSpace.xs),+ menuChildren: [+ row('swarm-project-menu-leaderboard', 'Leaderboard', onLeaderboard),+ row('swarm-project-menu-team', 'Team', onTeam),+ ],+ builder: (context, menu, _) => SwarmIconButton(+ key: const ValueKey('swarm-project-menu'),+ icon: LucideIcons.menu300,+ label: 'Menu',+ onPressed: () => menu.isOpen ? menu.close() : menu.open(),+ ),+ );+ }+}+/// The project's work and team in a sheet over its chat: its work — what/// waits on the person, then what the team is working on, by latest activity,/// and older work folded under "Older", read from the Swarm's closed workdiff --git a/mobile/lib/swarm/swarm_project_tabs.dart b/mobile/lib/swarm/swarm_project_tabs.dartindex 05e4d36c6..38ba268d8 100644--- a/mobile/lib/swarm/swarm_project_tabs.dart+++ b/mobile/lib/swarm/swarm_project_tabs.dart@@ -19,21 +19,20 @@ import 'swarm_unread.dart';/// A project's tabs: as B2 draws them (Tony, 2026-10-29), its chat with/// everyone, the person's Buddy chat, its tasks and its leaderboard-/// ([homeB]); as Swarm Home C draws them (Tony, 2026-10-30), its chat and its-/// team ([homeC]).+/// ([homeB]). Swarm Home C (Tony, 2026-10-30) has its chat alone, with no tab+/// bar ([homeC]): its leaderboard and team open from a menu.enum SwarmProjectTab {chat('Chat'),buddy('Buddy'),tasks('Tasks'),- leaderboard('Leaderboard'),- team('Team');+ leaderboard('Leaderboard');const SwarmProjectTab(this.label);final String label;static const homeB = [chat, buddy, tasks, leaderboard];- static const homeC = [chat, team];+ static const homeC = [chat];/// The tabs a project opens with: Swarm Home C's, the phone's Swarm Home/// since #2262 (Tony, 2026-10-30). Every way into a project takes thesediff --git a/mobile/lib/swarm/swarm_project_team.dart b/mobile/lib/swarm/swarm_project_team.dartindex 03e69412d..48c723232 100644--- a/mobile/lib/swarm/swarm_project_team.dart+++ b/mobile/lib/swarm/swarm_project_team.dart@@ -1,7 +1,6 @@-import 'dart:async';-import 'package:clock/clock.dart';import 'package:flutter/material.dart';+import 'package:lucide_icons_flutter/lucide_icons.dart';import 'package:harness_mobile/shared/theme/app_space.dart';import 'package:harness_mobile/shared/theme/app_theme.dart';@@ -9,10 +8,8 @@ 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 'identity.dart';import 'model.dart';import 'swarm_leaderboard.dart';-import 'swarm_leaderboard_reader.dart';import 'swarm_project_tasks.dart';import 'swarm_reader.dart';import 'swarm_row.dart';@@ -21,19 +18,6 @@ import 'swarm_style.dart';import 'swarm_task_status.dart';import 'team_glance.dart';-/// The people of [project] in [snapshot]: everyone in the Swarm, or, for a-/// private project, only its owner and members — the people who read it.-List<SuperTabPerson> swarmProjectPeople(- SuperTabSnapshot snapshot,- SuperTabProject project,-) => [- for (final person in snapshot.people)- if (!project.isPrivate ||- person.id == project.ownerId ||- project.memberIds.contains(person.id))- person,-];-/// "3 humans · 5 agents", the people and agents of a project in words; the/// agents left out when there are none, as the team's line then says so.String swarmProjectHeads({required int humans, required int agents}) => [@@ -150,66 +134,6 @@ String swarmTeamAgentsLine(List<SwarmTeamAgent> team) => ['$n ${state.counted}',].join(' · ');-/// The open [tasks] of a project counted as its Team's Tasks caption says-/// them, in the order they are listed: "1 waiting on you · 2 working"; empty-/// when none is open.-String swarmTeamTasksLine(SwarmProjectTaskLists tasks) => [- if (tasks.waiting.isNotEmpty) '${tasks.waiting.length} waiting on you',- if (tasks.working.isNotEmpty) '${tasks.working.length} working',-].join(' · ');--/// One person on a project's Team: what they are on now (the status they-/// set, while it lasts), their week's [score] from its board, if the board-/// has answered, and whether they are the viewer.-typedef SwarmTeamHuman = ({- SuperTabPerson person,- String name,- String? now,- SwarmScore? score,- bool own,-});--/// [project]'s people ([swarmProjectPeople]) as its Team lists them: by this-/// week's points on [board], most first, then by name, letter case aside —-/// all by name while there is no board. No ranks (Dee, 2026-10-29); each row-/// shows its points beside a line of what earned them, as Desktop's member-/// list does (#2230). Matched by id, never by name.-List<SwarmTeamHuman> swarmProjectHumans(- SuperTabSnapshot snapshot,- SuperTabProject project,- SwarmLeaderboard? board, {- required String viewer,- DateTime? now,-}) {- final at = now ?? clock.now();- final scores = {- for (final score in board?.people ?? const <SwarmScore>[])- score.personId: score,- };- final humans = [- for (final person in swarmProjectPeople(snapshot, project))- (- person: person,- name:- scores[person.id]?.displayName ?? superTabPersonName(person.email),- now: switch (person.status) {- final status? when status.shownAt(at) => status.label,- _ => null,- },- score: scores[person.id],- own: person.id == viewer,- ),- ];- String sortName(SwarmTeamHuman h) => h.name.toLowerCase();- int points(SwarmTeamHuman h) => h.score?.points ?? 0;- return humans..sort((a, b) {- final byPoints = points(b).compareTo(points(a));- if (byPoints != 0) return byPoints;- final byName = sortName(a).compareTo(sortName(b));- return byName != 0 ? byName : a.person.id.compareTo(b.person.id);- });-}-/// The colour of [state]'s dot on an agent's face. Never the only signal: the/// row says the state in words.Color swarmMemberColor(SwarmMemberState state) => switch (state) {@@ -220,21 +144,57 @@ Color swarmMemberColor(SwarmMemberState state) => switch (state) {SwarmMemberState.idle || SwarmMemberState.stopped => AppPalette.textFaint,};+/// A project's Team, in the sheet its menu opens (Tony, 2026-10-30), under+/// ✕ and "Team": [SwarmProjectTeam] of whichever read its Swarm has. The page+/// under it closes it when the read or the project is gone.+class SwarmProjectTeamSheet extends StatelessWidget {+ const SwarmProjectTeamSheet({+ super.key,+ required this.swarmId,+ required this.projectId,+ required this.onOpen,+ });++ final String swarmId, projectId;++ /// Opens one of the project's chats, by id: over this sheet, and back comes+ /// back to it.+ final ValueChanged<String> onOpen;++ @override+ Widget build(BuildContext context) {+ AppTheme.watch(context);+ final session = SwarmScope.of(context);+ return SwarmProjectSheetFrame(+ title: 'Team',+ closeKey: 'swarm-team-close',+ child: session == null+ ? const SizedBox.shrink()+ : ListenableBuilder(+ listenable: session.inbox,+ builder: (context, _) => switch (session.inbox.reader(swarmId)) {+ final reader? => SwarmProjectTeam(+ session: session,+ reader: reader,+ projectId: projectId,+ onOpen: onOpen,+ ),+ null => const SizedBox.shrink(),+ },+ ),+ );+ }+}+/// A project's Team, as Swarm Home C draws it (Tony, 2026-10-30) to Dee's-/// rules (2026-10-29), one row shape for all ([SwarmMemberRow]) and no-/// ranks. On top its open tasks (Tony, 2026-10-30: Home C has no Tasks tab),-/// in the Tasks tab's rows: what waits on the person there, then the work-/// going on ([swarmProjectTasks]), counted beside their caption, each-/// opening its chat ([onOpen]). Then its humans by this week's points, most first, then by name, each-/// opening their week; then its agents, each in its state with the task it-/// holds, the most urgent first ([swarmProjectAgents]), with what needs a look-/// counted beside their caption, each opening the task it holds ([onOpen]).-///-/// The points are the project's leaderboard ([SwarmLeaderboardReader]),-/// read as the tab opens and every few minutes while the app is in front:-/// until it answers the people show without points; a read that failed says-/// why, with Try again. A pull reads the Swarm and the board again. Nothing-/// read for one Swarm or project is shown for another.+/// rules (2026-10-29), one row shape for its agents ([SwarmMemberRow]). On+/// top its open tasks, in the Tasks tab's rows: what waits on the person,+/// then the work going on ([swarmProjectTasks]) — the first [workShown], and+/// a row that shows the rest in place — each opening its chat ([onOpen]).+/// Then its agents, each in its state with the task it holds, the most urgent+/// first ([swarmProjectAgents]), with what needs a look counted beside their+/// caption, each opening the task it holds ([onOpen]). Its humans are on the+/// project's leaderboard. A pull reads the Swarm again.class SwarmProjectTeam extends StatefulWidget {const SwarmProjectTeam({super.key,@@ -251,76 +211,24 @@ class SwarmProjectTeam extends StatefulWidget {/// Opens one of the project's chats, by id.final ValueChanged<String> onOpen;+ /// How much of the work going on shows before See all: a Swarm with a+ /// hundred open tasks still reaches its agents (Tony, 2026-10-30).+ static const workShown = 5;+@overrideState<SwarmProjectTeam> createState() => _SwarmProjectTeamState();}class _SwarmProjectTeamState extends State<SwarmProjectTeam> {- late SwarmLeaderboardReader _board = _read();-- /// The person's week this Team opened, while it is up. What it shows is- /// the project's: it closes with the Team, and when the read, the Swarm or- /// the project it was opened from is gone ([_closeWeek]).- ModalRoute<void>? _week;-- SwarmLeaderboardReader _read() => SwarmLeaderboardReader(- tabId: widget.reader.tabId,- projectId: widget.projectId,- request: widget.reader.request,- inFront: () => widget.session.inbox.shown,- )..start();+ /// See all was tapped: kept here, so no read of the Swarm folds it again.+ bool _allWork = false;@overridevoid didUpdateWidget(SwarmProjectTeam old) {super.didUpdateWidget(old);- // Another Swarm's read or another project: none of the last board stays.- if (old.reader != widget.reader || old.projectId != widget.projectId) {- _board.dispose();- _board = _read();- }- if (old.session != widget.session ||- old.reader != widget.reader ||- old.projectId != widget.projectId) {- _closeWeek();- }- }-- @override- void dispose() {- _closeWeek();- _board.dispose();- super.dispose();+ if (old.projectId != widget.projectId) _allWork = false;}- void _openWeek(SwarmTeamHuman h, SwarmScore score) {- ModalRoute<void>? shown;- unawaited(- showSwarmPersonWeek(- context,- score: score,- person: h.person,- name: h.name,- opened: (route) => _week = shown = route,- ).whenComplete(() {- if (_week == shown) _week = null;- }),- );- }-- /// Closes the week open, if any: once this frame is done, as a Team going- /// away may not change the navigator while it does.- void _closeWeek() {- final week = _week;- _week = null;- if (week == null) return;- WidgetsBinding.instance.addPostFrameCallback((_) {- if (week.isActive) week.navigator?.removeRoute(week);- });- }-- Future<void> _pull() =>- Future.wait([widget.reader.refresh(), _board.refresh()]);-@overrideWidget build(BuildContext context) {AppTheme.watch(context);@@ -328,30 +236,27 @@ class _SwarmProjectTeamState extends State<SwarmProjectTeam> {final reader = widget.reader;return ListenableBuilder(// Needs and held answers move with the session and its inbox; the- // work and the team with the read; the points with the board.- listenable: Listenable.merge([session, session.inbox, reader, _board]),+ // work and the team with the read.+ listenable: Listenable.merge([session, session.inbox, reader]),builder: (context, _) {final snapshot = reader.snapshot;final project = snapshot?.projects.where((p) => p.id == widget.projectId).firstOrNull;if (snapshot == null || project == null) {- _closeWeek();return const SizedBox.shrink();}final now = clock.now();final tasks = swarmProjectTasks(session.inbox, reader, project.id, now);final personName = swarmTaskPersonName(snapshot);final agents = swarmProjectAgents(snapshot, project.id);- final board = _board.board;- final humans = swarmProjectHumans(- snapshot,- project,- board,- viewer: reader.accountId,- );+ final working = tasks.working;+ final folds = working.length > SwarmProjectTeam.workShown;+ final work = folds && !_allWork+ ? working.take(SwarmProjectTeam.workShown)+ : working;return RefreshIndicator(- onRefresh: _pull,+ onRefresh: reader.refresh,child: ListView(key: const ValueKey('swarm-project-team-list'),physics: const AlwaysScrollableScrollPhysics(),@@ -362,21 +267,12 @@ class _SwarmProjectTeamState extends State<SwarmProjectTeam> {MediaQuery.paddingOf(context).bottom + AppSpace.xl,),children: [- SwarmCaption(- 'Tasks',- key: const ValueKey('swarm-team-tasks-caption'),- note: swarmTeamTasksLine(tasks),- first: true,- ),- if (tasks.waiting.isEmpty && tasks.working.isEmpty)- Padding(- padding: const EdgeInsets.symmetric(horizontal: AppSpace.xs),- child: SwarmRow.line(- 'No open tasks.',- key: const ValueKey('swarm-team-no-tasks'),- ),- )- else+ if (tasks.waiting.isNotEmpty) ...[+ const SwarmCaption(+ 'Waiting on you',+ key: ValueKey('swarm-team-waiting-caption'),+ first: true,+ ),SwarmGroup(children: [for (final need in tasks.waiting)@@ -389,7 +285,27 @@ class _SwarmProjectTeamState extends State<SwarmProjectTeam> {now: now,onOpen: () => widget.onOpen(need.conversationId),),- for (final g in tasks.working)+ ],+ ),+ ],+ if (working.isNotEmpty || tasks.waiting.isEmpty)+ SwarmCaption(+ 'Working on',+ key: const ValueKey('swarm-team-working-caption'),+ first: tasks.waiting.isEmpty,+ ),+ if (working.isEmpty && tasks.waiting.isEmpty)+ Padding(+ padding: const EdgeInsets.symmetric(horizontal: AppSpace.xs),+ child: SwarmRow.line(+ 'No open tasks.',+ key: const ValueKey('swarm-team-no-tasks'),+ ),+ )+ else if (working.isNotEmpty)+ SwarmGroup(+ children: [+ for (final g in work)SwarmWorkRow(key: ValueKey('swarm-task-${g.id}'),snapshot: snapshot,@@ -397,44 +313,19 @@ class _SwarmProjectTeamState extends State<SwarmProjectTeam> {personName: personName,onTap: () => widget.onOpen(g.id),),+ if (folds)+ SwarmRow(+ key: const ValueKey('swarm-team-see-all'),+ title: _allWork+ ? 'Show fewer'+ : 'See all ${working.length} tasks',+ chevron: _allWork+ ? LucideIcons.chevronUp300+ : LucideIcons.chevronRight300,+ onTap: () => setState(() => _allWork = !_allWork),+ ),],),- SwarmCaption(- 'Humans',- key: const ValueKey('swarm-team-humans-caption'),- ),- if (_board.error case final error? when board == null)- _BoardError(error: error, onRetry: _board.refresh),- SwarmGroup(- children: [- for (final h in humans)- SwarmMemberRow(- key: ValueKey('swarm-member-person-${h.person.id}'),- face: SwarmAvatar(- id: h.person.id,- name: h.name,- picture: h.person.avatar,- ),- name: h.name,- // As Desktop's member list (#2230): what they are on- // after the name, what they did this week beneath it,- // and the week's points at the right.- tag: switch ([if (h.own) 'you', ?h.now]) {- final words when words.isNotEmpty => words.join(' · '),- _ => null,- },- detail: switch (h.score) {- final score? => swarmNumbers(score).join(' · '),- null => null,- },- points: h.score?.points,- onTap: switch (h.score) {- final score? => () => _openWeek(h, score),- null => null,- },- ),- ],- ),SwarmCaption('Agents',key: const ValueKey('swarm-team-agents-caption'),@@ -477,63 +368,25 @@ class _SwarmProjectTeamState extends State<SwarmProjectTeam> {}}-/// Why the board was not read, and Try again: one read per tap.-class _BoardError extends StatelessWidget {- const _BoardError({required this.error, required this.onRetry});-- final String error;- final Future<void> Function() onRetry;-- @override- Widget build(BuildContext context) => Padding(- padding: const EdgeInsets.fromLTRB(AppSpace.xs, 0, AppSpace.xs, AppSpace.s),- child: Row(- children: [- Expanded(- child: SwarmRow.line(- error,- key: const ValueKey('swarm-team-board-error'),- lines: 2,- ),- ),- SwarmButton(- key: const ValueKey('swarm-team-board-retry'),- label: 'Try again',- onPressed: () => unawaited(onRetry()),- ),- ],- ),- );-}--/// One person or agent on a project's Team, in the one shape both share-/// (Dee, 2026-10-29): the face in one column — an agent's with its state's-/// [dot] — the name, a quiet [detail] line beneath, and a person's week's-/// [points] at the right. The same height with or without the line; a tap-/// does [onTap], when there is one.+/// One agent on a project's Team (Dee, 2026-10-29): the face in one column,+/// with its state's [dot], the name and a quiet [detail] line beneath. The+/// same height with or without the line; a tap does [onTap], when there is+/// one.class SwarmMemberRow extends StatelessWidget {const SwarmMemberRow({super.key,required this.face,required this.name,this.dot,- this.tag,this.detail,- this.points,this.onTap,});final Widget face;final String name;- /// A person's points this week, once the board has answered.- final int? points;-- /// The state's colour on the face's corner: an agent's.+ /// The state's colour on the face's corner.final Color? dot;-- /// Quiet words after the name: "you" on the viewer's own row.- final String? tag;final String? detail;final VoidCallback? onTap;@@ -542,18 +395,12 @@ class SwarmMemberRow extends StatelessWidget {@overrideWidget build(BuildContext context) {AppTheme.watch(context);- final dot = this.dot, tag = this.tag, detail = this.detail;- final points = this.points;+ final dot = this.dot, detail = this.detail;return Semantics(// Its own node, a tap or not: one row, said as one.container: true,button: onTap != null,- label: [- name,- ?tag,- if (detail != null && detail.isNotEmpty) detail,- if (points != null) '$points points',- ].join(', '),+ label: [name, if (detail != null && detail.isNotEmpty) detail].join(', '),excludeSemantics: true,child: InkWell(onTap: onTap,@@ -601,19 +448,8 @@ class SwarmMemberRow extends StatelessWidget {crossAxisAlignment: CrossAxisAlignment.start,mainAxisSize: MainAxisSize.min,children: [- Text.rich(- TextSpan(- children: [- TextSpan(text: name),- if (tag != null)- TextSpan(- text: ' $tag',- style: AppType.caption(- color: AppPalette.textSecondary,- ),- ),- ],- ),+ Text(+ name,maxLines: 1,overflow: TextOverflow.ellipsis,style: AppType.label(color: AppPalette.textPrimary),@@ -633,10 +469,6 @@ class SwarmMemberRow extends StatelessWidget {],),),- if (points != null) ...[- const SizedBox(width: AppSpace.s),- Text('$points', maxLines: 1, style: swarmPointsStyle()),- ],],),),diff --git a/mobile/lib/swarm/swarm_session.dart b/mobile/lib/swarm/swarm_session.dartindex 7453fd03a..c9cff986b 100644--- a/mobile/lib/swarm/swarm_session.dart+++ b/mobile/lib/swarm/swarm_session.dart@@ -140,6 +140,9 @@ class SwarmSession extends ChangeNotifier {/// unless [undo] takes it back first.void hold(SwarmDecisionNeed need, int choice) {if (_disposed) return;+ // Off the list since it was asked (answered elsewhere, or access taken+ // away): there is nothing to answer.+ if (!inbox.needs.any((open) => open.key == need.key)) return;_held.remove(need.key)?.timer.cancel();_dropped.remove(need.key);if (undoWindow <= Duration.zero) {diff --git a/mobile/test/phone/phone_shell_swarm_link_test.dart b/mobile/test/phone/phone_shell_swarm_link_test.dartindex 11b1f0537..016ba9e5f 100644--- a/mobile/test/phone/phone_shell_swarm_link_test.dart+++ b/mobile/test/phone/phone_shell_swarm_link_test.dart@@ -453,7 +453,79 @@ void main() {await frames(tester);expect(find.text('#Mobile'), findsNothing);- expect(key('swarm-project-tab-team'), findsNothing);+ expect(key('swarm-project-menu'), findsNothing);+ });++ testWidgets('access lost with Approve asking over the Team sheet, in the '+ "shell's own navigator: the dialog and the sheet go", (tester) async {+ const derived = {'decisionsWaiting': 1};+ final fake = swarm();+ fake.routes['/api/super-tabs/$tab/parts'] = (_) => {+ ...firstLoad(+ agents: [+ agent('agent-lead', name: 'Lead', displayName: 'River'),+ agent('agent-juno', displayName: 'Juno'),+ ],+ groups: [+ groupData(+ 'g2',+ title: 'Saved views cache',+ number: 2160,+ agentIds: ['agent-lead', 'agent-juno'],+ status: 'needs_human',+ workerId: 'agent-juno',+ lastMessageSequence: 4,+ ),+ ],+ derived: derived,+ ),+ 'members': [part('person-me', 1, person('person-me'))],+ };+ fake.routes['/api/super-tabs/$tab/changes'] = (_) =>+ changes(cursor: 'c2', derived: derived);+ fake.routes['/api/super-tabs/$tab/decisions?state=open'] = (_) => {+ 'decisions': [+ {+ 'id': 'd1',+ 'projectName': 'Mobile',+ 'conversationId': 'g2',+ 'conversationTitle': 'Saved views cache',+ 'askerName': 'River',+ 'question': 'Merge #2160?',+ 'options': ['Merge', 'Wait'],+ },+ ],+ };+ fake.routes['/api/super-tabs/$tab/mentions?state=waiting'] = (_) => {+ 'mentions': <Object>[],+ };+ (app as _LinkApp).swarm = fake;+ await start(tester);+ await frames(tester);+ await arrive(tester, 'harness://swarm/$tab/$leadChat/m7');+ await frames(tester);+ await tester.tap(key('swarm-project-menu'));+ await frames(tester);+ await tester.tap(key('swarm-project-menu-team'));+ await frames(tester);+ await tester.tap(key('swarm-approve-d1'));+ await frames(tester);+ expect(find.byType(AlertDialog), findsOneWidget);++ tester+ .widget<SwarmScope>(find.byType(SwarmScope).first)+ .notifier!+ .session!+ .inbox+ .reader(tab)!+ .revoke();+ await frames(tester);++ expect(find.byType(AlertDialog), findsNothing);+ expect(find.textContaining('Merge #2160?'), findsNothing);+ expect(find.byType(BottomSheet), findsNothing);+ expect(find.text('#Mobile'), findsNothing);+ expect(fake.commands, isEmpty);});});diff --git a/mobile/test/swarm/swarm_fixture.dart b/mobile/test/swarm/swarm_fixture.dartindex 90b2b8c0e..a496f573e 100644--- a/mobile/test/swarm/swarm_fixture.dart+++ b/mobile/test/swarm/swarm_fixture.dart@@ -389,14 +389,17 @@ SwarmHomeCache memoryHomeCache() {}/// Swarm Home C's project screen is up for the project named [name]: its-/// #name, and the tabs Chat and Team, none of direction B's (Buddy, Tasks,-/// Leaderboard) nor B's team button.+/// #name and ☰, and no tab bar: none of direction B's tabs (Buddy, Tasks,+/// Leaderboard), nor B's team button.void expectHomeCProject(String name) {Finder tab(String t) => find.byKey(ValueKey('swarm-project-tab-$t'));expect(find.text('#$name'), findsOneWidget, reason: 'its #name');- expect(tab('chat'), findsOneWidget, reason: 'Chat');- expect(tab('team'), findsOneWidget, reason: 'Team');- for (final b in ['buddy', 'tasks', 'leaderboard']) {+ expect(+ find.byKey(const ValueKey('swarm-project-menu')),+ findsOneWidget,+ reason: '☰',+ );+ for (final b in ['chat', 'buddy', 'tasks', 'leaderboard']) {expect(tab(b), findsNothing, reason: "B's $b tab");}expect(diff --git a/mobile/test/swarm/swarm_home_test.dart b/mobile/test/swarm/swarm_home_test.dartindex be7d665e0..813d374a1 100644--- a/mobile/test/swarm/swarm_home_test.dart+++ b/mobile/test/swarm/swarm_home_test.dart@@ -22,6 +22,7 @@ import 'package:harness_mobile/swarm/swarm_activity_page.dart';import 'package:harness_mobile/swarm/swarm_page.dart';import 'package:harness_mobile/swarm/swarm_project_page.dart';import 'package:harness_mobile/swarm/swarm_project_tabs.dart';+import 'package:harness_mobile/swarm/swarm_project_team.dart';import 'package:harness_mobile/swarm/swarm_request.dart';import 'package:harness_mobile/swarm/swarm_row.dart';import 'package:harness_mobile/swarm/swarm_session.dart';@@ -1224,11 +1225,13 @@ void main() {});testWidgets('back from a task opened on Team is the same Home C screen, '- 'on Team', (tester) async {+ 'with Team still open', (tester) async {await pump(tester, backend());await tester.tap(key('swarm-project-$tab-$project'));await tester.pumpAndSettle();- await tester.tap(key('swarm-project-tab-team'));+ await tester.tap(key('swarm-project-menu'));+ await tester.pumpAndSettle();+ await tester.tap(key('swarm-project-menu-team'));await tester.pumpAndSettle();final task = find.byWidgetPredicate((w) => switch (w.key) {@@ -1243,7 +1246,7 @@ void main() {await tester.tap(key('tty-back'));await tester.pumpAndSettle();expectHomeCProject('Mobile');- expect(key('swarm-project-body-team'), findsOneWidget);+ expect(find.byType(SwarmProjectTeamSheet), findsOneWidget);});});diff --git a/mobile/test/swarm/swarm_project_c_shots_test.dart b/mobile/test/swarm/swarm_project_c_shots_test.dartindex e8bc8eb73..e661fe636 100644--- a/mobile/test/swarm/swarm_project_c_shots_test.dart+++ b/mobile/test/swarm/swarm_project_c_shots_test.dart@@ -18,12 +18,12 @@ import '../voice_fakes.dart';import 'swarm_fixture.dart';/// Review screenshots of a project's screen in Swarm Home C, as Tony's-/// prototype draws it (2026-10-30): its Chat with the New messages line,+/// prototype draws it (2026-10-30): its chat with the New messages line,/// a task card and a PR card, a code block, reactions with the add-reaction-/// chip and a replies row; its Team with open tasks on top, the humans with-/// their week and points, and the agents in their states; and Approve's-/// question. On a 390-point phone in both phone themes, from made-up data-/// only, to the folder `SWARM_PROJECT_C_SHOTS` names.+/// chip and a replies row; ☰ open; its Leaderboard sheet; its Team sheet with+/// open tasks on top, See all and the agents in their states; and Approve's+/// question. On 390- and 320-point phones in both phone themes, from made-up+/// data only, to the folder `SWARM_PROJECT_C_SHOTS` names.final shots = Platform.environment['SWARM_PROJECT_C_SHOTS'];void main() {setUpAll(() async {@@ -51,15 +51,25 @@ void main() {}});- testWidgets('the project screen, its Chat and Team, in both phone themes', (+ testWidgets('the project screen, its menu and sheets, in both phone themes', (tester,) async {- await tester.binding.setSurfaceSize(const Size(390, 844));- addTearDown(() => tester.binding.setSurfaceSize(null));+ addTearDown(tester.view.reset);+ // Real shadows: a test's stand-in draws a menu's as a thick black rim.+ debugDisableShadows = false;// An iPhone's status bar and home indicator.tester.view.padding = const FakeViewPadding(top: 47 * 3, bottom: 34 * 3);addTearDown(tester.view.resetPadding);- for (final palette in [HarnessPalette.graphite, HarnessPalette.paper]) {+ for (final (palette, size) in [+ for (final palette in [HarnessPalette.graphite, HarnessPalette.paper])+ for (final size in const [Size(390, 844), Size(320, 568)])+ (palette, size),+ ]) {+ // The view, not only the surface: a sheet takes its height from+ // MediaQuery.+ tester.view+ ..physicalSize = size * 3+ ..devicePixelRatio = 3;final brightness = palette.brightness;AppTheme.palette.value = palette;AppTheme.brightness.value = brightness;@@ -132,6 +142,24 @@ void main() {workerId: 'agent-juno',lastMessageSequence: 4,),+ for (final (i, title) in const [+ 'Sign-in retries',+ 'Push token refresh',+ 'Machine list paging',+ 'Voice note waveform',+ 'Offline queue limits',+ 'Thread reply count',+ 'Attachment previews',+ ].indexed)+ groupData(+ 'g-more-$i',+ title: title,+ number: 2170 + i,+ agentIds: ['agent-lead', 'agent-builder'],+ status: 'working',+ workerId: 'agent-builder',+ lastMessageSequence: 2,+ ),],derived: derived,);@@ -303,7 +331,8 @@ void main() {as RenderRepaintBoundary).toImage(pixelRatio: 3);final png = await image.toByteData(format: ui.ImageByteFormat.png);- await File('$shots/project-c-$name-${brightness.name}.png')+ final width = size.width.round();+ await File('$shots/project-c-$width-$name-${brightness.name}.png').writeAsBytes(png!.buffer.asUint8List());image.dispose();});@@ -312,13 +341,30 @@ void main() {await tester.drag(key('swarm-messages'), const Offset(0, 600));await tester.pumpAndSettle();await capture('chat-earlier');- await tester.tap(key('swarm-project-tab-team'));+ await tester.tap(key('swarm-project-menu'));+ await tester.pumpAndSettle();+ await capture('menu');+ await tester.tap(key('swarm-project-menu-leaderboard'));+ await tester.pumpAndSettle();+ await capture('leaderboard');+ await tester.tap(key('swarm-leaderboard-close'));+ await tester.pumpAndSettle();+ await tester.tap(key('swarm-project-menu'));+ await tester.pumpAndSettle();+ await tester.tap(key('swarm-project-menu-team'));await tester.pumpAndSettle();await capture('team');- await tester.drag(key('swarm-project-team-list'), const Offset(0, -400));+ await tester.dragUntilVisible(+ key('swarm-team-see-all'),+ key('swarm-project-team-list'),+ const Offset(0, -200),+ );+ await tester.pumpAndSettle();+ await capture('team-see-all');+ await tester.drag(key('swarm-project-team-list'), const Offset(0, -1000));await tester.pumpAndSettle();await capture('team-agents');- await tester.drag(key('swarm-project-team-list'), const Offset(0, 400));+ await tester.drag(key('swarm-project-team-list'), const Offset(0, 2000));await tester.pumpAndSettle();await tester.tap(key('swarm-approve-d1'));await tester.pumpAndSettle();@@ -328,6 +374,7 @@ void main() {host.dispose();account.dispose();}+ debugDisableShadows = true;AppTheme.palette.value = HarnessPalette.graphite;AppTheme.brightness.value = Brightness.dark;}, skip: shots == null);diff --git a/mobile/test/swarm/swarm_project_c_test.dart b/mobile/test/swarm/swarm_project_c_test.dartindex be528f03d..26cdf381b 100644--- a/mobile/test/swarm/swarm_project_c_test.dart+++ b/mobile/test/swarm/swarm_project_c_test.dart@@ -9,18 +9,22 @@ import 'package:harness_mobile/shared/widgets/touch_target.dart';import 'package:harness_mobile/swarm/swarm_code_block.dart';import 'package:harness_mobile/swarm/swarm_conversation_page.dart';import 'package:harness_mobile/swarm/swarm_inbox.dart';+import 'package:harness_mobile/swarm/swarm_leaderboard.dart';+import 'package:harness_mobile/swarm/swarm_leaderboard_reader.dart';import 'package:harness_mobile/swarm/swarm_project_page.dart';import 'package:harness_mobile/swarm/swarm_project_tabs.dart';import 'package:harness_mobile/swarm/swarm_project_tasks.dart';import 'package:harness_mobile/swarm/swarm_project_team.dart';import 'package:harness_mobile/swarm/swarm_request.dart';import 'package:harness_mobile/swarm/swarm_session.dart';+import 'package:harness_mobile/swarm/swarm_style.dart';import '../voice_fakes.dart';import 'swarm_fixture.dart';/// The project screen of Tony's Swarm Home, direction C (2026-10-30): the-/// project's #name over its team line, and two tabs, Chat and Team.+/// project's #name over its team line and its chat filling the screen, with+/// ☰ opening its Leaderboard and its Team as sheets.void main() {const board = '/api/super-tabs/$tab/leaderboard?projectId=$project';@@ -164,14 +168,28 @@ void main() {tabs: SwarmProjectTab.homeC,);- /// The page on its Team tab.- Future<SwarmHost> team(WidgetTester tester, FakeSwarm fake) async {+ /// The page with the sheet of its menu's row keyed [row] open.+ Future<SwarmHost> fromMenu(+ WidgetTester tester,+ FakeSwarm fake,+ String row,+ ) async {final host = await pump(tester, fake, page);- await tester.tap(key('swarm-project-tab-team'));+ await tester.tap(key('swarm-project-menu'));+ await tester.pumpAndSettle();+ await tester.tap(key(row));await tester.pumpAndSettle();return host;}+ /// The page with its Team sheet open.+ Future<SwarmHost> team(WidgetTester tester, FakeSwarm fake) =>+ fromMenu(tester, fake, 'swarm-project-menu-team');++ /// The page with its Leaderboard sheet open.+ Future<SwarmHost> leaderboard(WidgetTester tester, FakeSwarm fake) =>+ fromMenu(tester, fake, 'swarm-project-menu-leaderboard');+/// The words of the row keyed [k], its rich text included.String said(WidgetTester tester, String k) => [for (final text in tester.widgetList<RichText>(@@ -199,25 +217,29 @@ void main() {return gate;}- /// The member rows under the caption keyed [caption]'s card.- List<String> rowsAfter(WidgetTester tester, String caption, String? next) {- final top = tester.getBottomLeft(key(caption)).dy;- final bottom = next == null- ? double.infinity- : tester.getTopLeft(key(next)).dy;- final rows =- tester.widgetList<SwarmMemberRow>(find.byType(SwarmMemberRow)).where((- row,- ) {- final y = tester.getTopLeft(find.byWidget(row)).dy;- return y >= top && y < bottom;- }).toList()..sort(- (a, b) => tester- .getTopLeft(find.byWidget(a))- .dy- .compareTo(tester.getTopLeft(find.byWidget(b)).dy),- );- return [for (final row in rows) (row.key! as ValueKey<String>).value];+ /// The people on the Leaderboard sheet, top to bottom.+ List<String> onBoard(WidgetTester tester) {+ final rows = find.byWidgetPredicate(+ (w) => switch (w.key) {+ ValueKey<String>(:final value) => value.startsWith(+ 'swarm-leaderboard-person-',+ ),+ _ => false,+ },+ );+ final found = rows.evaluate().map((e) => e.widget).toList()+ ..sort(+ (a, b) => tester+ .getTopLeft(find.byWidget(a))+ .dy+ .compareTo(tester.getTopLeft(find.byWidget(b)).dy),+ );+ return [+ for (final w in found)+ (w.key! as ValueKey<String>).value.substring(+ 'swarm-leaderboard-person-'.length,+ ),+ ];}/// The texts of the row keyed [k] with a digit in them, its face aside.@@ -231,16 +253,16 @@ void main() {String workKey(WidgetTester tester) =>host(tester).session!.inbox.needs.whereType<SwarmWorkNeed>().single.key;+ /// The key of that work's row.+ String waitingKey(WidgetTester tester) =>+ 'swarm-waiting-${workKey(tester)}';+testWidgets('on top: what waits on the person, then what is worked on, '- "in the Tasks tab's rows, counted beside their caption", (- tester,- ) async {+ "in the Tasks tab's rows, under a caption each", (tester) async {await team(tester, backend());- expect(- said(tester, 'swarm-team-tasks-caption'),- 'Tasks | 1 waiting on you · 1 working',- );+ expect(said(tester, 'swarm-team-waiting-caption'), 'Waiting on you');+ expect(said(tester, 'swarm-team-working-caption'), 'Working on');final waiting = 'swarm-waiting-${workKey(tester)}';expect(key(waiting), findsOneWidget);expect(tester.widget(key(waiting)), isA<SwarmWaitingRow>());@@ -249,10 +271,10 @@ void main() {expect(key('swarm-reply-${workKey(tester)}'), findsOneWidget);double y(String k) => tester.getTopLeft(key(k)).dy;final order = [- y('swarm-team-tasks-caption'),+ y('swarm-team-waiting-caption'),y(waiting),+ y('swarm-team-working-caption'),y('swarm-task-g1'),- y('swarm-team-humans-caption'),y('swarm-team-agents-caption'),];expect(order, [...order]..sort(), reason: 'Tasks first, waiting first');@@ -329,15 +351,14 @@ void main() {});});- testWidgets('access taken away while Approve asks: confirming it then '- 'holds and sends nothing', (tester) async {+ testWidgets('access taken away while Approve asks: confirming it before '+ 'the dialog goes holds and sends nothing', (tester) async {final fake = asked();await team(tester, fake);await tester.tap(key('swarm-approve-d1'));await tester.pumpAndSettle();host(tester).session!.inbox.reader(tab)!.revoke();- await tester.pump();await tester.tap(key('swarm-activity-approve-confirm'));await tester.pumpAndSettle();await tester.pump(const Duration(seconds: 5));@@ -347,6 +368,73 @@ void main() {expect(find.byType(SwarmWaitingRow), findsNothing);});+ /// Approve asking over the Team sheet, its question on screen.+ Future<FakeSwarm> asking(WidgetTester tester) async {+ final fake = asked();+ await team(tester, fake);+ await tester.tap(key('swarm-approve-d1'));+ await tester.pumpAndSettle();+ expect(find.byType(AlertDialog), findsOneWidget);+ return fake;+ }++ /// Nothing of Approve or the sheet stays, and nothing was sent.+ Future<void> expectAllGone(WidgetTester tester, FakeSwarm fake) async {+ await tester.pumpAndSettle();+ expect(find.byType(AlertDialog), findsNothing);+ expect(find.textContaining('Merge #2160?'), findsNothing);+ expect(key('swarm-activity-approve-confirm'), findsNothing);+ expect(find.byType(BottomSheet), findsNothing);+ await tester.pump(const Duration(seconds: 5));+ await tester.pumpAndSettle();+ expect(fake.commands, isEmpty);+ }++ testWidgets('access taken away while Approve asks: the dialog goes with '+ 'the sheet, and its question with it', (tester) async {+ final fake = await asking(tester);++ host(tester).session!.inbox.reader(tab)!.revoke();++ await expectAllGone(tester, fake);+ });++ testWidgets('the project taken off the Swarm while Approve asks: the '+ 'dialog goes with the sheet', (tester) async {+ final fake = await asking(tester);++ fake.routes['/api/super-tabs/$tab/changes'] = (_) => {+ ...changes(cursor: 'c3'),+ 'head': part('head', 2, headData(projects: const [])),+ };+ await host(tester).session!.inbox.reader(tab)!.refresh();++ await expectAllGone(tester, fake);+ });++ testWidgets('the account signing out while Approve asks: the dialog goes '+ 'with the sheet', (tester) async {+ final fake = await asking(tester);++ (host(tester).account as ValueNotifier<String?>).value = null;++ await expectAllGone(tester, fake);+ });++ testWidgets('closing the sheet takes nothing under it: the chat and the '+ 'page stay', (tester) async {+ final fake = await asking(tester);++ await tester.tap(key('swarm-activity-approve-cancel'));+ await tester.pumpAndSettle();+ await tester.tap(key('swarm-team-close'));+ await tester.pumpAndSettle();++ expect(find.byType(SwarmProjectPage), findsOneWidget);+ expect(find.text('CI on #2154 is green.'), findsOneWidget);+ expect(fake.commands, isEmpty);+ });+testWidgets('a task opens its chat', (tester) async {await team(tester, backend());@@ -382,87 +470,220 @@ void main() {};await team(tester, fake);- expect(said(tester, 'swarm-team-tasks-caption'), 'Tasks');+ expect(said(tester, 'swarm-team-working-caption'), 'Working on');+ expect(key('swarm-team-waiting-caption'), findsNothing);expect(key('swarm-team-no-tasks'), findsOneWidget);expect(find.text('No open tasks.'), findsOneWidget);expect(key('swarm-task-g1'), findsNothing);});- });- group('Team, its humans', () {- testWidgets("ordered by this week's points, most first, as Desktop's "- 'member list draws them (#2230): the name and what they are on now, '- 'a line of what they did this week, and the points at the right', (- tester,- ) async {- await team(tester, backend());+ /// [backend] with [count] tasks going on, g-0 the latest, besides what+ /// waits on the person.+ FakeSwarm manyTasks(int count) {+ final fake = backend();+ final load = fake.routes['/api/super-tabs/$tab/parts']!;+ fake.routes['/api/super-tabs/$tab/parts'] = (body) async {+ final read = (await load(body))! as Map<String, dynamic>;+ final groups = read['groups'] as List;+ groups.removeWhere((g) => (g as Map)['key'] == 'g1');+ return {+ ...read,+ 'groups': [+ ...groups,+ for (var i = 0; i < count; i++)+ part(+ 'g-$i',+ 1,+ groupData(+ 'g-$i',+ title: 'Task $i',+ number: 3000 + i,+ agentIds: ['agent-lead', 'agent-builder'],+ status: 'working',+ workerId: 'agent-builder',+ lastMessageSequence: 100 - i,+ ),+ ),+ ],+ };+ };+ return fake;+ }++ Finder workRows() => find.byType(SwarmWorkRow);++ /// A view tall enough that the list builds every row.+ void tall(WidgetTester tester) {+ tester.view+ ..physicalSize = const Size(800, 3000)+ ..devicePixelRatio = 1;+ addTearDown(tester.view.reset);+ }- expect(said(tester, 'swarm-team-humans-caption'), 'Humans');+ testWidgets('shows five of the work going on, and See all shows the rest '+ 'in place, above the agents', (tester) async {+ tall(tester);+ await team(tester, manyTasks(8));++ expect(key(waitingKey(tester)), findsOneWidget, reason: 'not capped');+ expect(workRows(), findsNWidgets(5));+ for (var i = 0; i < 5; i++) {+ expect(key('swarm-task-g-$i'), findsOneWidget, reason: 'latest first');+ }+ expect(key('swarm-task-g-5'), findsNothing);+ final seeAll = key('swarm-team-see-all');+ expect(find.text('See all 8 tasks'), findsOneWidget);expect(- rowsAfter(- tester,- 'swarm-team-humans-caption',- 'swarm-team-agents-caption',- ),- [- 'swarm-member-person-person-me',- 'swarm-member-person-diego',- 'swarm-member-person-ken',- ],+ tester.getSize(seeAll).height,+ greaterThanOrEqualTo(minTouchTarget),);+ double y(String k) => tester.getTopLeft(key(k)).dy;+ expect(y('swarm-task-g-4'), lessThan(y('swarm-team-see-all')));expect(- heard(tester, 'swarm-member-person-person-me'),- 'person-me, you, 6 shipped · 3 unblocked, 1320 points',+ y('swarm-team-see-all'),+ lessThan(y('swarm-team-agents-caption')),+ reason: 'the agents are a short way down, however many tasks',);- expect(- heard(tester, 'swarm-member-person-diego'),- 'diego, 🎯 Reviewing PRs, 10 hours lent, 1050 points',++ await tester.tap(seeAll);+ await tester.pumpAndSettle();++ expect(workRows(), findsNWidgets(8));+ expect(find.byType(SwarmProjectTeamSheet), findsOneWidget);+ expect(find.text('Show fewer'), findsOneWidget);+ expect(find.text('See all 8 tasks'), findsNothing);++ await tester.tap(seeAll);+ await tester.pumpAndSettle();+ expect(workRows(), findsNWidgets(5), reason: 'it folds again');+ });++ testWidgets('five or fewer have no See all', (tester) async {+ await team(tester, manyTasks(5));++ expect(workRows(), findsNWidgets(5));+ expect(key('swarm-team-see-all'), findsNothing);+ });++ testWidgets('See all stays open when the Swarm is read again, and over a '+ 'task opened from it and back', (tester) async {+ tall(tester);+ final fake = manyTasks(8);+ await team(tester, fake);+ await tester.tap(key('swarm-team-see-all'));+ await tester.pumpAndSettle();+ expect(workRows(), findsNWidgets(8));++ fake.routes['/api/super-tabs/$tab/changes'] = (_) => changes(+ cursor: 'c3',+ groups: [+ part(+ 'g-0',+ 9,+ groupData(+ 'g-0',+ title: 'Task 0, renamed',+ number: 3000,+ agentIds: ['agent-lead', 'agent-builder'],+ status: 'working',+ workerId: 'agent-builder',+ lastMessageSequence: 200,+ ),+ ),+ ],);+ await host(tester).session!.inbox.reader(tab)!.refresh();+ await tester.pumpAndSettle();++ expect(find.textContaining('Task 0, renamed'), findsWidgets);+ expect(workRows(), findsNWidgets(8), reason: 'a read folds nothing');++ await tester.tap(key('swarm-task-g-1'));+ await tester.pumpAndSettle();+ expect(find.byType(SwarmProjectTeamSheet, skipOffstage: false), findsOne);+ await tester.tap(key('tty-back'));+ await tester.pumpAndSettle();++ expect(find.byType(SwarmProjectTeamSheet), findsOneWidget);+ expect(workRows(), findsNWidgets(8), reason: 'back, as it was');+ });++ testWidgets('lists no humans: they are on the Leaderboard, and its board '+ 'is not read for the Team', (tester) async {+ final fake = backend();+ await team(tester, fake);++ expect(find.text('Humans'), findsNothing);+ expect(fake.paths.where((p) => p.contains('/leaderboard')), isEmpty);+ for (final id in ['person-me', 'diego', 'ken']) {+ expect(key('swarm-member-person-$id'), findsNothing, reason: id);+ }+ });+ });++ group('the Leaderboard sheet', () {+ testWidgets("this project's humans by this week's points, most first, "+ 'without ranks: the name, a line of what they did this week and the '+ 'points at the right', (tester) async {+ final fake = backend();+ await leaderboard(tester, fake);++ expect(find.text('Leaderboard'), findsOneWidget);+ expect(find.text('This week'), findsOneWidget);+ expect(key('swarm-leaderboard-close'), findsOneWidget);+ expect(onBoard(tester), ['person-me', 'diego', 'ken']);expect(- heard(tester, 'swarm-member-person-ken'),- 'ken, 640 points',- reason: 'a status whose time has passed is not shown, nor zeros',+ heard(tester, 'swarm-leaderboard-person-person-me'),+ 'person-me, 1320 points, 6 shipped, 3 unblocked',);expect(- said(tester, 'swarm-member-person-diego'),- 'D | diego 🎯 Reviewing PRs | 10 hours lent | 1050',- reason: 'the status after the name, as on Desktop',- );- final name = tester.getTopRight(- find.descendant(- of: key('swarm-member-person-diego'),- matching: find.textContaining('diego', findRichText: true),- ),+ heard(tester, 'swarm-leaderboard-person-diego'),+ 'diego, 1050 points, 10 hours lent',);- Finder points(String id, String value) => find.descendant(- of: key('swarm-member-person-$id'),- matching: find.text(value),+ expect(+ heard(tester, 'swarm-leaderboard-person-ken'),+ 'ken, 640 points',+ reason: 'no zeros',);expect(- tester.getTopLeft(points('diego', '1050')).dx,- greaterThan(name.dx),- reason: 'at the right',+ find.byKey(const ValueKey('swarm-leaderboard-rank-diego')),+ findsNothing,+ reason: 'no rank numbers',);+ Finder points(String id) => key('swarm-leaderboard-points-$id');expect(- tester.getTopRight(points('diego', '1050')).dx,- tester.getTopRight(points('ken', '640')).dx,+ tester.getTopRight(points('diego')).dx,+ tester.getTopRight(points('ken')).dx,reason: 'the points line up',);- });-- testWidgets('in the one row shape the agents share', (tester) async {- await team(tester, backend());-+ expect(fake.paths.where((p) => p == board).length, 1);expect(- rowsAfter(tester, 'swarm-team-agents-caption', null),- hasLength(4),+ fake.paths.where(+ (p) => p.contains('/leaderboard') && !p.startsWith(board),+ ),+ isEmpty,+ reason: "this project's board, and no other",);- final human = tester.getSize(key('swarm-member-person-diego'));- final agent = tester.getSize(key('swarm-member-agent-ash'));- expect(human.height, agent.height);- expect(human.width, agent.width);});+ testWidgets(+ 'its top line fits at 320 wide, with a finger for each control',+ (tester) async {+ tester.view+ ..physicalSize = const Size(320, 640)+ ..devicePixelRatio = 1;+ addTearDown(tester.view.reset);+ await leaderboard(tester, backend());++ expect(tester.takeException(), isNull);+ for (final k in ['swarm-leaderboard-close', 'swarm-leaderboard-week']) {+ final size = tester.getSize(key(k));+ expect(size.height, greaterThanOrEqualTo(minTouchTarget), reason: k);+ expect(size.width, greaterThanOrEqualTo(minTouchTarget), reason: k);+ }+ },+ );+testWidgets('equal points, and none, go by name', (tester) async {final fake = backend();fake.routes[board] = (_) => leaderboardData(@@ -471,34 +692,49 @@ void main() {scoreData('diego', points: 40, rank: 1),],);- await team(tester, fake);+ await leaderboard(tester, fake);+ expect(onBoard(tester), ['diego', 'ken', 'person-me']);expect(- rowsAfter(- tester,- 'swarm-team-humans-caption',- 'swarm-team-agents-caption',- ),- [- 'swarm-member-person-diego',- 'swarm-member-person-ken',- 'swarm-member-person-person-me',- ],+ heard(tester, 'swarm-leaderboard-person-person-me'),+ 'person-me',+ reason: 'the board does not list them: no points are made up',);});- testWidgets('a row opens their week', (tester) async {- await team(tester, backend());+ testWidgets('the week picker reads the week picked, for this project, and '+ 'says so', (tester) async {+ final fake = backend();+ await leaderboard(tester, fake);- await tester.tap(key('swarm-member-person-diego'));+ await tester.tap(key('swarm-leaderboard-week'));+ await tester.pumpAndSettle();+ fake.routes.addAll({+ for (var back = 1; back < 4; back++)+ '$board&week=${swarmWeekOf(DateTime.now()) - back * swarmWeekMs}': (+ _,+ ) => leaderboardData(people: [scoreData('ken', points: 7, rank: 1)]),+ });+ await tester.tap(key('swarm-leaderboard-week-1'));await tester.pumpAndSettle();+ expect(find.text('Last week'), findsOneWidget);+ expect(onBoard(tester).first, 'ken');expect(- find.byKey(const ValueKey('swarm-leaderboard-sheet')),- findsOneWidget,+ fake.paths.where((p) => p.startsWith('$board&week=')),+ hasLength(1),);});+ testWidgets('a row opens their week', (tester) async {+ await leaderboard(tester, backend());++ await tester.tap(key('swarm-leaderboard-person-diego'));+ await tester.pumpAndSettle();++ expect(key('swarm-leaderboard-sheet'), findsOneWidget);+ });+testWidgets('a private project lists only the people who read it', (tester,) async {@@ -514,10 +750,9 @@ void main() {];return read;};- await team(tester, fake);+ await leaderboard(tester, fake);- expect(key('swarm-member-person-ken'), findsNothing);- expect(key('swarm-member-person-diego'), findsOneWidget);+ expect(onBoard(tester), ['person-me', 'diego']);});testWidgets('while the board is read, the people show at once by name, '@@ -526,22 +761,13 @@ void main() {) async {final fake = backend();final gate = hold(fake, board);- await team(tester, fake);+ await leaderboard(tester, fake);- List<String> humans() => rowsAfter(- tester,- 'swarm-team-humans-caption',- 'swarm-team-agents-caption',- );- expect(humans(), [- 'swarm-member-person-diego',- 'swarm-member-person-ken',- 'swarm-member-person-person-me',- ]);+ expect(onBoard(tester), ['diego', 'ken', 'person-me']);expect(find.textContaining('Loading'), findsNothing);for (final id in ['person-me', 'diego', 'ken']) {expect(- figures('swarm-member-person-$id'),+ figures('swarm-leaderboard-person-$id'),findsNothing,reason: 'no points nor numbers before the board answers: $id',);@@ -549,54 +775,106 @@ void main() {gate.complete();await tester.pumpAndSettle();- expect(humans(), [- 'swarm-member-person-person-me',- 'swarm-member-person-diego',- 'swarm-member-person-ken',- ]);+ expect(onBoard(tester), ['person-me', 'diego', 'ken']);});- testWidgets('a board that cannot be read says so, and Try again reads it '- 'once', (tester) async {+ testWidgets('a first read that fails says so, and Try again recovers it, '+ 'with one read', (tester) async {final fake = backend();final answer = fake.routes[board]!;fake.routes[board] = (_) =>throw const SuperTabFailure('INTERNAL', 'Board is down.');- await team(tester, fake);+ await leaderboard(tester, fake);expect(find.text('Board is down.'), findsOneWidget);- expect(key('swarm-member-person-diego'), findsOneWidget);+ expect(onBoard(tester), contains('diego'));+ expect(find.textContaining('Loading'), findsNothing);final reads = fake.paths.where((p) => p == board).length;fake.routes[board] = answer;- await tester.tap(key('swarm-team-board-retry'));+ await tester.tap(key('swarm-leaderboard-retry'));await tester.pumpAndSettle();expect(fake.paths.where((p) => p == board).length, reads + 1);expect(find.text('Board is down.'), findsNothing);- expect(- rowsAfter(- tester,- 'swarm-team-humans-caption',- 'swarm-team-agents-caption',- ).first,- 'swarm-member-person-person-me',+ expect(onBoard(tester), ['person-me', 'diego', 'ken']);+ expect(figures('swarm-leaderboard-person-diego'), findsWidgets);+ });++ testWidgets('a pull reads the board and the Swarm, once each', (+ tester,+ ) async {+ final fake = backend();+ await leaderboard(tester, fake);+ int count(String path) =>+ fake.paths.where((p) => p.startsWith(path)).length;+ final boards = count(board);+ const swarm = '/api/super-tabs/$tab/changes';+ final reads = count(swarm);++ await tester.fling(+ key('swarm-leaderboard-person-diego'),+ const Offset(0, 400),+ 1000,);+ await tester.pumpAndSettle();++ expect(count(board), boards + 1);+ expect(count(swarm), reads + 1);+ expect(find.byType(SwarmLeaderboardPage), findsOneWidget, reason: 'open');+ });++ testWidgets('a server with no board says so, and its people still show', (+ tester,+ ) async {+ final fake = backend();+ fake.routes[board] = (_) =>+ throw const SuperTabFailure('NOT_FOUND', 'Nope.', statusCode: 404);+ await leaderboard(tester, fake);++ expect(key('swarm-leaderboard-unavailable'), findsOneWidget);+ expect(onBoard(tester), ['diego', 'ken', 'person-me']);});- testWidgets('access taken away while it is open leaves nothing of the '- 'team, and the board answer on its way is dropped', (tester) async {+ testWidgets('the board answer that lands after the sheet closed changes '+ 'nothing, and opening it again reads it anew', (tester) async {final fake = backend();final gate = hold(fake, board);- await team(tester, fake);+ await leaderboard(tester, fake);++ await tester.tap(key('swarm-leaderboard-close'));+ await tester.pumpAndSettle();+ expect(find.byType(SwarmLeaderboardPage), findsNothing);+ final reads = fake.paths.where((p) => p == board).length;+ gate.complete();+ await tester.pumpAndSettle();++ expect(find.text('1320'), findsNothing);+ expect(tester.takeException(), isNull);++ await tester.tap(key('swarm-project-menu'));+ await tester.pumpAndSettle();+ await tester.tap(key('swarm-project-menu-leaderboard'));+ await tester.pumpAndSettle();+ expect(fake.paths.where((p) => p == board).length, reads + 1);+ expect(find.text('1320'), findsOneWidget);+ });++ testWidgets('access taken away while it is open closes it, and the board '+ 'answer on its way is dropped', (tester) async {+ final fake = backend();+ final gate = hold(fake, board);+ await leaderboard(tester, fake);+ expect(onBoard(tester), isNotEmpty);host(tester).session!.inbox.reader(tab)!.revoke();await tester.pump();gate.complete();await tester.pumpAndSettle();- expect(find.byType(SwarmMemberRow), findsNothing);- expect(find.byType(SwarmProjectTeam), findsNothing);+ expect(find.byType(SwarmLeaderboardPage), findsNothing);+ expect(onBoard(tester), isEmpty);+ expect(find.text('diego'), findsNothing);expect(find.text('This project is no longer in the Swarm.'),findsOneWidget,@@ -644,7 +922,7 @@ void main() {testWidgets('a row opens the task its agent holds', (tester) async {await team(tester, backend());- // Under the Tasks and the humans.+ // Under the Tasks.await tester.ensureVisible(key('swarm-member-agent-builder'));await tester.pumpAndSettle();await tester.tap(key('swarm-member-agent-builder'));@@ -729,49 +1007,101 @@ void main() {);});- testWidgets('has two tabs, Chat and Team, each half the width and a '- "finger's height", (tester) async {+ testWidgets('has no tab bar: its chat fills the screen under its header', (+ tester,+ ) async {await pump(tester, backend(), page);- for (final name in ['buddy', 'tasks', 'leaderboard']) {+ expect(find.byType(SwarmProjectTabBar), findsNothing);+ for (final name in ['chat', 'buddy', 'tasks', 'leaderboard', 'team']) {expect(key('swarm-project-tab-$name'), findsNothing, reason: name);}- final width = tester.getSize(find.byType(SwarmProjectPage)).width;- for (final name in ['chat', 'team']) {- final size = tester.getSize(key('swarm-project-tab-$name'));- expect(size.height, greaterThanOrEqualTo(minTouchTarget), reason: name);- expect(size.width, greaterThan(width / 2 - 16), reason: name);- }- expect(find.text('Chat'), findsOneWidget);- expect(find.text('Team'), findsOneWidget);+ expect(find.text('CI on #2154 is green.'), findsOneWidget);+ expect(+ tester.getTopLeft(key('swarm-project-body-chat')).dy,+ tester.getBottomLeft(find.byType(SwarmTopBar)).dy,+ );+ expect(+ tester.getBottomLeft(key('swarm-project-body-chat')).dy,+ tester.getSize(find.byType(SwarmProjectPage)).height,+ );expect(key('swarm-project-team'),findsNothing,- reason: 'the team is a tab, not a sheet from the header',+ reason: "direction B's team button",);});- testWidgets('opens on its chat, and Team shows the team in its place', (+ testWidgets('☰ at the end of the header, a finger wide and tall, says '+ 'Menu, and opens Leaderboard and Team on the menu surface', (tester,) async {await pump(tester, backend(), page);- expect(find.text('CI on #2154 is green.'), findsOneWidget);- expect(key('swarm-project-body-chat'), findsOneWidget);- await tester.tap(key('swarm-project-tab-team'));+ final button = key('swarm-project-menu');+ final size = tester.getSize(button);+ expect(size.width, greaterThanOrEqualTo(minTouchTarget));+ expect(size.height, greaterThanOrEqualTo(minTouchTarget));+ expect(heard(tester, 'swarm-project-menu'), 'Menu');+ expect(+ tester.getTopRight(button).dx,+ greaterThan(tester.getTopRight(key('swarm-title')).dx),+ reason: 'at the end of the header',+ );+ expect(find.text('Leaderboard'), findsNothing);++ await tester.tap(button);await tester.pumpAndSettle();- expect(key('swarm-project-body-team'), findsOneWidget);- expect(find.text('CI on #2154 is green.'), findsNothing);+ expect(find.text('Leaderboard'), findsOneWidget);+ expect(find.text('Team'), findsOneWidget);+ for (final row in ['leaderboard', 'team']) {+ expect(+ tester.getSize(key('swarm-project-menu-$row')).height,+ greaterThanOrEqualTo(minTouchTarget),+ reason: row,+ );+ }expect(- tester- .widget<Semantics>(key('swarm-project-tab-team'))- .properties- .selected,- isTrue,+ tester.widget<MenuAnchor>(find.byType(MenuAnchor)).style,+ isNull,+ reason: "the theme's menu surface, AppMenu's, not one of its own",);++ await tester.tap(button);+ await tester.pumpAndSettle();+ expect(find.text('Leaderboard'), findsNothing, reason: 'it closes');});+ for (final (row, closeKey, title) in [+ ('leaderboard', 'swarm-leaderboard-close', 'Leaderboard'),+ ('team', 'swarm-team-close', 'Team'),+ ]) {+ testWidgets('$row opens as a sheet over the chat, with ✕ and a top '+ 'radius of 12; ✕ is back on the chat', (tester) async {+ await fromMenu(tester, backend(), 'swarm-project-menu-$row');++ expect(find.byType(BottomSheet), findsOneWidget);+ expect(find.text(title), findsOneWidget);+ expect(key('swarm-project-menu-$row'), findsNothing, reason: 'closed');+ final sheet = tester.widget<BottomSheet>(find.byType(BottomSheet));+ expect(+ (sheet.shape! as RoundedRectangleBorder).borderRadius,+ const BorderRadius.vertical(top: Radius.circular(12)),+ );+ final close = tester.getSize(key(closeKey));+ expect(close.height, greaterThanOrEqualTo(minTouchTarget));+ expect(close.width, greaterThanOrEqualTo(minTouchTarget));++ await tester.tap(key(closeKey));+ await tester.pumpAndSettle();++ expect(find.byType(BottomSheet), findsNothing);+ expect(find.text('CI on #2154 is green.'), findsOneWidget);+ expect(key('swarm-project-body-chat'), findsOneWidget);+ });+ }+testWidgets('the four tabs of direction B stay as they were', (tester,) async {@@ -789,6 +1119,7 @@ void main() {expect(key('swarm-project-tab-$name'), findsOneWidget, reason: name);}expect(key('swarm-project-tab-team'), findsNothing);+ expect(key('swarm-project-menu'), findsNothing);expect(tester.widget<Text>(key('swarm-title')).data, 'Mobile');expect(key('swarm-project-team'), findsOneWidget);});@@ -991,6 +1322,80 @@ void main() {expect(marksSent(fake).last, 40);});+ testWidgets('a message that comes under a sheet is not read until the '+ 'sheet closes, and the line and Jump to latest stay', (tester) async {+ final fake = chat([for (var i = 1; i <= 40; i++) said(i)], mark: 40);+ await pump(tester, fake, page);+ await tester.drag(key('swarm-messages'), const Offset(0, 1500));+ await tester.pumpAndSettle();+ expect(key('swarm-jump-latest'), findsOneWidget);+ await tester.tap(key('swarm-jump-latest'));+ await tester.pumpAndSettle();++ await tester.tap(key('swarm-project-menu'));+ await tester.pumpAndSettle();+ await tester.tap(key('swarm-project-menu-team'));+ await tester.pumpAndSettle();+ final sent = marksSent(fake).length;++ fake.routes['/api/super-tabs/$tab/conversations/$leadChat/messages'] =+ (_) => {+ 'messages': [for (var i = 1; i <= 41; i++) said(i)],+ 'next': null,+ };+ fake.routes['/api/super-tabs/$tab/changes'] = (_) => changes(+ cursor: 'c3',+ groups: [+ part(+ leadChat,+ 9,+ groupData(+ leadChat,+ title: 'Mobile',+ agentIds: ['agent-lead'],+ leadId: 'agent-lead',+ lastMessageSequence: 41,+ ),+ ),+ ],+ );+ await host(tester).session!.inbox.reader(tab)!.refresh();+ await tester.pumpAndSettle();+ await tester.pump(const Duration(seconds: 2));+ expect(marksSent(fake).length, sent, reason: 'under the sheet');++ await tester.tap(key('swarm-team-close'));+ await tester.pumpAndSettle();+ await tester.pump(const Duration(seconds: 2));+ expect(marksSent(fake).last, 41, reason: 'seen once it closed');++ await tester.drag(key('swarm-messages'), const Offset(0, 1500));+ await tester.pumpAndSettle();+ expect(key('swarm-jump-latest'), findsOneWidget);+ });++ testWidgets('the New messages line is still there after a sheet opened '+ 'and closed', (tester) async {+ await pump(+ tester,+ chat([for (var i = 1; i <= 4; i++) said(i)], mark: 2),+ page,+ );+ expect(line, findsOneWidget);++ await tester.tap(key('swarm-project-menu'));+ await tester.pumpAndSettle();+ await tester.tap(key('swarm-project-menu-leaderboard'));+ await tester.pumpAndSettle();+ await tester.tap(key('swarm-leaderboard-close'));+ await tester.pumpAndSettle();++ expect(line, findsOneWidget);+ final y = tester.getTopLeft(line).dy;+ expect(tester.getTopLeft(find.text('Update 2.')).dy, lessThan(y));+ expect(tester.getTopLeft(find.text('Update 3.')).dy, greaterThan(y));+ });+testWidgets('reading more than a screen back, Jump to latest takes the ''person to the foot; a little way back, none', (tester) async {await pump(@@ -1431,10 +1836,6 @@ void main() {.length,1,);- expect(- said(tester, 'swarm-team-tasks-caption'),- 'Tasks | 1 waiting on you · 1 working',- );});testWidgets('an agent of this project still holding work in another '@@ -1475,7 +1876,7 @@ void main() {findsOneWidget,reason: id,);- expect(key('swarm-project-tab-team'), findsNothing, reason: id);+ expect(key('swarm-project-menu'), findsNothing, reason: id);for (final words in ['Mobile','Desktop',@@ -1512,27 +1913,19 @@ void main() {],};};- await team(tester, fake);+ await leaderboard(tester, fake);expect(shown('Mallory'), findsNothing);+ expect(shown('Former member'), findsNothing);expect(shown('9999'), findsNothing);expect(shown('40 shipped'), findsNothing);- expect(- rowsAfter(- tester,- 'swarm-team-humans-caption',- 'swarm-team-agents-caption',- ),- [- 'swarm-member-person-person-me',- 'swarm-member-person-diego',- 'swarm-member-person-ken',- ],- );+ expect(onBoard(tester), ['person-me', 'diego', 'ken']);});- testWidgets('access taken away with the Team open: its tasks and agents '- 'go, and the Swarm read on its way brings none back', (tester) async {+ testWidgets('access taken away with the Team open: the sheet closes, its '+ 'tasks and agents go, and the Swarm read on its way brings none back', (+ tester,+ ) async {final fake = backend();await team(tester, fake);expect(find.byType(SwarmWaitingRow), findsOneWidget);@@ -1546,6 +1939,8 @@ void main() {gate.complete();await tester.pumpAndSettle();+ expect(find.byType(BottomSheet), findsNothing);+ expect(find.byType(SwarmProjectTeamSheet), findsNothing);expect(find.byType(SwarmWaitingRow), findsNothing);expect(find.byType(SwarmWorkRow), findsNothing);expect(find.byType(SwarmMemberRow), findsNothing);@@ -1565,8 +1960,201 @@ void main() {expect(fake.commands, isEmpty);});+ testWidgets('access taken away with the menu open: it closes, and its rows '+ 'open nothing', (tester) async {+ await pump(tester, backend(), page);+ await tester.tap(key('swarm-project-menu'));+ await tester.pumpAndSettle();+ expect(key('swarm-project-menu-team'), findsOneWidget);++ host(tester).session!.inbox.reader(tab)!.revoke();+ await tester.pumpAndSettle();++ expect(key('swarm-project-menu-team'), findsNothing);+ expect(key('swarm-project-menu-leaderboard'), findsNothing);+ expect(key('swarm-project-menu'), findsNothing);+ expect(find.byType(BottomSheet), findsNothing);+ });++ for (final (row, what) in [+ ('team', SwarmProjectTeamSheet),+ ('leaderboard', SwarmLeaderboardPage),+ ]) {+ testWidgets('access taken away between the tap on $row and its first '+ 'frame: it does not stay', (tester) async {+ await pump(tester, backend(), page);+ await tester.tap(key('swarm-project-menu'));+ await tester.pumpAndSettle();+ await tester.tap(key('swarm-project-menu-$row'));++ host(tester).session!.inbox.reader(tab)!.revoke();+ await tester.pumpAndSettle();++ expect(find.byType(what), findsNothing);+ expect(find.byType(BottomSheet), findsNothing);+ });++ testWidgets("the project taken off the Swarm with $row open, the Swarm "+ 'still read: it closes', (tester) async {+ final fake = backend();+ await fromMenu(tester, fake, 'swarm-project-menu-$row');+ expect(find.byType(what), findsOneWidget);+ final reader = host(tester).session!.inbox.reader(tab)!;++ fake.routes['/api/super-tabs/$tab/changes'] = (_) => {+ ...changes(cursor: 'c3'),+ 'head': part('head', 2, headData(projects: const [])),+ };+ await reader.refresh();+ await tester.pumpAndSettle();++ expect(reader.accessRevoked, isFalse);+ expect(find.byType(what), findsNothing);+ expect(find.byType(BottomSheet), findsNothing);+ });++ testWidgets('the account signing out with $row open: it closes', (+ tester,+ ) async {+ await fromMenu(tester, backend(), 'swarm-project-menu-$row');+ expect(find.byType(what), findsOneWidget);++ (host(tester).account as ValueNotifier<String?>).value = null;+ await tester.pumpAndSettle();++ expect(find.byType(what), findsNothing);+ expect(find.byType(BottomSheet), findsNothing);+ });++ testWidgets('leaving the page with $row open by a way that skips the '+ 'sheet: it closes with the page', (tester) async {+ final nav = GlobalKey<NavigatorState>();+ final fake = backend();+ final features = ExperimentalFeaturesStore(+ storage: MemoryKeyValueStore(),+ )..value = {PhoneExperiment.swarm};+ final account = ValueNotifier<String?>(me);+ final swarm = SwarmHost(+ accountId: () => account.value,+ account: account,+ request: fake.request,+ notices: SilentSystemNotices(),+ features: features,+ readMarks: MemoryKeyValueStore(),+ )..foreground = false;+ addTearDown(swarm.dispose);+ late Route<void> pageRoute;+ await tester.pumpWidget(+ MaterialApp(+ navigatorKey: nav,+ builder: (context, child) =>+ SwarmScope(notifier: swarm, child: child!),+ home: const SizedBox(),+ ),+ );+ pageRoute = MaterialPageRoute<void>(builder: (_) => page);+ unawaited(nav.currentState!.push(pageRoute));+ await tester.pumpAndSettle();+ await tester.tap(key('swarm-project-menu'));+ await tester.pumpAndSettle();+ await tester.tap(key('swarm-project-menu-$row'));+ await tester.pumpAndSettle();+ expect(find.byType(what), findsOneWidget);++ nav.currentState!.removeRoute(pageRoute);+ await tester.pumpAndSettle();++ expect(find.byType(SwarmProjectPage), findsNothing);+ expect(find.byType(what), findsNothing);+ expect(find.byType(BottomSheet), findsNothing);+ });+ }++ testWidgets('access taken away with a task opened over the Team: the sheet '+ 'under it closes, and back shows nothing of it', (tester) async {+ await team(tester, backend());+ await tester.tap(key('swarm-task-g1'));+ await tester.pumpAndSettle();+ expect(find.text('Header is in.'), findsOneWidget);++ host(tester).session!.inbox.reader(tab)!.revoke();+ await tester.pumpAndSettle();++ expect(find.text('Header is in.'), findsNothing);+ expect(+ find.byType(SwarmProjectTeamSheet, skipOffstage: false),+ findsNothing,+ );+ await tester.tap(key('tty-back').first);+ await tester.pumpAndSettle();+ expect(find.byType(BottomSheet), findsNothing);+ expect(+ find.text('This project is no longer in the Swarm.'),+ findsOneWidget,+ );+ });++ testWidgets('access taken away with the week picker up over the '+ 'Leaderboard: both close, and the pick is never read', (tester) async {+ final fake = backend();+ await leaderboard(tester, fake);+ await tester.tap(key('swarm-leaderboard-week'));+ await tester.pumpAndSettle();+ expect(key('swarm-leaderboard-week-1'), findsOneWidget);++ host(tester).session!.inbox.reader(tab)!.revoke();+ await tester.pumpAndSettle();++ expect(key('swarm-leaderboard-week-1'), findsNothing);+ expect(find.byType(BottomSheet), findsNothing);+ expect(fake.paths.where((p) => p.contains('&week=')), isEmpty);+ });++ testWidgets('a first read that fails shows no menu; the read that recovers '+ 'brings it, and it works', (tester) async {+ final fake = backend();+ final load = fake.routes['/api/super-tabs/$tab/parts']!;+ fake.routes['/api/super-tabs/$tab/parts'] = (_) =>+ throw const SuperTabFailure('INTERNAL', 'Swarm is down.');+ await pump(tester, fake, page);++ expect(find.text('Swarm is down.'), findsOneWidget);+ expect(key('swarm-project-menu'), findsNothing);+ expect(find.textContaining('Loading'), findsNothing);++ fake.routes['/api/super-tabs/$tab/parts'] = load;+ await tester.fling(+ find.text('Swarm is down.'),+ const Offset(0, 400),+ 1000,+ );+ await tester.pumpAndSettle();++ await tester.tap(key('swarm-project-menu'));+ await tester.pumpAndSettle();+ await tester.tap(key('swarm-project-menu-team'));+ await tester.pumpAndSettle();+ expect(find.byType(SwarmProjectTeamSheet), findsOneWidget);+ expect(key('swarm-task-g1'), findsOneWidget);+ });++ testWidgets('a Swarm read that fails with the Team open keeps what it '+ 'shows, and no Loading', (tester) async {+ final fake = backend();+ await team(tester, fake);++ fake.routes['/api/super-tabs/$tab/changes'] = (_) =>+ throw const SuperTabFailure('INTERNAL', 'Swarm is down.');+ await host(tester).session!.inbox.reader(tab)!.refresh();+ await tester.pumpAndSettle();++ expect(find.byType(SwarmProjectTeamSheet), findsOneWidget);+ expect(key('swarm-task-g1'), findsOneWidget);+ expect(find.textContaining('Loading'), findsNothing);+ });+/// [backend] whose Mobile is private to the person and Diego, on its- /// Team with Diego's week open.+ /// Leaderboard with Diego's week open.Future<FakeSwarm> diegoWeek(WidgetTester tester) async {final fake = backend();final load = fake.routes['/api/super-tabs/$tab/parts']!;@@ -1580,8 +2168,8 @@ void main() {];return read;};- await team(tester, fake);- await tester.tap(key('swarm-member-person-diego'));+ await leaderboard(tester, fake);+ await tester.tap(key('swarm-leaderboard-person-diego'));await tester.pumpAndSettle();expect(key('swarm-leaderboard-sheet'), findsOneWidget);expect(find.text('diego'), findsWidgets);@@ -1601,8 +2189,8 @@ void main() {testWidgets("access taken away between the tap on a person and the week's "'first frame: it does not stay', (tester) async {- await team(tester, backend());- await tester.tap(key('swarm-member-person-diego'));+ await leaderboard(tester, backend());+ await tester.tap(key('swarm-leaderboard-person-diego'));host(tester).session!.inbox.reader(tab)!.revoke();await tester.pumpAndSettle();diff --git a/mobile/test/swarm/swarm_task_rows_test.dart b/mobile/test/swarm/swarm_task_rows_test.dartindex 04f117036..6355de59d 100644--- a/mobile/test/swarm/swarm_task_rows_test.dart+++ b/mobile/test/swarm/swarm_task_rows_test.dart@@ -224,12 +224,14 @@ void main() {await tester.pumpAndSettle();}- /// [swarm]'s project Mobile, from Home, on its Team tab, its tasks on top- /// (Swarm Home C).+ /// [swarm]'s project Mobile, from Home, with its Team sheet open, its tasks+ /// on top (Swarm Home C).Future<void> openTasks(WidgetTester tester, {String swarm = tab}) async {await tester.tap(key('swarm-project-$swarm-$project'));await tester.pumpAndSettle();- await tester.tap(key('swarm-project-tab-team'));+ await tester.tap(key('swarm-project-menu'));+ await tester.pumpAndSettle();+ await tester.tap(key('swarm-project-menu-team'));await tester.pumpAndSettle();}@@ -398,6 +400,8 @@ void main() {);expect(find.textContaining('Orion'), findsNothing);+ await tester.tap(key('swarm-team-close'));+ await tester.pumpAndSettle();await tester.tap(key('tty-back'));await tester.pumpAndSettle();await openTasks(tester, swarm: other);