Repository navigation
Conversation
This branch has not been deployed
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 #4149
JSON Delete currently removes array elements by value equality. Deleting $.items[2] from {"items": [1, 2, 1]} therefore returns {"items": [2, 1]} instead of {"items": [1, 2]}.
Collect the original matching positions per array, normalize negative indices, deduplicate and delete in descending order. This keeps unselected items and handles unordered indices and slices without index shifts. Add real-SDK offline regression tests and a README example.
Release Notes
Fix JSON Delete removing the wrong array element when equal values occur. Array deletions now respect the positions selected by JSONPath, including negative indices, repeated selections, slices and nested arrays.
Change Type
Screenshots / Videos
Not applicable: deterministic JSON transformation with no UI changes.
LLM Plugin Checklist
Not applicable: JSON Process is a non-LLM utility plugin.
Version
The existing declaration is dify_plugin>=0.10.2 and the lock resolves 0.10.2. Both production dependency files are unchanged by this focused bug fix; the existing declaration has no upper bound.
Testing
Tested in a fresh Windows CPython 3.12.14 environment created with uv sync --frozen for this plugin, using dify-plugin 0.10.2 and jsonpath-ng 1.12.0. pytest was supplied as test tooling without changing the production lock.
The SDK emits the same two warnings before and after (gevent SSL import order and Pydantic Config deprecation). Existing daemon-based integration tests and a deployed Dify instance were not run; no deployment result is claimed.
AI assistance
OpenAI Codex assisted with proactive issue discovery, duplicate checks, reproduction, the focused patch, tests and drafting. The source was an intentional contribution search, not a production incident. The patch and evidence were presented to the contributor, who approved submitting this change.