MOD-6722 Fix mutation ordering for array commands with recursive paths#1543
Open
AvivDavid23 wants to merge 1 commit intomasterfrom
Open
MOD-6722 Fix mutation ordering for array commands with recursive paths#1543AvivDavid23 wants to merge 1 commit intomasterfrom
AvivDavid23 wants to merge 1 commit intomasterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1543 +/- ##
==========================================
+ Coverage 75.18% 75.30% +0.11%
==========================================
Files 15 15
Lines 4220 4240 +20
==========================================
+ Hits 3173 3193 +20
Misses 1047 1047 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Sort matched paths deepest-first before applying mutations in
ARRPOP,ARRTRIM, andARRINSERT. This prevents earlier mutations from invalidating later paths when using recursive descent expressions like$..*on nested arrays.Note
Medium Risk
Changes mutation ordering for
JSON.ARRPOP/JSON.ARRTRIM/JSON.ARRINSERT(including legacy variants), which can subtly affect command results for multi-path operations; adds tests to lock in the new behavior.Overview
Fixes array mutation commands when using recursive descent paths (e.g.
$..*) by applying mutations deepest-first (and for siblings, higher array indices first) so earlier updates don’t invalidate later matched paths.This introduces shared path-comparison/sorting helpers and updates
JSON.ARRPOP,JSON.ARRTRIM, andJSON.ARRINSERTto sort matched paths for safe in-place mutation while still returning results in the caller-expected order. New pytest coverage validates correct behavior on nested arrays for these commands.Reviewed by Cursor Bugbot for commit 8f9251a. Bugbot is set up for automated code reviews on this repo. Configure here.