@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 124 lines 4.79 KB
Raw
1 import * as AWS from "@alchemy.run/aws";
2 import { expect } from "@alchemy.run/test";
3 import * as Test from "@alchemy.run/test/Alchemy";
4 import * as finspace from "@distilled.cloud/aws/finspace";
5 import * as Effect from "effect/Effect";
6
7 const { test } = Test.make({ providers: AWS.providers() });
8
9 // Amazon FinSpace reached end of support on 2026-10-07
10 // (https://docs.aws.amazon.com/finspace/latest/userguide/amazon-finspace-end-of-support.html).
11 // The control-plane hostname finspace.<region>.amazonaws.com no longer has
12 // A records in any region, so every control-plane call fails before reaching
13 // AWS with:
14 // HttpClientError: Transport error (GET https://finspace.us-west-2.amazonaws.com/kx/environments)
15 // (cause: getaddrinfo ENOTFOUND finspace.us-west-2.amazonaws.com)
16 // A transport failure can't be patched into a typed tag, so all control-plane
17 // tests are gated behind AWS_TEST_FINSPACE=1 for accounts that still have access.
18 const finspaceRetired = !process.env.AWS_TEST_FINSPACE;
19
20 // FinSpace Managed kdb is closed to non-onboarded accounts, so the runtime
21 // bindings (all scoped to a live KxEnvironment) cannot be exercised through a
22 // deployed Lambda fixture here — deploying the fixture requires a real kdb
23 // environment (tens of minutes, gated onboarding). These ungated typed-error
24 // probes instead prove, against the live API, that every operation the
25 // bindings wrap carries the typed not-found tag in its distilled error union
26 // — the same tags a bound function observes at runtime.
27 //
28 // environmentId must match ^[a-zA-Z0-9]{1,26}$ — malformed ids fail earlier
29 // with ValidationException.
30 const missingEnvironmentId = "zzzzzzzzzzzzzzzzzzzzzzzzzz";
31
32 test.provider.skipIf(finspaceRetired)(
33 "getKxConnectionString on a nonexistent environment fails with ResourceNotFoundException",
34 () =>
35 Effect.gen(function* () {
36 const error = yield* Effect.flip(
37 finspace.getKxConnectionString({
38 environmentId: missingEnvironmentId,
39 clusterName: "nocluster",
40 userArn: `arn:aws:finspace:us-east-1:123456789012:kxEnvironment/${missingEnvironmentId}/kxUser/nouser`,
41 }),
42 );
43 expect(error._tag).toBe("ResourceNotFoundException");
44 }),
45 { tags: ["provider:aws", "provider:aws:finspace", "live"] },
46 );
47
48 test.provider.skipIf(finspaceRetired)(
49 "createKxChangeset on a nonexistent environment fails with ResourceNotFoundException",
50 () =>
51 Effect.gen(function* () {
52 const error = yield* Effect.flip(
53 finspace.createKxChangeset({
54 environmentId: missingEnvironmentId,
55 databaseName: "nodb",
56 changeRequests: [
57 {
58 changeType: "PUT",
59 s3Path: "s3://nonexistent-bucket/nonexistent/",
60 dbPath: "/2024.01.02/",
61 },
62 ],
63 clientToken: "alchemy-finspace-probe-changeset",
64 }),
65 );
66 expect(error._tag).toBe("ResourceNotFoundException");
67 }),
68 { tags: ["provider:aws", "provider:aws:finspace", "live"] },
69 );
70
71 test.provider.skipIf(finspaceRetired)(
72 "listKxChangesets on a nonexistent environment fails with ResourceNotFoundException",
73 () =>
74 Effect.gen(function* () {
75 const error = yield* Effect.flip(
76 finspace.listKxChangesets({ environmentId: missingEnvironmentId, databaseName: "nodb" }),
77 );
78 expect(error._tag).toBe("ResourceNotFoundException");
79 }),
80 { tags: ["provider:aws", "provider:aws:finspace", "live"] },
81 );
82
83 test.provider.skipIf(finspaceRetired)(
84 "listKxClusterNodes on a nonexistent environment fails with ResourceNotFoundException",
85 () =>
86 Effect.gen(function* () {
87 const error = yield* Effect.flip(
88 finspace.listKxClusterNodes({
89 environmentId: missingEnvironmentId,
90 clusterName: "nocluster",
91 }),
92 );
93 expect(error._tag).toBe("ResourceNotFoundException");
94 }),
95 { tags: ["provider:aws", "provider:aws:finspace", "live"] },
96 );
97
98 test.provider.skipIf(finspaceRetired)(
99 "getKxDataview on a nonexistent environment fails with ResourceNotFoundException",
100 () =>
101 Effect.gen(function* () {
102 const error = yield* Effect.flip(
103 finspace.getKxDataview({
104 environmentId: missingEnvironmentId,
105 databaseName: "nodb",
106 dataviewName: "noview",
107 }),
108 );
109 expect(error._tag).toBe("ResourceNotFoundException");
110 }),
111 { tags: ["provider:aws", "provider:aws:finspace", "live"] },
112 );
113
114 test.provider.skipIf(finspaceRetired)(
115 "getKxUser on a nonexistent environment fails with ResourceNotFoundException",
116 () =>
117 Effect.gen(function* () {
118 const error = yield* Effect.flip(
119 finspace.getKxUser({ environmentId: missingEnvironmentId, userName: "nouser" }),
120 );
121 expect(error._tag).toBe("ResourceNotFoundException");
122 }),
123 { tags: ["provider:aws", "provider:aws:finspace", "live"] },
124 );