Matrix bridge E2E integration tests #385

Closed
opened 2026-02-15 07:02:09 +00:00 by jason.woltje · 1 comment
Owner

Summary

End-to-end integration tests that verify the full Matrix bridge flow: message received → command parsed → job dispatched → status updates sent back to Matrix room.

Test Scenarios

Happy Path

  1. Send !mosaic help → Bot responds with command list
  2. Send !mosaic fix #123 → Job created, thread started, status updates posted
  3. Send !mosaic status <jobId> → Current job status returned
  4. Send !mosaic cancel <jobId> → Job cancelled, confirmation posted

Error Cases

  1. Send !mosaic fix (no issue) → Helpful error message
  2. Send unknown command → "Unknown command" with help suggestion
  3. Send message in non-control room → Ignored
  4. Matrix disconnection → Reconnect automatically, no lost commands

Multi-Bridge

  1. Same workspace with both Discord and Matrix → Herald broadcasts to both
  2. Command from Matrix, status visible in both Matrix thread and Discord thread

Workspace Isolation

  1. Command in workspace-A room → Only affects workspace-A
  2. Bot cannot see/interact with other workspace rooms

Implementation

Test Infrastructure

  • Use matrix-bot-sdk test utilities or mock Matrix client
  • Real CommandParser (no mocks)
  • Mocked StitcherService (verify dispatch calls)
  • Mocked MatrixClient (verify message sends)

Test Location

apps/api/src/bridge/matrix/matrix.integration.spec.ts

Acceptance Criteria

  • All 12 scenarios covered
  • Tests run in CI without external Matrix server
  • Coverage for MatrixService ≥ 85%
  • Tests verify message formatting (HTML body, m.notice type)

Refs

## Summary End-to-end integration tests that verify the full Matrix bridge flow: message received → command parsed → job dispatched → status updates sent back to Matrix room. ## Test Scenarios ### Happy Path 1. Send `!mosaic help` → Bot responds with command list 2. Send `!mosaic fix #123` → Job created, thread started, status updates posted 3. Send `!mosaic status <jobId>` → Current job status returned 4. Send `!mosaic cancel <jobId>` → Job cancelled, confirmation posted ### Error Cases 5. Send `!mosaic fix` (no issue) → Helpful error message 6. Send unknown command → "Unknown command" with help suggestion 7. Send message in non-control room → Ignored 8. Matrix disconnection → Reconnect automatically, no lost commands ### Multi-Bridge 9. Same workspace with both Discord and Matrix → Herald broadcasts to both 10. Command from Matrix, status visible in both Matrix thread and Discord thread ### Workspace Isolation 11. Command in workspace-A room → Only affects workspace-A 12. Bot cannot see/interact with other workspace rooms ## Implementation ### Test Infrastructure - Use matrix-bot-sdk test utilities or mock Matrix client - Real CommandParser (no mocks) - Mocked StitcherService (verify dispatch calls) - Mocked MatrixClient (verify message sends) ### Test Location `apps/api/src/bridge/matrix/matrix.integration.spec.ts` ## Acceptance Criteria - [ ] All 12 scenarios covered - [ ] Tests run in CI without external Matrix server - [ ] Coverage for MatrixService ≥ 85% - [ ] Tests verify message formatting (HTML body, m.notice type) ## Refs - Discord test pattern: `apps/api/src/bridge/discord/discord.service.spec.ts` - EPIC: #377 - Depends on: #378, #379, #380, #381, #382
jason.woltje added the testing label 2026-02-15 07:02:09 +00:00
jason.woltje added this to the M12-MatrixBridge (0.0.12) milestone 2026-02-15 07:02:56 +00:00
Author
Owner

Completed in commit 9cc70db on branch feature/m12-matrix-bridge.

  • 26 integration tests covering all bridge flows
  • BridgeModule DI, conditional loading, command flow
  • Herald multi-provider broadcast
  • Room-workspace mapping
  • Streaming flow verification
  • Multi-provider coexistence (Discord + Matrix)
  • 95 total matrix tests pass
Completed in commit 9cc70db on branch feature/m12-matrix-bridge. - 26 integration tests covering all bridge flows - BridgeModule DI, conditional loading, command flow - Herald multi-provider broadcast - Room-workspace mapping - Streaming flow verification - Multi-provider coexistence (Discord + Matrix) - 95 total matrix tests pass
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaic/stack#385