Skip to content

Feat/error messages parser - #12

Merged
gitsad merged 9 commits into
mainfrom
feat/error-messages-parser
Apr 21, 2026
Merged

gitsad merged 9 commits into
mainfrom
feat/error-messages-parser

Conversation

@gitsad

@gitsad gitsad commented Apr 20, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Improves parser and validator error messages, adds new validation rules, and refactors the validator demo for clarity. The main changes:

  1. New expected-components rule — Verifies the LLM generated the expected components with correct types, form fields, table columns, and action references. Only checks components present in the current message, making it safe for multi-turn flows.
  2. Thinking block improvements — No longer warns about missing thinking blocks (only validates positioning when present), detects duplicate thinking blocks, and auto-fixes by merging multiples into one at the top.
  3. Unfenced detection improvement — Now requires both type: and nearby id: to flag unfenced MDMA YAML, reducing false positives on documentation text.
  4. Disabled single-message-only rules — Commented out binding-resolution and unreferenced-components since components and their bindings are never in the same message.
  5. Demo refactor — Split ValidatorView.tsx (715 lines) into 8 focused files under validator/ directory.
  6. Test coverage — Added tests for YAML sanitization (colon-space, --- stripping, multi-component split), all new rules, and the thinking block auto-fix.
  7. README — Added comprehensive Validator section documenting all rules, auto-fix pipeline, expected components, and LLM error recovery.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing behavior to change)
  • Refactor (no functional change)
  • Documentation
  • CI / tooling

Packages Affected

  • @mobile-reality/mdma-validator

Checklist

  • I have read the CONTRIBUTING guide.
  • My code follows the existing code style (pnpm format and pnpm lint pass).
  • I have added or updated tests that cover my changes.
  • All tests pass (pnpm test).
  • Type-checking passes (pnpm typecheck).
  • I have added a changeset (pnpm changeset) if this change affects published packages.
  • New or changed MDMA schemas are backwards-compatible (or marked as breaking).
  • Sensitive fields are marked with sensitive: true where appropriate.

How to Test

  1. Run pnpm test — 190 tests should pass across parser and validator
  2. Run pnpm build --filter=@mobile-reality/mdma-validator && pnpm build --filter=@mobile-reality/mdma-cli
  3. Test within CLI or Demo app

gitsad and others added 9 commits April 17, 2026 13:51
…type errors

The "Unknown component type" error now suggests the closest match using
normalized comparison and Levenshtein distance, and always lists all valid
types (including custom schemas). This helps users quickly fix typos like
"frm" → "form" or separator mismatches like "approval_gate" → "approval-gate".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gitsad
gitsad merged commit 0ef567c into main Apr 21, 2026
1 check passed
@gitsad
gitsad deleted the feat/error-messages-parser branch April 21, 2026 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants