Skip to content

Commit 147aba9

Browse files
committed
fix(server): match the bundled runtime ADC directory
1 parent 729027d commit 147aba9

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

‎apps/server/src/provider/antigravityAuthSupport.test.ts‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -677,10 +677,13 @@ it.layer(NodeServices.layer)("Antigravity Agent Platform credentials", (it) => {
677677
const sdkConfig = path.join(userHome, "sdk-config");
678678
yield* fs.makeDirectory(sdkConfig);
679679
yield* fs.makeDirectory(path.join(userHome, ".config", "gcloud"), { recursive: true });
680-
yield* fs.writeFileString(
681-
path.join(userHome, ".config", "gcloud", "application_default_credentials.json"),
682-
"{}",
680+
const adcPath = path.join(
681+
userHome,
682+
".config",
683+
"gcloud",
684+
"application_default_credentials.json",
683685
);
686+
yield* fs.writeFileString(adcPath, "{}");
684687
const auth: AntigravityAuthConfig = {
685688
authMethod: "agent-platform",
686689
apiKey: "",
@@ -699,12 +702,13 @@ it.layer(NodeServices.layer)("Antigravity Agent Platform credentials", (it) => {
699702
onGoogleCloud: Effect.succeed(onGoogleCloud),
700703
});
701704

702-
// CLOUDSDK_CONFIG replaces ~/.config/gcloud, as it does for gcloud.
705+
// The bundled Go harness ignores CLOUDSDK_CONFIG when finding ADC.
706+
expect(yield* issueWith({ CLOUDSDK_CONFIG: sdkConfig })).toBeNull();
707+
yield* fs.writeFileString(path.join(sdkConfig, "application_default_credentials.json"), "{}");
708+
yield* fs.remove(adcPath);
703709
expect(yield* issueWith({ CLOUDSDK_CONFIG: sdkConfig })).toContain(
704710
"gcloud auth application-default login",
705711
);
706-
yield* fs.writeFileString(path.join(sdkConfig, "application_default_credentials.json"), "{}");
707-
expect(yield* issueWith({ CLOUDSDK_CONFIG: sdkConfig })).toBeNull();
708712
expect(
709713
yield* issueWith({
710714
CLOUDSDK_CONFIG: path.join(userHome, "missing"),
@@ -722,6 +726,7 @@ it.layer(NodeServices.layer)("Antigravity Agent Platform credentials", (it) => {
722726
),
723727
).toBeNull();
724728

729+
yield* fs.writeFileString(adcPath, "{}");
725730
// Windows reads %APPDATA%\gcloud and never the POSIX path.
726731
expect(yield* issueWith({ APPDATA: userHome }, "win32")).toContain(
727732
"gcloud auth application-default login",
@@ -733,6 +738,7 @@ it.layer(NodeServices.layer)("Antigravity Agent Platform credentials", (it) => {
733738
);
734739
expect(yield* issueWith({ APPDATA: userHome }, "win32")).toBeNull();
735740

741+
yield* fs.remove(adcPath);
736742
// A metadata server supplies credentials without any local file.
737743
const missing = { CLOUDSDK_CONFIG: path.join(userHome, "missing") };
738744
expect(yield* issueWith(missing, "linux")).toContain("gcloud auth application-default login");

‎apps/server/src/provider/antigravityAuthSupport.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,9 @@ export const antigravityAuthIssue = Effect.fn("antigravityAuthIssue")(function*
158158
const fs = yield* FileSystem.FileSystem;
159159
const path = yield* Path.Path;
160160
const gcloudDirectory =
161-
host.environment.CLOUDSDK_CONFIG ||
162-
(host.platform === "win32"
161+
host.platform === "win32"
163162
? host.environment.APPDATA && path.join(host.environment.APPDATA, "gcloud")
164-
: path.join(host.userHome, ".config", "gcloud"));
163+
: path.join(host.userHome, ".config", "gcloud");
165164
if (
166165
gcloudDirectory &&
167166
(yield* fs

0 commit comments

Comments
 (0)