test(core): use effectful temp fixtures - #45637
Merged
Merged
Conversation
# ------------------------ >8 ------------------------ # Do not modify or remove the line above. # Everything below it will be ignored. # # Conflicts: # packages/core/test/session-revert.test.ts
# ------------------------ >8 ------------------------ # Do not modify or remove the line above. # Everything below it will be ignored. # # Conflicts: # packages/core/test/fixture/tmpdir.ts
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.
Why
Effect-based session tests adapted an async-disposable temporary-directory fixture through
Effect.promiseand repeated acquisition wrappers. That duplicated lifecycle wiring at each call site and obscured the fixture policy that canonicalizes paths and retries transient Windows cleanup failures.What Changes
The shared fixture now exposes a scoped Effect resource directly:
Six acquisitions across Session move, remove, revert, and view tests use that API without manual release callbacks or disposable adaptation.
tmpdirScoped()owns acquisition and release withEffect.acquireRelease; the asynctmpdir()API andwithTempDirshare the samemakeandremoveimplementation.Windows Path Contract
The OS boundary deliberately remains on
fs/promises. Under Bun on Windows, the callback APIs used by EffectFileSystemreturned shortRUNNER~1paths instead of the canonicalrunneradminpath and could hang during recursive removal. The promise APIs preserve the existing canonical-path contract and the established 30-attemptEBUSYcleanup policy with garbage collection and a 100 ms delay.Scope
This is test infrastructure only. It preserves the temporary-directory prefix, canonical paths, cleanup policy, and async API; other Promise-based fixture call sites remain available for incremental migration.
Verification
The full Core run passed 3,815 tests and the focused run passed 35 tests. Core typecheck, formatting, fixture lint, diff validation, and the full 33-package push-hook typecheck passed.