Skip to content

test(listener): add e2e multi-channel notification delivery coverage - #69

Merged
Abd-Standard merged 1 commit into
Core-Foundry:mainfrom
distributed-nerd:test/multi-channel-notification-delivery-e2e
Jun 18, 2026
Merged

test(listener): add e2e multi-channel notification delivery coverage#69
Abd-Standard merged 1 commit into
Core-Foundry:mainfrom
distributed-nerd:test/multi-channel-notification-delivery-e2e

Conversation

@distributed-nerd

Copy link
Copy Markdown

Closes #65

Summary

Improves test coverage by validating notification delivery across multiple supported channels. Adds an end-to-end test that wires the real DiscordNotificationService and NotificationRetryQueue together (mirroring EventSubscriber.processEvent) and mocks only the outbound fetch — the actual network boundary — so the genuine delivery and retry path is exercised rather than stubbed.

A "channel" here maps to a distinct Discord webhook destination (different webhook URLs deliver to different Discord channels, e.g. #alerts, #ops, #audit), which is how a single deployment fans an event out to several destinations.

What's covered

Mapped directly to the issue's tasks and acceptance criteria:

  • End-to-end scenarios — one event fanned out to every configured channel; per-URL routing with no cross-talk between channels.
  • Channel-specific payloads — verifies each channel's Discord embed (title, event-type-based color, abbreviated contract address, value field).
  • Simulated delivery failures — partial failure isolation (one channel down, others still delivered), webhook error responses (429/500/503), and thrown network errors (ECONNRESET).
  • Retry behaviour — failed channel recovers via its own retry queue without re-hitting healthy channels; retry queues stay independent per channel; exhausted retries escalate to a permanent-failure log.
  • Meaningful logs — asserts error/warn logs carry the failing channel id, status, and event id.

New file

listener/src/__tests__/multi-channel-delivery.e2e.test.ts — 10 tests.

Verification

  • Baseline: 94 tests passing.
  • After: 104 tests passing (10 new), full suite green.

Validate notification delivery across multiple supported channels by
wiring the real DiscordNotificationService and NotificationRetryQueue
together (mirroring EventSubscriber.processEvent) and mocking only the
outbound fetch.

Covers:
- End-to-end fan-out: one event delivered to every configured channel
- Channel-specific payloads: per-URL routing and Discord embed contents
  (title, type-based color, contract/value fields)
- Delivery failures: partial failure isolation, webhook error responses,
  and network exceptions, each producing meaningful logs
- Retry behaviour: failed channel recovers via its retry queue, retry
  queues stay independent per channel, and exhausted retries escalate to
  a permanent-failure log
@Abd-Standard
Abd-Standard merged commit 396bda5 into Core-Foundry:main Jun 18, 2026
0 of 2 checks passed
Abd-Standard pushed a commit that referenced this pull request Jun 22, 2026
…131)

Add a NotificationPriority enum (Low/Medium/High/Critical) as a trailing
topic on every emitted event, alongside the existing NotificationCategory.
Off-chain consumers (alerting, dashboards, paging) can now route by
priority — or page on Critical (admin transfer, authorization failure)
without decoding the payload.

Backward compatibility: priority is added as the LAST topic. Existing
listeners keyed off category or the event name keep working unchanged.

- Add NotificationPriority contracttype enum to base/events.rs
- Append priority as trailing #[topic] on every event struct
- Update autoshare_logic.rs publish sites with semantic priority:
  * Low: GroupActivated/GroupDeactivated (routine lifecycle)
  * Medium: AutoshareCreated/AutoshareUpdated (operator awareness)
  * High: ContractPaused/ContractUnpaused (operator review)
  * Critical: AdminTransferred/AuthorizationFailure (urgent)
- Migrate topic helpers from topics.last() to topics.get(n-2) for
  category (pitfall #69 prevention); add priority_of helper
- Update existing tests with priority assertions; add backward-compat
  shape test verifying category_topic index remains stable

All 105 tests pass (cargo test --workspace).

Signed-off-by: zeroknowledge0x <zeroknowledge0x@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Tests] Add Integration Tests for Multi-Channel Delivery

3 participants