Skip to content

fix(antigravity): prefer userTier.name over legacy planInfo.planName#369

Merged
robinebers merged 2 commits into
robinebers:mainfrom
n3wr1ch:fix/antigravity-ultra-plan-display
Apr 12, 2026
Merged

fix(antigravity): prefer userTier.name over legacy planInfo.planName#369
robinebers merged 2 commits into
robinebers:mainfrom
n3wr1ch:fix/antigravity-ultra-plan-display

Conversation

@n3wr1ch
Copy link
Copy Markdown
Contributor

@n3wr1ch n3wr1ch commented Apr 11, 2026

Summary

Fixes #368 — Ultra subscribers are incorrectly displayed as "Pro" in the Antigravity plugin.

Problem

The GetUserStatus response contains two separate tier identifiers:

Field Ultra subscriber value Source
planStatus.planInfo.planName "Pro" Windsurf/Codeium legacy
userTier.name "Google AI Ultra" Google subscription system

The plugin was reading planInfo.planName, which always returns "Pro" for all paid tiers regardless of whether the user is on Pro or Ultra.

Fix

Prefer userTier.name when available, falling back to planInfo.planName for backward compatibility:

var ut = data.userStatus.userTier
if (ut && ut.name) {
  plan = ut.name
} else {
  var ps = data.userStatus.planStatus || {}
  var pi = ps.planInfo || {}
  plan = pi.planName || null
}

Tests

  • ✅ Added: "prefers userTier.name over legacy planInfo.planName for Ultra subscribers"
  • ✅ Added: "falls back to planInfo.planName when userTier is absent"
  • ✅ Added: "falls back to planInfo.planName when userTier.name is empty"
  • ✅ All 53 existing tests pass without modification

Summary by cubic

Fixes incorrect plan labels in the Antigravity plugin by preferring userTier.name over the legacy planInfo.planName. Ultra subscribers now display as "Google AI Ultra" instead of "Pro", with guards for empty or non-string values.

  • Bug Fixes
    • Prefer userTier.name; fall back to planStatus.planInfo.planName for backward compatibility.
    • Add typeof/trim guards to ignore invalid labels; add tests for Ultra, missing userTier, and empty userTier.name.

Written for commit cb63b20. Summary will update on new commits.

The planInfo.planName field inherited from Windsurf/Codeium always returns
'Pro' for all paid tiers, including Google AI Ultra subscribers. The
userTier object added by Google contains the accurate subscription name.

This fix reads userTier.name first and falls back to planInfo.planName
for backward compatibility when userTier is absent.

Fixes robinebers#368
Copilot AI review requested due to automatic review settings April 11, 2026 04:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes incorrect tier display in the Antigravity plugin by using Google’s userTier.name when available, instead of the legacy planStatus.planInfo.planName field that reports "Pro" for all paid tiers.

Changes:

  • Update LS GetUserStatus parsing to prefer userTier.name with a fallback to planInfo.planName.
  • Extend the Antigravity test fixture to support userTier overrides.
  • Add tests covering: prefer userTier.name, fallback when userTier is missing, and fallback when userTier.name is empty.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
plugins/antigravity/plugin.js Switch plan label source to userTier.name first, with legacy fallback.
plugins/antigravity/plugin.test.js Add fixture override + new test cases validating tier selection behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugins/antigravity/plugin.test.js Outdated
Comment on lines 199 to 200
expect(result.plan).toBe("Pro")

Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test asserts result.plan twice with the same expectation; the second expect(result.plan).toBe("Pro") is redundant and makes the test noisier without adding coverage. Consider keeping a single assertion (and the explanatory comment if desired).

Suggested change
expect(result.plan).toBe("Pro")

Copilot uses AI. Check for mistakes.
Comment thread plugins/antigravity/plugin.js Outdated
Comment on lines +435 to +440
if (ut && ut.name) {
plan = ut.name
} else {
var ps = data.userStatus.planStatus || {}
var pi = ps.planInfo || {}
plan = pi.planName || null
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

userTier.name is accepted as-is when truthy; if it’s non-string (e.g. an object) or whitespace-only, plan may become an unexpected type/blank label. To keep plan reliably a meaningful string, gate on typeof ut.name === "string" and use ut.name.trim() (falling back when the trimmed value is empty). Consider applying the same string/trim normalization to pi.planName for consistency with other plugins.

Suggested change
if (ut && ut.name) {
plan = ut.name
} else {
var ps = data.userStatus.planStatus || {}
var pi = ps.planInfo || {}
plan = pi.planName || null
var userTierName =
ut && typeof ut.name === "string" && ut.name.trim() ? ut.name.trim() : null
if (userTierName) {
plan = userTierName
} else {
var ps = data.userStatus.planStatus || {}
var pi = ps.planInfo || {}
plan =
typeof pi.planName === "string" && pi.planName.trim() ? pi.planName.trim() : null

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@validatedev
Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…cate assertion

- Gate userTier.name and planInfo.planName with typeof === 'string'
  and .trim() to prevent non-string or whitespace-only plan labels
- Remove duplicate expect(result.plan).toBe('Pro') in test
Copy link
Copy Markdown
Owner

@robinebers robinebers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@robinebers robinebers merged commit 3fb63e0 into robinebers:main Apr 12, 2026
2 checks passed
@n3wr1ch n3wr1ch deleted the fix/antigravity-ultra-plan-display branch April 12, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Antigravity] Ultra subscribers incorrectly displayed as 'Pro' — plugin reads legacy planName instead of userTier

4 participants