Skip to content

Validate role wire fields#265

Closed
leehack wants to merge 1 commit into
spec/annotations-wire-validationfrom
spec/role-wire-validation
Closed

Validate role wire fields#265
leehack wants to merge 1 commit into
spec/annotations-wire-validationfrom
spec/role-wire-validation

Conversation

@leehack

@leehack leehack commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • add shared validation for MCP Role wire values (user or assistant)
  • use the role validator for prompt messages, sampling messages, and create-message results
  • keep the typed enum APIs unchanged while rejecting malformed wire JSON as FormatException

Validation

  • dart format lib/src/types/validation.dart lib/src/types/sampling.dart lib/src/types/prompts.dart test/types/sampling_test.dart test/types_test.dart test/mcp_2025_11_25_test.dart
  • dart test test/types/sampling_test.dart test/types_test.dart test/mcp_2025_11_25_test.dart
  • dart analyze
  • git diff --check
  • dart test
  • dart pub global run coverage:test_with_coverage

Stacked on #264. This remains a draft RC PR and stays off main until the official spec release.

@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.79%. Comparing base (370996f) to head (f891c10).

Additional details and impacted files
@@                         Coverage Diff                          @@
##           spec/annotations-wire-validation     #265      +/-   ##
====================================================================
+ Coverage                             88.77%   88.79%   +0.01%     
====================================================================
  Files                                    47       47              
  Lines                                  9615     9621       +6     
====================================================================
+ Hits                                   8536     8543       +7     
+ Misses                                 1079     1078       -1     
Flag Coverage Δ
unittests 88.79% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@leehack leehack mentioned this pull request Jun 1, 2026
@leehack

leehack commented Jun 1, 2026

Copy link
Copy Markdown
Owner Author

Closing this draft micro PR because the RC spec work has been consolidated into a smaller reviewable stack. This change is preserved in #271 (type/schema validation); the consolidated tip is tree-identical to the previous micro-stack tip.

@leehack leehack closed this Jun 1, 2026
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.

1 participant