yapechan on Discord (Windows, Synology WebDAV): after an import or a WebDAV
sync no providers showed on the other computer; adding the same provider by
hand made the synced settings and usage apply. No error, a restart didn't
help.
Cause. A backup and a sync carry providers.json as stored. For a
subscription that is its model picks and settings alone (no endpoint, no
key), and sign-ins are never carried by design; allProviders lists such an
entry only once an account is signed in here. plugins.json was not carried
at all, so a provider served by a plugin (every moved subscription, any
plugin provider) had nothing to come from on the other side. The import
said "N added" and "Needs a key: , " (the picks entries have no name and no
key), and the sync said nothing. API-key providers do come over: tried with
a nogui build in two sandbox HOMEs (DeepSeek, a custom relay, Kimi Code all
listed after `magpie restore`). No Windows-only path issue found.
What changed:
- provider.Carried(keys): the plugins added from npm or git, on/off and
their options (without keys, options whose names look like a key are left
out, as secret headers are). Folder plugins and plugin-auth.json stay.
- backup.Bundle.Plugins (nil from an older magpie). Restore installs the
ones not here through provider.AddPlugins (plugin.Add, then Off and
Options, then HandOver once); it never removes or changes one already
here. A failed install is reported, not a failed restore.
- Result.SignIn / provider.NotSignedIn: the subscriptions brought with no
account here. NeedKey no longer lists picks-only entries (provider.OnlyPicks).
- davsync: the providers part's hash covers the plugins (unchanged for a
setup without any), take/bring carry them, bring installs (logged on
failure), and Status().SignIn names what to sign in to.
- CLI restore and `magpie webdav`/`s3` status print both; the GUI's import
result and the sync row show them (en, zh, zh-TW, ja, de).
- docs/reference.md says what a backup carries now.
Run:
- go test -tags nogui ./internal/provider ./internal/backup ./internal/davsync
./internal/cli ./internal/gui in a sandbox HOME.
- New tests fail with the change broken by hand: TestPluginsCarried
(installed-skip and the HandOver guard), TestNotSignedIn,
TestRestorePluginsAndSignIn ("Needs a key: [ Acme]" without OnlyPicks),
TestSyncPluginsAndSignIn (bring not installing, Status not naming),
sync-sign-in.test.cjs (the lines removed).
- sync-sign-in.test.cjs: Chromium and WebKit, en/zh/ja/de, 900 and 440px,
16/16; it also caught subNames throwing while providers was still null.
sync-*.test.cjs, s3-sync, i18n-keys, gui-ja, gui-de pass.
- gofmt -l, go vet, GOOS=linux and GOOS=windows go vet -tags nogui on the
touched packages.
Not tried: a real plugin install from a real sync (the installs are stubbed
in tests); a real Synology server.
The root held 89 .go files (30 commands, 59 tests). They move as they are
to internal/cli (package cli), with git mv so history follows them. The
only code change is main() becoming cli.Main(version): the root's new
main.go keeps `var version` in package main, so -ldflags "-X
main.version=…" in the Makefile, the Dockerfile and magpie-releases, and
every workflow, work unchanged. go-winres's rsrc_windows_*.syso still land
next to package main in the root.
Tests that read testdata by a root-relative path now go up one level
(../plugin/testdata/fake, ../sessions/testdata). Five subsystem doc links
point at internal/cli/.
Run:
- go build ./..., gofmt -l, go vet on darwin, linux and windows (nogui)
- builds with tags production, dev, "production nogui"; windows
-H windowsgui; linux CGO_ENABLED=0
- make release-cli TARGETS="darwin/arm64 linux/amd64 windows/amd64
android/arm64" VERSION=9.9.9-tidy: all four built, binary prints
"magpie 9.9.9-tidy"
- docker build --build-arg VERSION=7.7.7-tidy: container prints
"magpie 7.7.7-tidy"
- go test ./internal/cli (default and nogui): 152 tests, the same count
as the root on main
- go test ./...: all packages pass (agent, gateway, library, provider
timed out at 10m under other sessions' load and passed rerun alone
with -timeout 40m; none of them changed)
- the built binary in a sandbox HOME: version, help, ls, providers,
claude, and an unknown command's error