Skip to content

refactor(core): use nonempty array guards - #45718

Merged
kitlangton merged 2 commits into
v2from
nonempty-guards
Aug 28, 2026
Merged

refactor(core): use nonempty array guards#45718
kitlangton merged 2 commits into
v2from
nonempty-guards

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

Why
Three private paths manually prove non-emptiness by casting or reconstructing first-plus-rest tuples. Effect Array already supplies guards and mapping overloads that preserve the non-empty shape.

What Changes
Uses isReadonlyArrayNonEmpty for provider-hosted tool content, isArrayNonEmpty for normalized local tool results and flattened child-process pipelines, and Effect Array map for non-empty tool-content redaction. The already-normalized arrays are returned or published directly.

Scope
Hosted empty content still falls back to text, local empty content still dies, cross-spawn still throws on an impossible empty flatten result, pipeline command/options ordering is unchanged, and every transferred content item uses the same sanitizer. PRs #45336 and #44806 touch other publisher state, while #45407 touches cross-spawn exit handling; none implement these collection refinements.

Verification

cd packages/core
bun typecheck
bun run test test/session-runner-tool-events.test.ts test/session-create.test.ts test/effect/cross-spawn-spawner.test.ts
cd ../util
bun typecheck
cd ../..
bunx oxlint packages/core/src/session/runner/publish-llm-event.ts packages/core/src/session/transfer.ts packages/util/src/cross-spawn-spawner.ts

Core and Util typechecks passed, and all 84 focused tests passed. Oxlint completed with no errors and 36 pre-existing warnings. The push hook completed the 33-package workspace typecheck.

@kitlangton
kitlangton merged commit b1d7dd8 into v2 Aug 28, 2026
12 of 13 checks passed
@kitlangton
kitlangton deleted the nonempty-guards branch August 28, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant