Files
magpie/internal/agent/antigravity_windows_app_test.go
T
yetone 6abea5f8e8 agent: Antigravity's app on Windows is found by its installer's registration (JJasonsun on Discord)
On Windows magpie's Agents page showed agy but not Antigravity's desktop
app, which macOS finds right after install. desktopApps["antigravity"]
knew only the macOS bundle, so on Windows the app was found only by
~/.gemini/antigravity/agyhub_summaries_proto.pb, which a fresh install
hasn't written (the Windows box's real 2.30.0 install has no
~/.gemini/antigravity at all).

Google's Antigravity-x64.exe (2.32.1, antigravity.google/download) is
electron-builder's per-user NSIS installer (app-64.7z, SpiderBanner,
package name antigravity). The real 2.30.0 install on xiaomi-gpu is
%LOCALAPPDATA%\Programs\antigravity\Antigravity.exe, registered under
HKCU\Software\121a0be4-63bd-531e-acf8-fc3924c7e984 (InstallLocation) and
its Uninstall entry (DisplayIcon ...\Antigravity.exe,0, DisplayVersion
2.30.0, no InstallLocation). The guid is the UUID v5 of
com.google.antigravity in electron-builder's namespace, as dsh's is. The
entry now has win and guid, so AppVersion reads the registered version
(the 2.15 gate still holds) and HasApp finds the default folder too.
Linux ships only a tarball to unpack anywhere, with no desktop entry of
its own, so Linux keeps the backend-file rule.

Run:
- Windows (xiaomi-gpu, real HKCU and 2.30.0 install, sandbox
  USERPROFILE/HOME/APPDATA/LOCALAPPDATA, PATH without agy): `magpie ls`
  from origin/main's desktopapp.go lists no Antigravity; from this tree
  it lists Antigravity.
- win-run go test -count=1 -timeout 45m ./internal/agent: every
  TestAntigravity* and the new test pass; 36 reds, 35 of them listed
  in #6068 (Windows CI only compiles tests), and
  TestEveryFieldLabelHasTUIZh (Hermes profile labels from outside the
  test home), filed as #6972. None touch desktop apps' detection.
- mote: go test -count=1 ./internal/agent ok; go vet ./...,
  GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... ok;
  gofmt -l clean.

Broken by hand: origin/main's desktopapp.go with the new test ->
TestAntigravityWindowsAppRegistered red ("guid \"\""; with that check
skipped, "AppVersion \"\"").

Not tried: the gateway wiring again on Windows in this change (031938ca9
ran 2.30.0's language server headless on this box and it resolved its
models from ~/.gemini/config/config.json's gateway); a chat turn from the
real GUI app; Linux; a full go test ./... (mote and mica are near full
disk and loaded).
2026-11-17 20:05:03 +08:00

76 lines
2.5 KiB
Go

package agent
import (
"os"
"path/filepath"
"testing"
)
// Antigravity's Windows app is found by what its installer registered, with
// none of ~/.gemini/antigravity a fresh install hasn't written (JJasonsun
// on Discord: agy found on Windows, the app not). The registry values are a
// real 2.30.0 install's on the Windows box: HKCU\Software\<guid>'s
// InstallLocation, and its Uninstall entry's DisplayIcon and DisplayVersion
// with no InstallLocation.
func TestAntigravityWindowsAppRegistered(t *testing.T) {
home := antigravityHome(t)
app := desktopApps["antigravity"]
const guid = "121a0be4-63bd-531e-acf8-fc3924c7e984"
if app.guid != guid {
t.Fatalf("guid %q", app.guid)
}
programs := filepath.Join(t.TempDir(), "Programs")
at := filepath.Join(programs, "antigravity")
if err := os.MkdirAll(at, 0o755); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(filepath.Join(at, "Antigravity.exe"), []byte("MZ"), 0o755); err != nil {
t.Fatal(err)
}
version := "1.11.3"
real := func(hive, key, name string) string {
if hive != "HKCU" {
return ""
}
switch key + "|" + name {
case `Software\` + guid + "|InstallLocation":
return at
case `Software\Microsoft\Windows\CurrentVersion\Uninstall\` + guid + "|DisplayIcon":
return filepath.Join(at, "Antigravity.exe") + ",0"
case `Software\Microsoft\Windows\CurrentVersion\Uninstall\` + guid + "|DisplayVersion":
return version
}
return ""
}
wasReg, wasFolders := windowsRegisteredApp, appFolders
t.Cleanup(func() { windowsRegisteredApp, appFolders = wasReg, wasFolders })
windowsRegisteredApp = func(g string) (string, string) { return registeredIn(g, real) }
appFolders = func() []string { return nil }
// one before 2.15, which takes no gateway, isn't it
if antigravity(home).Detected() {
t.Fatal("an app before 2.15 taken for it")
}
version = "2.30.0"
a := antigravity(home)
if v := (&Agent{ID: "antigravity"}).AppVersion(); v != "2.30.0" {
t.Fatalf("AppVersion %q", v)
}
if !a.Detected() {
t.Fatal("the registered app isn't detected")
}
if err := a.Field("model").Set("magpie/anth/claude-sonnet-5"); err != nil {
t.Fatal(err)
}
if f := newAgyFile(filepath.Join(home, ".gemini", "config", "config.json")); !f.wired() {
t.Fatalf("config.json not on magpie:\n%s", readFile(f.path))
}
// the installer's default folder, where no registry says
windowsRegisteredApp = func(string) (string, string) { return "", "" }
appFolders = func() []string { return []string{programs} }
if !(&Agent{ID: "antigravity"}).HasApp() {
t.Fatal("not found under %LOCALAPPDATA%\\Programs")
}
}