Skip to content

Stabilize session event tests#27117

Merged
kitlangton merged 2 commits into
devfrom
fix/session-test-event-waits
May 12, 2026
Merged

Stabilize session event tests#27117
kitlangton merged 2 commits into
devfrom
fix/session-test-event-waits

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

@kitlangton kitlangton commented May 12, 2026

Summary

  • Replaces fixed 100ms sleeps in test/session/session.test.ts with waits resolved by actual event callbacks.
  • Converts the file to the shared testEffect(...) pattern with direct Session.Service usage, it.instance(...), it.live(...), tmpdirScoped(...), and provideInstance(...).
  • Uses GlobalBus for event assertions because SyncEvent still publishes through the legacy top-level Bus facade internally; that is the actual boundary these session events currently cross.
  • Skips the legacy session.updated ordering assertion when experimental workspaces are enabled, because Session.create intentionally does not publish that legacy event in that mode.

Sleep Audit

  • The session test had three fixed waits after bus events; all are now event-driven.
  • A repo-wide audit shows many remaining sleeps are either explicit timeout guards, fixture worker delays, polling harnesses, or broader integration timing. I kept this PR focused on the locally reproduced session event flake.

Verification

  • bun run test -- test/session/session.test.ts
  • Repeated test/session/session.test.ts 5 times in a row
  • bun typecheck in packages/opencode
  • bunx prettier --check packages/opencode/test/session/session.test.ts
  • bunx oxlint packages/opencode/test/session/session.test.ts (warnings only, existing patterns)
  • git diff --check
  • pre-push bun turbo typecheck

@kitlangton kitlangton enabled auto-merge (squash) May 12, 2026 18:45
@kitlangton kitlangton merged commit 549b146 into dev May 12, 2026
12 checks passed
@kitlangton kitlangton deleted the fix/session-test-event-waits branch May 12, 2026 18:51
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