feat(ground-suite): redesign observability console

This commit is contained in:
Onur Özkan committed 2026-08-10 16:46:36 +03:00
1 parent c67d553076
commit 153b0bf262
12 files changed
+1145 -507

No files matched your search

@@ -93,10 +93,72 @@ void main() {
expect(state.parserDropCount, 0);
expect(state.semanticDropCount, 0);
});
test(
'bounds diagnostics while telemetry stays outside the timeline',
() async {
final port = _ControlledDataPort();
final container = ProviderContainer(
overrides: [vehicleDataPortProvider.overrideWithValue(port)],
);
addTearDown(container.dispose);
container.read(observabilityControllerProvider);
await Future<void>.delayed(Duration.zero);
port.events.add(
ObservationReceived(
ErrorEvent(
receivedAt: DateTime.utc(2026, 8, 10),
path: 'kaptan_drivers::lidar_lite_v3::error::Error::TransferFault',
),
),
);
port.events.add(
ObservationReceived(
HeartbeatEvent(
receivedAt: DateTime.utc(2026, 8, 10, 0, 0, 1),
systemId: 7,
componentId: 42,
armed: false,
vehicleState: 'Standby',
),
),
);
for (var index = 0; index < 501; index++) {
port.events.add(
ObservationReceived(
TelemetryEvent(
receivedAt: DateTime.utc(2026, 8, 10, 0, 0, index % 60),
kind: TelemetryKind.rawImu,
),
),
);
}
for (var index = 0; index < 500; index++) {
port.events.add(
ObservationReceived(
LogEvent(
receivedAt: DateTime.utc(2026, 8, 10, 0, 1, index % 60),
level: MavSeverity.info,
message: 'Diagnostic $index',
),
),
);
}
final state = container.read(observabilityControllerProvider);
expect(state.events, hasLength(500));
expect(state.localTimelineEvictionCount, 1);
expect(state.events.whereType<ErrorEvent>(), hasLength(1));
expect(state.lastHeartbeat?.systemId, 7);
expect(state.observedTelemetryKinds, contains(TelemetryKind.rawImu));
},
);
}
class _ControlledDataPort implements VehicleDataPort {
final events = StreamController<VehicleDataUpdate>();
final events = StreamController<VehicleDataUpdate>(sync: true);
@override
bool get isReplay => false;
+29 -11
View File
@@ -3,7 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:ground_suite/app/app.dart';
import 'package:ground_suite/app/app_shell.dart';
import 'package:ground_suite/shared/widgets/glass_panel.dart';
import 'package:ground_suite/shared/widgets/surfaces.dart';
void main() {
testWidgets('replay workspace keeps diagnostics distinct and read-only', (
@@ -16,12 +16,12 @@ void main() {
expect(app.themeMode, ThemeMode.system);
expect(app.theme?.brightness, Brightness.light);
expect(app.darkTheme?.brightness, Brightness.dark);
expect(find.byType(GlassPanel), findsAtLeastNWidgets(1));
expect(find.text('Observation only'), findsOneWidget);
expect(find.byType(FrostedChrome), findsAtLeastNWidgets(1));
expect(find.text('OBSERVATION ONLY'), findsOneWidget);
expect(find.text('Replay fixture'), findsAtLeastNWidgets(1));
expect(find.text('Vehicle identity'), findsOneWidget);
expect(find.text('LAST REPORTED HEARTBEAT'), findsOneWidget);
await tester.tap(find.byTooltip('Choose theme'));
await tester.tap(find.byTooltip('Appearance: System default'));
await tester.pumpAndSettle();
await tester.tap(find.text('Dark'));
await tester.pumpAndSettle();
@@ -31,21 +31,21 @@ void main() {
ThemeMode.dark,
);
await tester.tap(find.byIcon(Icons.receipt_long_outlined));
await tester.tap(find.byIcon(Icons.segment_outlined));
await tester.pumpAndSettle();
expect(find.text('Diagnostics'), findsAtLeastNWidgets(1));
await tester.tap(find.text('Errors'));
expect(find.text('Event timeline'), findsOneWidget);
await tester.tap(find.text('Errors 1'));
await tester.pumpAndSettle();
expect(
find.text('kaptan_drivers::lidar_lite_v3::error::Error::TransferFault'),
findsOneWidget,
);
await tester.tap(find.text('Shutdowns'));
await tester.tap(find.text('Shutdown reports 1'));
await tester.pumpAndSettle();
expect(find.text('Orderly shutdown observed'), findsOneWidget);
expect(find.text('Orderly shutdown report'), findsOneWidget);
});
testWidgets(
@@ -57,7 +57,7 @@ void main() {
await tester.pumpWidget(const ProviderScope(child: GroundSuiteApp()));
await tester.pumpAndSettle();
expect(find.byType(NavigationBar), findsOneWidget);
expect(find.byKey(const Key('compact-navigation')), findsOneWidget);
expect(tester.takeException(), isNull);
},
);
@@ -75,4 +75,22 @@ void main() {
final context = tester.element(find.byType(AppShell));
expect(Theme.of(context).brightness, Brightness.dark);
});
testWidgets('large desktop text uses the compact session strip', (
tester,
) async {
await tester.binding.setSurfaceSize(const Size(1280, 900));
tester.binding.platformDispatcher.textScaleFactorTestValue = 2;
addTearDown(() {
tester.binding.setSurfaceSize(null);
tester.binding.platformDispatcher.clearTextScaleFactorTestValue();
});
await tester.pumpWidget(const ProviderScope(child: GroundSuiteApp()));
await tester.pumpAndSettle();
expect(find.text('OBSERVATION ONLY'), findsOneWidget);
expect(find.text('Replay ended 12:00:06Z'), findsNothing);
expect(tester.takeException(), isNull);
});
}