Add useful attributes to the JSON and Regex nodes#4069
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a new extract_element node for retrieving bare values from tables and enhances the JSON and Regex nodes to include metadata attributes such as type, start, end, and name in their output table rows. A review comment points out a potential overflow and truncation issue in the extract_element implementation when casting SignedInteger (i64) to i32, suggesting a safer indexing logic using unsigned_abs().
Contributor
There was a problem hiding this comment.
1 issue found across 4 files
Confidence score: 3/5
- There is a concrete regression risk in
node-graph/nodes/graphic/src/graphic.rs: negating a signed index can overflow ati32::MIN, which can trigger a panic for extreme negative inputs. - I’m scoring this as moderate merge risk because the issue is medium severity (6/10) with high confidence (9/10) and affects runtime behavior rather than just style/maintainability.
- Pay close attention to
node-graph/nodes/graphic/src/graphic.rs- replace signed negation with a safe distance calculation (for exampleunsigned_abs()) to avoid overflow-driven panics.
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/graphic/src/graphic.rs">
<violation number="1" location="node-graph/nodes/graphic/src/graphic.rs:103">
P2: Negating a signed index here can overflow (`i32::MIN`), causing a panic path for extreme negative inputs. Use `unsigned_abs()` to compute distance from the end safely.
(Based on your team's feedback about avoiding panics in application code.) [FEEDBACK_USED]</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Keavon
added a commit
that referenced
this pull request
Apr 29, 2026
* Add useful attributes to the JSON and Regex nodes * Code review fix
oluseyi
pushed a commit
to oluseyi/Graphite
that referenced
this pull request
Apr 29, 2026
* Add useful attributes to the JSON and Regex nodes * Code review fix
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.
This also fixes the broken 'Regex Find' document node which was inadvertently returning a table instead of a string after the traits changed to make that happen.
Partly closes #3779.