Skip to content

Validate notification batches before processing to detect malformed r…#93

Merged
Abd-Standard merged 1 commit into
Core-Foundry:mainfrom
Johnsource-hub:Backend-Implement-Notification-Batch-Validation-Service
Jun 19, 2026
Merged

Validate notification batches before processing to detect malformed r…#93
Abd-Standard merged 1 commit into
Core-Foundry:mainfrom
Johnsource-hub:Backend-Implement-Notification-Batch-Validation-Service

Conversation

@Johnsource-hub

Copy link
Copy Markdown

#closes
#82

Description

This PR implements an off-chain notification batch validation service within the listener/ application workspace. It introduces an early-gating validation mechanism to intercept, audit, and sanitize raw event notifications before they are queued for dispatch providers (e.g., Discord webhooks).

Problem Statement

  • Issue: The listener pipeline lacked upfront validation for heavy notification processing bursts.
  • Impact: Malformed event blocks or redundant network operations (such as duplicate recipient event targets) could bypass early processing layers, resulting in failed webhook payloads or inefficient system thrashing.

Technical Changes

  • Implemented BatchValidator runtime utility matrix inside listener/src/utils/batch-validator.ts.
  • Added explicit structure checks to verify that input batches are non-empty arrays with intact id, recipient, channel, and message strings.
  • Built in-memory tracking sets (Set<string>) to isolate and intercept duplicate recipient IDs inside a single batch execution window.
  • Introduced a terminal runner engine (runTerminalSimulation()) that logs human-readable verification steps and dumps processing results locally.
  • Appended validate:batch automation shortcut script to the local listener/package.json manifest.

Affected Areas

  • listener/src/utils/batch-validator.ts (Core validation service logic)
  • listener/package.json (Script shortcuts configuration)
  • listener/reports/last-validation-run.json (Local output report tracking — gitignored if applicable)

Verification & Acceptance Criteria

  • Batch Structure Validation: Malformed array formats or empty payloads throw immediate, descriptive block alerts.
  • Duplicate Filtering: Multi-item bursts targeted at the same user/channel endpoint flag warning validations instantly.
  • Actionable Error Arrays: Rejections explicitly isolate item index numbers (e.g., Item at index [1]) to speed up troubleshooting context.
  • IDE Execution Integration: Automation script successfully creates, maps, and updates files directly inside the active VS Code workspace tree pane.

Security & Performance Safeguards

Batch Throttling Enforcement: By filtering duplicate targets and dropping empty structures before calling remote HTTP endpoints, this service acts as a buffer layer—preventing rate-limiting blocks from third-party notification APIs.

@Abd-Standard Abd-Standard merged commit 97f1c3e into Core-Foundry:main Jun 19, 2026
1 of 2 checks passed
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.

2 participants