providers, gui: a Copilot account on the individual_max plan reads "Max", not "Individual_max", and individual_edu reads "Education"

copilotPlans had no name for two copilot_plan values that GitHub sends,
so label() capitalised the raw id. GitHub's own clients name them:
- VS Code's chatEntitlementService maps individual_pro to ProPlus
  ("Copilot Pro+"), individual_max to Max ("Copilot Max") and
  individual_edu to EDU.
- CopilotForXcode's planDisplayName gives "Copilot Pro+ Plan" for
  individual_pro and "Copilot Max Plan" for individual_max.

So individual_max is Max, not Pro+. The real individual_max response in
copilot_usage_test.go has a premium allowance of 20000, above Pro+'s.
That test and its comments called it Pro+ and now say Max. VS Code also
gives individual_edu the EDU entitlement, which magpie already labels
"Education" through the free_educational_quota SKU, so the plan id gets
the same name. The full list of ids that GitHub's clients handle (free,
individual, individual_pro, individual_max, individual_edu, business,
enterprise) is now named. The Copilot tile's plan list in the Add sheet
includes Max.

Verified: TestCopilotEntitlementLabels fails without the map change
("{Plan:individual_max AccessSKU:free_github_star_quota}: "Individual_max",
want "Max""; individual_edu the same), and passes with it under -race
-count=20. deprecated-subscriptions and signin-closes-sheet GUI tests pass
in Chromium and WebKit (5/5 each). No new t() string.
This commit is contained in:
yetone
2026-10-07 07:08:17 +08:00
parent 1ef6c92670
commit d688a8b43c
4 changed files with 13 additions and 5 deletions
+1 -1
View File
@@ -9744,7 +9744,7 @@ const SUBS = [
// so does Grok Build
{ agent: "grok", name: "Grok (SuperGrok)", icon: "xai", plans: "SuperGrok · X Premium+", own: true },
// signed in with GitHub's device code; the editors' own sign-in stays theirs
{ agent: "copilot", name: "Copilot", icon: "githubcopilot", plans: "Free · Education · Pro · Pro+ · Business · Enterprise", own: true },
{ agent: "copilot", name: "Copilot", icon: "githubcopilot", plans: "Free · Education · Pro · Pro+ · Max · Business · Enterprise", own: true },
// Z.ai's GLM Coding Plan, signed in as ZCode does; ZCode's own account is read too
// sites: where the account is, Z.ai's or BigModel's (智谱), asked before
// the sign-in opens; a team's plan (团队套餐) is signed in on its site too
+6 -1
View File
@@ -129,9 +129,14 @@ func copilotAlsoOn() []Provider {
return out
}
// copilotPlans names Copilot's plans as GitHub sells them.
// copilotPlans names Copilot's plans as GitHub sells them, as GitHub's own
// clients name each copilot_plan (VS Code's chatEntitlementService,
// CopilotForXcode's planDisplayName): individual_pro is Pro+ and
// individual_max is Max. individual_edu is the student plan, which the
// free_educational_quota SKU also names.
var copilotPlans = map[string]string{
"free": "Free", "individual": "Pro", "individual_pro": "Pro+",
"individual_max": "Max", "individual_edu": "Education",
"business": "Business", "enterprise": "Enterprise",
}
@@ -16,6 +16,9 @@ func TestCopilotEntitlementLabels(t *testing.T) {
{"individual", "unknown-sku", "Pro"},
{"individual", "free_limited_copilot", "Free"},
{"individual_pro", "", "Pro+"}, {"business", "", "Business"},
// the real Max account's (copilot_usage_test.go), not "Individual_max"
{"individual_max", "free_github_star_quota", "Max"},
{"individual_edu", "", "Education"},
{"enterprise", "", "Enterprise"}, {"free", "", "Free"},
{"", "free_limited_copilot", "Free"}, {"", "unknown-sku", ""},
{"future_plan", "future-sku", "Future_plan"}, {"", "", ""},
+3 -3
View File
@@ -34,7 +34,7 @@ func copilotWindow(q SubscriptionQuota, name string) *QuotaWindow {
}
// The snapshots of a token-based-billing account's quota_snapshots, the way
// GitHub sends them: a Pro+ (individual_max) account's, read from the real
// GitHub sends them: a Max (individual_max) account's, read from the real
// endpoint on 2026-10-07 with its ids and lists left out, and the
// Business/Enterprise shapes VS Code's own parser is tested with
// (chatEntitlementService.test.ts): entitlement as a string, has_quota
@@ -55,7 +55,7 @@ func TestCopilotUsageReadsEverySeat(t *testing.T) {
name, body string
premium *want // nil: the card must say Premium requests are unlimited
}{
{"Pro+ with allowance left, the real response", `{"access_type_sku":"free_github_star_quota","copilot_plan":"individual_max","quota_reset_date":"2026-11-01","quota_snapshots":{` + copilotUnlimitedSnaps + `,
{"Max with allowance left, the real response", `{"access_type_sku":"free_github_star_quota","copilot_plan":"individual_max","quota_reset_date":"2026-11-01","quota_snapshots":{` + copilotUnlimitedSnaps + `,
"premium_interactions":{"overage_count":0,"overage_permitted":false,"percent_remaining":99.9,"quota_id":"premium_interactions","quota_remaining":19999.9,"unlimited":false,"timestamp_utc":"2026-10-06T14:40:30.429-07:00","has_quota":true,"quota_reset_at":0,"token_based_billing":true,"credits_used":0,"overage_entitlement":0,"remaining":19999,"entitlement":20000}},
"quota_reset_date_utc":"2026-11-01T00:00:00.000Z","token_based_billing":true}`,
&want{0.0005, "0.1 / 20000", false}},
@@ -68,7 +68,7 @@ func TestCopilotUsageReadsEverySeat(t *testing.T) {
{"Business used up (#1063)", `{"access_type_sku":"copilot_for_business_seat","copilot_plan":"business","quota_reset_date_utc":"2026-11-01T00:00:00.000Z","token_based_billing":true,"quota_snapshots":{` + copilotBusinessUnlimited + `,
"premium_interactions":{"overage_count":0,"overage_entitlement":0,"overage_permitted":false,"percent_remaining":0,"unlimited":false,"entitlement":"300","quota_remaining":"0","has_quota":false}}}`,
&want{100, "300 / 300", false}},
{"Business used up, numbers as github.com sent the Pro+ one (#1063's card: Chat and Completions unlimited, nothing else)", `{"access_type_sku":"copilot_for_business_seat","copilot_plan":"business","quota_reset_date":"2026-11-01","quota_snapshots":{` + copilotUnlimitedSnaps + `,
{"Business used up, numbers as github.com sent the Max one (#1063's card: Chat and Completions unlimited, nothing else)", `{"access_type_sku":"copilot_for_business_seat","copilot_plan":"business","quota_reset_date":"2026-11-01","quota_snapshots":{` + copilotUnlimitedSnaps + `,
"premium_interactions":{"overage_count":0,"overage_permitted":false,"percent_remaining":0.0,"quota_id":"premium_interactions","quota_remaining":0.0,"unlimited":false,"has_quota":false,"quota_reset_at":0,"token_based_billing":true,"credits_used":0,"overage_entitlement":0,"remaining":0,"entitlement":300}},
"quota_reset_date_utc":"2026-11-01T00:00:00.000Z","token_based_billing":true}`,
&want{100, "300 / 300", false}},