-
Notifications
You must be signed in to change notification settings - Fork 387
fix: improve validation error details in validateCommonProjectManifest #2966
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
base: main
Are you sure you want to change the base?
fix: improve validation error details in validateCommonProjectManifest #2966
Conversation
Replace TODO comment with detailed error formatting for validation failures. Error messages now include property names and constraint details instead of generic toString() output, making it easier to identify validation issues.
WalkthroughValidation error handling in the project loader was changed to produce structured, per-property constraint messages by importing Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (3)**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{test,spec}.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
packages/**/src/**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (1)📚 Learning: 2025-11-25T02:34:46.620ZApplied to files:
🧬 Code graph analysis (1)packages/common/src/project/load.spec.ts (1)
🔇 Additional comments (7)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/common/src/project/load.ts (1)
94-98: Excellent improvement to error messaging.The structured error formatting is much more actionable than generic
toString()output. The defensive check for constraints and clear property-level formatting will help developers quickly identify validation issues.One optional enhancement:
ValidationErrorobjects can have nested errors via thechildrenproperty for complex object validations. If manifest structures become more deeply nested in the future, consider recursively handling these children.Example recursive approach if nested validation becomes relevant:
const formatError = (error: ValidationError, indent = ' '): string => { const property = error.property; const constraints = error.constraints ? Object.values(error.constraints).join(', ') : ''; let message = `${indent}- ${property}${constraints ? ': ' + constraints : ''}`; if (error.children?.length) { const childMessages = error.children.map(child => formatError(child, indent + ' ')).join('\n'); message += '\n' + childMessages; } return message; }; const errorMsgs = errors.map(error => formatError(error)).join('\n');
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/common/src/project/load.ts(2 hunks)
🔇 Additional comments (1)
packages/common/src/project/load.ts (1)
8-8: Good addition for type safety.Adding the
ValidationErrortype import enables proper type annotation in the error formatting logic, improving code maintainability and IDE support.
|
Hi @Lil-Duckling-22, thanks for your PR. Can you please update tests and provide an example of how the error output has changed |
|
@stwiname sure thing, here are the tests |
|
How do the errors look for an error in a child object? e.g. An invalid filter on a mapping handler |
Replace TODO comment with detailed error formatting for validation failures. Error messages now include property names and constraint details instead of generic toString() output, making it easier to identify validation issues.
Summary by CodeRabbit
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.