provider: six more plugins' sign-ins rotate before the host list is read (plugins #1027)
plugins #1027 made eight auth hooks say rotating: Cline, CodeArts (with OfficeAce), Factory, MiniMax, Nous Portal, Qoder, SenseNova and WorkBuddy. magpie reads that from the plugin host's list, but a sync that runs at start can come before the list is read. rotatesKnown covers that window, and it held only MiniMax and Qoder. It now holds all twelve provider ids, so none of those sign-ins is carried to another computer by an early Sync, backup or Restore. MiniMax and Qoder stay listed for the same reason. TestRotatingKnownBeforeHostList checks each id. With the old list put back by hand it was red (workbuddy-ai and the others named). Run on mica at this tree: go test -count=1 ./internal/provider/ ok (128s); go vet ./internal/provider/ on darwin, windows and linux ok. Not run: the full suite (it runs after the push, per the ship rule). Not tried: a real sync between two computers.
This commit is contained in:
@@ -196,8 +196,16 @@ func (s *SignIns) records() map[string]signInRec {
|
||||
// rotatesKnown are the community plugins whose vendor spends a refresh
|
||||
// token once, read from their sources: MiniMax Code ("MiniMax spends a
|
||||
// refresh token once", invalid_grant 400 after) and Qoder ("a refresh
|
||||
// token is spent once, so two refreshes would spend it twice").
|
||||
var rotatesKnown = []string{"minimax-code", "minimax-code-global", "qoder", "qoder-cn"}
|
||||
// token is spent once, so two refreshes would spend it twice"), and the
|
||||
// six whose auth hooks say rotating since plugins #1027: Cline (a spent
|
||||
// token is 400 invalid_grant), CodeArts and OfficeAce ("one-time refresh
|
||||
// token"), Factory (WorkOS rotates), Nous Portal (refresh_token_reused),
|
||||
// SenseNova (Hydra rotates) and WorkBuddy. The hooks say so too; this list
|
||||
// holds for a sync that runs before the plugin host's list is read.
|
||||
var rotatesKnown = []string{
|
||||
"cline", "codearts", "factory", "minimax-code", "minimax-code-global", "nous-portal",
|
||||
"officeace", "qoder", "qoder-cn", "sensenova-token-plan", "workbuddy", "workbuddy-ai",
|
||||
}
|
||||
|
||||
// rotatingPlugins are the ids of the plugins whose auth hook says their
|
||||
// refresh tokens rotate (Rotating): a sign-in of theirs is never carried,
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package provider
|
||||
|
||||
import "testing"
|
||||
|
||||
// Before the plugin host's list is read, a sync still knows which
|
||||
// plugins' sign-ins rotate: every plugin whose hook says rotating
|
||||
// (plugins #1027) or whose source says a refresh token is spent once.
|
||||
func TestRotatingKnownBeforeHostList(t *testing.T) {
|
||||
got := rotatingPlugins()
|
||||
for _, id := range []string{
|
||||
"cline", "codearts", "factory", "minimax-code", "minimax-code-global", "nous-portal",
|
||||
"officeace", "qoder", "qoder-cn", "sensenova-token-plan", "workbuddy", "workbuddy-ai",
|
||||
} {
|
||||
if !got[id] {
|
||||
t.Errorf("%s is carried before the plugin host list is read", id)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user