You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`entitlement` presence is the machine-readable discriminator; consumers must treat it as an
332
+
optional enhancement (absent on envelope-less servers and older CLI versions).
333
+
-`legacySuggestUpgrade` (`src/legacy/shared/legacy-upgrade-suggest.ts`) is only the
334
+
entitlements-lookup FALLBACK for envelope-less denials (v1 SSO, older servers). When the
335
+
response carries an envelope it returns the confirmed-gated boolean but performs no side
336
+
effects — hint, telemetry, and error fields are the central handler's. New commands must not
337
+
call it for envelope-emitting routes.
338
+
- Known central-handler bypasses (all dormant while v1 SSO emits no envelope; fix when the routes
339
+
gain it): `sso add` POST and `sso update` PUT construct status errors without
340
+
`mapLegacyHttpError` (no attach), and `sso list`/`sso remove`/`sso show`/`sso update`'s GET
341
+
swap the mapped error for a bare replacement error on 404 (fields discarded — `NotFoundError`
342
+
variants; `list` uses `SamlDisabledError`). Route these through `mapLegacyHttpError` (or attach
343
+
via `src/shared/api/plan-gate.ts`) before enveloping SSO server-side.
344
+
- Go divergence (deliberate, 2026-07-28): the Go binary kept per-site `SuggestUpgradeOnError`
345
+
wiring; the TS handler is central. Consistent with
346
+
[Legacy Port Status and Go CLI Authority](#legacy-port-status-and-go-cli-authority), the 1:1
347
+
parity doctrine covers this subsystem's user-visible output only, not its internal structure.
348
+
349
+
---
350
+
309
351
## Legacy Port: Go Parity Checklist
310
352
311
353
When porting a Management-API-style command, verify each item before marking the command as `ported`:
@@ -346,12 +388,12 @@ The legacy shell sends the same PostHog events to the same product analytics pip
346
388
-**Proxy handlers (`LegacyGoProxy.exec`) must NOT wrap with any instrumentation.** The Go subprocess fires its own telemetry; a TS wrapper would double-count `cli_command_executed`.
347
389
-**When promoting a command from proxy to native, reproduce every `phtelemetry.*` call in the Go counterpart.** Grep `apps/cli-go/internal/<command>/` for `service.Capture`, `service.Alias`, `service.Identify`, `service.GroupIdentify`, and `TrackUpgradeSuggested` — note that most `internal/<command>/` packages were deleted in CLI-1970 once their commands went fully native, so this grep only finds something for the still-`wrapped` commands; check out commit `7b469f5b3` to grep an already-ported command's former Go source. The current Go custom events that legacy ports must reproduce when natively ported (already captured below, so this is only needed for a command not yet in this table):
348
390
349
-
| Command | Event | Identity / groups | Go source |
|`login`|`cli_login_completed`|`analytics.alias(gotrueId, deviceId)` after token persists |`internal/login/login.go:283-296` (deleted in CLI-1970; last present at commit 7b469f5b3) |
352
-
|`link`|`cli_project_linked`|`analytics.groupIdentify("organization", slug, …)` + `analytics.groupIdentify("project", ref, …)` after link write |`internal/link/link.go:60` (deleted in CLI-1970; last present at commit 7b469f5b3) |
353
-
|`start`|`cli_stack_started`| none — fired after stack health check passes | formerly `internal/start/start.go:1245` (deleted as unreachable in CLI-1966; last present at commit a253ccba2) |
354
-
|`sso/{list,create,update,remove}`, `branches/{create,update}`, `hostnames/{create,activate,get,reverify}`, `vanity_subdomains/{activate,get}`|`cli_upgrade_suggested`| none — payload is `{feature_key, org_slug}`, fired inside billing-gate error branch (`SuggestUpgradeOnError` is envelope-first; hostnames + vanity get are envelope-only)| call-sites under `internal/{sso,branches,hostnames,vanity_subdomains}/` (deleted in CLI-1970; last present at commit 7b469f5b3) |
391
+
| Command | Event | Identity / groups | Go source |
|`login`|`cli_login_completed`|`analytics.alias(gotrueId, deviceId)` after token persists |`internal/login/login.go:283-296` (deleted in CLI-1970; last present at commit 7b469f5b3) |
394
+
|`link`|`cli_project_linked`|`analytics.groupIdentify("organization", slug, …)` + `analytics.groupIdentify("project", ref, …)` after link write |`internal/link/link.go:60` (deleted in CLI-1970; last present at commit 7b469f5b3) |
395
+
|`start`|`cli_stack_started`| none — fired after stack health check passes | formerly `internal/start/start.go:1245` (deleted as unreachable in CLI-1966; last present at commit a253ccba2) |
396
+
|`sso/{list,create,update,remove}`, `branches/{create,update}`, `hostnames/{create,activate,get,reverify}`, `vanity_subdomains/{activate,get}`|`cli_upgrade_suggested`| none — payload is `{feature_key, org_slug}`. TS divergence (deliberate): envelope denials fire centrally at envelope parse in `mapLegacyHttpError` (feature from the envelope, org from `upgrade_url`; check-availability suppression = `trackUpgradeSuggested: false` on its mapper); the per-site `legacySuggestUpgrade` fallback fires only for envelope-less denials. Go stays per-site (`SuggestUpgradeOnError`, envelope-first).| call-sites under `internal/{sso,branches,hostnames,vanity_subdomains}/` (deleted in CLI-1970; last present at commit 7b469f5b3) |
355
397
356
398
Reference pattern for login: `next/commands/login/login.handler.ts:38-62`.
0 commit comments