Files
magpie/internal/provider/migrate_withdrawn_test.go
T
yetone 256910f174 plugin: Antigravity's plugin keeps serving whoever has it, and is given to nobody new
The owner (11-15): "正在使用的继续正常,加个提示,新用户不让下载". Google
suspends accounts it sees on Code Assist through Antigravity's own client,
so 9cd5f3652 retired the plugin outright (0.2.0 answered every request with
a 410). Now its users keep it working and are told the risk; nobody new
gets it.

- internal/plugin/withdrawn.go: a list of withdrawn packages (Antigravity's,
  pointing to agy-cli). plugin.Add, the one place the CLI, the GUI,
  Discover and import links install through, turns a withdrawn package
  away unless this magpie has it listed already (on or off), and says
  what to use instead. Upgrade and AddExact (backup, sync) are not gated:
  they act on a plugin the user has.
- The mover installs it for the user's own accounts (move,
  keepMovedCurrent) under plugin.KeepWithdrawn; Adopt, which brings no
  accounts, is a new user and is turned away. Antigravity's min is 0.2.1,
  plugins c0c625ac: the 0.1.18 plugin restored, out of the registry.
- /api/providers lists the withdrawn plugins kept in `withdrawn`, and the
  Providers page draws a line over the list: the risk, why, and "Use
  Antigravity (local agy CLI)", which opens Plugins on "agy". New strings
  in zh, zh-TW, ja and de. depLine() now draws all three kinds of
  Providers line (discovery off, unmoved, this one), which keeps app.js
  inside its budget without a raise.
- AGENTS.md, provider-plugins.md and the site's subscriptions docs (en,
  zh, ja, search index) say the plugin keeps working for its users and
  is withdrawn for anyone new.

Run on mote at this tree (base 52e83f7b5). After the rebase onto
500f39886 (testenv, qianfan, LESSONS upstream), again at this head: go vet
and go test -count=1 of internal/plugin, internal/provider, internal/gui,
internal/testenv and the root package, all ok. Before it:
- go vet, GOOS=linux go vet -tags nogui and GOOS=windows go vet of
  internal/plugin, internal/provider and internal/gui: ok. gofmt -l clean.
- go test -count=1 ./internal/plugin ./internal/provider ./internal/gui
  (whole packages, TestCoreScriptBudget and the i18n guards in them): ok.
- node --test providers-withdrawn (new; chromium and webkit, en zh
  zh-TW ja de, 1100 and 420), deprecation-notice, plugin-move,
  plugin-move-overflow, retired-move, deprecated-subscriptions, i18n-keys,
  providers-discovery-off, plugin-movable-review, providers-off-fold: ok.
  plugin-move-unserved's 'Try again takes the models unticked' is red 4 of
  4, the same at origin/main 500f39886 alone: #4410.
- Broken by hand: without RefuseWithdrawn in Add,
  TestWithdrawnGivenToNobodyNew goes red (Add goes on to install); without
  KeepWithdrawn in move, TestWithdrawnPluginKeptForItsUsers goes red (the
  user's own move is turned away).
- Plugins: bun scripts/check.mjs all and bun test packages/antigravity
  packages/agy-cli scripts, 195 pass; dist index.json has 0.2.1.

Not tried: a real Antigravity account through 0.2.1 (it is 0.1.18's code,
which served until 11-15), and the CLI/TUI show no notice beyond Add's
refusal.
2026-11-16 03:00:18 +08:00

56 lines
1.8 KiB
Go

package provider
import (
"context"
"errors"
"testing"
"github.com/yetone/magpie/internal/plugin"
)
// A withdrawn plugin (Antigravity's, owner 11-15) is still installed for
// the users who have it: a move of their own built-in accounts onto it, and
// keepMovedCurrent bringing a moved user's up to its min. Adopt, which signs
// in to it with no account to bring, is a new user's install, and turned
// away.
func TestWithdrawnPluginKeptForItsUsers(t *testing.T) {
claudeHome(t)
fakeMover(t)
const pkg = "@magpie-community/opencode-antigravity-auth"
movers["fakeco"].pkg, movers["fakeco"].min = pkg, "0.2.1"
var said []error
installPlugin = func(ctx context.Context, p, _ string) error {
err := plugin.RefuseWithdrawn(ctx, p)
said = append(said, err)
return err
}
oldProviders, oldRemove := pluginProviders, removePlugin
pluginProviders = func(context.Context) ([]plugin.Provider, error) { return nil, errors.New("stop here") }
removePlugin = func(context.Context, string) error { return nil }
t.Cleanup(func() { pluginProviders, removePlugin = oldProviders, oldRemove })
ctx := context.Background()
if err := Adopt(ctx, "fakeco"); err == nil || len(said) != 1 || said[0] == nil {
t.Fatalf("Adopt with no account = %v (install said %v), want it turned away", err, said)
}
loginsMu.Lock()
if err := writeLogins([]savedLogin{fakeLogin("a@fake", "r-a", true, true)}); err != nil {
loginsMu.Unlock()
t.Fatal(err)
}
loginsMu.Unlock()
said = nil
_ = Move(ctx, "fakeco")
if len(said) != 1 || said[0] != nil {
t.Fatalf("a move of the user's own account: install said %v, want it allowed", said)
}
said = nil
_ = setMigration("fakeco", func(m *Migration) { m.State = MovePlugin })
keepMovedCurrent(ctx)
if len(said) != 1 || said[0] != nil {
t.Fatalf("keepMovedCurrent: install said %v, want it allowed", said)
}
}