Skip to content

feat! Major Design and Feature Improvements - #22

Merged
couchdeveloper merged 1 commit into
mainfrom
feature/improveDesign
Aug 2, 2026
Merged

feat! Major Design and Feature Improvements#22
couchdeveloper merged 1 commit into
mainfrom
feature/improveDesign

Conversation

@couchdeveloper

Copy link
Copy Markdown
Owner

Summary

This PR consolidates the feature/improveDesign branch into main, representing a substantial architectural overhaul of the Transduce runtime. The changes span the effect system, task management, concurrency model, and host layer — with a focus on correctness under Swift 6 strict concurrency and a cleaner, more composable public API.

This is a breaking change. Several public types and signatures have been restructured. At this early development stage, API instability is expected and acceptable. Consumers on 0.9.0 should not merge until 1.0 beta is released.

Effect System
The effect system has been simplified from a fragmented set of factory functions into a cohesive enum with explicit cases for each effect variant. Task effects now use nonisolated(nonsending) closures, eliminating ambiguity around actor isolation. The TaskReturn enum gives fine-grained control over how tasks dispatch their results — supporting .response, .send, .post, .request, and .uniqueRequest dispatch styles. Action effects are split into sync/async x terminal/partial/maybe-partial variants, each with clear isolation semantics documented inline.

Task Management
The TaskManager now implements a full 2x2 overlap policy matrix: .switchToLatest and .shareable policies, each behaving correctly for both runtime-owned and caller-owned continuations. Anonymous tasks get auto-generated identifiers. Waiter lifecycle is enforced via the Waiters enum with exactly-once resume semantics. The test suite for task management has grown to ~30 tests covering add, cancel, subscribe, switch, and cross-id isolation scenarios.

Concurrency & Swift 6
The runtime is fully compliant with Swift 6 strict concurrency. The Transducer protocol uses a primary associated type (Transducer) for cleaner constraint expressions. BaseRuntime is @unchecked Sendable with host-level guarantees enforced by GlobalActorRuntime. The compute gate serializes all compute cycles on the system actor, preventing re-entrancy. All closure parameters carry explicit isolation annotations — nonisolated(nonsending) for task operations, isolated variants for actions that touch actor state.

Hosts & Observation
EffectView remains the primary SwiftUI host, with TransducerHost providing a lightweight actor-isolated wrapper for non-UI contexts. The TransducerObservable host bridges to Swift's Observation framework. The observe() function enables reactive keypath tracking inside task effects, with proper cancellation on task teardown.

Version & Release Intent
This commit is the candidate for a beta release, positioning the library near its first beta release. The core runtime is stable, the test suite is comprehensive (162 tests, all passing), and the public API surface is well-documented. Remaining work before 1.0 beta includes: sequence effects discarding intermediate events (deferred), stress testing under high concurrency, and filling Observation host test coverage.

@couchdeveloper
couchdeveloper force-pushed the feature/improveDesign branch from fd32c28 to e00b68d Compare August 2, 2026 19:48
**Summary**

This PR consolidates the feature/improveDesign branch into main,
representing a substantial architectural overhaul of the Transduce
runtime. The changes span the effect system, task management, concurrency
model, and host layer — with a focus on correctness under Swift 6 strict
concurrency and a cleaner, more composable public API.

This is a breaking change. Several public types and signatures have been
restructured. At this early development stage, API instability is expected
and acceptable. Consumers on 0.9.0 should not merge until 1.0 beta is
released.

**Effect System**
The effect system has been simplified from a fragmented set of factory
functions into a cohesive enum with explicit cases for each effect
variant. Task effects now use nonisolated(nonsending) closures,
eliminating ambiguity around actor isolation. The TaskReturn enum gives
fine-grained control over how tasks dispatch their results — supporting
.response, .send, .post, .request, and .uniqueRequest dispatch styles.
Action effects are split into sync/async x terminal/partial/maybe-partial
variants, each with clear isolation semantics documented inline.

**Task Management**
The TaskManager now implements a full 2x2 overlap policy matrix:
.switchToLatest and .shareable policies, each behaving correctly for
both runtime-owned and caller-owned continuations. Anonymous tasks get
auto-generated identifiers. Waiter lifecycle is enforced via the Waiters
enum with exactly-once resume semantics. The test suite for task
management has grown to ~30 tests covering add, cancel, subscribe,
switch, and cross-id isolation scenarios.

**Concurrency & Swift 6**
The runtime is fully compliant with Swift 6 strict concurrency. The
Transducer protocol uses a primary associated type (Transducer<Env>) for
cleaner constraint expressions. BaseRuntime is @unchecked Sendable with
host-level guarantees enforced by GlobalActorRuntime. The compute gate
serializes all compute cycles on the system actor, preventing re-entrancy.
All closure parameters carry explicit isolation annotations —
nonisolated(nonsending) for task operations, isolated variants for
actions that touch actor state.

**Hosts & Observation**
EffectView remains the primary SwiftUI host, with TransducerHost
providing a lightweight actor-isolated wrapper for non-UI contexts. The
TransducerObservable host bridges to Swift's Observation framework. The
observe() function enables reactive keypath tracking inside task effects,
with proper cancellation on task teardown.

**Version & Release Intent**
This commit is the candidate for a beta release, positioning the library
near its first beta release. The core runtime is stable, the test suite
is comprehensive (162 tests, all passing), and the public API surface is
well-documented. Remaining work before 1.0 beta includes: sequence
effects discarding intermediate events (deferred), stress testing under
high concurrency, and filling Observation host test coverage.

Remove analysis reports

Remove development todos files

Reset tool version to 6.3 in package manifest

Adjust code for Swift 6.3.x
@couchdeveloper
couchdeveloper force-pushed the feature/improveDesign branch from e00b68d to 30d28ba Compare August 2, 2026 21:21
@couchdeveloper
couchdeveloper merged commit 8b63ae5 into main Aug 2, 2026
1 check passed
@couchdeveloper
couchdeveloper deleted the feature/improveDesign branch August 2, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant