effect-concurrency-testing

Test Effect concurrency primitives deterministically with Deferred, Latch, PubSub, and Stream.

22|1|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/mpsuesser/pi-effect-harness --skill effect-concurrency-testing-mpsuesser
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-concurrency-testing
Source: https://github.com/mpsuesser/pi-effect-harness/tree/main/harnesses/effect/skills/effect-concurrency-testing
Command: npx skills add https://github.com/mpsuesser/pi-effect-harness --skill effect-concurrency-testing-mpsuesser

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Effect concurrency tests often flake or miss events because fibers, streams, and subscriptions aren’t synchronized correctly.

Core Features & Use Cases

  • Coordination primitive selection: choose the right tool (yieldNow, Latch, Deferred, PubSub, SubscriptionRef, Stream) for the synchronization goal.
  • Deterministic fiber testing patterns: verify scheduling, completion status, interruption behavior, and time-dependent logic using TestClock only when appropriate.
  • Event and stream correctness: validate published events, ensure subscriptions are ready before mutations, and confirm stream finalizers and error handling.

Quick Start

Use the effect-concurrency-testing skill to help you write deterministic tests for PubSub, Deferred, Latch, SubscriptionRef, and Stream by coordinating readiness, mutations, and assertions correctly.

Frequently Asked Questions about effect-concurrency-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write deterministic tests for Effect concurrency primitives?

Deterministic tests for Effect concurrency primitives require coordinating readiness using Latch, Deferred, or PubSub before asserting mutations, ensuring fibers, streams, and subscriptions synchronize correctly without missing events.

Why does my Effect PubSub test flake or miss published events?

Effect PubSub tests flake when subscriptions are not fully ready before publishing events. You must synchronize subscription readiness using coordination primitives like Latch or Deferred to guarantee deterministic event delivery.

When should I use TestClock for time-dependent logic in Effect streams?

Use TestClock for time-dependent logic in Effect streams only when you need to control scheduled time progression. Apply it carefully alongside readiness synchronization to avoid busy polling and verify deterministic fiber completion behavior.

What's the best way to test Effect Fiber interruption and completion status?

Testing Effect Fiber interruption and completion status requires deterministic scheduling patterns. Coordinate fibers using Latch or Deferred to verify interruption correctness and controlled completion without relying on busy polling.

How do I verify SubscriptionRef change streams in Effect without race conditions?

Verify SubscriptionRef change streams by ensuring subscription readiness before applying mutations. Synchronize the stream attachment using Latch or Deferred so change events are captured deterministically, preventing race conditions and missed updates.

Can I use Deferred and Latch to coordinate readiness for Effect stream finalizers?

Yes, Deferred and Latch coordinate readiness for Effect stream finalizers by gating stream attachment and lifecycle progression. This scoped lifecycle management ensures finalizers and error handling execute predictably during concurrent workflow tests.