Skip to content

Add useful attributes to the JSON and Regex nodes#4069

Merged
Keavon merged 2 commits intomasterfrom
json-regex-attributes
Apr 28, 2026
Merged

Add useful attributes to the JSON and Regex nodes#4069
Keavon merged 2 commits intomasterfrom
json-regex-attributes

Conversation

@Keavon
Copy link
Copy Markdown
Member

@Keavon Keavon commented Apr 28, 2026

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.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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().

Comment thread node-graph/nodes/graphic/src/graphic.rs
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 at i32::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 example unsigned_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.

Comment thread node-graph/nodes/graphic/src/graphic.rs Outdated
@Keavon Keavon merged commit 229d6f3 into master Apr 28, 2026
10 of 11 checks passed
@Keavon Keavon deleted the json-regex-attributes branch April 28, 2026 21:11
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data trees

1 participant