Skip to content

test(core): use effectful temp fixtures - #45637

Merged
kitlangton merged 5 commits into
v2from
disposable-fixtures
Aug 28, 2026
Merged

test(core): use effectful temp fixtures#45637
kitlangton merged 5 commits into
v2from
disposable-fixtures

Conversation

@kitlangton

@kitlangton kitlangton commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Why

Effect-based session tests adapted an async-disposable temporary-directory fixture through Effect.promise and 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:

const tmp = yield* tmpdirScoped()

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 with Effect.acquireRelease; the async tmpdir() API and withTempDir share the same make and remove implementation.

Windows Path Contract

The OS boundary deliberately remains on fs/promises. Under Bun on Windows, the callback APIs used by Effect FileSystem returned short RUNNER~1 paths instead of the canonical runneradmin path and could hang during recursive removal. The promise APIs preserve the existing canonical-path contract and the established 30-attempt EBUSY cleanup 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

cd packages/core
bun run test
bun run test test/session-move.test.ts test/session-remove.test.ts test/session-revert.test.ts test/session-view.test.ts test/tool-edit.test.ts test/tool-write.test.ts
bun typecheck

cd ../..
bunx prettier --check packages/core/test/fixture/tmpdir.ts packages/core/test/session-move.test.ts packages/core/test/session-remove.test.ts packages/core/test/session-revert.test.ts packages/core/test/session-view.test.ts
bunx oxlint packages/core/test/fixture/tmpdir.ts
git diff --check
git push origin disposable-fixtures

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.

# ------------------------ >8 ------------------------
# Do not modify or remove the line above.
# Everything below it will be ignored.
#
# Conflicts:
#	packages/core/test/session-revert.test.ts
@kitlangton kitlangton changed the title test(core): use disposable session fixtures test(core): use effectful temp fixtures Aug 28, 2026
# ------------------------ >8 ------------------------
# Do not modify or remove the line above.
# Everything below it will be ignored.
#
# Conflicts:
#	packages/core/test/fixture/tmpdir.ts
@kitlangton
kitlangton merged commit 5743537 into v2 Aug 28, 2026
10 checks passed
@kitlangton
kitlangton deleted the disposable-fixtures branch August 28, 2026 05:01
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