🔧 update: enhance platform source detection and add unit tests#31
🔧 update: enhance platform source detection and add unit tests#31warengonzaga merged 11 commits intomainfrom
Conversation
🛠️ Container Build Complete - Dev BuildBuild Status: ✅ Success 📦 Pull ImageDocker Hub: docker pull wgtechlabs/unthread-webhook-server:dev-f924b27GHCR: docker pull ghcr.io/wgtechlabs/unthread-webhook-server:dev-f924b27📋 Build Details
🏷️ Image Tags• 🔍 Testing Your Changes
🚀 Quick Start# Pull and run the container
Docker Hub: docker pull wgtechlabs/unthread-webhook-server:dev-f924b27
docker run <your-options> <image>🔒 Security Scan Results📋 Pre-Build Security Checks✅ Source Code Scan: 1 vulnerabilities found 🐳 Container Image Vulnerabilities
📋 View Vulnerability DetailsNode.js
... and 23 more vulnerabilities 📊 Detailed Security ReportsView detailed vulnerability reports in the GitHub Security tab. 🤖 Powered by Container Build Flow Action v1.2.0 |
There was a problem hiding this comment.
Pull request overview
This PR improves webhook idempotency and platform source detection, adds unit test coverage for the updated behavior, and includes small logging/config/dependency updates.
Changes:
- Add Redis fingerprint-based deduplication (SET NX) alongside eventId deduplication in webhook processing.
- Enhance platform detection to treat
@mentionand phone-numberbotNameformats as the target platform. - Add Vitest unit tests for platform detection and deduplication flow; update
@wgtechlabs/log-engineversion and add.contributerc.json.
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/services/webhookService.ts | Adds fingerprint generation + claim, logs fingerprint, and expands botName pattern detection. |
| src/services/webhookService.test.ts | New unit tests covering validation, platform detection patterns, and dedup claim ordering. |
| src/services/redisService.ts | Refactors eventId key helpers and adds claimFingerprint() using Redis SET NX. |
| src/controllers/webhookController.ts | Standardizes log messages (removes emoji prefixes). |
| src/config/redis.ts | Adds fingerprintPrefix to Redis event tracking config. |
| package.json | Bumps @wgtechlabs/log-engine to 2.3.1. |
| pnpm-lock.yaml | Lockfile updates for @wgtechlabs/log-engine 2.3.1. |
| .gitignore | Adds .contributerc.json to ignores. |
| .contributerc.json | Adds Clean Commit / branching workflow configuration. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
This pull request introduces improved event deduplication logic for webhook processing and refines platform detection, along with dependency and configuration updates. The main enhancement is the addition of atomic fingerprint-based deduplication to prevent duplicate processing when webhook retries use new event IDs for the same logical event. Several logging messages are also standardized for clarity, and a new
.contributerc.jsonconfiguration file is added.Event Deduplication and Processing Improvements
SET NXto detect and prevent processing of webhook retries with new event IDs but identical event content. This is implemented via the newclaimFingerprintmethod inRedisServiceand integrated intoWebhookService. [1] [2] [3]keyExistsandmarkKeytoRedisServicefor reusable key management, supporting both event ID and fingerprint deduplication.Platform Detection Enhancements
@mentionand phone number formats for bot names, covering additional platforms such as WhatsApp via Twilio and Discord.Logging and Configuration Updates
WebhookControllerandRedisService. [1] [2] [3] [4] [5] [6] [7] [8] [9].contributerc.jsonto define branching strategy, commit conventions, and workflow roles.@wgtechlabs/log-enginefrom version 2.2.0 to 2.3.1 inpackage.jsonandpnpm-lock.yaml. [1] [2] [3] [4]Other Minor Changes
fingerprintPrefixto support fingerprint-based deduplication.