refactor: destroy Storage facades#21956
Merged
kitlangton merged 3 commits intodevfrom Apr 11, 2026
Merged
Conversation
Migrates Session.diff from Effect.tryPromise(() => Storage.read(...)) to a direct yield, deletes the Storage async facades and per-service makeRuntime, and converts storage.test.ts to full effectful style using testEffect + it.live + Effect.gen. Adds a "Destroying the facades" section to the effect-migration spec documenting the process and the Layer.fresh trick for letting inner Effect.provide override layers that are already cached in the outer testEffect runtime's memoMap.
- Fold Storage.Service yield into the scope() helper so the 10 scope
tests can destructure { root, svc } instead of yielding twice
- Drop local writeJson/writeText helpers in favor of the existing
AppFileSystem.writeWithDirs method
- Use Exit.isFailure(exit) instead of stringly-typed exit._tag check
- Rename map → remap (less generic) and rename remapped → remappedFs
- Add comments explaining the remap pattern and the Layer.fresh
workaround for cached Storage instances
cc580a6 to
2cbb55c
Compare
mrsimpson
pushed a commit
to mrsimpson/opencode
that referenced
this pull request
Apr 14, 2026
xywsxp
pushed a commit
to xywsxp/opencode
that referenced
this pull request
Apr 24, 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.
Summary
First facade destruction using the new AppRuntime composition. Migrates
Session.difffrom theStorage.readpromise facade to a direct service yield, deletes the Storage facades +makeRuntime, and convertsstorage.test.tsto full effectful style.Changes
session/index.ts—Session.layernow requiresStorage.Service;Session.diffusesyield* storage.read(...)instead ofEffect.tryPromise(() => Storage.read(...))storage/storage.ts— deletedread,write,update,remove,listasync facades and the per-servicemakeRuntimetest/storage/storage.test.ts— fully converted totestEffect+it.live+Effect.gen. Rawfs/Bun.write/tmpdir/try/finallyreplaced withAppFileSystem.Service/tmpdirScoped/Effect.addFinalizertest/share/share-next.test.ts— switched fromSession.layertoSession.defaultLayersince Session now requires Storagespecs/effect-migration.md— new "Destroying the facades" section documenting the migration process, including theLayer.freshtrick for letting innerEffect.provideoverride layers cached in the outer testEffect runtime's memoMapTest plan
bun run typecheckclean