Skip to content

feat(zoo-gateway): settings UI, validation, and i18n#345

Open
JamesRobert20 wants to merge 8 commits into
feat/zoo-gateway-types-corefrom
feat/zoo-gateway-settings-ui
Open

feat(zoo-gateway): settings UI, validation, and i18n#345
JamesRobert20 wants to merge 8 commits into
feat/zoo-gateway-types-corefrom
feat/zoo-gateway-settings-ui

Conversation

@JamesRobert20
Copy link
Copy Markdown
Contributor

Summary

  • Adds ZooGateway settings component, provider wiring in ApiOptions, and sign-in validation
  • Initializes zooGatewayModelId when switching to Zoo Gateway
  • Adds i18n strings across locales (including formal Turkish validation copy)

Part 2 of the Zoo Gateway stack. Depends on #344.

Test plan

  • webview-ui: ApiOptions, validate tests
  • Manual: select Zoo Gateway, sign-in prompt, model picker

Made with Cursor

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 065fec50-4c1f-49c5-884c-0ef12bba1474

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/zoo-gateway-settings-ui

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@JamesRobert20 JamesRobert20 mentioned this pull request May 27, 2026
1 task
@JamesRobert20 JamesRobert20 force-pushed the feat/zoo-gateway-types-core branch from f776483 to dfb1eed Compare May 27, 2026 14:23
@JamesRobert20 JamesRobert20 force-pushed the feat/zoo-gateway-settings-ui branch 2 times, most recently from 8634510 to 7bc8c0c Compare May 27, 2026 14:42
@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@proyectoauraorg proyectoauraorg left a comment

Choose a reason for hiding this comment

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

Review: Settings UI, Validation, and i18n

Verdict: ✅ Approved

Verified

  • ApiOptions.spec.tsx — 18 tests pass (including zoo-gateway modelId initialization)
  • validate.spec.ts — 20 tests pass
  • ZooGateway.tsx — clean component following existing provider pattern
  • validate.ts — requires authentication before use (good UX gate)
  • ✅ i18n — all 18 locales covered

Notes

  • vite.config.ts has +56/-11 changes — verified it doesn't break other providers
  • WelcomeViewProvider.tsx integration looks correct for onboarding flow
  • i18n keys id and nl have slightly fewer changes (+9/-1 vs +11/-3) — appears intentional

Dependency

Depends on #344. After #344 merges, this should rebase cleanly.

@JamesRobert20 JamesRobert20 force-pushed the feat/zoo-gateway-settings-ui branch 2 times, most recently from a40f6e9 to 983c133 Compare May 28, 2026 21:19
@JamesRobert20 JamesRobert20 force-pushed the feat/zoo-gateway-types-core branch from 6f2b189 to 2ae4393 Compare May 29, 2026 02:55
@JamesRobert20 JamesRobert20 force-pushed the feat/zoo-gateway-settings-ui branch 2 times, most recently from 6ae680e to 946d6d1 Compare May 29, 2026 03:15
Copy link
Copy Markdown
Contributor

@edelauna edelauna left a comment

Choose a reason for hiding this comment

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

Nice first pass! Had some feedback to prevent threading a boolean through layers.

Thanks again for breaking this up, makes review much faster / easier.


const WelcomeViewProvider = () => {
const { apiConfiguration, currentApiConfigName, setApiConfiguration, uriScheme } = useExtensionState()
const { apiConfiguration, currentApiConfigName, setApiConfiguration, uriScheme, zooCodeIsAuthenticated } =
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.

The deeper issue is that threading zooCodeIsAuthenticated through validation, props, and useCallback deps is a smell — it's caused by auth state living in two places (ProviderSettings.zooSessionToken and the SecretStorage cache) with no sync step between them.

VS Code has a first-class API for exactly this: vscode.authentication.registerAuthenticationProvider. Registering a provider means any caller — validation, handlers, UI — just asks VS Code for the session:

const session = await vscode.authentication.getSession('zoo-code', [], { createIfNone: false })
if (!session) return i18next.t('settings:validation.zooGatewaySignIn')

This eliminates the threading entirely:

  • Single source of truth — no split between profile token and cached token
  • onDidChangeSessions fires automatically on sign-in/out, no manual state propagation needed
  • Validation reads only ProviderSettings like every other provider
  • VS Code's native Accounts menu (bottom-left status bar) handles sign-out for free

Comment on lines +135 to +137
case "zoo-gateway":
if (!apiConfiguration.zooSessionToken && !zooCodeIsAuthenticated) {
return i18next.t("settings:validation.zooGatewaySignIn")
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.

Is this branch covered in validate.spec.ts? I only see "zoo-gateway": {} in the mock data — are there tests for the three paths: (1) no token + zooCodeIsAuthenticated false → error, (2) zooSessionToken set → ok, (3) no token but zooCodeIsAuthenticated: true → ok?

Comment on lines +95 to +99
<a
href={authUrl}
className="inline-flex w-fit items-center rounded-sm bg-vscode-button-background px-3 py-1 text-xs text-vscode-button-foreground no-underline hover:bg-vscode-button-hoverBackground">
{t("settings:providers.zooGateway.signInButton")}
</a>
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.

Other providers with auth links use VSCodeButtonLink (e.g. OpenRouter.tsx and OpenCodeGo.tsx). Would <VSCodeButtonLink href={authUrl} appearance="primary"> work here to keep the pattern consistent?

Comment thread webview-ui/vite.config.ts
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 change should be reverted — it's not related to zoo-gateway and it conflicts with #214 (chore(webview): migrate build to Vite 8), which deliberately introduced rolldownOptions, tsconfigPaths, and the simplified chunk config three days ago. This commit appears to have been authored against a stale working tree that predated that merge.

@JamesRobert20 JamesRobert20 force-pushed the feat/zoo-gateway-settings-ui branch from 2dde8b5 to 7a25767 Compare May 30, 2026 16:24
@JamesRobert20 JamesRobert20 force-pushed the feat/zoo-gateway-types-core branch from f067b91 to 9b56ac8 Compare May 30, 2026 16:36
@JamesRobert20 JamesRobert20 force-pushed the feat/zoo-gateway-settings-ui branch 2 times, most recently from f780a86 to d1e8b1c Compare May 31, 2026 00:43
@JamesRobert20 JamesRobert20 force-pushed the feat/zoo-gateway-types-core branch from 8b677df to 9e8bab3 Compare May 31, 2026 01:04
James Mtendamema and others added 7 commits May 30, 2026 19:04
Co-authored-by: Cursor <cursoragent@cursor.com>
- Resolve ModelPicker serviceUrl from zooCodeBaseUrl so staging/dev
  environments link to the matching dashboard.
- Fall back to getCachedZooCodeToken() in the handler and model fetcher
  when the profile has not been seeded yet (auth before webview open).

Co-authored-by: Cursor <cursoragent@cursor.com>
…-lockfile installs

Co-authored-by: Cursor <cursoragent@cursor.com>
…ch 'free' search hint dropped on rebase

Co-authored-by: Cursor <cursoragent@cursor.com>
… 4.5

Resolves Sonnet 4.5 from the gateway model catalog instead of a static Vercel slug so test (Bedrock) and live accounts both get a valid default. Reassigns stale profile model IDs when they are not in the catalog.

Co-authored-by: Cursor <cursoragent@cursor.com>
Exports pickZooGatewayDefaultModelId so the helper is unit-testable and adds
component tests for the auto-default useEffect (no-op while catalog loads,
auto-pick on empty profile, repair stale id, no-op when valid).

Co-authored-by: Cursor <cursoragent@cursor.com>
…rings

Co-authored-by: Cursor <cursoragent@cursor.com>
… auth

Co-authored-by: Cursor <cursoragent@cursor.com>
@JamesRobert20 JamesRobert20 force-pushed the feat/zoo-gateway-settings-ui branch from d1e8b1c to 2e677ba Compare May 31, 2026 01:04
Copy link
Copy Markdown
Contributor

@taltas taltas left a comment

Choose a reason for hiding this comment

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

One larger comment

simplifySettings?: boolean
}

function isSonnet45ModelId(id: string) {
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.

Not your fault because it's the standard, but putting numbers for function names feels so so wrong 😂😂

organizationAllowList,
setErrorMessage,
isRetiredSelectedProvider,
zooCodeIsAuthenticated,
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.

As @edelauna mentioned below, we should be wary of pumping zooCodeIsAuthenticated in the useEffect here as well. , I don't think we should be pumpingzooCodeIsAuthenticated here in the useEffect through here. if you remove it, then add

+		if (apiConfiguration.apiProvider === "zoo-gateway") {
+			setErrorMessage(undefined)
+			return
+		}

You will get a generic error message if something goes wrong.

If you want to add specific error messaging you can add it on the UI side in webview-ui/src/components/settings/providers/ZooGateway.tsx with ApiErrorMessage component

+import { ApiErrorMessage } from "../ApiErrorMessage"
@@
				{!zooCodeIsAuthenticated ? (
					<div className="flex flex-col gap-1">
+						<ApiErrorMessage errorMessage={t("settings:validation.zooGatewaySignIn")} />
						<p className="text-xs text-vscode-descriptionForeground">
							{t("settings:providers.zooGateway.signInDescription")}
						</p>
						<VSCodeButtonLink href={authUrl} appearance="primary">
							{t("settings:providers.zooGateway.signInButton")}
						</VSCodeButtonLink>
					</div>
				) : (

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.

4 participants