Skip to content

Conversation

@khaliqgant
Copy link
Collaborator

@khaliqgant khaliqgant commented Jan 16, 2026

CodeAnt-AI Description

Show unknown property names and allowed values in validation errors

What Changed

  • Validation errors for unexpected properties now include the exact property name (e.g., "allowed-tools") so the error message identifies which field is invalid.
  • Enum/allowed-value errors now append the list of allowed values to the message so users can see valid options immediately.
  • Error paths include missing property names when relevant, making it easier to locate the offending field.
  • Added a test that verifies additional-properties errors contain the invalid property name.

Impact

✅ Clearer validation errors
✅ Easier agent config fixes
✅ Faster debugging of schema issues

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai
Copy link

codeant-ai bot commented Jan 16, 2026

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@my-senior-dev-pr-review
Copy link

🤖 My Senior Dev — Analysis Complete

👤 For @khaliqgant

📁 Expert in packages/ (190 edits) • ⚡ 20th PR this month

View your contributor analytics →


📊 2 files reviewed • 4 need attention

⚠️ Needs Attention:

  • packages/converters/src/validation.ts — Changes enhance validation and error messaging but introduce potential information exposure and runtime errors.

🚀 Open Interactive Review →

The full interface unlocks features not available in GitHub:

  • 💬 AI Chat — Ask questions on any file, get context-aware answers
  • 🔍 Smart Hovers — See symbol definitions and usage without leaving the diff
  • 📚 Code Archeology — Understand how files evolved over time (/archeology)
  • 🎯 Learning Insights — See how this PR compares to similar changes

💬 Chat here: @my-senior-dev explain this change — or try @chaos-monkey @security-auditor @optimizer @skeptic @junior-dev

📖 View all 12 personas & slash commands

You can interact with me by mentioning @my-senior-dev in any comment:

In PR comments or on any line of code:

  • Ask questions about the code or PR
  • Request explanations of specific changes
  • Get suggestions for improvements

Slash commands:

  • /help — Show all available commands
  • /archeology — See the history and evolution of changed files
  • /profile — Performance analysis and suggestions
  • /expertise — Find who knows this code best
  • /personas — List all available AI personas

AI Personas (mention to get their perspective):

Persona Focus
@chaos-monkey 🐵 Edge cases & failure scenarios
@skeptic 🤨 Challenge assumptions
@optimizer Performance & efficiency
@security-auditor 🔒 Security vulnerabilities
@accessibility-advocate Inclusive design
@junior-dev 🌱 Simple explanations
@tech-debt-collector 💳 Code quality & shortcuts
@ux-champion 🎨 User experience
@devops-engineer 🚀 Deployment & scaling
@documentation-nazi 📚 Documentation gaps
@legacy-whisperer 🏛️ Working with existing code
@test-driven-purist Testing & TDD

For the best experience, view this PR on myseniordev.com — includes AI chat, file annotations, and interactive reviews.

@codeant-ai codeant-ai bot added the size:M This PR changes 30-99 lines, ignoring generated files label Jan 16, 2026
@codeant-ai
Copy link

codeant-ai bot commented Jan 16, 2026

Sequence Diagram

The PR improves validation error messages by adding context (e.g., the additional property name and allowed enum values). The diagram shows the core flow from markdown validation to enhanced error construction and the test assertion that checks for the property name in the error.

sequenceDiagram
    participant Test
    participant ValidationModule
    participant SchemaLoader
    participant AJV

    Test->>ValidationModule: validateMarkdown(format='claude', markdown, subtype='agent')
    ValidationModule->>SchemaLoader: parse frontmatter & build validation data
    ValidationModule->>AJV: validate(data) using compiled schema
    AJV-->>ValidationModule: errors (e.g., additionalProperties -> additionalProperty='allowed-tools')
    ValidationModule->>ValidationModule: enhance message (include additionalProperty / allowedValues)
    ValidationModule-->>Test: return ValidationResult with enhanced error messages
Loading

Generated by CodeAnt AI

@codeant-ai
Copy link

codeant-ai bot commented Jan 16, 2026

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Path composition bug
    The logic that builds path doesn't append missingProperty or additionalProperty to a non-empty instancePath. For errors where instancePath points to the parent (common for missingProperty / additionalProperties), the path should include the child property (e.g. /parent/missingField) so messages and tooling can locate the exact property.

  • Brittle assertion
    The test asserts on the exact string of an AJV-generated validation message (expects 'must NOT have additional properties') and also assumes the property name appears in the same message. Error message shapes and wording can vary across AJV versions/locales or be split across fields (e.g. params.additionalProperty). Prefer asserting on structured error fields or searching all errors rather than exact message equality.

  • Index-based error access
    The test only inspects result.errors[0]. Validation may return multiple errors and ordering is not guaranteed. This makes the test brittle if the additionalProperties error is not first. Find the relevant error by keyword/params or aggregate messages.

  • Allowed values formatting
    The enum branch joins params.allowedValues with .join(', '). If allowed values contain objects or strings that need quoting, the resulting message may be misleading or hard to read. Use JSON.stringify (or a safe serializer) per value to preserve types and readability.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@codeant-ai
Copy link

codeant-ai bot commented Jan 16, 2026

CodeAnt AI finished reviewing your PR.

@khaliqgant khaliqgant merged commit 91362c6 into main Jan 16, 2026
10 of 12 checks passed
@khaliqgant khaliqgant deleted the fix/improve-validation-error-messages branch January 16, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants