better_effect 0.4.0
better_effect: ^0.4.0 copied to clipboard
Contextual dependency injection, typed error propagation, and scoped resources for result_dart.
0.4.0 #
- Added the repository-level normative semantic contract and an independent cross-package conformance suite mapping stable lifecycle/outcome rules to executable rule IDs.
- Semantic compatibility changes now require the matching conformance scenario, affected package changelog entries, and a semantic migration ledger entry.
- Added
Runtime.forkfor feature-length child environments with local-first resolution and parent fallback. - Child Module resources survive multiple executions, close exactly once with the child Runtime, and are coordinated before parent resources during parent shutdown.
- Runtime observer contexts now expose
runtimeId,parentRuntimeId, andruntimeLabelso feature and execution boundaries can be correlated. - Nested execution overlays preserve the complete parent fallback chain.
- Added typed-failure
Effect.retrywithnone, fixed, linear, and exponential policies, optional full jitter, maximum delays, and explicit attempt-count semantics. - Each retry attempt owns a child Scope that closes before policy evaluation or delay; cleanup defects retain Runtime precedence and prevent a broken typed-failure attempt from retrying.
- Added optional
EffectClockandEffectRandomcontracts with host, seeded, and manual test implementations; no service is installed implicitly. - Added observable
RetryEventdecisions, deterministic tests, package and website guides, and a retry benchmark. - Added lazy
Effect.allandEffect.forEachcollection composition with sequential-by-default and positive bounded concurrency. - Added explicit
Effect.allUnboundedandEffect.forEachUnboundedAPIs so unbounded fan-out cannot happen through an omitted limit. - Collection results preserve input order and are returned as unmodifiable Lists, while scheduling remains FIFO.
- Typed failure selection is deterministic by lowest started input index; no new work starts after failure or interruption, and already-started operations remain physically owned until completion.
- Collection defects stay defects, worker resources retain normal Scope cleanup semantics, and sequential/bounded/unbounded benchmarks are included.
0.3.0 #
- Added
Runtime.executeWith,runWith, andrunExitWithfor temporary execution-scoped Modules. - Execution Modules resolve local providers first and fall back to the root Runtime without mutating root registrations.
- Local constructor injection can combine execution-local and root services,
including typed
ServiceKeyregistrations. - Execution Module resources share the managed execution Scope and remain owned until physical completion after timeout or interruption.
- Partial local startup failures release previously acquired resources before publishing an execution defect.
- Added the optional
ResolverBackendOverlayFactorycapability for custom backends;AutoInjectorBackendsupports isolated overlays by default. - Added synchronous, SDK-neutral
RuntimeObservercallbacks for execution, service resolution, resource acquisition/release, interruption, and cleanup failures. - Runtime observer failures are isolated and can be reported through a
best-effort
RuntimeObserverErrorHandlerwithout changing Effect outcomes. - Execution events now expose labels, physical duration, opaque Scope identity, logical outcomes, and selected local metadata.
- Added
EffectLocal.metadata, typedEffectLocal.bind, andEffect.withLocalsfor heterogeneous batch context composition. - Added service resolution paths, execution-scoped Module event propagation, Flutter Command label verification, observer-ordering tests, and a standalone no-observer overhead benchmark.
- Added
package:better_effect/testing.dartwithTestRuntime, typed Exit matchers/extractors, deterministic gates and signals, ordered event recording, Runtime event waits, and active-execution leak assertions. - Added a public
ResolverBackendcompatibility kit covering lifetimes, keys, constructor resolution, missing/circular dependencies, duplicate and post-commit registration, startup cleanup, close semantics, overlays, and optional native disposal probes.
0.2.0 #
- Added owned
Scope.make()values with public child Scope, finalizer, acquisition, and close operations. - Child Scopes now close before their parents in reverse creation order.
- Resource acquisition now registers cleanup atomically and immediately releases resources acquired after Scope closure begins.
- Resource release callbacks now receive the
Exitthat closed their Scope. - Module resources and
EffectContext.acquirenow share the same Scope acquisition lifecycle. - Added
Runtime.executeand typedEffectExecution<A, E>handles with IDs, labels, logical exits, physical-running state, and cooperative interruption. Runtime.runandrunExitnow delegate to the managed execution path.- Runtime shutdown now rejects new work, drains active executions, supports a grace period, and can request cooperative interruption before resource release.
- Timeouts keep their physical execution Scope owned until the source Future and all resource cleanup complete.
- Cleanup failures preserve typed failures and interruptions, aggregate with defects, and can be reported through a best-effort observer.
- Cancellation signals expose the first reason and a cooperative
throwIfCancelledboundary. Module.overrideWithnow replaces existing bindings in place and appends only new service identities, preserving resource startup and reverse cleanup order.- Resource acquisition defects now identify the resource service and optional key while preserving the original dependency-resolution cause.
- Added a bounded, gate-driven regression suite for Scope races, timeout-owned resources, shutdown ordering, concurrent close, outcome authority, and cleanup precedence.
0.1.1 #
- Expanded the package documentation with complete installation, composition, runtime, resource, testing, and operational guidance.
0.1.0 #
- Initial core implementation.
- Added lazy
Effect<A, E>values backed byresult_dart. - Added contextual service resolution with
use<T>(). - Added automatic typed failure propagation with
use.unwrap,use.result, anduse.fail. - Added
Module,Binding, and anauto_injectorbackend. - Added factory, eager singleton, lazy singleton, instance, keyed, and resource bindings.
- Added runtime and execution scopes with reverse-order asynchronous cleanup.
- Added Effect locals, local service overrides,
Exit, records-basedzip, and core Effect operators.