Skip to content

[TEST] Bus fallback and recovery flow tests (Go bus + MemoryBusTui) #32

Closed

Description

@four-bytes-robby

Purpose

Validate the useServiceBus fallback/recovery behaviour (from src/tui-hooks.ts) by testing the underlying mechanisms:

  1. MemoryBusTui fallback — when Go bus is unavailable and BusTui.connect() throws, MemoryBusTui must work as an in-process fallback
  2. Recovery retry — after MemoryBusTui is set, the real BusTui must be recoverable when the Go bus becomes available
  3. ScopedBusTui.forProject() — regression test for the bug we just fixed (P1 bug [BUG] Scoped bus close() tears down shared bus connection #10)

Test Cases

  1. MemoryBusTui works standalone (in-process pub/sub via MemoryBus singleton)
  2. BusTui.connect() throws when Go bus is unavailable (port file missing)
  3. BusTui.connect() succeeds and returns real BusTui once Go bus starts
  4. ScopedBusTui.forService().forProject() chaining works correctly
  5. After MemoryBusTui fallback, retrying BusTui.connect() replaces it with real BusTui

References

  • src/tui-hooks.ts — useServiceBus hook (lines 46-59: MemoryBusTui fallback + 5s retry)
  • src/bus-tui.ts — BusTui.connect(), MemoryBusTui, ScopedBusTui
  • src/memory-bus.ts — MemoryBus singleton used by MemoryBusTui
  • test/integration.test.ts — existing integration test patterns
  • test/scoped-close.test.ts — scoped bus regression test pattern

Activity

  1. coderabbitai commented on Jun 17, 2026

    @coderabbitai
    🔗 Related PRs

    #11 - fix: scoped bus close() tears down shared bus (P1) #10 [merged]
    #14 - fix: MemoryBusTui never upgrades + spawn lock #13 [merged]
    #23 - fix: add MemoryBusTui fallback and HTTP polling to useServiceBus (#22) [closed]
    #29 - fix: remove return blocking retry after MemoryBusTui fallback #28 [closed]
    #31 - fix: close old bus before replacing in tryConnect .then() #30 [closed]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. four-bytes-robby commented on Nov 17, 2026

    @four-bytes-robby
    MemberAuthor

    Tests landed via #33 (test: add bus fallback and recovery flow tests) and are merged into main. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions