Add regression test for missing_constant with whitespace suppressing min/max range errors - #1680
Open
jordanpadams wants to merge 2 commits into
Open
jordanpadams wants to merge 2 commits into
jordanpadams wants to merge 2 commits into
Conversation
…esses min/max warnings Test case reproduces the bug where a missing_constant value with leading whitespace (e.g. " -1.000") is not recognized as matching the field value "-1.000", causing false field_value_out_of_min_max_range errors. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Special constant values in labels may have leading/trailing whitespace (e.g. <missing_constant> -1.000</missing_constant>). The string comparison paths in isNonConformantSpecialConstant and the numeric path in sameContent both failed to match because they compared against the unstripped raw XML text value. - Add equalsStripped() helper and use it in isNonConformantSpecialConstant so string-based constant comparisons tolerate whitespace-padded values - Call constant_repr.strip() at the top of sameContent() so the numeric comparison path (including BigDecimal parsing) also tolerates whitespace Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
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
Adds a regression test for #1656, which reports that
validateemits false warnings/errors when amissing_constantvalue contains leading or trailing whitespace (e.g.,-1.000) and the actual field value is the numeric equivalent (-1.000). The fix for #1660 likely resolves this as well — this test case ensures #1656 stays covered going forward.Test data (
src/test/resources/github1656/):test_missing_constant_whitespace.csv— 3-record delimited table; two records contain the missing-constant sentinel value-1.000, one contains a valid value5.000test_missing_constant_whitespace.xml— label with<missing_constant> -1.000</missing_constant>(leading whitespace) andField_Statistics.minimum = 0.001, which triggers falsefield_value_out_of_min_max_rangeerrors on unpatched codeConfirmed bug reproduction against v4.2.0-SNAPSHOT: 2
error.table.field_value_out_of_min_max_rangeerrors are emitted for rows containing the missing-constant value.🤖 AI Assistance Disclosure
Estimated % of code influenced by AI: 90%
⚙️ Test Data and/or Report
New Cucumber scenario added to
src/test/resources/features/4.2.x.feature(test 1656-1):Expected outcome after fix:
passed=1, totalErrors=0, totalWarnings=2(only the two expected schema-related warnings matching the same pattern as test 1660-1).Current outcome on v4.2.0-SNAPSHOT (bug reproduced):
Run with:
♻️ Related Issues
Fixes #1656
Refs #1660
🤓 Reviewer Checklist
Reviewers: Please verify the following before approving this pull request.
Documentation and PR Content
Security & Quality
Testing & Validation
Maintenance
🤖 Generated with Claude Code