@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 48 lines 1.82 KB
Raw
1 import * as Cloudflare from "@alchemy.run/cloudflare";
2 import { expect } from "@alchemy.run/test";
3 import * as Test from "@alchemy.run/test/Alchemy";
4 import * as Provider from "alchemy/Provider";
5 import * as Effect from "effect/Effect";
6 import { MinimumLogLevel } from "effect/References";
7
8 const { test } = Test.make({ providers: Cloudflare.providers() });
9
10 const logLevel = Effect.provideService(MinimumLogLevel, process.env.DEBUG ? "Debug" : "Info");
11
12 test.provider(
13 "list enumerates the deployed R2 bucket",
14 (stack) =>
15 Effect.gen(function* () {
16 yield* stack.destroy();
17
18 const bucket = yield* stack.deploy(
19 Effect.gen(function* () {
20 return yield* Cloudflare.R2.Bucket("ListResource", {
21 forceDestroy: true,
22 });
23 }),
24 );
25
26 const provider = yield* Provider.findProvider(Cloudflare.R2.Bucket);
27 const all = yield* provider.list();
28
29 const found = all.find((b) => b.bucketName === bucket.bucketName);
30 expect(found).toBeDefined();
31 expect(found?.accountId).toEqual(bucket.accountId);
32 expect(found?.jurisdiction).toEqual(bucket.jurisdiction);
33 expect(found?.storageClass).toEqual(bucket.storageClass);
34
35 yield* stack.destroy();
36 }).pipe(logLevel),
37 // `list()` is genuinely O(account buckets): it enumerates every R2 bucket
38 // across all three jurisdictions and hydrates each (custom domains +
39 // lifecycle), all with bounded per-item retries (no unbounded hang). The
40 // provider no longer wastes the consistency-retry budget on buckets a
41 // parallel suite is concurrently deleting, but a heavily-populated shared
42 // account can still take a while — keep a modest margin over the 120s
43 // default for the genuine enumeration cost.
44 {
45 tags: ["provider:cloudflare", "provider:cloudflare:r2", "live"],
46 timeout: 180_000,
47 },
48 );