From bfb5494552870229d91102c767407a03b9df6af3 Mon Sep 17 00:00:00 2001 From: elpresidank Date: Tue, 2 Jun 2026 02:55:06 -0500 Subject: [PATCH] Remove provider stream sentinel assertions --- ts/EFFECT_NATIVE_REWRITE_AUDIT.md | 28 ++++++++++++++++--- .../src/model/text-completion/azure-openai.ts | 2 +- .../flow/src/model/text-completion/claude.ts | 2 +- .../flow/src/model/text-completion/mistral.ts | 2 +- .../flow/src/model/text-completion/ollama.ts | 2 +- .../text-completion/openai-compatible.ts | 2 +- .../flow/src/model/text-completion/openai.ts | 2 +- 7 files changed, 30 insertions(+), 10 deletions(-) diff --git a/ts/EFFECT_NATIVE_REWRITE_AUDIT.md b/ts/EFFECT_NATIVE_REWRITE_AUDIT.md index a6e9ddcc..a712eecc 100644 --- a/ts/EFFECT_NATIVE_REWRITE_AUDIT.md +++ b/ts/EFFECT_NATIVE_REWRITE_AUDIT.md @@ -12,8 +12,8 @@ Verified source roots: - Effect v4 subtree: `/home/elpresidank/YeeBois/projects/beep-effect2/.repos/effect-v4` - Installed Effect beta used by this workspace: `ts/node_modules/effect` -Current signal counts from `ts/packages` after the 2026-06-02 Base flow -definition schema slice: +Current signal counts from `ts/packages` after the 2026-06-02 Text completion +stream sentinel slice: | Signal | Count | | --- | ---: | @@ -68,6 +68,10 @@ Notes: - The base flow definition schema slice removed hand-rolled `Predicate`/object narrowing from `flow-processor.ts`; signal counts are unchanged because this was a validation-quality migration. +- The text completion stream sentinel slice removed the duplicated + `Effect.void as Effect.Effect` assertions from provider stream + unfold branches. Counts are unchanged because this was an Effect diagnostic + and type-channel cleanup. - `Record` and `throwLibrarianServiceError` are now clean in `ts/packages`. @@ -543,6 +547,24 @@ Notes: - `cd ts && bun run test` - `git diff --check` +### 2026-06-02: Text Completion Stream Sentinel Slice + +- Status: migrated and root-verified. +- Completed: + - `ts/packages/flow/src/model/text-completion/{ollama,openai,mistral,azure-openai,claude,openai-compatible}.ts` + now return the `Stream.unfold` end sentinel with + `Effect.as(Effect.void, undefined)`. + - Removed six `Effect.void as Effect.Effect` assertions without + replacing them with `Effect.succeed(undefined)`, which `@effect/tsgo` + flags as a diagnostic. +- Verification: + - `bun run --cwd ts/packages/flow build` + - `cd ts && bun run check` + - `bun run --cwd ts/packages/flow test` + - `cd ts && bun run build` + - `cd ts && bun run test` + - `git diff --check` + ## Subagent Findings To Preserve - MCP/workbench: @@ -627,8 +649,6 @@ Notes: - Rewrite shape: - Move env/config reading into `Config` loaders and provider-specific layers. - Scope SDK clients that need explicit close/disconnect. - - Remove `Effect.void as Effect.Effect` stream assertions by - letting branch return types infer or by restructuring the stream parser. - Tests: - Provider config tests with `ConfigProvider.fromMap`. - Storage tests with fake clients before changing real resource lifetimes. diff --git a/ts/packages/flow/src/model/text-completion/azure-openai.ts b/ts/packages/flow/src/model/text-completion/azure-openai.ts index 6e02c045..0414c401 100644 --- a/ts/packages/flow/src/model/text-completion/azure-openai.ts +++ b/ts/packages/flow/src/model/text-completion/azure-openai.ts @@ -164,7 +164,7 @@ export function makeAzureOpenAIProvider(config: AzureOpenAIProcessorConfig): Llm return Stream.unfold<"pulling" | "done", LlmChunk, TextCompletionRuntimeError, never>( "pulling", (state) => { - if (state === "done") return Effect.void as Effect.Effect; + if (state === "done") return Effect.as(Effect.void, undefined); return Effect.gen(function* () { while (true) { diff --git a/ts/packages/flow/src/model/text-completion/claude.ts b/ts/packages/flow/src/model/text-completion/claude.ts index 8d00486e..83f10409 100644 --- a/ts/packages/flow/src/model/text-completion/claude.ts +++ b/ts/packages/flow/src/model/text-completion/claude.ts @@ -142,7 +142,7 @@ export function makeClaudeProvider(config: ClaudeProcessorConfig): LlmProvider { return Stream.unfold<"pulling" | "done", LlmChunk, TextCompletionRuntimeError, never>( "pulling", (state) => { - if (state === "done") return Effect.void as Effect.Effect; + if (state === "done") return Effect.as(Effect.void, undefined); return Effect.gen(function* () { while (true) { diff --git a/ts/packages/flow/src/model/text-completion/mistral.ts b/ts/packages/flow/src/model/text-completion/mistral.ts index e9633467..8ae43154 100644 --- a/ts/packages/flow/src/model/text-completion/mistral.ts +++ b/ts/packages/flow/src/model/text-completion/mistral.ts @@ -142,7 +142,7 @@ export function makeMistralProvider(config: MistralProcessorConfig): LlmProvider return Stream.unfold<"pulling" | "done", LlmChunk, TextCompletionRuntimeError, never>( "pulling", (state) => { - if (state === "done") return Effect.void as Effect.Effect; + if (state === "done") return Effect.as(Effect.void, undefined); return Effect.gen(function* () { while (true) { diff --git a/ts/packages/flow/src/model/text-completion/ollama.ts b/ts/packages/flow/src/model/text-completion/ollama.ts index d27abaeb..61b87693 100644 --- a/ts/packages/flow/src/model/text-completion/ollama.ts +++ b/ts/packages/flow/src/model/text-completion/ollama.ts @@ -120,7 +120,7 @@ export function makeOllamaProvider(config: OllamaProcessorConfig): LlmProvider { return Stream.unfold<"pulling" | "done", LlmChunk, TextCompletionRuntimeError, never>( "pulling", (state) => { - if (state === "done") return Effect.void as Effect.Effect; + if (state === "done") return Effect.as(Effect.void, undefined); return Effect.gen(function* () { while (true) { diff --git a/ts/packages/flow/src/model/text-completion/openai-compatible.ts b/ts/packages/flow/src/model/text-completion/openai-compatible.ts index d5762dea..754a5081 100644 --- a/ts/packages/flow/src/model/text-completion/openai-compatible.ts +++ b/ts/packages/flow/src/model/text-completion/openai-compatible.ts @@ -155,7 +155,7 @@ export function makeOpenAICompatibleProvider( return Stream.unfold<"pulling" | "done", LlmChunk, TextCompletionRuntimeError, never>( "pulling", (state) => { - if (state === "done") return Effect.void as Effect.Effect; + if (state === "done") return Effect.as(Effect.void, undefined); return Effect.gen(function* () { while (true) { diff --git a/ts/packages/flow/src/model/text-completion/openai.ts b/ts/packages/flow/src/model/text-completion/openai.ts index a6530b39..fd123e9e 100644 --- a/ts/packages/flow/src/model/text-completion/openai.ts +++ b/ts/packages/flow/src/model/text-completion/openai.ts @@ -146,7 +146,7 @@ export function makeOpenAIProvider(config: OpenAIProcessorConfig): LlmProvider { return Stream.unfold<"pulling" | "done", LlmChunk, TextCompletionRuntimeError, never>( "pulling", (state) => { - if (state === "done") return Effect.void as Effect.Effect; + if (state === "done") return Effect.as(Effect.void, undefined); return Effect.gen(function* () { while (true) {