Skip to content

feat(cli): billing and upgrade links carry the signed-in workspace - #7103

Merged
miguel-heygen merged 1 commit into
mainfrom
feat/cli-links-carry-workspace
Nov 4, 2026
Merged

miguel-heygen merged 1 commit into
mainfrom
feat/cli-links-carry-workspace

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

What

Every plans or credits link the CLI prints or opens (billing subscribe, billing top-up, the Free line in auth status, the credits and subscribe refusals, the reverse upgrade link) now carries workspace_hint=<workspace the CLI is signed in for>. The site's sign-in reads it once its change lands (a separate PR in another repo, not yet merged); until then the parameter is ignored, so merging this first is harmless. With both, the person lands in the same workspace instead of their account default. Signed out, links are unchanged.

How

pageUrl in heygen/plan.ts already built all of these links, so it is the one owner: it asks account.get for the workspace bound to the current sign-in and appends the hint. The workspace is read live, never stored, so it cannot go stale after a different account signs in. No workspace is guessed: a failed read, a signed-out run or an id that is not letters, digits and hyphens (up to 64) adds nothing. Links the server sends back whole (upgrade_url, url) pass through untouched.

pageUrl is now async, so its callers (billing, auth status, reverse, the v3 refusal) await it.

Tests

  • plan.test.ts: both link kinds carry the hint from account.get; signed out, a failed read and a malformed id carry none.
  • billing.test.ts: the opened subscribe page carries the hint.
  • Existing v3 fetch stubs answer the new workspace read apart from their queued job answers.
  • Fails without the fix: dropping the one workspace_hint line turns the plan and billing tests red (2 failed); restored, 176 passed across the changed suites. Oxlint and oxfmt clean.

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: REQUEST CHANGES · 1 blocker · 1 important · 0 nits · head dbc45e1b

  • blocker — Comments ratchet fails. It added 1 comment line to auth/status.ts (13.9% → 14.0%) and 2 to heygen/plan.ts (9.1% → 9.2%). See the inline comments.
  • important — the site doesn't read the hint yet. The body says "The site's sign-in reads it", but on hyperframes-internal main the signed-out Get Pro button (PricingScreen.tsx:162) goes to /api/auth/login?return_to=…. /api/auth/login only reads workspace_hint from its own query, so a hint that comes in on /pricing?…&workspace_hint=… is dropped and the account default is still used. The site side is hyperframes-internal#8149, which is still open. Merging this first does no harm (the parameter is just ignored), but name #8149 as the dependency in the body, or land it first.
Scope

Read all 6 changed source files end-to-end, plus cloud/auth.ts and demo-next's /api/auth/login, /pricing and PricingScreen. The fails without the fix line holds: dropping the workspace_hint line makes the plan and billing tests fail (2), and at this head the changed suites pass 102/102. The edit to refusalWhenServerBlocksFree (session.upgradeUrl === null) behaves the same as before. CI's Fallow audit job was cancelled. PR captures, CodeQL, regression and preview-regression are green. No prior reviews.

apiError: string | null;
/** The HyperFrames plan and credits, when the server (or the mock) answers. */
plan?: Plan | null;
/** The plans link shown to a Free account, built before printing because it names the workspace. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This line fails the comment ratchet (13.9% → 14.0%). Drop it; the field name upgradeUrl already says what it holds.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Fixed in 5787863

Comment thread packages/cli/src/heygen/plan.ts Outdated

/**
* A plans or credits page link with what the web side reads: `from=cli`, the credits needed, the waiting step,
* and `workspace_hint` (the signed-in workspace, so the site's sign-in lands in the same one; none when signed out).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

plan.ts goes from 9.1% to 9.2% comment share. The 2-line signedInSpace docstring at :53 plus this added line exceed what the ratchet allows. Drop the signedInSpace docstring (the name says it) and keep this line to one.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Fixed in 5787863

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: APPROVE · 2 resolved, 0 open, 0 new · dbc45e1b → 5787863b

Both findings are resolved. Comments passes, and the body now says the website side lands separately (hyperframes-internal#8149, still open). The diff since the last review only changes comments. CI was cancelled on both runs for this head, but every job passed in at least one of them, except Lint, which was cancelled in both. I ran bun run lint locally at this head and it is clean.

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 3, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 3, 2026
@miguel-heygen
miguel-heygen force-pushed the feat/cli-links-carry-workspace branch from 5787863 to 44f95eb Compare November 4, 2026 01:16

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: APPROVE · 0 resolved, 0 open, 0 new · 5787863b → 44f95ebe

The rebase is clean. Every pageUrl / reverseUpgradeUrl caller in the CLI is awaited, the reverse-start refusal goes through reverseUpgradeUrl, credits links keep #packs, and the comments stay out. At this head, the CLI suites I ran (heygen, billing, reverse, auth) pass 189/189 and tsc is clean for the changed files. Every check, CI included, is green.

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit c5a5e08 Nov 4, 2026
70 checks passed
@miguel-heygen
miguel-heygen deleted the feat/cli-links-carry-workspace branch November 4, 2026 01:55
This was referenced Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant