Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ export default function EditConnectionModal({
const setOpenRouterPreset = openRouterPreset.setValue;
const isCodex = provider === "codex";
const isClaude = provider === "claude";
const isAntigravity = provider === "antigravity";
const supportsGoogleProjectId = isAntigravity;
const isAntigravityFamily = provider === "antigravity" || provider === "agy";
const localProviderMetadata = getLocalProviderMetadata(provider);
const isLocalSelfHostedProvider = !!localProviderMetadata;
const isGooglePse = provider === "google-pse-search";
Expand Down Expand Up @@ -431,7 +430,7 @@ export default function EditConnectionModal({
overrides.maxConcurrent = Number(formData.rateLimitMaxConcurrent);
updates.rateLimitOverrides = Object.keys(overrides).length > 0 ? overrides : null;

if (supportsGoogleProjectId) {
if (isAntigravityFamily) {
updates.projectId = trimmedCloudCodeProjectId || null;
}

Expand Down Expand Up @@ -505,7 +504,7 @@ export default function EditConnectionModal({
defaultRegion,
isGlm,
isCloudflare,
supportsGoogleProjectId,
isAntigravityFamily,
trimmedCloudCodeProjectId,
isGooglePse,
isCcCompatible,
Expand All @@ -530,11 +529,11 @@ export default function EditConnectionModal({
updates.providerSpecificData.openaiStoreEnabled =
formData.codexOpenaiStoreEnabled === true;
}
if (supportsGoogleProjectId) {
if (isAntigravityFamily) {
updates.providerSpecificData.projectId = trimmedCloudCodeProjectId || null;
}
}
if (isAntigravity) {
if (isAntigravityFamily) {
updates.providerSpecificData = {
...(connection.providerSpecificData || {}),
...(updates.providerSpecificData || {}),
Expand Down Expand Up @@ -685,22 +684,20 @@ export default function EditConnectionModal({
t={t}
editMode
/>
{supportsGoogleProjectId && (
{isAntigravityFamily && (
<div className="flex flex-col gap-4 rounded-lg border border-border/50 bg-surface/20 p-4">
{isAntigravity && (
<Select
label={t("antigravityClientProfileLabel")}
value={formData.antigravityClientProfile}
options={ANTIGRAVITY_CLIENT_PROFILE_OPTIONS.map((option) => ({
value: option.value,
label: t(option.labelKey),
}))}
onChange={(e) =>
setFormData({ ...formData, antigravityClientProfile: e.target.value })
}
hint={t("antigravityClientProfileHint")}
/>
)}
<Select
label={t("antigravityClientProfileLabel")}
value={formData.antigravityClientProfile}
options={ANTIGRAVITY_CLIENT_PROFILE_OPTIONS.map((option) => ({
value: option.value,
label: t(option.labelKey),
}))}
onChange={(e) =>
setFormData({ ...formData, antigravityClientProfile: e.target.value })
}
hint={t("antigravityClientProfileHint")}
/>
<Input
label={t("antigravityProjectIdLabel")}
value={formData.cloudCodeProjectId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function assignEditApiKeyProviderSpecificData(options: {
defaultRegion: string;
isGlm: boolean;
isCloudflare: boolean;
supportsGoogleProjectId: boolean;
isAntigravityFamily: boolean;
trimmedCloudCodeProjectId: string;
isGooglePse: boolean;
isCcCompatible: boolean;
Expand All @@ -116,7 +116,7 @@ export function assignEditApiKeyProviderSpecificData(options: {
else if (o.isCloudflare && o.formData.accountId.trim()) {
o.target.accountId = o.formData.accountId.trim();
}
if (o.supportsGoogleProjectId) o.target.projectId = o.trimmedCloudCodeProjectId || null;
if (o.isAntigravityFamily) o.target.projectId = o.trimmedCloudCodeProjectId || null;
if (o.isCcCompatible) {
o.target.requestDefaults = mergeCcCompatibleRequestDefaults(
o.target.requestDefaults,
Expand Down
44 changes: 44 additions & 0 deletions tests/unit/agy-projectid-ui.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { describe, it } from "node:test";
import assert from "node:assert";
import { readFileSync } from "node:fs";

const modalPath =
"src/app/(dashboard)/dashboard/providers/[id]/components/modals/EditConnectionModal.tsx";
const source = readFileSync(modalPath, "utf8");

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.

medium

Reading the source file directly and asserting on exact multiline strings containing \n is fragile because it can fail on Windows environments where git checkout converts line endings to CRLF (\r\n).\n\nNormalizing the line endings by replacing \r\n with \n right after reading the file ensures the test suite remains robust and platform-independent.

Suggested change
const source = readFileSync(modalPath, "utf8");
const source = readFileSync(modalPath, "utf8").replace(/\r\n/g, "\n");


describe("agy Project ID UI support", () => {
it("declares a single Antigravity-family provider gate", () => {
assert.ok(
source.includes(
'const isAntigravityFamily = provider === "antigravity" || provider === "agy";'
),
"isAntigravityFamily must include antigravity and agy without a separate Google Project ID gate"
);
});

it("does not keep the old supportsGoogleProjectId alias", () => {
assert.equal(source.includes("supportsGoogleProjectId"), false);
});

it("uses antigravityProjectIdLabel for Antigravity-family providers", () => {
assert.ok(
source.includes('label={t("antigravityProjectIdLabel")}'),
"projectId label must use Antigravity-family copy"
);
});

it("uses isAntigravityFamily for antigravityClientProfile UI", () => {
assert.ok(
source.includes("{isAntigravityFamily && (\n <div") &&
source.includes('label={t("antigravityClientProfileLabel")}'),
"client profile Select must render for isAntigravityFamily"
);
});

it("uses isAntigravityFamily for client profile save", () => {
assert.ok(
source.includes("if (isAntigravityFamily) {"),
"client profile save must use isAntigravityFamily"
);
});
});
Loading