Skip to content

Run tests on effection v4#99

Merged
taras merged 45 commits intomainfrom
tm/try-v4
Dec 8, 2025
Merged

Run tests on effection v4#99
taras merged 45 commits intomainfrom
tm/try-v4

Conversation

@taras
Copy link
Member

@taras taras commented Oct 19, 2025

Closes thefrontside/effection#1035

Motivation

All @effectionx extensions were migrated to v3 in #87, but we now want to ensure compatibility with effection v4. This PR adds the infrastructure to run tests against both v3 and v4 versions of effection, and prepares all packages for publishing with dual version support.

Changes

Import Map Generation

  • Created tasks/generate-importmap.ts that dynamically fetches the latest v4 version from the npm registry at generation time
  • The import map automatically collects all external dependencies from workspace packages
  • Maps @effectionx/* packages to their local paths for testing

CI Workflow Updates

  • Refactored .github/workflows/verify-posix.yaml and .github/workflows/verify-windows.yaml to use workflow_call for reusability
  • CI now runs both V3 Tests and V4 Tests on every PR and push to main
  • Added --trace-leaks flag to v4 tests for better debugging
  • Updated publish workflow to require verification jobs before publishing

NPM Peer Dependency

  • Updated tasks/build-npm.ts to use "effection": "^3 || ^4.0.0-0" to support v4 prereleases

Version Bumps

All 16 packages received minor version bumps to publish with v3/v4 compatibility:

Package New Version
@effectionx/context-api 0.2.0
@effectionx/deno-deploy 0.3.0
@effectionx/bdd 0.3.0
@effectionx/jsonl-store 0.3.0
@effectionx/fx 0.3.0
@effectionx/raf 0.1.0
@effectionx/task-buffer 1.2.0
@effectionx/test-adapter 0.6.0
@effectionx/timebox 0.3.0
@effectionx/tinyexec 0.3.0
@effectionx/watch 0.3.0
@effectionx/websocket 2.2.0
@effectionx/worker 0.3.0
@effectionx/stream-helpers 0.4.0
@effectionx/signals 0.4.0
@effectionx/process 0.6.0

Test Adapter Enhancements

  • Added sanitization options to test functions for disabling operation and resource sanitization when needed

Resource Refactoring

  • Converted process to use resource pattern (required for v4 compatibility)
  • Refactored inspector into a resource

Test Compatibility Fixes

Multiple test files were updated to work with both v3 and v4:

  • Added sleep(0) calls to give the operation tree time to set up subscriptions
  • Wrapped operations in spawn where v4's stricter lifecycle management requires it
  • Fixed batch stream completion handling for proper done state propagation

Documentation

  • Added testing instructions to root README.md for running v3 and v4 tests
  • Rewrote process/README.md with comprehensive documentation

How to Use

  1. Generate the v4 import map:

    deno task generate-importmap
  2. Run tests with v4:

    deno test --import-map v4.importmap.json -A
  3. Run tests with v3 (default):

    deno test -A

Summary

  • 53 files changed, 1,211 insertions(+), 489 deletions(-)
  • Key packages affected: stream-helpers, signals, task-buffer, watch, process, test-adapter, fx

@taras taras force-pushed the tm/try-v4 branch 3 times, most recently from 71c04be to 9913264 Compare October 19, 2025 19:40
@cowboyd cowboyd force-pushed the tm/try-v4 branch 2 times, most recently from daf5aec to 6f4feee Compare October 20, 2025 18:46
taras and others added 23 commits October 28, 2025 19:38
- Created tasks/generate-importmap.ts to automatically collect all
  external dependencies from workspace packages
- Added "generate-importmap" task to root deno.json
- Replaced @gordonb/pipe with remeda in watch package
- Updated all remeda versions to ^2
- Added ws dependency to websocket package
- Added v4.importmap.json to .gitignore (generated file)
- Read exports field from each package's deno.json
- Support both string and object export formats
- Map workspace packages to their actual export paths
- Automatically add @std/testing sub-packages (/bdd, /mock, /time)
- Force all packages to use effection v4
- Rewrite batch implementation to use iterator-based approach with timebox
- Remove all console.log debug statements from batch
- Add sleep(1) calls in tests for operation tree setup timing
- Update batch tests to use signal convergence patterns
- Refactor tracker tests to use createArraySignal and is()
- Remove unused imports from test files
- Add @effectionx/timebox dependency to stream-helpers
- Initialize next with done=true to handle stream completion properly
- When lastPull times out, halt it and clear the reference before checking next
- When lastPull resolves, use its result as next instead of pushing to batch
- Move subscription.next() into else block to avoid duplicate calls
- Return next directly at end to propagate done state correctly
- When lastPull exists at the start of next(), wrap it in a timebox to respect maxTime. If the timeout occurs, halt the task instead of waiting indefinitely.

This fixes the hanging test where forEach would wait indefinitely for more items after the source stream was exhausted.
@taras taras force-pushed the tm/try-v4 branch 2 times, most recently from f3ad201 to 0e48239 Compare November 2, 2025 16:08
@taras taras marked this pull request as ready for review December 8, 2025 00:42
taras added 7 commits December 7, 2025 19:46
…nagement features, including usage examples for exec() and daemon() functions, and clarify error handling with join() and expect() methods.
…ss multiple modules, and update @effectionx/test-adapter to version 0.6.0 in bdd module.
…@effectionx/test-adapter, and related packages across multiple modules.
…nx/bdd, @effectionx/test-adapter, and related packages across multiple modules."

This reverts commit 0bdeb12.
…nd improve usage documentation. Update dependencies for @effectionx/bdd and related packages to version 0.2.2 across multiple modules, and adjust GitHub Actions workflows to use the new import map generation.
@taras taras merged commit a58764f into main Dec 8, 2025
4 checks passed
@taras taras deleted the tm/try-v4 branch December 8, 2025 01:45
@jbolda jbolda mentioned this pull request Dec 8, 2025
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.

EffectionX working on v4

3 participants