New nodes: 'Format JSON', 'Query JSON', and 'Query JSON All', replacing the 'JSON Get' node#4044
New nodes: 'Format JSON', 'Query JSON', and 'Query JSON All', replacing the 'JSON Get' node#4044
Conversation
…ng the 'JSON Get' node
There was a problem hiding this comment.
Code Review
This pull request introduces a new suite of JSON processing nodes, including "Format JSON", "Query JSON", and "Query JSON All", while deprecating the older "json_get" implementation. These new nodes provide advanced capabilities for reformatting JSON strings and extracting data using a custom path syntax. The review feedback identifies several areas for improvement in the path parser, such as the need for robust escape sequence handling and support for single-quoted keys to match JavaScript's accessor syntax. Additionally, a bug was found in the string serialization logic where manual quoting failed to properly escape internal characters, which can be resolved by leveraging built-in serialization methods.
| if c == '\\' { | ||
| chars.next(); | ||
| if let Some(&escaped) = chars.peek() { | ||
| key.push(escaped); | ||
| chars.next(); | ||
| } |
There was a problem hiding this comment.
The escape handling for quoted keys in the path parser is too simplistic. It currently just strips the backslash and pushes the next character, which means \n becomes n instead of a newline character. Consider using the existing unescape_string utility or implementing proper JSON escape sequence support.
There was a problem hiding this comment.
3 issues found across 4 files
Confidence score: 3/5
- There is concrete user-impact risk in
node-graph/nodes/text/src/json.rs: quoted string output is not JSON-safe because escaping is bypassed, which can produce invalid JSON or incorrect serialized values. editor/src/messages/portfolio/document_migration.rsmisses an alias for the previousgraphene_stdJSON Get identifier, so older serialized documents may fail to migrate toquery_jsonas expected.- This looks mergeable with caution, but the combination of two high-confidence 7/10 issues plus a 6/10 parser-validation issue raises meaningful regression risk beyond a minor cleanup.
- Pay close attention to
node-graph/nodes/text/src/json.rsandeditor/src/messages/portfolio/document_migration.rs- JSON escaping/path validation and backward-compat migration behavior are the key risk areas.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="node-graph/nodes/text/src/json.rs">
<violation number="1" location="node-graph/nodes/text/src/json.rs:280">
P2: Malformed quoted-bracket paths are accepted instead of rejected because closing `]` is not required.</violation>
<violation number="2" location="node-graph/nodes/text/src/json.rs:356">
P1: Quoted string output is not JSON-safe because it bypasses escaping. Use serde_json serialization for strings.</violation>
</file>
<file name="editor/src/messages/portfolio/document_migration.rs">
<violation number="1" location="editor/src/messages/portfolio/document_migration.rs:680">
P1: This rename updates the destination identifier but does not add the previous `graphene_std` JSON Get identifier as an alias, so documents serialized with the old std identifier will not be migrated to `query_json`.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
@Keavon I have started the AI code review. It will take a few minutes to complete. |
Category - Text: JSON
[]accesses all.Broken out from #4010.