From f63ab521f1c9aa4b8e08d87f102a82ea6576133c Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Sat, 6 Jun 2026 12:59:48 +0200 Subject: [PATCH] cover the cli-install env fallback and stale-GUI activation paths Adds the two missing cases that left lib/kernel/src/cli_install.dart:74 (default-environment constructor branch) and the builtin extension's stale-GUI activation warning uncovered. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../cli_install/cli_install_extension_test.dart | 16 ++++++++++++++++ test/kernel/cli_install_test.dart | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/test/builtin/cli_install/cli_install_extension_test.dart b/test/builtin/cli_install/cli_install_extension_test.dart index 9eb2b74b..ea2e26ed 100644 --- a/test/builtin/cli_install/cli_install_extension_test.dart +++ b/test/builtin/cli_install/cli_install_extension_test.dart @@ -69,6 +69,22 @@ void main() { expect(notes.first.title, 'clide CLI not installed'); }); + test('warns on activation when clide is a stale GUI symlink', () async { + final gui = touchExec('${tmp.path}/gui/clide').path; + final binDir = Directory('${tmp.path}/bin')..createSync(); + Link('${binDir.path}/clide').createSync(gui); // PATH clide → the GUI + await boot(CliInstaller( + resolvedExecutable: gui, + env: {'PATH': binDir.path}, + bundledClientCandidates: const [], + installDir: binDir.path, + )); + final notes = f.services.notify.active; + expect(notes, isNotEmpty); + expect(notes.first.level, NotificationLevel.warning); + expect(notes.first.title, 'clide CLI is stale'); + }); + test('does not warn when clide is already installed', () async { final binDir = Directory('${tmp.path}/bin')..createSync(); touchExec('${binDir.path}/clide'); diff --git a/test/kernel/cli_install_test.dart b/test/kernel/cli_install_test.dart index 2f85107a..455490f2 100644 --- a/test/kernel/cli_install_test.dart +++ b/test/kernel/cli_install_test.dart @@ -128,6 +128,14 @@ void main() { ); expect(i.bundledClientCandidates, ['/opt/clide/bundle/clide-cli']); }); + + test('falls back to the process environment when no env is passed', () { + // No env → uses Platform.environment; the in-bundle candidate still + // derives from the exe dir and the install dir from $HOME. + final i = CliInstaller(resolvedExecutable: '/opt/clide/bundle/clide'); + expect(i.bundledClientCandidates, contains('/opt/clide/bundle/clide-cli')); + expect(i.installDir, endsWith('/.local/bin')); + }); }); group('expandedPath', () {