-
-
Notifications
You must be signed in to change notification settings - Fork 3
Log response validation errors #378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe changes update the version in Changes
Sequence Diagram(s)sequenceDiagram
participant Router
participant Logger
participant ResponseValidation
Router->>Logger: Pass logger instance
Router->>ResponseValidation: Instantiate with logger (makeResponseValidation(logger))
Router->>ResponseValidation: Call as postResponseHandler (context, request, response)
ResponseValidation->>Logger: Log error if validation fails (conditional)
Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
@coderabbitai summary |
✅ Actions performedSummary regeneration triggered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the response validation flow to emit structured error logs and bumps the package version to 1.12.0.
- Refactored
responseValidationinto a factory (makeResponseValidation) that accepts a logger - Updated
setupRouterto instantiate response validation with the injectedlogger - Added a basic
loggermock in the router tests and bumped the app version
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/router.test.js | Added a logger mock and adjusted the test invocation to include it |
| src/router.js | Swapped the named import for responseValidation to makeResponseValidation(logger) |
| src/handlers/response-validation.js | Converted to a default-export factory and added logger.error logging on validation failures |
| package.json | Updated version from 1.11.2 to 1.12.0 |
Comments suppressed due to low confidence (2)
src/handlers/response-validation.js:12
- No existing tests cover the new error-logging path. Add a test that forces a validation failure and asserts that
logger.erroris called with the expected payload.
if (logger) {
src/handlers/response-validation.js:1
- Update or add JSDoc above this export to explain that this is now a factory accepting a
loggerand returns the validation handler.
export default (logger) => (context, request, response) => {
| return originalAjv | ||
| } | ||
| }, | ||
| logger |
Copilot
AI
Jun 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logger is being passed as a separate argument rather than inside the options object. It should be moved into the object literal (e.g., { ..., logger }) so it’s correctly injected by setupRouter.
| logger | |
| logger: logger |
Summary by CodeRabbit
Chores
Refactor