Jevik_AI on X uninstalled magpie and rebooted, and Codex's config.toml still had openai_base_url = "http://127.0.0.1:3425/backend-api/codex"; Rk1ngggg asked whether an update cleans it. magpie's own uninstall (Settings › About › Uninstall magpie, `magpie uninstall`) already disconnects every agent and takes Codex's leftovers (#3866), but on Windows magpie wasn't in Settings › Apps › Installed apps, so it was removed the way Windows offers for a program it doesn't list: by deleting the exe and folders, which runs no code. shortcut.Ensure now writes HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\magpie (DisplayName, DisplayIcon, Publisher, InstallLocation, UninstallString, URLInfoAbout, NoModify, NoRepair) at every installed start, beside App Paths, and Remove (uninstall's System step) takes it out the same way: only while it names this exe, or an exe that is gone. Its Uninstall runs `magpie.exe uninstall --window` (shortcut.UninstallArgs). magpie.exe has no console, where the terminal's `magpie uninstall` would refuse for want of one to ask on, so those exact args open the app's window (or forward to the running app, OnSecondInstanceLaunch) on Settings › About with Uninstall magpie's question asked (uninstallView, ?uninstall=1). It asks once: a redraw of Settings doesn't ask again, and Cancel removes nothing. magpie web opened at that link asks nothing. Deleting the app by hand still runs no code (macOS drag-to-Trash included); agent-wiring.md says so. Run on mote at the pushed head (rebased ontobe9dbce02): - gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: ok. go build, GOOS=linux go build -tags nogui, GOOS=windows go build: ok. - go test -tags nogui ./internal/gui ./internal/cli ./internal/shortcut ./internal/uninstall: ok (TestCoreScriptBudget included). - uninstall-settings.test.cjs and i18n-keys.test.cjs: 40 of 40 (chromium and webkit; the new Installed-apps cases in en and zh at 1100 and 420). At d3f40bedd, the same change onc7ebb6f8d, under suite.lock: - go test -tags nogui -timeout 45m ./...: ok, every package. - The whole GUI suite (--test-concurrency=4): 22518 of 22800; the 282 reds are in 53 files the change doesn't reach (model-chip-steady 40, usage-agents-hide 22, zero-priced-free 20, provider-fetch-again 14, ...), the full-suite reds of #5475; the numbers are on that issue. Their run atc7ebb6f8dalone is queued behind other sessions' suites. - The first full run found the core scripts 147 bytes over TestCoreScriptBudget; the page's part was cut to one line (the budget is not raised). On xiaomi-gpu (win-run): go test ./internal/shortcut, incl. TestInstalledAppsEntry on the real HKCU registry under a test key: ok. Broken by hand, each red: - registerAppPath not calling registerUninstall: TestInstalledAppsEntry (UninstallString = "") on Windows. - main.go not taking UninstallArgs to the window: TestInstalledAppsUninstallOpensTheWindow (unknown "--window"). - app.js not asking on ?uninstall=1: 4 of 4 Installed-apps GUI cases. - app.js asking without its once guard (params.delete): the same 4 ("asked again"). Not tried: a real Settings › Apps › Uninstall click on Windows with an installed magpie (the test box's install belongs to other sessions); the second-instance forward (OnSecondInstanceLaunch) has no test of its own.
37 lines
1.2 KiB
Go
37 lines
1.2 KiB
Go
//go:build !nogui
|
||
|
||
package cli
|
||
|
||
import (
|
||
"testing"
|
||
|
||
"github.com/yetone/magpie/internal/applog"
|
||
"github.com/yetone/magpie/internal/gui"
|
||
"github.com/yetone/magpie/internal/shortcut"
|
||
)
|
||
|
||
// Windows' Installed apps runs magpie's Uninstall with no console
|
||
// (shortcut.UninstallArgs): the terminal's `magpie uninstall` would refuse
|
||
// for want of one to ask on, so it opens the app's window at Settings ›
|
||
// Uninstall magpie, which asks, and puts every agent back before magpie's
|
||
// files go. Nothing is removed by the command itself.
|
||
func TestInstalledAppsUninstallOpensTheWindow(t *testing.T) {
|
||
was, wasRun := openApp, runUninstall
|
||
t.Cleanup(func() { openApp, runUninstall = was, wasRun; gui.OpenUninstall = false; applog.Stop() })
|
||
var shown []bool
|
||
openApp = func(show bool, link string) error {
|
||
if link != "" {
|
||
t.Errorf("opened on a link %q", link)
|
||
}
|
||
shown = append(shown, show && gui.OpenUninstall)
|
||
return nil
|
||
}
|
||
runUninstall = nil // called, it panics: the window asks, not this
|
||
if err := run(shortcut.UninstallArgs); err != nil {
|
||
t.Fatal(err)
|
||
}
|
||
if len(shown) != 1 || !shown[0] {
|
||
t.Fatalf("the app's window wasn't opened on Uninstall magpie: %v", shown)
|
||
}
|
||
}
|