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
1212 Effect.gen(function* () {
1313 const sources: readonly Source[] = yield* executor.sources
1414 .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+ );
1620
1721 const description = yield* Effect.sync(() => formatDescription(sources)).pipe(
1822 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
1818 import { env } from "cloudflare:workers";
1919 import * as Effect from "effect/Effect";
2020 import * as Layer from "effect/Layer";
21+import * as Predicate from "effect/Predicate";
2122 import { HttpClient, HttpClientResponse, type HttpClientRequest } from "effect/unstable/http";
2223
2324 import {
@@ -85,15 +86,17 @@ const makeRecordingHttpClient = () => { · 61 unmodified lines
8586 const headers = { ...request.headers };
8687 let bytes = new Uint8Array();
8788 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");
8992
90− if (tag === "Raw" || tag === "Uint8Array") {
93+ if (isRaw || isUint8Array) {
9194 const wire = new Request("http://capture/", {
9295 method: "POST",
9396 body: request.body.body as BodyInit,
9497 });
9598 bytes = new Uint8Array(yield* Effect.promise(() => wire.arrayBuffer()));
96− } else if (tag === "FormData") {
99+ } else if (isFormData) {
97100 // Letting `Response` realize the FormData yields the actual
98101 // multipart wire bytes plus a generated boundary in its
99102 // content-type header — exactly what the upstream server sees.
@@ -106,7 +109,7 @@ const makeRecordingHttpClient = () => { · 6 unmodified lines
106109 url: request.url,
107110 method: request.method,
108111 contentType,
109− bodyKind: tag,
112+ bodyKind: isRaw ? "Raw" : isUint8Array ? "Uint8Array" : isFormData ? "FormData" : "",
110113 body: bytes,
111114 });
112115