Skip to content

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

Closed
kitlangton wants to merge 3 commits intoeffectify-vcsfrom
effectify-env-filetime
Closed

refactor(file-time): effectify FileTimeService with Semaphore locks#17640
kitlangton wants to merge 3 commits intoeffectify-vcsfrom
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

Stacked on #17634.

Testing

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

@kitlangton kitlangton force-pushed the effectify-env-filetime branch 5 times, most recently from 74d2d30 to b0b8728 Compare March 15, 2026 23:32
opencode-agent bot added a commit that referenced this pull request Mar 16, 2026
opencode-agent bot added a commit that referenced this pull request Mar 16, 2026
opencode-agent bot added a commit that referenced this pull request Mar 16, 2026
opencode-agent bot added a commit that referenced this pull request Mar 16, 2026
opencode-agent bot added a commit that referenced this pull request Mar 16, 2026
opencode-agent bot added a commit that referenced this pull request Mar 16, 2026
opencode-agent bot added a commit that referenced this pull request Mar 16, 2026
opencode-agent bot added a commit that referenced this pull request Mar 16, 2026
opencode-agent bot added a commit that referenced this pull request Mar 16, 2026
opencode-agent bot added a commit that referenced this pull request Mar 16, 2026
opencode-agent bot added a commit that referenced this pull request Mar 16, 2026
opencode-agent bot added a commit that referenced this pull request Mar 16, 2026
opencode-agent bot added a commit that referenced this pull request Mar 16, 2026
opencode-agent bot added a commit that referenced this pull request Mar 16, 2026
@kitlangton kitlangton force-pushed the effectify-env-filetime branch from 434173a to 70d22b8 Compare March 16, 2026 17:02
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 force-pushed the effectify-env-filetime branch from 70d22b8 to 86aa331 Compare March 16, 2026 17:18
opencode-agent bot added a commit that referenced this pull request Mar 16, 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