Preserve boolean distinctions in nested JSON equality - #372
Open
oyeong011 wants to merge 2 commits into
Open
Conversation
Nested lists and objects must compare their values using JMESPath equality instead of Python numeric coercion. Confidence: high Scope-risk: narrow Tested: 994 tests passed; nested-filter public API QA Not-tested: Python versions outside 3.12
Use an explicit work stack so separately parsed deeply nested JSON remains comparable while preserving boolean and number distinctions. Confidence: high Scope-risk: narrow Tested: 995 tests passed; depth-600 array/object API QA Not-tested: Python versions outside 3.12; non-JSON cycles
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.
Nested equality currently delegates to Python container equality, so
[true] == [1]returns true even though the corresponding JMESPath scalar comparison is false. This also includes incorrect records in filters on nested values.Compare array elements and object values with an explicit work stack and JMESPath scalar equality. This preserves boolean/number distinctions without adding Python recursion frames. Numeric equality, object key ordering, differing lengths/keys, empty containers, and identical-object fast paths remain supported.
Validation on macOS/Python 3.12.13:
python -m pytest tests -q: 995 passed, 1 skipped.The full platform/Python-version matrix was not run locally. The work stack uses memory proportional to queued structural pairs.
AI disclosure: OpenAI Codex assisted with the implementation, tests, and description. The reported checks were executed locally.