Skip to content

refactor(file-time): effectify FileTimeService with Semaphore locks#17835

Merged
kitlangton merged 4 commits intodevfrom
effectify-env-filetime
Mar 16, 2026
Merged

refactor(file-time): effectify FileTimeService with Semaphore locks#17835
kitlangton merged 4 commits intodevfrom
effectify-env-filetime

Conversation

@kitlangton
Copy link
Contributor

Summary

  • Convert FileTime from Instance.state to an Effect ServiceMap.Service on the Instances LayerMap
  • Replace hand-rolled Promise lock chain with Semaphore.makeUnsafe + withPermits for per-file mutual exclusion
  • Legacy facade preserved — no caller changes needed (read, get, assert, withLock signatures unchanged)
  • Add 7 tests covering timestamp recording, session scoping, assert on unread/unchanged/modified files, and withLock serialization

Restacked from #17640 onto dev after parent merge.

Testing

  • bun run test test/file/time.test.ts
  • bunx tsgo --noEmit

7 tests covering: timestamp recording, session scoping, assert on
unread/unchanged/modified files, and withLock serialization.
All pass against the current Instance.state implementation.
Convert FileTime from Instance.state to Effect ServiceMap.Service.
Replace hand-rolled Promise lock chain with SynchronizedRef<Map> +
Semaphore.withPermits for per-file mutual exclusion. Legacy facade
preserved — callers unchanged.
@kitlangton kitlangton enabled auto-merge (squash) March 16, 2026 18:22
@kitlangton kitlangton merged commit 2cbdf04 into dev Mar 16, 2026
8 checks passed
@kitlangton kitlangton deleted the effectify-env-filetime branch March 16, 2026 18:23
AvatarGanymede pushed a commit to AvatarGanymede/opencode-dev that referenced this pull request Mar 19, 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