Skip to content

refactor(storage): effectify Storage service#20132

Merged
kitlangton merged 5 commits intodevfrom
fix/llm-stream-queue-abort
Mar 31, 2026
Merged

refactor(storage): effectify Storage service#20132
kitlangton merged 5 commits intodevfrom
fix/llm-stream-queue-abort

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

@kitlangton kitlangton commented Mar 30, 2026

Summary

  • Migrate Storage service from promise-based to Effect-based using ServiceMap.Service, TxReentrantLock, and AppFileSystem
  • Replace raw fs/promises + custom Lock/Filesystem utilities with Effect's SynchronizedRef and TxReentrantLock for concurrent access
  • Add Zod schemas for migration data validation
  • Add storage tests (round-trip, NotFoundError, concurrent updates, list/remove)
  • Fix LLM stream to use queue-based approach with scoped abort

Test plan

  • bun run typecheck passes across all packages
  • Storage tests pass (27/27)

@kitlangton kitlangton changed the title fix(session): resolve merge conflict in LLM stream refactor(storage): effectify Storage service Mar 30, 2026
Migrate from promise-based to Effect-based implementation using
ServiceMap.Service, TxReentrantLock, and AppFileSystem. Add Zod
schemas for migration validation and storage tests.
@kitlangton kitlangton force-pushed the fix/llm-stream-queue-abort branch from d00e759 to 7a5dc9b Compare March 30, 2026 21:33
Extract repeated dir/target/lock resolution into a single `resolve`
helper, removing 3-line boilerplate from each CRUD operation.
Drop Effect.fn wrapper from cached state (runs once, no trace needed).
Rename get→lock for clarity, use fnUntraced for internal helper.
Add tests for update-on-missing, write-overwrite, remove-noop,
list-empty, concurrent reads, and nested keys.
@kitlangton kitlangton marked this pull request as ready for review March 30, 2026 21:55
Scope storage tests to unique directories so they do not race other package tests. Disable the file watcher only inside session message server tests on Windows to avoid the Bun watcher crash without breaking watcher-dependent coverage.
Handle invalid migration markers and malformed legacy records without skipping or corrupting migrations. Add focused migration coverage and switch the storage lock cache to RcMap so per-key locks are cleaned up automatically.
@kitlangton kitlangton enabled auto-merge (squash) March 31, 2026 01:12
@kitlangton kitlangton merged commit a898c2e into dev Mar 31, 2026
8 checks passed
@kitlangton kitlangton deleted the fix/llm-stream-queue-abort branch March 31, 2026 01:16
h33h pushed a commit to h33h/opencode that referenced this pull request Mar 31, 2026
vicary pushed a commit to vicary/opencode that referenced this pull request Apr 6, 2026
balcsida pushed a commit to balcsida/opencode that referenced this pull request Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant