Refactor provider session reaper timing with Effect primitives#3689
Draft
cursor[bot] wants to merge 3 commits into
Draft
Refactor provider session reaper timing with Effect primitives#3689cursor[bot] wants to merge 3 commits into
cursor[bot] wants to merge 3 commits into
Conversation
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
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.
What Changed
Durationvalues.Date.parse/Clock.currentTimeMillisidle checks withDateTime.make,DateTime.now, andDateTime.distance.ProviderSessionReapertests to use@effect/vitest,TestClock, and partialLayer.mockservices instead of real-clock polling/full fake service objects.Why
This keeps the reaper's lifecycle policy testable through Effect services and aligns the module with the codebase's idiomatic Effect guidance around
Duration,DateTime, dependency injection, and deterministic clocks.UI Changes
Not applicable; no UI changes.
Checklist
Verification
PATH="/home/ubuntu/.nvm/versions/node/v24.18.0/bin:$PATH" pnpm exec vp test run src/provider/Layers/ProviderSessionReaper.test.ts(fromapps/server): 6 passedPATH="/home/ubuntu/.nvm/versions/node/v24.18.0/bin:$PATH" pnpm exec vp run typecheck(from repo root): passedPATH="/home/ubuntu/.nvm/versions/node/v24.18.0/bin:$PATH" pnpm exec vp check(from repo root): passedNote
Refactor provider session reaper to use Effect Duration primitives and TestClock
inactivityThresholdMs,sweepIntervalMs) withDuration.Inputtypes inProviderSessionReaperLiveOptions, requiring callers to update their configuration.makeProviderSessionReaperto useDateTimeandDurationAPIs instead ofClock.currentTimeMillisand raw arithmetic; invalidlastSeenAtvalues are now skipped with a warning instead of causing errors.TestClockand Effect-native test utilities, eliminating async polling helpers andManagedRuntimein favor of deterministic, synchronous assertions.inactivityThresholdandsweepIntervaloption names are breaking changes for any existing callers ofmakeProviderSessionReaperLive.📊 Macroscope summarized 80f0439. 1 file reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted
🗂️ Filtered Issues
No issues evaluated.