effectify Bus service: migrate to Effect PubSub + InstanceState#18579
Merged
kitlangton merged 19 commits intodevfrom Mar 26, 2026
Merged
effectify Bus service: migrate to Effect PubSub + InstanceState#18579kitlangton merged 19 commits intodevfrom
kitlangton merged 19 commits intodevfrom
Conversation
2400082 to
aceadf1
Compare
Contributor
|
This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch Please resolve this issue to include this PR in the next beta release. |
- Replace manual subscription Map with PubSub.unbounded per instance - Per-type PubSubs + wildcard PubSub, cleaned up via addFinalizer - InstanceDisposed published before PubSub shutdown so subscribers see it - Add makeRuntime to run-service.ts (single runtime with runPromise + runFork) - Legacy facade preserved: publish/subscribe/subscribeAll same signatures - subscribe/subscribeAll fork stream consumer fibers, return interrupt function - Extract Format.file() for explicit formatting, remove event-driven subscription - Inline Format.file() calls in write/edit/apply_patch tools - Drop Bus.once (zero callers) - Keep makeRunPromise as deprecated wrapper for existing services
- Replace manual subscription Map with PubSub.unbounded per instance - Per-type PubSubs + wildcard PubSub, cleaned up via addFinalizer - InstanceDisposed published before PubSub shutdown so subscribers see it - Replace makeRunPromise with makeRuntime (single runtime with runPromise + runFork) - Update all 19 services to use makeRuntime destructuring - Legacy facade preserved: publish/subscribe/subscribeAll same signatures - subscribe/subscribeAll fork stream consumer fibers, return interrupt function - Extract Format.file() for explicit formatting, remove event-driven subscription - Inline Format.file() calls in write/edit/apply_patch tools - Drop Bus.once (zero callers)
- Add runCallback to makeRuntime (returns interrupt function directly) - Simplify forkStream to use runCallback instead of runFork + Fiber.interrupt - Add 6 bus tests covering publish/subscribe, unsubscribe, subscribeAll, and InstanceDisposed delivery on instance disposal
- Plugin: use bus.subscribeAll() Stream + forkScoped instead of callback facade - Vcs: use bus.subscribe() Stream + forkScoped instead of acquireRelease callback - Status: use bus.publish() Effect directly instead of Effect.promise wrapper - Rewrite Vcs test to use facade functions (shared memoMap ensures singleton Bus) - Add Bus integration tests for subscribe cleanup and instance disposal
…attern, check off Bus
- tmpdirScoped uses FileSystem.makeTempDirectoryScoped (auto cleanup on scope close) - Git init uses ChildProcessSpawner.spawn + ChildProcess.make (proper Effect pattern) - Effect-native bus tests use withServices + Bus.layer + Effect.scoped + forkScoped
…ewrite format tests - Add provideInstance, provideTmpdirInstance to test/fixture/fixture.ts - Delete test/fixture/instance.ts (withServices no longer needed) - Rewrite format tests to use provideTmpdirInstance + testEffect (fully Effect-native) - Effect-native bus tests use provideTmpdirInstance
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.
Summary
MapwithPubSub.unboundedper instance viaInstanceStateaddFinalizer(shutdown on instance disposal)makeRuntimetorun-service.ts— single runtime object withrunPromise+runForkpublish/subscribe/subscribeAllsame signatures, no caller changesFormat.file()for explicit formatting — tools call it directly instead of publishingFile.Event.EditedBus.once(zero callers)Test plan
bun run turbo typecheckpassestest/format/)Bus.subscribeAll)