Skip to content

Commit d5ea6b7

Browse files
authored
fix(utoopack): unify native development ownership (#118)
1 parent ba3049e commit d5ea6b7

23 files changed

Lines changed: 1406 additions & 797 deletions

ARCHITECTURE.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,20 @@ one fixed config, CoreGraph, BuildPlan, plugin-hook set, generated IR image,
242242
and bundler controller; adapters are never asked to replace those inputs in
243243
place.
244244

245+
The Utoopack adapter keeps one native-owner Worker for the lifetime of
246+
`ev dev`. That Worker is the only development realm that loads Utoopack's
247+
native binding: it registers the process-global loader scheduler and owns all
248+
sequential native Projects. Individual Sessions still own and fully release
249+
their Project, HTTP server, subscriptions, and persistent-cache lock. The host
250+
exchanges cloneable Session commands with the owner and retains only callbacks
251+
that cannot cross the Worker boundary, such as function-valued proxy rewrites.
252+
Successful Utoopack process-exit requests are converted into Session-close
253+
acknowledgements inside the owner; unexpected exits, scheduler failures, and
254+
shutdown timeouts poison the owner and prevent an overlapping replacement.
255+
Production build and development ownership cannot be mixed in one process;
256+
development also rejects a host-preloaded Utoopack binding before it creates
257+
the owner Worker.
258+
245259
Framework watchers cover opaque config/plugin inputs, semantic analysis
246260
dependencies, and Page/API topology. They compare file content and stable
247261
directory topology, ignore generated output, and fall back from native events

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ All notable changes to evjs are documented here. Releases follow [Semantic Versi
66

77
## [Unreleased]
88

9+
### 🐛 Bug Fixes
10+
11+
- **Single-realm Utoopack native ownership**`ev dev` now keeps Utoopack's
12+
native binding, process-global loader scheduler, loader-worker pool, and all
13+
sequential Projects in one long-lived Worker. Immutable Session replacement
14+
runs complete Project, server, subscription, and persistent-cache cleanup
15+
without moving native callbacks across Worker environments; owner and
16+
shutdown failures remain fail-stop instead of starting overlapping Projects.
17+
918
---
1019

1120
## [0.3.15] — 2026-08-20

package-lock.json

Lines changed: 63 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/bundler-utoopack/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,25 @@ Its declared capabilities are the authoritative boundary: conventional
1111
server-rendered Page entries are supported, while plans that require RSC or
1212
PPR fail during framework preflight.
1313

14+
## Development Native Ownership
15+
16+
Utoopack development uses one long-lived native-owner Worker for the complete
17+
`ev dev` command. Ownership is intentionally split by lifetime:
18+
19+
| Lifetime | Owner | Responsibility |
20+
| --- | --- | --- |
21+
| `ev dev` process | Framework host | Session protocol, function-valued proxy rewrites, and framework supervision. It does not load Utoopack's native binding. |
22+
| `ev dev` process | Native-owner Worker | Utoopack's native binding, process-global loader scheduler, loader-worker pool, and every sequential native Project. |
23+
| Immutable Session | Native-owner Worker | One Project, development server, subscriptions, and persistent-cache lock. These close completely before the next Session starts. |
24+
25+
Session replacement runs Utoopack's own graceful cleanup inside the owner and
26+
converts its successful process exit into a Session boundary. The Worker then
27+
remains idle for the next immutable Session. Owner startup failures, loader
28+
scheduler failures, unexpected exits, and shutdown timeouts are fail-stop; the
29+
host never creates a second native owner in the same process. Startup also
30+
rejects a host that has already loaded Utoopack's native binding, because that
31+
would recreate cross-environment native ownership.
32+
1433
## Usage
1534

1635
This adapter is enabled by default in evjs. You do not need to configure it manually unless you are overriding another bundler.

0 commit comments

Comments
 (0)