Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

AntigravityInstallation.test.ts

1,081 lines46.5 KB

1import * as NodeServices from "@effect/platform-node/NodeServices";
2import { expect, it } from "@effect/vitest";
3import * as HostProcess from "@t3tools/shared/HostProcess";
4import * as Crypto from "effect/Crypto";
5import * as Deferred from "effect/Deferred";
6import * as Effect from "effect/Effect";
7import * as Hex from "effect/encoding/Hex";
8import * as Exit from "effect/Exit";
9import * as Fiber from "effect/Fiber";
10import * as FileSystem from "effect/FileSystem";
11import * as Option from "effect/Option";
12import * as Path from "effect/Path";
13import * as PlatformError from "effect/PlatformError";
14import * as Queue from "effect/Queue";
15import * as Schema from "effect/Schema";
16import * as Scope from "effect/Scope";
17import * as Sink from "effect/Sink";
18import * as Stream from "effect/Stream";
19import * as TestClock from "effect/testing/TestClock";
20import { HttpClient, HttpClientResponse } from "effect/http";
21import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
22​
23import * as AntigravityInstallation from "./AntigravityInstallation.ts";
24import { ANTIGRAVITY_AUTH_BROWSER_MARKER } from "./antigravityAuthSupport.ts";
25import {
26 resolveAntigravityReleaseAsset,
27 type AntigravityReleaseAsset,
28} from "./antigravityRelease.ts";
29​
30import antigravityInitialize from "../../../../packages/effect-acp/test/fixtures/antigravity-initialize.json" with { type: "json" };
31​
32const serverContents = "antigravity runtime\n";
33const harnessContents = "local harness\n";
34const previousReleaseId = "1".repeat(64);
35const previousVersion = "fixture-old";
36const encodeJsonString = Schema.encodeSync(Schema.fromJsonString(Schema.Unknown));
37​
38// Small ZIPs made with Python's zipfile module. The unsafe entries are intentional.
39const zipFixtures = {
40 complete:
41 "UEsDBBQAAAAIAAAAIl1zEy/oFAAAABQAAAASAAAAYWd5X2FjcF9zZXJ2ZXIucGFyS8wryUwvSizLLKlUKCoFcnJTuQBQSwMEFAAAAAgAAAAiXV9yAykQAAAADgAAABUAAABsb2NhbGhhcm5lc3NfZXh0ZXJuYWzLyU9OzFHISCzKSy0u5gIAUEsBAhQDFAAAAAgAAAAiXXMTL+gUAAAAFAAAABIAAAAAAAAAAAAAAO2BAAAAAGFneV9hY3Bfc2VydmVyLnBhclBLAQIUAxQAAAAIAAAAIl1fcgMpEAAAAA4AAAAVAAAAAAAAAAAAAADtgUQAAABsb2NhbGhhcm5lc3NfZXh0ZXJuYWxQSwUGAAAAAAIAAgCDAAAAhwAAAAAA",
42 missingHarness:
43 "UEsDBBQAAAAIAAAAIl1zEy/oFAAAABQAAAASAAAAYWd5X2FjcF9zZXJ2ZXIucGFyS8wryUwvSizLLKlUKCoFcnJTuQBQSwECFAMUAAAACAAAACJdcxMv6BQAAAAUAAAAEgAAAAAAAAAAAAAA7YEAAAAAYWd5X2FjcF9zZXJ2ZXIucGFyUEsFBgAAAAABAAEAQAAAAEQAAAAAAA==",
44 duplicate:
45 "UEsDBBQAAAAIAAAAIl1zEy/oFAAAABQAAAASAAAAYWd5X2FjcF9zZXJ2ZXIucGFyS8wryUwvSizLLKlUKCoFcnJTuQBQSwMEFAAAAAgAAAAiXXMTL+gUAAAAFAAAABIAAABhZ3lfYWNwX3NlcnZlci5wYXJLzCvJTC9KLMssqVQoKgVyclO5AFBLAQIUAxQAAAAIAAAAIl1zEy/oFAAAABQAAAASAAAAAAAAAAAAAADtgQAAAABhZ3lfYWNwX3NlcnZlci5wYXJQSwECFAMUAAAACAAAACJdcxMv6BQAAAAUAAAAEgAAAAAAAAAAAAAA7YFEAAAAYWd5X2FjcF9zZXJ2ZXIucGFyUEsFBgAAAAACAAIAgAAAAIgAAAAAAA==",
46 traversal:
47 "UEsDBBQAAAAIAAAAIl1zEy/oFAAAABQAAAAVAAAALi5cYWd5X2FjcF9zZXJ2ZXIucGFyS8wryUwvSizLLKlUKCoFcnJTuQBQSwMEFAAAAAgAAAAiXV9yAykQAAAADgAAABUAAABsb2NhbGhhcm5lc3NfZXh0ZXJuYWzLyU9OzFHISCzKSy0u5gIAUEsBAhQDFAAAAAgAAAAiXXMTL+gUAAAAFAAAABUAAAAAAAAAAAAAAO2BAAAAAC4uXGFneV9hY3Bfc2VydmVyLnBhclBLAQIUAxQAAAAIAAAAIl1fcgMpEAAAAA4AAAAVAAAAAAAAAAAAAADtgUcAAABsb2NhbGhhcm5lc3NfZXh0ZXJuYWxQSwUGAAAAAAIAAgCGAAAAigAAAAAA",
48 symlink:
49 "UEsDBBQAAAAIAAAAIl1zEy/oFAAAABQAAAASAAAAYWd5X2FjcF9zZXJ2ZXIucGFyS8wryUwvSizLLKlUKCoFcnJTuQBQSwMEFAAAAAgAAAAiXV9yAykQAAAADgAAABUAAABsb2NhbGhhcm5lc3NfZXh0ZXJuYWzLyU9OzFHISCzKSy0u5gIAUEsBAhQDFAAAAAgAAAAiXXMTL+gUAAAAFAAAABIAAAAAAAAAAAAAAO2BAAAAAGFneV9hY3Bfc2VydmVyLnBhclBLAQIUAxQAAAAIAAAAIl1fcgMpEAAAAA4AAAAVAAAAAAAAAAAAAAD/oUQAAABsb2NhbGhhcm5lc3NfZXh0ZXJuYWxQSwUGAAAAAAIAAgCDAAAAhwAAAAAA",
50 oversizedMember:
51 "UEsDBBQAAAAIAAAAIl0WGThFFQAAABUAAAASAAAAYWd5X2FjcF9zZXJ2ZXIucGFyS8wryUwvSizLLKlUKCoFcnJTuSoAUEsDBBQAAAAIAAAAIl1fcgMpEAAAAA4AAAAVAAAAbG9jYWxoYXJuZXNzX2V4dGVybmFsy8lPTsxRyEgsykstLuYCAFBLAQIUAxQAAAAIAAAAIl0WGThFFQAAABUAAAASAAAAAAAAAAAAAADtgQAAAABhZ3lfYWNwX3NlcnZlci5wYXJQSwECFAMUAAAACAAAACJdX3IDKRAAAAAOAAAAFQAAAAAAAAAAAAAA7YFFAAAAbG9jYWxoYXJuZXNzX2V4dGVybmFsUEsFBgAAAAACAAIAgwAAAIgAAAAAAA==",
52 windows:
53 "UEsDBBQAAAAIAAAAIl1zEy/oFAAAABQAAAASAAAAYWd5X2FjcF9zZXJ2ZXIuZXhlS8wryUwvSizLLKlUKCoFcnJTuQBQSwMEFAAAAAgAAAAiXV9yAykQAAAADgAAABkAAABsb2NhbGhhcm5lc3NfZXh0ZXJuYWwuZXhly8lPTsxRyEgsykstLuYCAFBLAQIUAxQAAAAIAAAAIl1zEy/oFAAAABQAAAASAAAAAAAAAAAAAADtgQAAAABhZ3lfYWNwX3NlcnZlci5leGVQSwECFAMUAAAACAAAACJdX3IDKRAAAAAOAAAAGQAAAAAAAAAAAAAA7YFEAAAAbG9jYWxoYXJuZXNzX2V4dGVybmFsLmV4ZVBLBQYAAAAAAgACAIcAAACLAAAAAAA=",
54};
55​
56// The installation checks POSIX exec bits off the real filesystem unless the
57// platform is win32, so a linux platform mock cannot pass on NTFS. Default to
58// the host and let the fixture names follow; the suite is about install
59// mechanics, which are the same on every platform.
60const hostPlatform: NodeJS.Platform =
61 HostProcess.Platform.defaultValue() === "win32" ? "win32" : "linux";
62const completeArchive = Buffer.from(
63 hostPlatform === "win32" ? zipFixtures.windows : zipFixtures.complete,
64 "base64",
65);
66const executableName = hostPlatform === "win32" ? "agy_acp_server.exe" : "agy_acp_server.par";
67const harnessName =
68 hostPlatform === "win32" ? "localharness_external.exe" : "localharness_external";
69​
70const releaseAsset = Effect.fn("test.antigravityReleaseAsset")(function* (
71 archive: Uint8Array = completeArchive,
72 platform: NodeJS.Platform = hostPlatform,
73) {
74 const crypto = yield* Crypto.Crypto;
75 return {
76 version: "fixture-new",
77 url: "https://dl.google.com/antigravity-test.zip",
78 sha256: Hex.encode(yield* crypto.digest("SHA-256", archive).pipe(Effect.orDie)),
79 archiveBytes: archive.byteLength,
80 executable: {
81 name: platform === "win32" ? "agy_acp_server.exe" : "agy_acp_server.par",
82 bytes: Buffer.byteLength(serverContents),
83 },
84 harness: {
85 name: platform === "win32" ? "localharness_external.exe" : "localharness_external",
86 bytes: Buffer.byteLength(harnessContents),
87 },
88 } satisfies AntigravityReleaseAsset;
89});
90​
91const writeRelease = Effect.fn("test.writeAntigravityRelease")(function* (
92 managedDirectory: string,
93 asset: AntigravityReleaseAsset,
94 active = true,
95) {
96 const fs = yield* FileSystem.FileSystem;
97 const path = yield* Path.Path;
98 const directory = path.join(managedDirectory, "versions", asset.sha256);
99 yield* fs.makeDirectory(directory, { recursive: true });
100 yield* fs.writeFileString(path.join(directory, asset.executable.name), serverContents, {
101 mode: 0o755,
102 });
103 yield* fs.writeFileString(path.join(directory, asset.harness.name), harnessContents, {
104 mode: 0o755,
105 });
106 yield* fs.writeFileString(
107 path.join(directory, ".install-complete.json"),
108 encodeJsonString({
109 releaseId: asset.sha256,
110 version: asset.version,
111 executable: asset.executable,
112 harness: asset.harness,
113 }),
114 );
115 if (active) {
116 yield* fs.writeFileString(
117 path.join(managedDirectory, "active.json"),
118 encodeJsonString({ releaseId: asset.sha256 }),
119 );
120 }
121});
122​
123interface HarnessOptions {
124 readonly baseDir?: string;
125 readonly asset?: AntigravityReleaseAsset | null;
126 readonly archive?: Buffer;
127 readonly body?: Stream.Stream<Uint8Array> | undefined;
128 readonly contentLength?: number;
129 readonly contentEncoding?: string;
130 readonly platform?: NodeJS.Platform;
131 readonly arch?: NodeJS.Architecture;
132 readonly path?: string;
133 readonly previous?: boolean;
134 readonly fileSystem?: FileSystem.FileSystem;
135 readonly validate?: AntigravityInstallation.AntigravityInstallationOptions["validate"];
136 readonly useDefaultValidation?: boolean;
138​
139const makeHarness = Effect.fn("test.makeAntigravityInstallation")(function* (
140 options: HarnessOptions = {},
141) {
142 const fs = yield* FileSystem.FileSystem;
143 const path = yield* Path.Path;
144 const baseDir =
145 options.baseDir ?? (yield* fs.makeTempDirectoryScoped({ prefix: "t3-agy-test-" }));
146 const platform = options.platform ?? hostPlatform;
147 const arch = options.arch ?? "x64";
148 const archive = options.archive ?? completeArchive;
149 const asset =
150 options.asset === undefined ? yield* releaseAsset(archive, platform) : options.asset;
151 const managedDirectory = path.join(baseDir, "tools", "antigravity-acp", `${platform}-${arch}`);
152 if (options.previous) {
153 yield* writeRelease(managedDirectory, {
154 ...(yield* releaseAsset(archive, platform)),
155 sha256: previousReleaseId,
156 version: previousVersion,
157 });
158 }
159 const stagingReleased = yield* Deferred.make<void>();
160 const requests: string[] = [];
161 const validations: Array<{
162 executable: AntigravityInstallation.AntigravityExecutable;
163 version: string;
164 }> = [];
165 const installationFs = options.fileSystem ?? fs;
166 const trackedFs = FileSystem.FileSystem.of({
167 ...installationFs,
168 makeTempDirectoryScoped: (settings) =>
169 settings?.prefix === ".install-"
170 ? Effect.acquireRelease(installationFs.makeTempDirectory(settings), (directory) =>
171 fs
172 .remove(directory, { recursive: true, force: true })
173 .pipe(Effect.orDie, Effect.andThen(Deferred.succeed(stagingReleased, undefined))),
174 )
175 : installationFs.makeTempDirectoryScoped(settings),
176 });
177 const installation = yield* AntigravityInstallation.makeAntigravityInstallation({
178 baseDir,
179 releaseAsset: asset,
180 ...(options.useDefaultValidation
181 ? {}
182 : {
183 validate: (executable: AntigravityInstallation.AntigravityExecutable, version: string) =>
184 Effect.sync(() => validations.push({ executable, version })).pipe(
185 Effect.andThen(options.validate?.(executable, version) ?? Effect.void),
186 ),
187 }),
188 }).pipe(
189 Effect.provideService(FileSystem.FileSystem, trackedFs),
190 Effect.provideService(HostProcess.Platform, platform),
191 Effect.provideService(HostProcess.Architecture, arch),
192 Effect.provideService(HostProcess.Environment, { PATH: options.path ?? "" }),
193 Effect.provideService(
194 HttpClient.HttpClient,
195 HttpClient.make((request) =>
196 Effect.sync(() => {
197 requests.push(request.url);
198 const response = HttpClientResponse.fromWeb(
199 request,
200 new Response(null, {
201 headers: {
202 ...(options.contentLength === undefined
203 ? {}
204 : { "content-length": String(options.contentLength) }),
205 ...(options.contentEncoding === undefined
206 ? {}
207 : { "content-encoding": options.contentEncoding }),
208 },
209 }),
210 );
211 return Object.defineProperty(response, "stream", {
212 value:
213 options.body ??
214 Stream.make(
215 archive.subarray(0, 31),
216 archive.subarray(31, 149),
217 archive.subarray(149),
218 ),
219 });
220 }),
221 ),
222 ),
223 );
224 return { installation, fs, path, baseDir, requests, validations, stagingReleased };
225});
226​
227const terminalState = (installation: AntigravityInstallation.AntigravityInstallation["Service"]) =>
228 installation.changes.pipe(
229 Stream.filter((state) => ["succeeded", "failed", "cancelled"].includes(state.phase)),
230 Stream.runHead,
231 Effect.map(Option.getOrThrow),
232 );
233​
234const expectPreviousRelease = Effect.fn("test.expectPreviousAntigravityRelease")(function* (
235 installation: AntigravityInstallation.AntigravityInstallation["Service"],
236) {
237 const fs = yield* FileSystem.FileSystem;
238 const path = yield* Path.Path;
239 const resolved = yield* installation.resolve();
240 expect(resolved.version).toBe(previousVersion);
241 expect(resolved.managedVersionDirectory).toBe(
242 path.join(installation.managedDirectory, "versions", previousReleaseId),
243 );
244 expect(yield* fs.readFileString(resolved.executablePath)).toBe(serverContents);
245 expect(yield* fs.readFileString(resolved.harnessPath)).toBe(harnessContents);
246 expect((yield* installation.state).installedVersion).toBe(previousVersion);
247});
248​
249it.layer(NodeServices.layer)("Antigravity installation", (it) => {
250 it.effect("reports missing Node before downloading the standalone provider runtime", () =>
251 Effect.gen(function* () {
252 const { installation, requests, validations } = yield* makeHarness();
253 yield* installation.start;
254 expect(yield* terminalState(installation)).toMatchObject({
255 phase: "failed",
256 message: expect.stringContaining("Install Node.js"),
257 });
258 expect(requests).toEqual([]);
259 expect(validations).toEqual([]);
260 }).pipe(Effect.provideService(HostProcess.IsExecutable, true)),
261 );
262​
263 it.effect("verifies both files before activating a streamed download", () =>
264 Effect.gen(function* () {
265 const enteredValidation = yield* Deferred.make<void>();
266 const finishValidation = yield* Deferred.make<void>();
267 const { installation, fs, path, validations, requests, stagingReleased } = yield* makeHarness(
268 {
269 previous: true,
270 validate: () =>
271 Deferred.succeed(enteredValidation, undefined).pipe(
272 Effect.andThen(Deferred.await(finishValidation)),
273 ),
274 },
275 );
276 const initial = yield* installation.changes.pipe(
277 Stream.runHead,
278 Effect.map(Option.getOrThrow),
279 );
280 expect(initial).toMatchObject({ phase: "idle", installedVersion: previousVersion });
281 const started = yield* installation.start;
282 expect(started).toMatchObject({ phase: "downloading", downloadedBytes: 0 });
283 yield* Deferred.await(enteredValidation);
284 yield* expectPreviousRelease(installation);
285 const validation = validations[0];
286 expect(validation?.version).toBe("fixture-new");
287 if (!validation) return yield* Effect.die("Expected runtime validation.");
288 expect(yield* fs.readFileString(validation.executable.executablePath)).toBe(serverContents);
289 expect(yield* fs.readFileString(validation.executable.harnessPath)).toBe(harnessContents);
290​
291 yield* Deferred.succeed(finishValidation, undefined);
292 expect(yield* terminalState(installation)).toMatchObject({
293 phase: "succeeded",
294 operationId: started.operationId,
295 downloadedBytes: completeArchive.byteLength,
296 installedVersion: "fixture-new",
297 });
298 yield* Deferred.await(stagingReleased);
299 const selected = yield* installation.resolve();
300 expect(selected).toMatchObject({ source: "managed", version: "fixture-new" });
301 expect(path.dirname(selected.harnessPath)).toBe(path.dirname(selected.executablePath));
302 expect(yield* fs.readFileString(selected.executablePath)).toBe(serverContents);
303 expect(yield* fs.readFileString(selected.harnessPath)).toBe(harnessContents);
304 expect(yield* fs.readDirectory(path.join(installation.managedDirectory, "versions"))).toEqual(
305 expect.arrayContaining([previousReleaseId, (yield* releaseAsset()).sha256]),
306 );
307 expect(requests).toEqual([(yield* releaseAsset()).url]);
308 }),
309 );
310​
311 it.effect.each(
312 [
313 {
314 name: "the expected release with protocol 1",
315 protocolVersion: 1,
316 agentName: "antigravity-acp",
317 version: "fixture-new",
318 valid: true,
319 },
320 {
321 name: "the expected release with protocol 2 and legacy fields",
322 protocolVersion: 2,
323 agentName: "antigravity-acp",
324 version: "fixture-new",
325 valid: true,
326 },
327 {
328 name: "an unsupported protocol version",
329 protocolVersion: 3,
330 agentName: "antigravity-acp",
331 version: "fixture-new",
332 valid: false,
333 },
334 { name: "a different agent", agentName: "other-agent", version: "fixture-new", valid: false },
335 {
336 name: "a different version",
337 agentName: "antigravity-acp",
338 version: "other-version",
339 valid: false,
340 },
341 {
342 name: "the Windows ARM release with locked child processes",
343 platform: "win32" as const,
344 arch: "arm64" as const,
345 agentName: "antigravity-acp",
346 version: "fixture-new",
347 valid: true,
348 },
349 {
350 name: "an invalid Windows ARM release with locked child processes",
351 platform: "win32" as const,
352 arch: "arm64" as const,
353 agentName: "antigravity-acp",
354 version: "other-version",
355 valid: false,
356 },
357 {
358 name: "a cancelled Windows ARM verification with locked child processes",
359 platform: "win32" as const,
360 arch: "arm64" as const,
361 agentName: "antigravity-acp",
362 version: "fixture-new",
363 cancel: true,
364 valid: false,
365 },
366 ].flatMap((testCase) => {
367 const cleanupErrorTags =
368 testCase.platform === "win32"
369 ? (["Unknown", "PermissionDenied", "Busy"] as const)
370 : (["Unknown"] as const);
371 return cleanupErrorTags.map((cleanupErrorTag) => ({
372 ...testCase,
373 cleanupErrorTag,
374 name: `${cleanupErrorTag}: ${testCase.name}`,
375 }));
376 }),
377 )("validates $name with initialize only and removes the disposable profile", (testCase) =>
378 Effect.gen(function* () {
379 const fs = yield* FileSystem.FileSystem;
380 const platform = testCase.platform ?? hostPlatform;
381 const encoder = new TextEncoder();
382 const decodeRequest = Schema.decodeUnknownEffect(
383 Schema.fromJsonString(
384 Schema.Struct({
385 id: Schema.Union([Schema.String, Schema.Number]),
386 method: Schema.String,
387 }),
388 ),
389 );
390 const methods: string[] = [];
391 const profiles = new Set<string>();
392 const cleanupRetryStarted = yield* Deferred.make<void>();
393 const initializationStarted = yield* Deferred.make<void>();
394 let childProcessesRunning = false;
395 let profileRemovalAttempts = 0;
396 let closedRuntimes = 0;
397 const spawner = ChildProcessSpawner.make(
398 Effect.fn("test.spawnAntigravityValidator")(function* (command) {
399 if (command._tag !== "StandardCommand") {
400 return yield* Effect.die("Expected one validation process.");
401 }
402 const profile = command.options.env?.GEMINI_HOME;
403 if (!profile) return yield* Effect.die("Expected a disposable validation profile.");
404 profiles.add(profile);
405 const helper = command.args[0] === "-e";
406 if (!helper) childProcessesRunning = true;
407 // The runtime unpacks straight into the disposable profile.
408 if (!helper) {
409 if (platform === "win32") {
410 expect(command.options.env?.TEMP).toBe(profile);
411 expect(command.options.env?.TMP).toBe(profile);
412 } else {
413 expect(command.options.env?.TMPDIR).toBe(profile);
414 }
415 }
416 const output = yield* Queue.unbounded<Uint8Array>();
417 const exited = yield* Deferred.make<ChildProcessSpawner.ExitCode>();
418 const terminate = Deferred.succeed(exited, ChildProcessSpawner.ExitCode(0)).pipe(
419 Effect.asVoid,
420 );
421 yield* Effect.addFinalizer(() =>
422 terminate.pipe(
423 Effect.andThen(Queue.shutdown(output)),
424 Effect.andThen(
425 Effect.sync(() => {
426 if (!helper) closedRuntimes += 1;
427 }),
428 ),
429 ),
430 );
431 return ChildProcessSpawner.makeHandle({
432 pid: ChildProcessSpawner.ProcessId(helper ? 1 : 2),
433 exitCode: helper
434 ? Effect.succeed(ChildProcessSpawner.ExitCode(0))
435 : Deferred.await(exited),
436 isRunning: Deferred.isDone(exited).pipe(Effect.map((done) => !done)),
437 kill: () =>
438 Effect.sync(() => {
439 if (!helper) childProcessesRunning = false;
440 }).pipe(Effect.andThen(terminate)),
441 unref: Effect.succeed(Effect.void),
442 stdin: Sink.forEach((bytes: Uint8Array) =>
443 Effect.gen(function* () {
444 const request = yield* decodeRequest(new TextDecoder().decode(bytes)).pipe(
445 Effect.orDie,
446 );
447 methods.push(request.method);
448 if (testCase.cancel) {
449 yield* Deferred.succeed(initializationStarted, undefined);
450 return;
451 }
452 yield* Queue.offer(
453 output,
454 encoder.encode(
455 `${encodeJsonString({
456 jsonrpc: "2.0",
457 id: request.id,
458 ...(request.method === "initialize"
459 ? {
460 result: {
461 ...antigravityInitialize,
462 protocolVersion: testCase.protocolVersion ?? 2,
463 agentInfo: { name: testCase.agentName, version: testCase.version },
464 },
465 }
466 : {
467 error: {
468 code: -32601,
469 message: "Validation must not sign in or create sessions.",
470 },
471 }),
472 })}\n`,
473 ),
474 );
475 }),
476 ),
477 stdout: helper ? Stream.empty : Stream.fromQueue(output),
478 stderr: helper
479 ? Stream.make(
480 encoder.encode(
481 `${ANTIGRAVITY_AUTH_BROWSER_MARKER}${encodeJsonString(command.args.at(-1))}\n`,
482 ),
483 )
484 : Stream.empty,
485 all: Stream.empty,
486 getInputFd: () => Sink.drain,
487 getOutputFd: () => Stream.empty,
488 });
489 }),
490 );
491 const { installation, stagingReleased } = yield* makeHarness({
492 previous: true,
493 useDefaultValidation: true,
494 platform,
495 ...(testCase.arch ? { arch: testCase.arch } : {}),
496 archive:
497 platform === "win32" ? Buffer.from(zipFixtures.windows, "base64") : completeArchive,
498 fileSystem: FileSystem.FileSystem.of({
499 ...fs,
500 remove: (target, options) =>
501 Effect.suspend(() => {
502 if (platform === "win32" && profiles.has(target)) {
503 profileRemovalAttempts += 1;
504 expect(childProcessesRunning).toBe(false);
505 // Even after the tree exits, Windows can briefly retain a DLL handle.
506 if (profileRemovalAttempts === 1) {
507 return Deferred.succeed(cleanupRetryStarted, undefined).pipe(
508 Effect.andThen(
509 Effect.fail(
510 PlatformError.systemError({
511 _tag: testCase.cleanupErrorTag,
512 module: "FileSystem",
513 method: "remove",
514 description: "Unpacked DLL is in use",
515 }),
516 ),
517 ),
518 );
519 }
520 }
521 return fs.remove(target, options);
522 }),
523 }),
524 }).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner));
525 const started = yield* installation.start;
526 const cancellation = testCase.cancel
527 ? yield* Deferred.await(initializationStarted).pipe(
528 Effect.andThen(installation.cancel(started.operationId!)),
529 Effect.forkChild,
530 )
531 : undefined;
532 if (platform === "win32") {
533 yield* Effect.raceFirst(
534 Deferred.await(cleanupRetryStarted).pipe(Effect.andThen(TestClock.adjust("100 millis"))),
535 terminalState(installation),
536 );
537 }
538 if (cancellation) yield* Fiber.join(cancellation);
539 expect((yield* terminalState(installation)).phase).toBe(
540 testCase.cancel ? "cancelled" : testCase.valid ? "succeeded" : "failed",
541 );
542 yield* Deferred.await(stagingReleased);
543 expect(methods).toEqual(["initialize"]);
544 expect(closedRuntimes).toBe(1);
545 expect(profiles.size).toBe(1);
546 if (platform === "win32") expect(profileRemovalAttempts).toBe(2);
547 for (const profile of profiles) {
548 expect(yield* fs.exists(profile)).toBe(false);
549 }
550 if (testCase.valid) {
551 expect((yield* installation.resolve()).version).toBe("fixture-new");
552 } else {
553 yield* expectPreviousRelease(installation);
554 }
555 }),
556 );
557​
558 it.effect("accepts an encoded Content-Length when the body is compressed", () =>
559 Effect.gen(function* () {
560 // dl.google.com gzips the archive and reports the encoded size. The decoded
561 // stream is still checked byte for byte and by hash.
562 const { installation, validations } = yield* makeHarness({
563 contentLength: completeArchive.byteLength - 1_000,
564 contentEncoding: "gzip",
565 });
566 yield* installation.start;
567 const state = yield* terminalState(installation);
568 expect(state.phase).toBe("succeeded");
569 expect(validations).toHaveLength(1);
570 }),
571 );
572​
573 it.effect.each([
574 { name: "checksum mismatch", completeAsset: { sha256: "2".repeat(64) } },
575 { name: "short download", archive: completeArchive.subarray(0, -1), completeAsset: {} },
576 {
577 name: "oversized download",
578 archive: Buffer.concat([completeArchive, Buffer.from("extra")]),
579 completeAsset: {},
580 },
581 { name: "wrong Content-Length", contentLength: completeArchive.byteLength + 1 },
582 { name: "missing harness", archive: Buffer.from(zipFixtures.missingHarness, "base64") },
583 { name: "duplicate executable", archive: Buffer.from(zipFixtures.duplicate, "base64") },
584 { name: "path traversal", archive: Buffer.from(zipFixtures.traversal, "base64") },
585 { name: "symbolic link", archive: Buffer.from(zipFixtures.symlink, "base64") },
586 { name: "oversized member", archive: Buffer.from(zipFixtures.oversizedMember, "base64") },
587 ])("rejects $name before runtime validation", ({ completeAsset, ...options }) =>
588 Effect.gen(function* () {
589 // Pin the asset to the complete archive so the download itself is what disagrees.
590 const asset =
591 completeAsset === undefined ? undefined : { ...(yield* releaseAsset()), ...completeAsset };
592 const { installation, validations, stagingReleased, fs, path } = yield* makeHarness({
593 ...options,
594 ...(asset === undefined ? {} : { asset }),
595 previous: true,
596 });
597 yield* installation.start;
598 const state = yield* terminalState(installation);
599 expect(state.phase).toBe("failed");
600 expect(state.message).toBeTruthy();
601 expect(validations).toEqual([]);
602 yield* Deferred.await(stagingReleased);
603 yield* expectPreviousRelease(installation);
604 expect(yield* fs.readDirectory(path.join(installation.managedDirectory, "versions"))).toEqual(
605 [previousReleaseId],
606 );
607 }),
608 );
609​
610 it.effect.each(["download", "extract", "active pointer"] as const)(
611 "preserves the old runtime after an ENOSPC error during %s",
612 (stage) =>
613 Effect.gen(function* () {
614 const fs = yield* FileSystem.FileSystem;
615 const noSpace = PlatformError.systemError({
616 _tag: "Unknown",
617 module: "FileSystem",
618 method: "write",
619 description: "ENOSPC: no space left on device",
620 });
621 const fileSystem = FileSystem.FileSystem.of({
622 ...fs,
623 sink: (target, options) =>
624 (stage === "download" && target.endsWith("download.zip")) ||
625 (stage === "extract" && target.endsWith(executableName))
626 ? fs.sink(target, options).pipe(Sink.mapInputEffect(() => Effect.fail(noSpace)))
627 : fs.sink(target, options),
628 writeFileString: (target, content, options) =>
629 stage === "active pointer" && target.endsWith("contents.tmp")
630 ? Effect.fail(noSpace)
631 : fs.writeFileString(target, content, options),
632 });
633 const { installation, stagingReleased, path } = yield* makeHarness({
634 previous: true,
635 fileSystem,
636 });
637 yield* installation.start;
638 expect((yield* terminalState(installation)).phase).toBe("failed");
639 yield* Deferred.await(stagingReleased);
640 yield* expectPreviousRelease(installation);
641 expect(
642 (yield* fs.readDirectory(path.join(installation.managedDirectory, "versions"))).some(
643 (name) => name.startsWith(".install-"),
644 ),
645 ).toBe(false);
646 expect(yield* fs.readDirectory(installation.managedDirectory)).toEqual([
647 "active.json",
648 "versions",
649 ]);
650 }),
651 );
652​
653 it.effect.each(["downloading", "extracting", "verifying"] as const)(
654 "cancels during %s and waits for open resources to close",
655 (phase) =>
656 Effect.gen(function* () {
657 const fs = yield* FileSystem.FileSystem;
658 const entered = yield* Deferred.make<void>();
659 const release = yield* Deferred.make<void>();
660 const interrupted = yield* Deferred.make<void>();
661 const barrier = Deferred.succeed(entered, undefined).pipe(
662 Effect.andThen(Deferred.await(release)),
663 Effect.onInterrupt(() => Deferred.succeed(interrupted, undefined)),
664 );
665 const { installation, stagingReleased, path, validations } = yield* makeHarness({
666 previous: true,
667 body:
668 phase === "downloading"
669 ? Stream.concat(
670 Stream.make(completeArchive.subarray(0, 31)),
671 Stream.fromEffect(barrier.pipe(Effect.as(completeArchive.subarray(31)))),
672 )
673 : undefined,
674 validate: phase === "verifying" ? () => barrier : undefined,
675 fileSystem: FileSystem.FileSystem.of({
676 ...fs,
677 sink: (target, options) =>
678 phase === "extracting" && target.endsWith(executableName)
679 ? fs
680 .sink(target, options)
681 .pipe(
682 Sink.mapInputEffect((chunk: Uint8Array) => barrier.pipe(Effect.as(chunk))),
683 )
684 : fs.sink(target, options),
685 }),
686 });
687 const started = yield* installation.start;
688 yield* Deferred.await(entered);
689 expect((yield* installation.state).phase).toBe(phase);
690 expect(
691 (yield* installation.cancel(started.operationId ?? "missing-operation-id")).phase,
692 ).toBe("cancelled");
693 yield* Deferred.await(interrupted);
694 yield* Deferred.await(stagingReleased);
695 yield* expectPreviousRelease(installation);
696 expect(validations).toHaveLength(phase === "verifying" ? 1 : 0);
697 expect(
698 yield* fs.readDirectory(path.join(installation.managedDirectory, "versions")),
699 ).toEqual([previousReleaseId]);
700 }),
701 );
702​
703 it.effect.each([
704 { name: "the committed install", restart: false },
705 { name: "a newer install", restart: true },
706 ])("does not fail $name when old pointer cleanup fails", (testCase) =>
707 Effect.gen(function* () {
708 const fs = yield* FileSystem.FileSystem;
709 const cleanupStarted = yield* Deferred.make<void>();
710 const releaseCleanup = yield* Deferred.make<void>();
711 const nextValidationStarted = yield* Deferred.make<void>();
712 const releaseNextValidation = yield* Deferred.make<void>();
713 const firstWorker = yield* Deferred.make<Fiber.Fiber<unknown, unknown>>();
714 const cleanupError = PlatformError.systemError({
715 _tag: "PermissionDenied",
716 module: "FileSystem",
717 method: "remove",
718 description: "EPERM: pointer temp directory is in use",
719 });
720 let firstPointer = true;
721 let validationCount = 0;
722 const { installation, stagingReleased } = yield* makeHarness({
723 previous: true,
724 validate: () => {
725 validationCount += 1;
726 return validationCount === 2
727 ? Deferred.succeed(nextValidationStarted, undefined).pipe(
728 Effect.andThen(Deferred.await(releaseNextValidation)),
729 )
730 : Effect.void;
731 },
732 fileSystem: FileSystem.FileSystem.of({
733 ...fs,
734 makeTempDirectoryScoped: (settings) => {
735 if (settings?.prefix !== "active.json." || !firstPointer) {
736 return fs.makeTempDirectoryScoped(settings);
737 }
738 firstPointer = false;
739 return Effect.fiber.pipe(
740 Effect.tap((worker) => Deferred.succeed(firstWorker, worker)),
741 Effect.andThen(
742 Effect.acquireRelease(fs.makeTempDirectory(settings), () =>
743 Deferred.succeed(cleanupStarted, undefined).pipe(
744 Effect.andThen(Deferred.await(releaseCleanup)),
745 Effect.andThen(Effect.die(cleanupError)),
746 ),
747 ),
748 ),
749 );
750 },
751 }),
752 });
753 yield* Effect.gen(function* () {
754 const first = yield* installation.start;
755 yield* Deferred.await(cleanupStarted);
756 expect(yield* installation.state).toMatchObject({
757 operationId: first.operationId,
758 phase: "succeeded",
759 installedVersion: "fixture-new",
760 });
761 const current = testCase.restart ? yield* installation.start : first;
762 if (testCase.restart) yield* Deferred.await(nextValidationStarted);
763​
764 yield* Deferred.succeed(releaseCleanup, undefined);
765 yield* Fiber.await(yield* Deferred.await(firstWorker));
766 yield* Deferred.await(stagingReleased);
767 expect(yield* installation.state).toMatchObject({
768 operationId: current.operationId,
769 phase: testCase.restart ? "verifying" : "succeeded",
770 installedVersion: "fixture-new",
771 });
772 expect((yield* installation.resolve()).version).toBe("fixture-new");
773​
774 yield* Deferred.succeed(releaseNextValidation, undefined);
775 expect(yield* terminalState(installation)).toMatchObject({
776 operationId: current.operationId,
777 phase: "succeeded",
778 installedVersion: "fixture-new",
779 });
780 }).pipe(
781 Effect.ensuring(
782 Deferred.succeed(releaseCleanup, undefined).pipe(
783 Effect.andThen(Deferred.succeed(releaseNextValidation, undefined)),
784 ),
785 ),
786 );
787 }),
788 );
789​
790 it.effect(
791 "shares one install across callers and keeps it alive after the caller scope closes",
792 () =>
793 Effect.gen(function* () {
794 const entered = yield* Deferred.make<void>();
795 const release = yield* Deferred.make<void>();
796 const { installation, requests, stagingReleased } = yield* makeHarness({
797 body: Stream.fromEffect(
798 Deferred.succeed(entered, undefined).pipe(
799 Effect.andThen(Deferred.await(release)),
800 Effect.as(completeArchive),
801 ),
802 ),
803 });
804 const callerScope = yield* Scope.make();
805 const started = yield* installation.start.pipe(Scope.provide(callerScope));
806 yield* Deferred.await(entered);
807 yield* Scope.close(callerScope, Exit.void);
808 const concurrent = yield* Effect.all([installation.start, installation.start], {
809 concurrency: "unbounded",
810 });
811 expect(concurrent.map((state) => state.operationId)).toEqual([
812 started.operationId,
813 started.operationId,
814 ]);
815 expect(
816 yield* installation.changes.pipe(Stream.runHead, Effect.map(Option.getOrThrow)),
817 ).toMatchObject({ phase: "downloading", operationId: started.operationId });
818 yield* Deferred.succeed(release, undefined);
819 expect((yield* terminalState(installation)).phase).toBe("succeeded");
820 yield* Deferred.await(stagingReleased);
821​
822 const next = yield* installation.start;
823 expect(next.operationId).not.toBe(started.operationId);
824 expect(
825 yield* installation
826 .cancel(started.operationId ?? "missing-operation-id")
827 .pipe(Effect.flip),
828 ).toMatchObject({ operation: "cancel" });
829 expect((yield* terminalState(installation)).phase).toBe("succeeded");
830 expect(requests).toHaveLength(1);
831 }),
832 );
833​
834 // Real posix executables in a real temp dir, resolved by a linux-mocked
835 // PATH walk; a Windows temp path cannot be split on `:`.
836 it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
837 "honors explicit paths and reports invalid overrides without falling back",
838 () =>
839 Effect.gen(function* () {
840 const fs = yield* FileSystem.FileSystem;
841 const path = yield* Path.Path;
842 const baseDir = yield* fs
843 .makeTempDirectoryScoped({ prefix: "t3-agy-path-test-" })
844 .pipe(Effect.flatMap((directory) => fs.realPath(directory)));
845 const externalDirectory = path.join(baseDir, "external");
846 const externalExecutable = path.join(externalDirectory, executableName);
847 const externalHarness = path.join(externalDirectory, harnessName);
848 yield* fs.makeDirectory(externalDirectory);
849 yield* fs.writeFileString(externalExecutable, "external server", { mode: 0o755 });
850 yield* fs.writeFileString(externalHarness, "external harness", { mode: 0o755 });
851 const { installation } = yield* makeHarness({
852 baseDir,
853 path: externalDirectory,
854 previous: true,
855 });
856 yield* expectPreviousRelease(installation);
857 expect(yield* installation.resolve(undefined, { PATH: externalDirectory })).toMatchObject({
858 source: "managed",
859 version: previousVersion,
860 });
861 expect(yield* installation.resolve(externalExecutable)).toMatchObject({
862 executablePath: externalExecutable,
863 source: "override",
864 managedVersionDirectory: null,
865 });
866 expect(yield* installation.resolve(executableName)).toMatchObject({
867 source: "override",
868 });
869 yield* fs.remove(externalHarness);
870 expect(yield* installation.resolve(externalExecutable).pipe(Effect.flip)).toMatchObject({
871 operation: "resolve",
872 });
873 expect(
874 yield* installation.resolve(path.join(baseDir, "missing")).pipe(Effect.flip),
875 ).toMatchObject({
876 operation: "resolve",
877 });
878 yield* expectPreviousRelease(installation);
879 yield* fs.writeFileString(externalHarness, "external harness", { mode: 0o755 });
880 yield* installation.remove();
881 expect(yield* installation.resolve()).toMatchObject({
882 source: "path",
883 executablePath: externalExecutable,
884 });
885 const isolated = yield* makeHarness({ baseDir });
886 expect(yield* isolated.installation.resolve().pipe(Effect.flip)).toMatchObject({
887 operation: "resolve",
888 });
889 expect(
890 yield* isolated.installation.resolve(undefined, { PATH: externalDirectory }),
891 ).toMatchObject({
892 source: "path",
893 executablePath: externalExecutable,
894 });
895 expect(
896 yield* isolated.installation.resolve(executableName, { PATH: externalDirectory }),
897 ).toMatchObject({ source: "override", executablePath: externalExecutable });
898 }),
899 );
900​
901 it.effect("keeps leased releases available while new sessions resolve the new release", () =>
902 Effect.gen(function* () {
903 const { installation, fs, stagingReleased } = yield* makeHarness({ previous: true });
904 const processScope = yield* Scope.make();
905 const oldExecutable = yield* installation.acquire().pipe(Scope.provide(processScope));
906 yield* installation.start;
907 expect((yield* terminalState(installation)).phase).toBe("succeeded");
908 yield* Deferred.await(stagingReleased);
909 const current = yield* installation.resolve();
910 expect(current.version).toBe("fixture-new");
911 expect(current.executablePath).not.toBe(oldExecutable.executablePath);
912 expect(yield* fs.readFileString(oldExecutable.executablePath)).toBe(serverContents);
913 expect(yield* installation.remove().pipe(Effect.flip)).toMatchObject({ operation: "remove" });
914 yield* Scope.close(processScope, Exit.void);
915 yield* installation.remove();
916 expect(yield* fs.exists(installation.managedDirectory)).toBe(false);
917 }),
918 );
919​
920 it.effect(
921 "removes an incomplete active release before reinstalling without a PATH fallback",
922 () =>
923 Effect.gen(function* () {
924 const { installation, baseDir, fs, path } = yield* makeHarness({ previous: true });
925 const previous = yield* installation.resolve();
926 yield* fs.remove(previous.harnessPath);
927 const externalDirectory = path.join(baseDir, "external");
928 yield* fs.makeDirectory(externalDirectory);
929 yield* fs.writeFileString(path.join(externalDirectory, executableName), "external server", {
930 mode: 0o755,
931 });
932 yield* fs.writeFileString(path.join(externalDirectory, harnessName), "external harness", {
933 mode: 0o755,
934 });
935 const restarted = yield* makeHarness({ baseDir, path: externalDirectory });
936 expect(yield* restarted.installation.state).toMatchObject({
937 phase: "failed",
938 installedVersion: null,
939 canRemove: true,
940 });
941 expect(yield* restarted.installation.resolve().pipe(Effect.flip)).toMatchObject({
942 operation: "resolve",
943 });
944 yield* restarted.installation.remove();
945 expect(yield* restarted.installation.state).toMatchObject({
946 phase: "idle",
947 canRemove: false,
948 });
949 expect(yield* fs.exists(installation.managedDirectory)).toBe(false);
950 yield* restarted.installation.start;
951 expect(yield* terminalState(restarted.installation)).toMatchObject({
952 phase: "succeeded",
953 installedVersion: "fixture-new",
954 canRemove: true,
955 });
956 yield* Deferred.await(restarted.stagingReleased);
957 expect((yield* restarted.installation.resolve()).source).toBe("managed");
958 }),
959 );
960​
961 it.effect(
962 "blocks removal of custom managed paths and leaves external executables and profiles intact",
963 () =>
964 Effect.gen(function* () {
965 const { installation, fs, path, baseDir } = yield* makeHarness({ previous: true });
966 const managed = yield* installation.resolve();
967 const externalDirectory = path.join(baseDir, "external");
968 const profileDirectory = path.join(baseDir, "providers", "antigravity", "profile");
969 yield* fs.makeDirectory(externalDirectory);
970 yield* fs.makeDirectory(profileDirectory, { recursive: true });
971 const externalExecutable = path.join(externalDirectory, executableName);
972 const externalHarness = path.join(externalDirectory, harnessName);
973 const profilePath = path.join(profileDirectory, "preferences.json");
974 yield* fs.writeFileString(externalExecutable, "external server", { mode: 0o755 });
975 yield* fs.writeFileString(externalHarness, "external harness", { mode: 0o755 });
976 yield* fs.writeFileString(profilePath, "{}");
977 expect(
978 yield* installation.remove([managed.executablePath]).pipe(Effect.flip),
979 ).toMatchObject({
980 operation: "remove",
981 });
982 yield* expectPreviousRelease(installation);
983 yield* installation.remove([externalExecutable]);
984 expect(yield* installation.state).toMatchObject({
985 phase: "idle",
986 operationId: null,
987 installedVersion: null,
988 });
989 expect(yield* fs.readFileString(externalExecutable)).toBe("external server");
990 expect(yield* fs.readFileString(externalHarness)).toBe("external harness");
991 expect(yield* fs.readFileString(profilePath)).toBe("{}");
992 }),
993 );
994​
995 it.effect(
996 "reuses an immutable Windows release and preserves the pointer when rename is denied",
997 () =>
998 Effect.gen(function* () {
999 const fs = yield* FileSystem.FileSystem;
1000 const path = yield* Path.Path;
1001 const archive = Buffer.from(zipFixtures.windows, "base64");
1002 const asset = yield* releaseAsset(archive, "win32");
1003 let denyPointerRename = true;
1004 const renameTargets: string[] = [];
1005 const { installation, requests, validations } = yield* makeHarness({
1006 previous: true,
1007 platform: "win32",
1008 archive,
1009 fileSystem: FileSystem.FileSystem.of({
1010 ...fs,
1011 rename: (source, target) => {
1012 renameTargets.push(target);
1013 return denyPointerRename
1014 ? Effect.fail(
1015 PlatformError.systemError({
1016 _tag: "PermissionDenied",
1017 module: "FileSystem",
1018 method: "rename",
1019 pathOrDescriptor: target,
1020 description: "EPERM: file is in use",
1021 }),
1023 : fs.rename(source, target);
1024 },
1025 }),
1026 });
1027 yield* writeRelease(installation.managedDirectory, asset, false);
1028 yield* installation.start;
1029 expect((yield* terminalState(installation)).phase).toBe("failed");
1030 yield* expectPreviousRelease(installation);
1031 expect(renameTargets).toEqual([path.join(installation.managedDirectory, "active.json")]);
1032​
1033 denyPointerRename = false;
1034 yield* installation.start;
1035 expect((yield* terminalState(installation)).phase).toBe("succeeded");
1036 expect((yield* installation.resolve()).version).toBe("fixture-new");
1037 expect(requests).toEqual([]);
1038 expect(validations).toHaveLength(2);
1039 expect(renameTargets).toEqual([
1040 path.join(installation.managedDirectory, "active.json"),
1041 path.join(installation.managedDirectory, "active.json"),
1042 ]);
1043 }),
1044 );
1045​
1046 it.effect("reports unsupported hosts without downloading or changing state", () =>
1047 Effect.gen(function* () {
1048 const { installation, requests } = yield* makeHarness({ asset: null, platform: "darwin" });
1049 expect(yield* installation.start.pipe(Effect.flip)).toMatchObject({ operation: "start" });
1050 expect(yield* installation.resolve().pipe(Effect.flip)).toMatchObject({
1051 operation: "resolve",
1052 });
1053 expect(yield* installation.state).toMatchObject({ phase: "idle", operationId: null });
1054 expect(requests).toEqual([]);
1055 }),
1056 );
1057​
1058 it("resolves all supported platform release assets including Intel Mac", () => {
1059 const supportedPlatforms: Array<{ readonly platform: NodeJS.Platform; readonly arch: string }> =
1061 { platform: "darwin", arch: "arm64" },
1062 { platform: "darwin", arch: "x64" },
1063 { platform: "linux", arch: "x64" },
1064 { platform: "linux", arch: "arm64" },
1065 { platform: "win32", arch: "x64" },
1066 { platform: "win32", arch: "arm64" },
1067 ];
1068​
1069 for (const { platform, arch } of supportedPlatforms) {
1070 const asset = resolveAntigravityReleaseAsset(platform, arch);
1071 expect(asset).not.toBeNull();
1072 expect(asset?.version).toBe("1.3.0");
1073 expect(asset?.url).toContain("1.3.0");
1074 expect(asset?.archiveBytes).toBeGreaterThan(0);
1075 expect(asset?.executable.bytes).toBeGreaterThan(0);
1076 expect(asset?.harness.bytes).toBeGreaterThan(0);
1078​
1079 expect(resolveAntigravityReleaseAsset("freebsd", "x64")).toBeNull();
1080 });
1081});