History

Merge remote-tracking branch 'origin/codex/batch22-execution-runtime-boundaries' into codex/effect-lint-integration

Rhys Sullivan committed 6 months ago

Commit 39cf6ac2 parents 8673012 719c5ea2 files · +12 −5Browse files

Unified · Split

2 files
  1. packages/core/execution/src/description.ts +5 −1
  2. packages/kernel/runtime-dynamic-worker/src/integration.test.ts +7 −4
packages/core/execution/src/description.ts+5−1
@@ -12,7 +12,11 @@ export const buildExecuteDescription = (executor: Executor): Effect.Effect<strin · 11 unmodified lines
12 Effect.gen(function* () {12 Effect.gen(function* () {
13 const sources: readonly Source[] = yield* executor.sources13 const sources: readonly Source[] = yield* executor.sources
14 .list()14 .list()
15 .pipe(Effect.orDie, Effect.withSpan("executor.sources.list"));15 .pipe(
16 // oxlint-disable-next-line executor/no-effect-escape-hatch -- boundary: ExecutionEngine.getDescription currently exposes no error channel; engine typed-error widening is covered separately
17 Effect.orDie,
18 Effect.withSpan("executor.sources.list"),
19 );
16 20
17 const description = yield* Effect.sync(() => formatDescription(sources)).pipe(21 const description = yield* Effect.sync(() => formatDescription(sources)).pipe(
18 Effect.withSpan("schema.compile.description", {22 Effect.withSpan("schema.compile.description", {
packages/kernel/runtime-dynamic-worker/src/integration.test.ts+7−4
@@ -18,6 +18,7 @@ import { describe, expect, it } from "@effect/vitest"; · 17 unmodified lines
18import { env } from "cloudflare:workers";18import { env } from "cloudflare:workers";
19import * as Effect from "effect/Effect";19import * as Effect from "effect/Effect";
20import * as Layer from "effect/Layer";20import * as Layer from "effect/Layer";
21import * as Predicate from "effect/Predicate";
21import { HttpClient, HttpClientResponse, type HttpClientRequest } from "effect/unstable/http";22import { HttpClient, HttpClientResponse, type HttpClientRequest } from "effect/unstable/http";
22 23
23import {24import {
@@ -85,15 +86,17 @@ const makeRecordingHttpClient = () => { · 61 unmodified lines
85 const headers = { ...request.headers };86 const headers = { ...request.headers };
86 let bytes = new Uint8Array();87 let bytes = new Uint8Array();
87 let contentType = headers["content-type"] ?? "";88 let contentType = headers["content-type"] ?? "";
88 const tag = request.body._tag;89 const isRaw = Predicate.isTagged(request.body, "Raw");
90 const isUint8Array = Predicate.isTagged(request.body, "Uint8Array");
91 const isFormData = Predicate.isTagged(request.body, "FormData");
89 92
90 if (tag === "Raw" || tag === "Uint8Array") {93 if (isRaw || isUint8Array) {
91 const wire = new Request("http://capture/", {94 const wire = new Request("http://capture/", {
92 method: "POST",95 method: "POST",
93 body: request.body.body as BodyInit,96 body: request.body.body as BodyInit,
94 });97 });
95 bytes = new Uint8Array(yield* Effect.promise(() => wire.arrayBuffer()));98 bytes = new Uint8Array(yield* Effect.promise(() => wire.arrayBuffer()));
96 } else if (tag === "FormData") {99 } else if (isFormData) {
97 // Letting `Response` realize the FormData yields the actual100 // Letting `Response` realize the FormData yields the actual
98 // multipart wire bytes plus a generated boundary in its101 // multipart wire bytes plus a generated boundary in its
99 // content-type header — exactly what the upstream server sees.102 // content-type header — exactly what the upstream server sees.
@@ -106,7 +109,7 @@ const makeRecordingHttpClient = () => { · 6 unmodified lines
106 url: request.url,109 url: request.url,
107 method: request.method,110 method: request.method,
108 contentType,111 contentType,
109 bodyKind: tag,112 bodyKind: isRaw ? "Raw" : isUint8Array ? "Uint8Array" : isFormData ? "FormData" : "",
110 body: bytes,113 body: bytes,
111 });114 });
112 115