Skip to content

Porting process to V3#87

Merged
taras merged 265 commits into
mainfrom
tm/add-process
Oct 18, 2025
Merged

Porting process to V3#87
taras merged 265 commits into
mainfrom
tm/add-process

Conversation

@taras

@taras taras commented Sep 7, 2025

Copy link
Copy Markdown
Member

Motivation

We need a repliable way to spawn processes. We did a lot of research for processes in v2 and it running it's tests passed on my machine which has been experiecing a weird problem not being able to terminate processes.

Approach

Rewrite to V3

dagda1 and others added 30 commits July 23, 2021 16:42
Co-authored-by: Charles Lowell <cowboyd@frontside.com>
> resolves #360

This adds a `spawn()` operation to the `Task` api which,
unsuprisingly, spawns a child in the context of a particular
task. Note that this is an _operation_, and not a synchronous
function. Calling the `spawn()` method will not actually do anything
until the operation is evaluated.

Now, it is very easy and safe to spawn operations within the context
of a specific task without having to use the `within()` syntax (which
we might deprecate in the future).
Co-authored-by: frontsidejack <frontsidejack@users.noreply.github.com>
* create a lib directory for esm

* add tsconfig.dist-esm.json

* copy package.json into dist for version in @effection/core

* rename tsconfig.dist.json to tsconfig.cjs.json

* add tsconfig.esm.json files

* rollback inspect-ui changes

* add return types

* more return types

* readd patches

* fix copy

* add copy task to core

* again

* remove copy

* remove copy

* remove copy 2

* copy 3

* copy 4

* copy 5

* use cp instead of copy

* use copy-cli alias
* Add sideEffects field to package.json

* expand sideEffects in inspect-ui

* remove sideEffects from mocha package.json

* remove sideEffects from inspect
Co-authored-by: frontsidejack <frontsidejack@users.noreply.github.com>
Add spawn operation directly to Task.

@cowboyd cowboyd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like there are a lot of changes on this branch that are unrelated to process. Did these come in from a different branch?

@taras

taras commented Oct 8, 2025

Copy link
Copy Markdown
Member Author

I imported history from v2 when bringing process and it imported all of those commits.

Taras Mankovski added 3 commits October 17, 2025 19:07
Downgraded packages to versions lower than their lowest published versions on JSR:
- websocket: 2.1.0 → 2.0.0
- worker: 0.2.0 → 0.1.0
- test-adapter: 0.5.1 → 0.1.0
- timebox: 0.2.0 → 0.1.0
- watch: 0.2.0 → 0.1.1
- jsonl-store: 0.2.0 → 0.1.0
- task-buffer: 1.1.0 → 1.0.1
- raf: 1.0.0-alpha.1 → 0.0.1

All packages were previously downgraded from Effection v4 to v3, and now need version numbers that don't conflict with already-published versions.

Added path-dependencies.md documenting:
- Projects with path-based dependencies
- Effection v4 → v3 downgrade history
- Published versions on JSR
- Suggested downgrade versions
Updated dependency versions to match downgraded package versions:
- worker: timebox dependency from ^0.2.0 → ^0.1.0
- bdd: test-adapter dependency from ^0.5.1 → ^0.1.0

These packages depend on packages that were downgraded to unpublished
versions, so their dependency constraints need to be updated accordingly.

Updated path-dependencies.md to document the dependency changes.
Changes:
- process: stream-helpers path → jsr:@effectionx/stream-helpers@0.3.0
- watch: process path → jsr:@effectionx/process@0.5.0
- watch: stream-helpers path → jsr:@effectionx/stream-helpers@0.3.0
- worker: timebox jsr → npm:@effectionx/timebox@^0.1.0
- stream-helpers: signals jsr → npm:@effectionx/signals@0.3.0
- bdd: test-adapter npm → jsr:@effectionx/test-adapter@^0.1.0
- All packages: bdd version 0.1.0 → 0.2.2 to match actual bdd package version

Most @effectionx packages use JSR for dependencies on other @effectionx packages
except timebox and signals which use npm. Dependency versions now match actual
package versions to avoid Deno workspace member warnings.
Taras Mankovski added 2 commits October 17, 2025 19:43
Added version constraint @6.0.6 to @types/cross-spawn in the @ts-types
directive to satisfy JSR publish requirements. This ensures the package
can be published without warnings about missing version constraints.
@taras taras merged commit e1da8b8 into main Oct 18, 2025
4 checks passed
@taras taras deleted the tm/add-process branch October 18, 2025 00:16
@taras taras mentioned this pull request Oct 19, 2025
taras pushed a commit that referenced this pull request Dec 8, 2025
### 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:
   ```bash
   deno task generate-importmap
   ```

2. Run tests with v4:
   ```bash
   deno test --import-map v4.importmap.json -A
   ```

3. Run tests with v3 (default):
   ```bash
   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`
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.

8 participants