Skip to content

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.

desktop tests: a signed-out daemon and window are a guest now, not a wall

dee7fb521679676
diff --git a/desktop/test/environment_recheck_timer_test.dart b/desktop/test/environment_recheck_timer_test.dart
index 64b634a1e..41da32bdb 100644
--- a/desktop/test/environment_recheck_timer_test.dart
+++ b/desktop/test/environment_recheck_timer_test.dart
@@ -7,6 +7,23 @@ import 'package:harness/core/local_key_value_store.dart';
import 'package:harness/settings/config_store.dart';
import 'package:harness/state/app_state.dart';
+/// Past setup a signed-out desktop boots home as a guest; this one never reaches for a real daemon.
+class _GuestApp extends AppNotifier {
+ _GuestApp({
+ required super.config,
+ required super.authSession,
+ super.configStore,
+ super.cliLogin,
+ super.environmentProvisioner,
+ });
+
+ @override
+ Future<void> ensureCliDaemonReady() async {}
+
+ @override
+ Future<void> refreshMachines() async {}
+}
+
class _FakeCliLogin extends CliLogin {
@override
Future<CliAuthStatus> checkStatus() async =>
@@ -79,7 +96,7 @@ void main() {
mode: EnvironmentSetupMode.automatic,
);
final provisioner = _ScriptedProvisioner([review, waiting, ready]);
- final app = AppNotifier(
+ final app = _GuestApp(
config: AppConfig.dev,
authSession: AuthSession(),
configStore: ConfigStore(storage: _FakeKeyValueStore()),
@@ -99,7 +116,8 @@ void main() {
expect(provisioner.installCalls, [false, true, false]);
expect(app.environmentReadiness.isReady, isTrue);
expect(app.environmentRecheckPending, isFalse);
- expect(app.status, AppStatus.unauthenticated);
+ expect(app.status, AppStatus.authenticated);
+ expect(app.isGuest, isTrue, reason: 'signed out, a desktop opens on this computer as a guest');
app.dispose();
});
}
diff --git a/desktop/test/environment_setup_screen_test.dart b/desktop/test/environment_setup_screen_test.dart
index fb2494bfd..d55898bb6 100644
--- a/desktop/test/environment_setup_screen_test.dart
+++ b/desktop/test/environment_setup_screen_test.dart
@@ -28,6 +28,24 @@ class _Login extends CliLogin {
const CliAuthStatus(loggedIn: false);
}
+/// A desktop that never reaches for a real daemon: past setup, a signed-out window boots onto home
+/// as a guest (the sign-in is a sheet raised later), the way boot_flow_widget_test's fixture does.
+class _GuestApp extends AppNotifier {
+ _GuestApp({
+ required super.config,
+ required super.authSession,
+ super.configStore,
+ super.cliLogin,
+ super.environmentProvisioner,
+ });
+
+ @override
+ Future<void> ensureCliDaemonReady() async {}
+
+ @override
+ Future<void> refreshMachines() async {}
+}
+
class _Attempt {
_Attempt(this.install, this.progress);
final bool install;
@@ -84,8 +102,8 @@ Future<void> _mount(
),
home: ListenableBuilder(
listenable: app,
- builder: (_, _) => app.status == AppStatus.unauthenticated
- ? const Scaffold(body: Text('Sign-in reached'))
+ builder: (_, _) => app.status == AppStatus.authenticated
+ ? const Scaffold(body: Text('Home reached'))
: EnvironmentSetupScreen(notifier: app),
),
),
@@ -94,7 +112,7 @@ Future<void> _mount(
}
AppNotifier _app(_Provisioner provisioner) =>
- AppNotifier(
+ _GuestApp(
config: AppConfig.dev,
authSession: AuthSession(),
configStore: null,
@@ -226,7 +244,7 @@ void main() {
});
}
- testWidgets('Enter installs and retries once before reaching sign-in', (
+ testWidgets('Enter installs and retries once, then a signed-out desktop opens as a guest', (
tester,
) async {
final provisioner = _Provisioner();
@@ -266,7 +284,8 @@ void main() {
);
await tester.pump();
await tester.pump();
- expect(find.text('Sign-in reached'), findsOneWidget);
+ expect(find.text('Home reached'), findsOneWidget);
+ expect(app.isGuest, isTrue);
expect(provisioner.attempts.map((attempt) => attempt.install), [
true,
true,
diff --git a/desktop/test/local_cli_discovery_test.dart b/desktop/test/local_cli_discovery_test.dart
index 44ef43b6d..92e1b5bb8 100644
--- a/desktop/test/local_cli_discovery_test.dart
+++ b/desktop/test/local_cli_discovery_test.dart
@@ -692,7 +692,7 @@ void main() {
// machine) exits, and the supervisor respawned it forever — every replacement starting without a
// session and exiting again, silently, for the app's whole lifetime.
test(
- 'startSupervising stops respawning once the CLI reports it is signed out',
+ 'startSupervising brings back a signed-out daemon, which now runs as a guest, and says so',
() async {
const computerId = '0123456789abcdef0123456789abcdef';
final identityFile = File('${scratch.path}/computer-id')
@@ -727,13 +727,16 @@ void main() {
await Future.delayed(const Duration(milliseconds: 300));
+ // A signed-out daemon used to exit and refuse to start again, so respawning it looped forever.
+ // It now starts without an account and serves this computer, so it is brought back like any
+ // other, and the caller hears of the sign-out (AppNotifier acts only while still signed in).
expect(
spawnCount,
- 0,
- reason: 'a signed-out daemon must never be respawned',
+ greaterThan(0),
+ reason: 'a signed-out daemon starts as a guest now',
);
- expect(signedOutCalls, 1, reason: 'the caller is told exactly once');
- expect(timer.isActive, isFalse, reason: 'supervision stops for good');
+ expect(signedOutCalls, greaterThanOrEqualTo(1), reason: 'the caller is told');
+ expect(timer.isActive, isTrue, reason: 'supervision goes on');
},
);