Clarify empty server states

Show calm, actionable empty states for pipelines, runs, and chats while keeping filtered and failed loads distinct. Add focused widget coverage and document the remaining verification limits.
This commit is contained in:
2026-11-12 01:02:31 +00:00
parent 4f1b45571f
commit dbd525a7b1
11 changed files with 201 additions and 17 deletions
@@ -84,7 +84,7 @@ class ChatSessionsBody extends StatelessWidget {
emptyMessageOverride ??
(sessions.isEmpty
? error == null
? 'No chat sessions on this server yet.'
? 'No chats yet. Use New chat to start one.'
: null
: 'No chats match "${query.trim()}".');
@@ -77,11 +77,13 @@ class PipelineFilters {
);
}
/// The empty-state sentence for the list plus its optional reset action.
/// The empty-state sentence for the list, an optional line naming the next
/// step, and an optional reset action.
class PipelineEmptyState {
const PipelineEmptyState(this.message, {this.clearAction});
const PipelineEmptyState(this.message, {this.detail, this.clearAction});
final String message;
final String? detail;
final String? clearAction;
}
@@ -153,7 +155,10 @@ PipelineEmptyState? pipelineListEmptyState(
) {
if (items.isNotEmpty) return null;
if (all.isEmpty) {
return const PipelineEmptyState('No pipelines are defined on this server.');
return const PipelineEmptyState(
'No pipelines yet.',
detail: 'Create one from a template in Templates.',
);
}
final name = filters.name;
final onlyName =
@@ -192,6 +192,15 @@ class PipelineListPanel extends StatelessWidget {
textAlign: TextAlign.center,
style: _mutedStyle(context),
),
if (empty.detail != null)
Padding(
padding: const EdgeInsets.only(top: 4),
child: Text(
empty.detail!,
textAlign: TextAlign.center,
style: _mutedStyle(context),
),
),
if (empty.clearAction != null)
PipelineTextButton(
label: empty.clearAction!,
+20 -6
View File
@@ -163,18 +163,32 @@ class RunsList extends StatelessWidget {
// Filtered and sorted once per build: the getter recomputes every read.
final visible = controller.visibleRuns;
if (visible.isNotEmpty) return _groupedRuns(context, header, visible);
// A server with no runs at all is not a filter problem: say what the list
// is for and where its first run comes from. A free-text query counts as
// a filter too, so a search on an empty server reads as "nothing found".
final noRunsAtAll = controller.runs.isEmpty &&
controller.activeFilterCount == 0 &&
controller.query.trim().isEmpty;
return BelowTopBar(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
...header,
Expanded(
child: _state(
context,
icon: const Icon(Icons.inbox_outlined),
title: 'No runs found.',
subtitle: 'Try changing or clearing the filters.',
),
child: noRunsAtAll
? _state(
context,
icon: const Icon(Icons.inbox_outlined),
title: 'No runs yet.',
subtitle:
'Start one from Pipelines and its runs appear here.',
)
: _state(
context,
icon: const Icon(Icons.inbox_outlined),
title: 'No runs found.',
subtitle: 'Try changing or clearing the filters.',
),
),
],
),
+61
View File
@@ -0,0 +1,61 @@
# Empty-server states (Pipelines, Runs, Chat)
On a brand-new server (no pipelines, runs or chats) the healthy empty reply
should read as "nothing here yet" with the next step, not as a filter problem
or a missing list. Real failures keep their error treatment and never show the
empty copy.
## Changed states
| Destination | Before (empty, healthy server) | After |
| --- | --- | --- |
| Pipelines list | "No pipelines are defined on this server." | "No pipelines yet." + "Create one from a template in Templates." |
| Runs list | "No runs found." + "Try changing or clearing the filters." | "No runs yet." + "Start one from Pipelines and its runs appear here." |
| Runs list, filter hides every run | (same as above) | unchanged: "No runs found." + filter hint |
| Chat list | "No chat sessions on this server yet." | "No chats yet. Use New chat to start one." |
Source: `lib/features/pipelines/pipeline_filter.dart`,
`lib/features/pipelines/widgets/pipeline_list_panel.dart` (renders the new
`PipelineEmptyState.detail` line), `lib/features/runs/ui/runs_list.dart`,
`lib/features/chat/ui/sessions/chat_sessions_body.dart`.
Unchanged error paths: a failed Pipelines list shows its error banner with
Retry; a failed Runs list shows the error with Retry; a failed chat load hides
the empty message and shows the reason.
## Focused results
Command (from `app/`): `tool/memwatch/full.sh 'test/features/pipelines/pipelines_empty_server_test.dart test/features/pipelines/pipeline_filter_test.dart test/features/pipelines/pipelines_screen_filter_test.dart test/features/runs/ui/runs_list_widget_test.dart test/features/chat/ui/sessions/chat_sessions_screen_test.dart test/features/chat/ui/sessions/chat_ios_material_test.dart'`
- Before the source change (new and updated expectations): 18 passed, 6 failed,
as expected on the old copy. The new test file also failed to compile
(missing `Key` import), fixed before the rerun.
- After the change: PASS, 25 passed, 0 failed, peak 1484 MB, 5s.
- Review fix (runs must-fix): the no-runs state now also requires an empty
free-text query, so an empty server with a search query shows "No runs
found." with the filter hint. Covered by a new widget test in
`runs_list_widget_test.dart`. Focused rerun of that file: PASS, 6 passed,
0 failed, peak 768 MB, 4s.
- `tool/analyze.sh`: clean (rerun after the review fix).
New or extended coverage:
- `test/features/pipelines/pipelines_empty_server_test.dart`: empty server shows
the no-pipelines state and next step, with no spinner, list or Retry; a failed
list still shows the error and not the empty copy.
- `test/features/runs/ui/runs_list_widget_test.dart`: loading, error, and
server-empty states stay distinct; a status filter that hides every run keeps
the "No runs found." filter state.
- Chat and pipeline-filter expectations updated to the new copy.
## Not verified here
- No UI build or capture; `ui-review` owns rendered evidence.
- Schedules, Search, Settings, Usage/stats, Needs-you and Templates were read,
not changed or tested. Their empty copy is already calm, except that
"No schedules yet." has no next step because the list has no add action.
Stats says "No runs loaded." (secondary text, not an error).
- Runs and other error text still shows the raw error string (`'$e'`); this is
not an empty-server path and was not changed.
- Server gap: this stage did not check Go's empty-database replies. The client
treats an empty list as healthy. No Go change was made.
@@ -17,7 +17,7 @@ void main() {
expect(find.byType(Scaffold), findsWidgets);
const message = 'No chat sessions on this server yet.';
const message = 'No chats yet. Use New chat to start one.';
expect(find.text(message), findsOneWidget);
expectNormalTextStyle(tester, message);
});
@@ -39,7 +39,7 @@ void main() {
'for this operator';
expect(find.text(message), findsOneWidget);
expectNormalTextStyle(tester, message);
expect(find.text('No chat sessions on this server yet.'), findsNothing);
expect(find.text('No chats yet. Use New chat to start one.'), findsNothing);
expect(
find.ancestor(
of: find.text('Retry'),
@@ -91,7 +91,10 @@ void main() {
) async {
final gateway = FakeChatGateway();
await pumpMaterialChat(tester, gateway);
expect(find.text('No chat sessions on this server yet.'), findsOneWidget);
expect(
find.text('No chats yet. Use New chat to start one.'),
findsOneWidget,
);
expect(find.textContaining('No chats match'), findsNothing);
});
@@ -111,7 +114,7 @@ void main() {
'Bad state: server unavailable while listing chat sessions '
'for this operator';
expect(find.text(message), findsOneWidget);
expect(find.text('No chat sessions on this server yet.'), findsNothing);
expect(find.text('No chats yet. Use New chat to start one.'), findsNothing);
final messageBox = tester.renderObject<RenderBox>(find.text(message));
expect(
messageBox.size.height,
@@ -132,7 +132,7 @@ void main() {
const [],
const PipelineFilters(),
)?.message,
'No pipelines are defined on this server.',
'No pipelines yet.',
);
expect(pipelineListEmptyState(all, all, const PipelineFilters()), isNull);
});
@@ -0,0 +1,50 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'fixtures.dart';
import 'test_helpers.dart';
/// A brand-new server: every list is empty and healthy.
FakeGateway emptyServerGateway() => FakeGateway(
(type, fields) => switch (type) {
'list_pipelines' => pipelineListReply(const []),
'list_runs' => runListReply(const []),
'list_schedules' => {'type': 'schedules', 'schedules': <dynamic>[]},
_ => errorReply('unexpected $type'),
},
);
void main() {
testWidgets(
'an empty server shows a calm no-pipelines state with the next step',
(tester) async {
await pumpWide(tester, emptyServerGateway());
expect(find.text('No pipelines yet.'), findsOneWidget);
expect(
find.text('Create one from a template in Templates.'),
findsOneWidget,
);
expect(find.text('Loading pipelines…'), findsNothing);
expect(find.byKey(const Key('pipeline-list')), findsNothing);
expect(find.textContaining('not defined'), findsNothing);
expect(find.text('Retry'), findsNothing);
expect(tester.takeException(), isNull);
},
);
testWidgets(
'a failed list stays an error and never reads as an empty server',
(tester) async {
await pumpWide(
tester,
gatewayFor(PipelineFixture(), listFails: true, summaries: const []),
);
expect(find.textContaining('server offline'), findsOneWidget);
expect(find.text('No pipelines yet.'), findsNothing);
expect(find.text('Loading pipelines…'), findsNothing);
expect(tester.takeException(), isNull);
},
);
}
@@ -98,8 +98,9 @@ void main() {
MaterialApp(home: PipelinesScreen(gateway: emptyGateway)),
);
await tester.pumpAndSettle();
expect(find.text('No pipelines yet.'), findsOneWidget);
expect(
find.text('No pipelines are defined on this server.'),
find.text('Create one from a template in Templates.'),
findsOneWidget,
);
});
@@ -162,9 +162,50 @@ void main() {
gateway.reply = {'runs': []};
await controller.load();
await tester.pumpAndSettle();
expect(find.text('No runs found.'), findsOneWidget);
expect(find.text('No runs yet.'), findsOneWidget);
expect(find.textContaining('Start one from Pipelines'), findsOneWidget);
expect(find.text('No runs found.'), findsNothing);
expect(find.textContaining('offline'), findsNothing);
expect(tester.takeException(), isNull);
// A filter that hides every run is a different state: say so and offer
// the filter as the way back, not a server with no runs.
controller.setStatus('failed');
await tester.pumpAndSettle();
expect(find.text('No runs found.'), findsOneWidget);
expect(find.text('No runs yet.'), findsNothing);
expect(
find.text('Try changing or clearing the filters.'),
findsOneWidget,
);
expect(tester.takeException(), isNull);
},
variant: TargetPlatformVariant.only(TargetPlatform.android),
);
testWidgets(
'an empty server with a search query reads as no match, not no runs',
(tester) async {
gateway.failure = null;
gateway.gate = null;
gateway.reply = {'runs': []};
await controller.load();
controller.setQuery('deploy');
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: RunsList(controller: controller, onSelected: (_) {}),
),
),
);
await tester.pumpAndSettle();
expect(find.text('No runs found.'), findsOneWidget);
expect(find.text('No runs yet.'), findsNothing);
expect(
find.text('Try changing or clearing the filters.'),
findsOneWidget,
);
expect(tester.takeException(), isNull);
},
variant: TargetPlatformVariant.only(TargetPlatform.android),
);