Files
mcpctl/.taskmaster/tasks/task_151.md

29 lines
1003 B
Markdown
Raw Normal View History

# Task ID: 151
**Title:** Git webhook receiver for post-merge failure
**Status:** pending
**Dependencies:** 130, 148
**Priority:** medium
**Description:** Create webhook endpoint that reopens tasks when post-merge CI fails
**Details:**
Create src/mcpd/src/routes/webhook.routes.ts:
1. POST /api/v1/webhooks/git/:provider - receive webhook payloads
2. Validate webhook signature using provider-specific method (Gitea uses HMAC-SHA256 with secret)
3. Parse payload to identify: repo, commit SHA, status (success/failure/pending)
4. If status is failure for a merged commit:
- Find Task with that headCommit and state=merged
- Call taskService.reopenOnPostMergeFailure(taskId)
- This transitions merged→reopened and creates TaskEvent
5. Register route in main.ts
6. Webhook secret stored in CodeRepo's credential secret
**Test Strategy:**
Unit tests: test signature validation, test payload parsing, test reopen triggered on failure status. Integration: simulate Gitea webhook payload.