feat: docs/prds/webhook-trigger.md#100
Conversation
|
DiffGuard AI AnalysisAI Review Summary🏆 Overall Score: 88/100 This PR implements a comprehensive webhook trigger system with HMAC authentication, GitHub webhook integration, and UI configuration. The implementation is well-structured with strong test coverage, but has a few notable gaps around timestamp validation and edge case handling. ✅ Key Strengths
|
| Issue Type | Issue Name | Affected Components | Description | Impact/Severity |
|---|---|---|---|---|
| Maintainability | Unused Config Options | job.routes.ts, config.ts |
requireTimestamp and maxSkewSeconds are parsed and exposed in UI but never used in route logic. |
Medium |
| Maintainability | Duplicate Type Definitions | types.ts, shared/types.ts |
IWebhookTriggerConfig and related interfaces defined in two places could diverge over time. |
Low |
| Security | Raw Body Size Limit | index.ts |
1MB limit for raw body may be too large for some webhook payloads; consider if this is appropriate. | Low |
🔚 Conclusion
Strong implementation ready for merge with one follow-up: either implement timestamp validation or remove the unused config options to avoid user confusion. The core webhook functionality is solid and well-tested.
Analyzed using z-ai/glm-5
DiffGuard AI AnalysisAI Review Summary🏆 Overall Score: 82/100 This PR implements a comprehensive webhook trigger feature for Night Watch with solid architecture, good test coverage, and proper security practices. A few implementation gaps and code quality issues prevent a higher score. ✅ Key Strengths
|
| Issue Type | Issue Name | Affected Components | Description | Impact/Severity |
|---|---|---|---|---|
| Maintainability | Unimplemented Config Features | packages/server/src/routes/job.routes.ts |
requireTimestamp and maxSkewSeconds are validated in config but not enforced in the route. |
Medium |
| Maintainability | Duplicate Type Definitions | packages/core/src/types.ts, shared/types.ts |
Identical webhook trigger interfaces defined in two locations could diverge over time. | Low |
| Testing | Missing Edge Case Tests | packages/server/src/__tests__/server/ |
No tests for malformed JSON (400), lock conflicts (409), or dual signature scenarios. | Low |
| Maintainability | Hardcoded vs Dynamic Defaults | templates/night-watch.config.json |
Template hardcodes allowedJobIds while code uses getValidJobTypes(), risking inconsistency. |
Low |
🔚 Conclusion
This is a strong feature implementation with proper security practices and good architecture. The unimplemented timestamp validation is the main concern—either implement the feature or remove the config fields. Merge readiness is good after addressing the timestamp validation gap.
Analyzed using z-ai/glm-5
DiffGuard AI AnalysisAI Review Summary🏆 Overall Score: 82/100 This PR implements a comprehensive webhook trigger feature with HMAC-signed job dispatch and GitHub webhook integration. The implementation is well-structured with solid test coverage, but has a few maintainability concerns and an incomplete feature. ✅ Key Strengths
|
| Issue Type | Issue Name | Affected Components | Description | Impact/Severity |
|---|---|---|---|---|
| Maintainability | Duplicate Type Definitions | packages/core/src/types.ts, shared/types.ts |
Identical interfaces defined in two locations risk divergence during future maintenance. | Medium |
| Correctness | Unimplemented Timestamp Validation | job.routes.ts |
requireTimestamp and maxSkewSeconds config fields are collected but never validated against requests. |
Medium |
| Testing | Missing Global Mode Coverage | jobs.test.ts, jobs-github.test.ts |
No tests for project-scoped webhook routes used in global mode. | Low |
| Maintainability | Branch Glob Semantics | job.routes.ts:globToRegExp |
Pattern feat/* matches feat/anything/else/nested since * converts to .*. Consider documenting or using stricter matching. |
Low |
🔚 Conclusion
This is a strong implementation of a complex feature with good security practices and test coverage. The duplicate type definitions should be consolidated before merge, and the timestamp validation should either be implemented or the fields removed to avoid user confusion. Minor test gaps for global mode are non-blocking.
Analyzed using z-ai/glm-5
DiffGuard AI AnalysisAI Review Summary🏆 Overall Score: 78/100 This PR implements a comprehensive webhook trigger feature with HMAC-verified job dispatch, GitHub webhook integration, and Settings UI. The implementation is well-structured with good test coverage, but has notable issues with type duplication and an incomplete feature. ✅ Key Strengths
|
| Bug Name | Affected Files | Description | Confidence |
|---|---|---|---|
| Undefined Function Reference | packages/core/src/constants.ts |
getValidJobTypes() is called in DEFAULT_WEBHOOK_TRIGGERS.allowedJobIds but is not shown as imported in the diff. If this function doesn't exist in the file, this will throw ReferenceError at module load time. |
Medium 🟡 |
📋 Issues Found
| Issue Type | Issue Name | Affected Components | Description | Impact/Severity |
|---|---|---|---|---|
| Maintainability | Type Definition Duplication | packages/core/src/types.ts, packages/core/src/shared/types.ts |
Identical webhook trigger types defined in two locations with different optionality, risking confusion and sync issues. | Medium |
| Testing | Missing Timestamp Validation Tests | packages/server/src/__tests__/server/jobs.test.ts |
The requireTimestamp feature has no test coverage, and the feature itself is unimplemented in the handler. |
Low |
| Testing | Missing Multi-Signature Header Test | packages/server/src/routes/job.routes.ts |
No test case for when both X-Night-Watch-Signature and X-Hub-Signature-256 headers are present. |
Low |
🔚 Conclusion
This is a solid implementation of a valuable feature with good security practices and documentation. The type duplication and undefined function reference should be resolved before merge; the timestamp validation feature should either be implemented or removed from the config schema.
Analyzed using z-ai/glm-5
DiffGuard AI AnalysisAI Review Summary🏆 Overall Score: 82/100 This PR implements a comprehensive webhook trigger feature with HMAC-signed job dispatch and GitHub webhook integration. The implementation is well-structured with solid security practices, but has a few notable gaps around duplicate type definitions and an unimplemented config feature. ✅ Key Strengths
|
| Bug Name | Affected Files | Description | Confidence |
|---|---|---|---|
| Dead Config: Timestamp Validation | packages/server/src/routes/job.routes.ts, packages/core/src/types.ts |
requireTimestamp and maxSkewSeconds are accepted in config but never used in the dispatch handler, misleading users who expect replay attack protection. |
High 🟢 |
📋 Issues Found
| Issue Type | Issue Name | Affected Components | Description | Impact/Severity |
|---|---|---|---|---|
| Maintainability | Duplicate Type Definitions | packages/core/src/types.ts, packages/core/src/shared/types.ts |
Identical webhook trigger interfaces defined in two locations risk divergence and increase maintenance burden. | Medium |
| Maintainability | Missing Exhaustive Return | packages/server/src/routes/job.routes.ts |
getLockPathForJob() has no fallback return; adding a new JobType without updating the switch would cause runtime errors. |
Low |
🔚 Conclusion
This is a well-executed feature with strong security fundamentals and good test coverage. The duplicate types and unimplemented timestamp validation should be resolved before merge to avoid user confusion and technical debt. The core functionality is production-ready.
Analyzed using z-ai/glm-5
DiffGuard AI AnalysisAI Review Summary🏆 Overall Score: 82/100 This PR implements a comprehensive inbound webhook trigger system with HMAC authentication, GitHub webhook support, and a settings UI. The implementation is well-structured with good test coverage, but has one notable incomplete feature (timestamp validation) and a few maintainability concerns. ✅ Key Strengths
|
| Issue Type | Issue Name | Affected Components | Description | Impact/Severity |
|---|---|---|---|---|
| Correctness | Missing Timestamp Validation | packages/server/src/routes/job.routes.ts |
requireTimestamp and maxSkewSeconds are configured but never used to validate request timestamps. |
Medium |
| Maintainability | Missing Default Case in Switch | packages/server/src/routes/job.routes.ts |
getLockPathForJob switch statement returns undefined for unhandled job types, which could cause runtime failures. |
Low |
| Maintainability | Duplicate Type Definitions | packages/core/src/types.ts, packages/core/src/shared/types.ts |
Same interfaces defined in two places; web/api.ts imports from one while core uses the other. |
Low |
| Testing | Missing Global Mode Tests | packages/server/src/__tests__/server/jobs.test.ts |
Tests only cover single-project mode; project-scoped routes (/api/projects/:projectId/jobs/:id/run) are untested. |
Low |
🔚 Conclusion
This is a well-executed feature with solid fundamentals, but the timestamp validation gap should be addressed before merge—either by implementing the validation or removing the dead config fields. The maintainability issues are non-blocking but worth tracking for future cleanup.
Analyzed using z-ai/glm-5
✅ Ready for Human ReviewNight Watch reviewed this PR (score: 78/100) at commit This PR is ready for human review and merge. |
Closes #96
Night Watch manages this draft PR automatically so progress is preserved across retries and timeouts.
Status labels: