Fix validation to reject field-level assertions in test blocks#2259
Merged
aaronvg merged 3 commits intoBoundaryML:canaryfrom Aug 5, 2025
Merged
Fix validation to reject field-level assertions in test blocks#2259aaronvg merged 3 commits intoBoundaryML:canaryfrom
aaronvg merged 3 commits intoBoundaryML:canaryfrom
Conversation
Add semantic validation to detect and reject @Assert and @check attributes on test block fields. These field-level assertions are silently ignored at runtime - only block-level @@Assert and @@check work correctly for tests. The validation now provides clear error messages directing users to use the correct block-level syntax instead. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
|
@dexhorthy is attempting to deploy a commit to the Boundary Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed everything up to 86029cc in 42 seconds. Click for details.
- Reviewed
362lines of code in5files - Skipped
0files when reviewing. - Skipped posting
5draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. engine/baml-lib/baml-core/src/validate/validation_pipeline/validations/tests.rs:14
- Draft comment:
Consider storingattr.name.name()in a local variable to avoid repeated calls (minor performance/clarity improvement). - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
2. engine/baml-lib/baml/tests/validation_files/functions_v2/tests/field_level_assertions_v2.baml:9
- Draft comment:
Test file correctly uses a field-level @Assert to trigger the validation error. The error message format is clear. - Reason this comment was not posted:
Confidence changes required:10%<= threshold50%None
3. engine/baml-lib/baml/tests/validation_files/functions_v2/tests/field_level_check.baml:12
- Draft comment:
Test file correctly demonstrates rejection of a field-level @check attribute with an appropriate error message. - Reason this comment was not posted:
Confidence changes required:10%<= threshold50%None
4. thoughts/2025-08-05_05-15-59_baml_test_assertions.md:72
- Draft comment:
Documentation provides a detailed analysis and correctly identifies the validation gap. Ensure the error message in documentation remains consistent with the implementation. - Reason this comment was not posted:
Confidence changes required:10%<= threshold50%None
5. thoughts/baml-test-assertion-validation-with-research.md:36
- Draft comment:
The implementation plan is comprehensive and clearly outlines success criteria and testing strategy. This helps ensure that the new validation works as intended. - Reason this comment was not posted:
Confidence changes required:10%<= threshold50%None
Workflow ID: wflow_TO1UhMd2TYndoEY0
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
Keep research docs locally but remove from version control
Contributor
Author
|
ref - #1252 |
Contributor
|
oo thanks, thsi should go out on tonights release |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1252 by adding validation to reject field-level
@assertand@checkattributes on test blocks. These attributes were previously accepted by the parser but silently ignored at runtime, causing confusion.Problem
@assert(single @) syntax without warnings@@assert(double @) assertions actually work for testsSolution
Added semantic validation in the test validator to:
@assertor@checkattributes@@assertor@@checkat the block level insteadChanges
engine/baml-lib/baml-core/src/validate/validation_pipeline/validations/tests.rsfield_level_assertions_v2.baml- validates @Assert rejectionfield_level_check.baml- validates @check rejectionTesting
Example Error
🤖 Generated with Claude Code
Important
Adds validation to reject field-level
@assertand@checkattributes in test blocks, providing clear error messages and directing users to use block-level assertions.@assertand@checkattributes in test blocks, directing users to use@@assertor@@checkat the block level.validate()intests.rsto include logic for detecting field-level assertion attributes.field_level_assertions_v2.bamlandfield_level_check.bamlto test validation of@assertand@checkrejection.This description was created by
for 86029cc. You can customize this summary. It will automatically update as commits are pushed.