stack: effectify-file-watcher-service#17827
Merged
kitlangton merged 12 commits intodevfrom Mar 16, 2026
Merged
Conversation
Convert FileWatcher from Instance.state namespace to an Effect ServiceMap.Service with proper scope-based lifecycle management.
The @parcel/watcher callback fires from a native C++ uv_async handle which does not preserve Node.js AsyncLocalStorage context. Wrap the callback in Instance.provide to restore the instance ALS context so Bus.publish can resolve instance-scoped state and directory.
Add Instance.bind(fn) which captures the current instance ALS context and returns a wrapper that synchronously restores it when called. This prevents silent failures when callbacks fire outside the instance async context (native addons, event emitters, timers). Use it in FileWatcherService to bind the @parcel/watcher callback, replacing the async Instance.provide workaround.
…pace Use Effect.Config.boolean with ConfigProvider (defaults to env) so tests can override flags via ConfigProvider.layer without module mocking. Removes mock.module that was poisoning Flag getters and causing cross-test pollution in config/instruction tests.
Document Instance-scoped services, Instance.bind for ALS context in native callbacks, and the Flag → Effect.Config migration pattern.
Probe both root and git watcher readiness before asserting events so the watcher tests stop racing startup. Also make the PTY ordering test use a deterministic short-lived process and keep native PTY callbacks bound to the instance context.
- Use property shorthand `{ init }` in catchCause fallback
- Make BusUpdate.directory required (non-optional)
- Use Effect.runSync instead of Effect.runFork in synchronous callback
The deny path is synchronous once the Effect runs, but the ManagedRuntime can take >100ms to start on slow CI runners. Just await the result directly — bun's 30s test timeout is the backstop if it ever hangs.
When w.subscribe() takes longer than SUBSCRIBE_TIMEOUT_MS and eventually resolves, the subscription was left active and unmanaged. Now the catchCause handler explicitly unsubscribes it, matching the old withTimeout cleanup behavior.
Collaborator
|
Stacks on Stacks on Stacks |
ConanXu-math
pushed a commit
to ConanXu-math/opencode
that referenced
this pull request
Mar 17, 2026
3 tasks
AvatarGanymede
pushed a commit
to AvatarGanymede/opencode-dev
that referenced
this pull request
Mar 19, 2026
demostanis
pushed a commit
to demostanis/opencode
that referenced
this pull request
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restacked effectify-file-watcher-service onto dev.