History

Fix CI failures: oauth-discovery test, formatter, lint, Workers build, miniflare test

Rhys Sullivan committed 6 months ago

Commit a3bd6801 parent 485996011 files · +31 −30Browse files

Unified · Split

11 files
  1. apps/cloud/executor.config.ts +1 −4
  2. apps/cloud/src/services/__test-harness__/api-harness.ts +1 −6
  3. apps/cloud/src/services/executor.ts +3 −1
  4. apps/cloud/src/services/tenant-isolation.node.test.ts +2 −2
  5. packages/core/sdk/src/executor.ts +1 −1
  6. packages/core/sdk/src/hosted-http-client.test.ts +2 −5
  7. packages/core/sdk/src/hosted-http-client.ts +6 −4
  8. packages/core/sdk/src/oauth-discovery.test.ts +2 −2
  9. packages/core/sdk/src/oauth-service.ts +3 −3
  10. packages/core/vite-plugin/package.json +5 −1
  11. packages/plugins/graphql/src/sdk/plugin.ts +5 −1
apps/cloud/executor.config.ts+1−4
@@ -37,10 +37,7 @@ interface CloudPluginDeps { · 36 unmodified lines
3737
3838 export default defineExecutorConfig({
3939 dialect: "pg",
40− plugins: ({
41− workosCredentials,
42− workosVaultClient,
43− }: CloudPluginDeps = {}) =>
40+ plugins: ({ workosCredentials, workosVaultClient }: CloudPluginDeps = {}) =>
4441 [
4542 openApiPlugin(),
4643 mcpPlugin({
apps/cloud/src/services/__test-harness__/api-harness.ts+1−6
@@ -26,12 +26,7 @@ import { · 25 unmodified lines
2626 } from "@executor-js/api/server";
2727 import { createExecutionEngine } from "@executor-js/execution";
2828 import { makeQuickJsExecutor } from "@executor-js/runtime-quickjs";
29−import {
30− Scope,
31− ScopeId,
32− collectSchemas,
33− createExecutor,
34−} from "@executor-js/sdk";
29+import { Scope, ScopeId, collectSchemas, createExecutor } from "@executor-js/sdk";
3530 import { makePostgresAdapter, makePostgresBlobStore } from "@executor-js/storage-postgres";
3631 import { makeTestWorkOSVaultClient } from "@executor-js/plugin-workos-vault/testing";
3732
apps/cloud/src/services/executor.ts+3−1
@@ -64,7 +64,9 @@ export const createScopedExecutor = ( · 63 unmodified lines
6464 const { db } = yield* DbService;
6565
6666 const plugins = orgPlugins();
67− const httpClientLayer = makeHostedHttpClientLayer();
67+ const httpClientLayer = makeHostedHttpClientLayer({
68+ allowLocalNetwork: env.NODE_ENV === "test",
69+ });
6870 const schema = collectSchemas(plugins);
6971 const adapter = makePostgresAdapter({ db, schema });
7072 const blobs = makePostgresBlobStore({ db });
apps/cloud/src/services/tenant-isolation.node.test.ts+2−2
@@ -336,9 +336,9 @@ describe("tenant isolation (HTTP)", () => { · 335 unmodified lines
336336 client.connections.usages({
337337 params: { scopeId: ScopeId.make(orgB), connectionId: connectionIdA },
338338 }),
339− ).pipe(Effect.result);
339+ );
340340
341− if (Result.isSuccess(usages)) expect(usages.success).toEqual([]);
341+ expect(usages).toEqual([]);
342342 }),
343343 );
344344
packages/core/sdk/src/executor.ts+1−1
@@ -2458,7 +2458,7 @@ export const createExecutor = <const TPlugins extends readonly AnyPlugin[] = []> · 2457 unmodified lines
24582458 usagesForConnection: credentialBindingUsagesForConnection,
24592459 };
24602460
2461− const oauthBundle = makeOAuth2Service({
2461+ const oauthBundle = makeOAuth2Service({
24622462 adapter: core,
24632463 rawAdapter: adapter,
24642464 secretsGet: (id) =>
packages/core/sdk/src/hosted-http-client.test.ts+2−5
@@ -26,11 +26,8 @@ describe("hosted outbound HTTP client", () => { · 25 unmodified lines
2626 "http://192.168.1.10/mcp",
2727 "http://169.254.169.254/latest/meta-data/",
2828 ]) {
29− const result = yield* validateHostedOutboundUrl(url).pipe(Effect.result);
30− expect(Result.isFailure(result)).toBe(true);
31− if (Result.isFailure(result)) {
32− expect(result.failure).toBeInstanceOf(HostedOutboundRequestBlocked);
33− }
29+ const error = yield* validateHostedOutboundUrl(url).pipe(Effect.flip);
30+ expect(error).toBeInstanceOf(HostedOutboundRequestBlocked);
3431 }
3532 }),
3633 );
packages/core/sdk/src/hosted-http-client.ts+6−4
@@ -96,7 +96,7 @@ export const validateHostedOutboundUrl = ( · 95 unmodified lines
9696 });
9797
9898 const guardFetch = (
99− fetch: typeof globalThis.fetch,
99+ underlying: typeof globalThis.fetch,
100100 options: HostedHttpClientOptions,
101101 ): typeof globalThis.fetch =>
102102 (async (input, init) => {
@@ -105,7 +105,7 @@ const guardFetch = ( · 2 unmodified lines
105105 for (let redirects = 0; redirects <= maxRedirects; redirects++) {
106106 const url = current instanceof Request ? current.url : String(current);
107107 Effect.runSync(validateHostedOutboundUrl(url, options));
108− const response = await fetch(current, { ...init, redirect: "manual" });
108+ const response = await underlying(current, { ...init, redirect: "manual" });
109109 if (
110110 response.status >= 300 &&
111111 response.status < 400 &&
@@ -117,7 +117,7 @@ const guardFetch = ( · 5 unmodified lines
117117 }
118118 return response;
119119 }
120− return fetch(current, { ...init, redirect: "manual" });
120+ return underlying(current, { ...init, redirect: "manual" });
121121 }) as typeof globalThis.fetch;
122122
123123 export const makeHostedHttpClientLayer = (
@@ -129,7 +129,9 @@ export const makeHostedHttpClientLayer = ( · 5 unmodified lines
129129 ? Layer.succeed(FetchHttpClient.Fetch)(guardFetch(options.fetch, options))
130130 : Layer.effect(
131131 FetchHttpClient.Fetch,
132− Effect.map(Effect.service(FetchHttpClient.Fetch), (fetch) => guardFetch(fetch, options)),
132+ Effect.map(Effect.service(FetchHttpClient.Fetch), (underlying) =>
133+ guardFetch(underlying, options),
134+ ),
133135 ),
134136 ),
135137 );
packages/core/sdk/src/oauth-discovery.test.ts+2−2
@@ -433,7 +433,7 @@ describe("beginDynamicAuthorization", () => { · 432 unmodified lines
433433 ),
434434 );
435435
436− it.effect("requests empty scope when only AS-level scopes_supported is advertised", () =>
436+ it.effect("omits scope when only AS-level scopes_supported is advertised", () =>
437437 withOAuthFixture(
438438 (request, baseUrl) => {
439439 if (request.url === "/.well-known/oauth-protected-resource") {
@@ -475,7 +475,7 @@ describe("beginDynamicAuthorization", () => { · 35 unmodified lines
475475 expect(body.scope).toBeUndefined();
476476
477477 const authUrl = new URL(result.authorizationUrl);
478− expect(authUrl.searchParams.get("scope")).toBe("");
478+ expect(authUrl.searchParams.has("scope")).toBe(false);
479479 }),
480480 ),
481481 );
packages/core/sdk/src/oauth-service.ts+3−3
@@ -261,9 +261,9 @@ export const makeOAuth2Service = ( · 260 unmodified lines
261261 })();
262262
263263 const authServer = authorizationServerUrl
264− ? yield* discoverAuthorizationServerMetadata(authorizationServerUrl, { httpClientLayer }).pipe(
265− Effect.catchTag("OAuthDiscoveryError", () => Effect.succeed(null)),
266− )
264+ ? yield* discoverAuthorizationServerMetadata(authorizationServerUrl, {
265+ httpClientLayer,
266+ }).pipe(Effect.catchTag("OAuthDiscoveryError", () => Effect.succeed(null)))
267267 : null;
268268
269269 // Dynamic registration is only viable when the AS advertises a
packages/core/vite-plugin/package.json+5−1
@@ -16,7 +16,11 @@ · 15 unmodified lines
1616 ],
1717 "type": "module",
1818 "exports": {
19− ".": "./src/index.ts"
19+ ".": {
20+ "types": "./src/index.ts",
21+ "bun": "./src/index.ts",
22+ "default": "./dist/index.js"
23+ }
2024 },
2125 "publishConfig": {
2226 "access": "public",
packages/plugins/graphql/src/sdk/plugin.ts+5−1
@@ -923,7 +923,11 @@ export const graphqlPlugin = definePlugin((options?: GraphqlPluginOptions) => { · 922 unmodified lines
923923 storage: (deps): GraphqlStore => makeDefaultGraphqlStore(deps),
924924
925925 extension: (ctx) =>
926− makeGraphqlExtension(ctx, options?.httpClientLayer ?? ctx.httpClientLayer, options?.configFile),
926+ makeGraphqlExtension(
927+ ctx,
928+ options?.httpClientLayer ?? ctx.httpClientLayer,
929+ options?.configFile,
930+ ),
927931
928932 staticSources: (self) => [
929933 {