Open History to see the last commit
1import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
2import * as NodeServices from "@effect/platform-node/NodeServices";
3import * as Layer from "effect/Layer";
4import { describe, expect, it } from "@effect/vitest";
5import * as Context from "effect/Context";
6import * as DateTime from "effect/DateTime";
7import * as Effect from "effect/Effect";
8import * as FileSystem from "effect/FileSystem";
9import * as Path from "effect/Path";
10import * as TestClock from "effect/testing/TestClock";
11import { FetchHttpClient, HttpClient, HttpClientResponse } from "effect/http";
12
13import { makeAntigravityUsageProbe } from "./antigravityUsageLimits.ts";
14
15const summary = {
16 groups: [
17 {
18 displayName: "Gemini Models",
19 buckets: [
20 {
21 bucketId: "gemini-weekly",
22 window: "weekly",
23 remainingFraction: 0.96,
24 resetTime: "2026-10-12T19:41:43Z",
25 },
26 {
27 bucketId: "gemini-5h",
28 window: "5h",
29 remainingFraction: 0.91,
30 resetTime: "2026-10-09T16:06:01Z",
31 },
32 ],
33 },
34 {
35 displayName: "Claude and GPT models",
36 buckets: [
37 {
38 bucketId: "3p-weekly",
39 window: "weekly",
40 remainingFraction: 0,
41 resetTime: "2026-10-10T15:28:22Z",
42 },
43 {
44 bucketId: "3p-5h",
45 window: "5h",
46 remainingFraction: 0.44,
47 resetTime: "2026-10-09T16:06:30Z",
48 },
49 ],
50 },
51 ],
52};
53
54const fixture = Effect.fn("AntigravityUsageTest.fixture")(function* (
55 options: {
56 summary?: unknown;
57 /** Per-host quota summaries; hosts not listed fall back to `summary`. */
58 summaryByHost?: Record<string, unknown>;
59 models?: unknown;
60 summaryStatus?: number;
61 /** Per-host summary statuses; hosts not listed fall back to `summaryStatus`. */
62 summaryStatusByHost?: Record<string, number>;
63 tokenStatus?: number;
64 refreshToken?: string;
65 userId?: string;
66 userInfoAt?: number;
67 missingToken?: boolean;
68 authMethod?: "oauth-personal" | "gemini-api-key";
69 } = {},
70) {
71 const fs = yield* FileSystem.FileSystem;
72 const path = yield* Path.Path;
73 const profileDirectory = yield* fs.makeTempDirectoryScoped();
74 yield* fs.makeDirectory(path.join(profileDirectory, "antigravity-acp"));
75 const tokenPath = path.join(profileDirectory, "antigravity-acp", "acp_token.json");
76 const writeToken = (refreshToken: string) =>
77 fs.writeFileString(
78 tokenPath,
79 JSON.stringify({
80 client_id: "client-id",
81 client_secret: "client-secret",
82 refresh_token: refreshToken,
83 project_id: "project-id",
84 }),
85 );
86 if (!options.missingToken) yield* writeToken(options.refreshToken ?? "refresh-a");
87 const requests: Array<{ url: string; body: string }> = [];
88 const http = HttpClient.make((request, url, _signal, fiber) =>
89 Effect.sync(() => {
90 const init = Context.getOrUndefined(fiber.context, FetchHttpClient.RequestInit);
91 expect(init?.redirect).toBe("manual");
92 const body =
93 request.body._tag === "Uint8Array" ? new TextDecoder().decode(request.body.body) : "";
94 requests.push({ url: request.url, body });
95 if (request.url.endsWith("/token")) {
96 expect(new URLSearchParams(body).get("grant_type")).toBe("refresh_token");
97 return HttpClientResponse.fromWeb(
98 request,
99 Response.json(
100 { access_token: "access-token", expires_in: 3600 },
101 { status: options.tokenStatus ?? 200 },
102 ),
103 );
104 }
105 expect(request.headers.authorization).toBe("Bearer access-token");
106 if (request.url.endsWith("/userinfo")) {
107 return HttpClientResponse.fromWeb(
108 request,
109 options.userId
110 ? Response.json({ id: options.userId, email: "someone@example.com" })
111 : Response.json({}, { status: 403 }),
112 );
113 }
114 expect(JSON.parse(body)).toEqual({ project: "project-id" });
115 expect(request.headers["user-agent"]).toMatch(/^antigravity\/hub\/2\.24\.0 /);
116 return HttpClientResponse.fromWeb(
117 request,
118 request.url.endsWith(":retrieveUserQuotaSummary")
119 ? Response.json(options.summaryByHost?.[url.host] ?? options.summary ?? summary, {
120 status: options.summaryStatusByHost?.[url.host] ?? options.summaryStatus ?? 200,
121 })
122 : Response.json(options.models ?? { models: {} }),
123 );
124 }).pipe(
125 Effect.tap(() =>
126 request.url.endsWith("/userinfo") && options.userInfoAt !== undefined
127 ? TestClock.setTime(options.userInfoAt)
128 : Effect.void,
129 ),
130 ),
131 );
132 const usage = yield* makeAntigravityUsageProbe({
133 profileDirectory,
134 authMethod: options.authMethod ?? "oauth-personal",
135 }).pipe(Effect.provideService(HttpClient.HttpClient, http));
136 return { ...usage, requests, writeToken, tokenPath };
137});
138
139describe("Antigravity subscription limits", () => {
140 // Oracle: the 10:16 UTC payload and its narrow Workaround rule.
141 it.effect("omits rolling resets for untouched summary buckets and keeps used Gemini resets", () =>
142 Effect.gen(function* () {
143 yield* TestClock.setTime(DateTime.toEpochMillis(DateTime.makeUnsafe("2026-10-21T10:16:04Z")));
144 const { probe } = yield* fixture({
145 summary: {
146 groups: [
147 {
148 buckets: [
149 {
150 bucketId: "3p-5h",
151 window: "5h",
152 remainingFraction: 1,
153 resetTime: "2026-10-21T15:16:05Z",
154 },
155 {
156 bucketId: "3p-weekly",
157 window: "weekly",
158 remainingFraction: 1,
159 resetTime: "2026-10-28T10:16:05Z",
160 },
161 {
162 bucketId: "gemini-5h",
163 window: "5h",
164 remainingFraction: 0.848104,
165 resetTime: "2026-10-21T13:29:53Z",
166 description:
167 "You have used some of your 5-hour limit, it will fully refresh in 3 hours, 13 minutes.",
168 },
169 {
170 bucketId: "gemini-weekly",
171 window: "weekly",
172 remainingFraction: 0.9620177,
173 resetTime: "2026-10-28T08:29:53Z",
174 description:
175 "You have used some of your weekly limit, it will fully refresh in 6 days, 22 hours.",
176 },
177 ],
178 },
179 ],
180 },
181 });
182 const limits = yield* probe;
183 const byId = new Map(limits.windows.map((window) => [window.id, window]));
184 expect(byId.get("3p-5h")).toEqual({
185 id: "3p-5h",
186 label: "Claude & GPT (shared) · 5-hour",
187 kind: "session",
188 usedPercent: 0,
189 windowDurationMins: 300,
190 });
191 expect(byId.get("3p-weekly")).toEqual({
192 id: "3p-weekly",
193 label: "Claude & GPT (shared) · Weekly",
194 kind: "weekly",
195 usedPercent: 0,
196 windowDurationMins: 10080,
197 });
198 expect(byId.get("gemini-5h")?.resetsAt).toBe("2026-10-21T13:29:53.000Z");
199 expect(byId.get("gemini-weekly")?.resetsAt).toBe("2026-10-28T08:29:53.000Z");
200 }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
201 );
202
203 // Oracle: measure the tolerance from the summary request, after auth.
204 it.effect("uses summary request time after authentication for the reset tolerance", () =>
205 Effect.gen(function* () {
206 yield* TestClock.setTime(DateTime.toEpochMillis(DateTime.makeUnsafe("2026-10-21T10:16:02Z")));
207 const { probe } = yield* fixture({
208 userInfoAt: DateTime.toEpochMillis(DateTime.makeUnsafe("2026-10-21T10:16:04Z")),
209 summary: {
210 buckets: [
211 {
212 bucketId: "3p-5h",
213 window: "5h",
214 remainingFraction: 1,
215 resetTime: "2026-10-21T15:17:03Z",
216 },
217 ],
218 },
219 });
220 expect((yield* probe).windows[0]?.resetsAt).toBeUndefined();
221 }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
222 );
223
224 // Oracle: keep descriptions, measured resets, and spent buckets.
225 it.effect("keeps summary resets with a description, a distant reset, or no quota left", () =>
226 Effect.gen(function* () {
227 yield* TestClock.setTime(DateTime.toEpochMillis(DateTime.makeUnsafe("2026-10-21T10:16:04Z")));
228 const { probe } = yield* fixture({
229 summary: {
230 buckets: [
231 {
232 bucketId: "described",
233 window: "5h",
234 remainingFraction: 1,
235 description: "Reported reset",
236 resetTime: "2026-10-21T15:16:04Z",
237 },
238 {
239 bucketId: "distant",
240 window: "weekly",
241 remainingFraction: 1,
242 resetTime: "2026-10-28T12:16:04Z",
243 },
244 {
245 bucketId: "spent",
246 window: "5h",
247 remainingFraction: 0,
248 resetTime: "2026-10-21T15:16:04Z",
249 },
250 {
251 bucketId: "overfull",
252 window: "5h",
253 remainingFraction: 1.01,
254 resetTime: "2026-10-21T15:16:04Z",
255 },
256 {
257 bucketId: "empty-description",
258 window: "5h",
259 remainingFraction: 1,
260 description: "",
261 resetTime: "2026-10-21T15:16:04Z",
262 },
263 ],
264 },
265 });
266 expect((yield* probe).windows.map(({ id, resetsAt }) => ({ id, resetsAt }))).toEqual([
267 { id: "described", resetsAt: "2026-10-21T15:16:04.000Z" },
268 { id: "empty-description", resetsAt: "2026-10-21T15:16:04.000Z" },
269 { id: "overfull", resetsAt: "2026-10-21T15:16:04.000Z" },
270 { id: "spent", resetsAt: "2026-10-21T15:16:04.000Z" },
271 { id: "distant", resetsAt: "2026-10-28T12:16:04.000Z" },
272 ]);
273 }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
274 );
275
276 // Oracle: the 60-second tolerance applies to both known window lengths.
277 it.effect("omits summary resets 59 seconds away but keeps resets 61 seconds away", () =>
278 Effect.gen(function* () {
279 yield* TestClock.setTime(DateTime.toEpochMillis(DateTime.makeUnsafe("2026-10-21T10:16:04Z")));
280 const { probe } = yield* fixture({
281 summary: {
282 buckets: [
283 {
284 bucketId: "5h-before",
285 window: "5h",
286 remainingFraction: 1,
287 resetTime: "2026-10-21T15:15:05Z",
288 },
289 {
290 bucketId: "5h-after",
291 window: "5h",
292 remainingFraction: 1,
293 resetTime: "2026-10-21T15:17:05Z",
294 },
295 {
296 bucketId: "5h-edge",
297 window: "5h",
298 remainingFraction: 1,
299 resetTime: "2026-10-21T15:17:04Z",
300 },
301 {
302 bucketId: "weekly-after",
303 window: "weekly",
304 remainingFraction: 1,
305 resetTime: "2026-10-28T10:17:03Z",
306 },
307 {
308 bucketId: "weekly-before",
309 window: "weekly",
310 remainingFraction: 1,
311 resetTime: "2026-10-28T10:15:03Z",
312 },
313 {
314 bucketId: "weekly-edge",
315 window: "weekly",
316 remainingFraction: 1,
317 resetTime: "2026-10-28T10:15:04Z",
318 },
319 ],
320 },
321 });
322 expect((yield* probe).windows.map(({ id, resetsAt }) => ({ id, resetsAt }))).toEqual([
323 { id: "5h-after", resetsAt: "2026-10-21T15:17:05.000Z" },
324 { id: "5h-before", resetsAt: undefined },
325 { id: "5h-edge", resetsAt: undefined },
326 { id: "weekly-after", resetsAt: undefined },
327 { id: "weekly-before", resetsAt: "2026-10-28T10:15:03.000Z" },
328 { id: "weekly-edge", resetsAt: undefined },
329 ]);
330 }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
331 );
332
333 // Oracle: the existing endpoint merge keeps the most-used reading.
334 it.effect("keeps the used endpoint reading and its reset over an untouched reading", () =>
335 Effect.gen(function* () {
336 yield* TestClock.setTime(DateTime.toEpochMillis(DateTime.makeUnsafe("2026-10-21T10:16:04Z")));
337 const { probe } = yield* fixture({
338 summaryByHost: {
339 "daily-cloudcode-pa.googleapis.com": {
340 buckets: [
341 {
342 bucketId: "3p-5h",
343 window: "5h",
344 remainingFraction: 1,
345 resetTime: "2026-10-21T15:16:04Z",
346 },
347 {
348 bucketId: "3p-weekly",
349 window: "weekly",
350 remainingFraction: 0.5,
351 resetTime: "2026-10-27T10:16:04Z",
352 },
353 ],
354 },
355 "cloudcode-pa.googleapis.com": {
356 buckets: [
357 {
358 bucketId: "3p-5h",
359 window: "5h",
360 remainingFraction: 0.5,
361 resetTime: "2026-10-21T13:16:04Z",
362 },
363 {
364 bucketId: "3p-weekly",
365 window: "weekly",
366 remainingFraction: 1,
367 resetTime: "2026-10-28T10:16:04Z",
368 },
369 ],
370 },
371 },
372 });
373 expect((yield* probe).windows).toEqual([
374 {
375 id: "3p-5h",
376 label: "Claude & GPT (shared) · 5-hour",
377 kind: "session",
378 usedPercent: 50,
379 windowDurationMins: 300,
380 resetsAt: "2026-10-21T13:16:04.000Z",
381 },
382 {
383 id: "3p-weekly",
384 label: "Claude & GPT (shared) · Weekly",
385 kind: "weekly",
386 usedPercent: 50,
387 windowDurationMins: 10080,
388 resetsAt: "2026-10-27T10:16:04.000Z",
389 },
390 ]);
391 }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
392 );
393
394 // Oracle: model quotas have no evidence for the summary-only rule.
395 it.effect("keeps full model fallback resets even at a full window from the request", () =>
396 Effect.gen(function* () {
397 yield* TestClock.setTime(DateTime.toEpochMillis(DateTime.makeUnsafe("2026-10-21T10:16:04Z")));
398 const { probe } = yield* fixture({
399 summaryStatus: 404,
400 models: {
401 models: {
402 "gemini-a": {
403 quotaInfo: { remainingFraction: 1, resetTime: "2026-10-21T15:16:04Z" },
404 weeklyQuotaInfo: { remainingFraction: 1, resetTime: "2026-10-28T10:16:04Z" },
405 },
406 },
407 },
408 });
409 expect(
410 (yield* probe).windows.map(({ id, resetsAt, windowDurationMins }) => ({
411 id,
412 resetsAt,
413 windowDurationMins,
414 })),
415 ).toEqual([
416 { id: "gemini-weekly", resetsAt: "2026-10-28T10:16:04.000Z", windowDurationMins: 10080 },
417 { id: "gemini-quota", resetsAt: "2026-10-21T15:16:04.000Z", windowDurationMins: undefined },
418 ]);
419 }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
420 );
421
422 it.effect("reports separate Gemini and shared Claude/GPT five-hour and weekly limits", () =>
423 Effect.gen(function* () {
424 const { probe, requests } = yield* fixture();
425 const limits = yield* probe;
426 expect(limits.windows).toHaveLength(4);
427 expect(limits.unavailable).toBeUndefined();
428 expect(limits.credentialFingerprint).toMatch(/^[0-9a-f]{64}$/);
429 const byId = new Map(limits.windows.map((window) => [window.id, window]));
430 expect(byId.get("gemini-weekly")?.usedPercent).toBeCloseTo(4);
431 expect(byId.get("gemini-5h")?.usedPercent).toBeCloseTo(9);
432 expect(byId.get("3p-weekly")).toMatchObject({
433 label: "Claude & GPT (shared) · Weekly",
434 kind: "weekly",
435 usedPercent: 100,
436 windowDurationMins: 10080,
437 resetsAt: "2026-10-10T15:28:22.000Z",
438 });
439 expect(byId.get("3p-5h")).toMatchObject({ kind: "session", windowDurationMins: 300 });
440 expect(byId.get("3p-5h")?.usedPercent).toBeCloseTo(56);
441 yield* probe;
442 expect(requests.filter((request) => request.url.endsWith("/token"))).toHaveLength(1);
443 expect(
444 requests.filter((request) => request.url.endsWith(":retrieveUserQuotaSummary")),
445 ).toHaveLength(4);
446 }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
447 );
448
449 it.effect("merges quota groups that only one endpoint reports", () =>
450 Effect.gen(function* () {
451 const { probe } = yield* fixture({
452 summaryByHost: {
453 // The daily endpoint can omit Gemini while the other endpoint returns all groups.
454 "daily-cloudcode-pa.googleapis.com": {
455 groups: [
456 {
457 displayName: "Claude and GPT models",
458 buckets: [
459 { bucketId: "3p-weekly", window: "weekly", remainingFraction: 0.5 },
460 { bucketId: "3p-5h", window: "5h", remainingFraction: 0.3 },
461 ],
462 },
463 ],
464 },
465 },
466 });
467 const limits = yield* probe;
468 expect(limits.windows.map((window) => window.id).toSorted()).toEqual([
469 "3p-5h",
470 "3p-weekly",
471 "gemini-5h",
472 "gemini-weekly",
473 ]);
474 const byId = new Map(limits.windows.map((window) => [window.id, window]));
475 expect(byId.get("gemini-weekly")?.label).toBe("Gemini · Weekly");
476 expect(byId.get("3p-5h")?.usedPercent).toBeCloseTo(70);
477 expect(byId.get("3p-weekly")?.usedPercent).toBe(100);
478 }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
479 );
480
481 it.effect("labels Argon's weekly quota apart from the default Gemini weekly quota", () =>
482 Effect.gen(function* () {
483 const { probe } = yield* fixture({
484 summary: {
485 groups: [
486 ...summary.groups,
487 {
488 displayName: "Gemini 4 Argon",
489 buckets: [
490 { bucketId: "gemini-argon-wtu-weekly", window: "weekly", remainingFraction: 0.6 },
491 ],
492 },
493 ],
494 },
495 });
496 const limits = yield* probe;
497 const byId = new Map(limits.windows.map((window) => [window.id, window]));
498 expect(byId.get("gemini-weekly")?.label).toBe("Gemini · Weekly");
499 expect(byId.get("gemini-argon-wtu-weekly")?.label).toBe("Gemini 4 Argon · Weekly");
500 }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
501 );
502
503 it.effect("keeps one endpoint's quotas when the other fails", () =>
504 Effect.gen(function* () {
505 const { probe } = yield* fixture({
506 summaryStatusByHost: { "daily-cloudcode-pa.googleapis.com": 503 },
507 });
508 const limits = yield* probe;
509 expect(limits.unavailable).toBeUndefined();
510 expect(limits.windows).toHaveLength(4);
511 }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
512 );
513
514 it.effect("re-reads changed credentials and clears cached access after sign-out", () =>
515 Effect.gen(function* () {
516 const { probe, clear, requests, writeToken, tokenPath } = yield* fixture();
517 const first = yield* probe;
518 yield* writeToken("refresh-b");
519 const second = yield* probe;
520 expect(second.credentialFingerprint).not.toBe(first.credentialFingerprint);
521 expect(requests.filter((request) => request.url.endsWith("/token"))).toHaveLength(2);
522 yield* (yield* FileSystem.FileSystem).remove(tokenPath);
523 expect((yield* probe).unavailable?.reason).toBe("unsupported");
524 yield* writeToken("refresh-b");
525 yield* probe;
526 expect(requests.filter((request) => request.url.endsWith("/token"))).toHaveLength(3);
527 yield* clear;
528 yield* probe;
529 expect(requests.filter((request) => request.url.endsWith("/token"))).toHaveLength(4);
530 }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
531 );
532
533 it.effect("names one Google account the same way from every sign-in", () =>
534 Effect.gen(function* () {
535 const read = (refreshToken: string, userId: string) =>
536 fixture({ refreshToken, userId }).pipe(Effect.flatMap((usage) => usage.probe));
537 const machineA = yield* read("refresh-a", "google-user-1");
538 const machineB = yield* read("refresh-b", "google-user-1");
539 const otherAccount = yield* read("refresh-c", "google-user-2");
540 expect(machineA.credentialFingerprint).toMatch(/^[0-9a-f]{64}$/);
541 expect(machineB.credentialFingerprint).toBe(machineA.credentialFingerprint);
542 expect(otherAccount.credentialFingerprint).not.toBe(machineA.credentialFingerprint);
543 expect(JSON.stringify(machineA)).not.toMatch(/google-user-1|someone@example.com/);
544 }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
545 );
546
547 it.effect("falls back to model quotas without inventing a window duration", () =>
548 Effect.gen(function* () {
549 const { probe } = yield* fixture({
550 summaryStatus: 404,
551 models: {
552 models: {
553 "gemini-a": {
554 modelProvider: "MODEL_PROVIDER_GOOGLE",
555 quotaInfo: { remainingFraction: 0.8, resetTime: "2026-10-10T12:00:00Z" },
556 },
557 "gemini-b": {
558 modelProvider: "MODEL_PROVIDER_GOOGLE",
559 quotaInfo: { remainingFraction: 0.6, resetTime: "2026-10-10T12:00:00Z" },
560 },
561 "claude-a": { quotaInfo: { remainingFraction: 0.2 } },
562 },
563 },
564 });
565 const limits = yield* probe;
566 expect(limits.windows).toHaveLength(2);
567 expect(limits.windows.find((window) => window.id === "gemini-quota")?.usedPercent).toBe(40);
568 expect(
569 limits.windows.every(
570 (window) => window.kind === "other" && window.windowDurationMins === undefined,
571 ),
572 ).toBe(true);
573 }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
574 );
575
576 it.effect("skips disabled and missing fractions and clamps valid percentages", () =>
577 Effect.gen(function* () {
578 const { probe } = yield* fixture({
579 summary: {
580 buckets: [
581 { bucketId: "disabled", remainingFraction: 0, disabled: true },
582 { bucketId: "missing", resetTime: "2026-10-10T12:00:00Z" },
583 { bucketId: "gemini-5h", window: "5h", remainingFraction: 2, resetTime: "invalid" },
584 ],
585 },
586 });
587 expect((yield* probe).windows).toEqual([
588 {
589 id: "gemini-5h",
590 kind: "session",
591 label: "Gemini · 5-hour",
592 usedPercent: 0,
593 windowDurationMins: 300,
594 },
595 ]);
596 }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
597 );
598
599 it.effect("returns a safe failure when OAuth refresh fails", () =>
600 Effect.gen(function* () {
601 const { probe } = yield* fixture({ tokenStatus: 401 });
602 const limits = yield* probe;
603 expect(limits.windows).toEqual([]);
604 expect(limits.unavailable?.reason).toBe("probeFailed");
605 expect(JSON.stringify(limits)).not.toMatch(/client-secret|refresh-a|access-token/);
606 }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
607 );
608
609 it.effect("does not make network requests for API keys or missing sign-ins", () =>
610 Effect.gen(function* () {
611 for (const options of [{ authMethod: "gemini-api-key" as const }, { missingToken: true }]) {
612 const { probe, requests } = yield* fixture(options);
613 expect((yield* probe).unavailable?.reason).toBe("unsupported");
614 expect(requests).toEqual([]);
615 }
616 }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
617 );
618});