New node: 'Heart' - #4478
Open
Ayush2k02 wants to merge 7 commits into
Open
Conversation
Ayush2k02
marked this pull request as ready for review
August 26, 2026 14:58
Contributor
There was a problem hiding this comment.
9 issues found across 7 files
Confidence score: 2/5
heart_shape.rscan divide by zero for horizontal, vertical, or zero-length drags, sending infinite or NaN scale values into the document; guard zero dimensions before calculating aspect ratio.shape_tool.rsuses viewport-space radius as a document-space value when zoom is not 100%, so newly drawn hearts can have the wrong size; convert the radius to document space before dispatch.shapes.rscan generate a self-intersecting heart whencleavage_depthandshoulder_heightare near their maxima, producing invalid geometry; constrain shoulder height relative to cleavage depth.heart_shape.rscan panic if the Heart definition is missing from the runtime node registry during normal shape-tool use; propagate or handle the missing-definition error instead.
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="editor/src/messages/tool/common_functionality/shapes/heart_shape.rs">
<violation number="1" location="editor/src/messages/tool/common_functionality/shapes/heart_shape.rs:25">
P2: If the heart definition is absent from the runtime node registry, `create_node` panics during a normal shape-tool action instead of failing that action gracefully. Propagate the missing-definition error or handle the `None` case at the caller rather than using `expect`.
(Based on your team's feedback about avoiding panics in application code.)</violation>
<violation number="2" location="editor/src/messages/tool/common_functionality/shapes/heart_shape.rs:47">
P2: When one drag dimension is zero (e.g. a purely horizontal drag, or a click with no drag), `scale.x = dimensions.x / dimensions.y` or `scale.y = dimensions.y / dimensions.x` divides by zero, producing Infinity/NaN that is written into the radius node input and the layer transform, breaking/non-rendering the heart. Guard the divisor so a degenerate drag degrades gracefully instead of emitting non-finite values.</violation>
<violation number="3" location="editor/src/messages/tool/common_functionality/shapes/heart_shape.rs:49">
P1: When the heart is dragged exactly horizontally, vertically, or not at all, one of these divisions uses zero and sends an infinite or NaN scale to the document. Return before the aspect-ratio calculation when either dimension is zero.</violation>
</file>
<file name="editor/src/messages/tool/tool_messages/shape_tool.rs">
<violation number="1" location="editor/src/messages/tool/tool_messages/shape_tool.rs:19">
P2: Custom agent: **PR title enforcement**
This PR adds the new `Heart` node, so its title must use the dedicated `New node: 'Node Name'` format. Rename the title to `New node: 'Heart'`.</violation>
<violation number="2" location="editor/src/messages/tool/tool_messages/shape_tool.rs:1198">
P2: When the canvas is zoomed away from 100%, drawing a Heart produces the wrong size because this dispatch reaches an update path that writes viewport-space dimensions as document-space radius. Convert the radius to document units with `viewport_zoom(document)` before setting the Heart input.</violation>
</file>
<file name="node-graph/libraries/vector-types/src/vector/algorithms/shapes.rs">
<violation number="1" location="node-graph/libraries/vector-types/src/vector/algorithms/shapes.rs:192">
P3: When `cleavage_angle` is zero, the top remains a sharp cusp with vertical tangents; it does not become a smooth join as documented. Update the documentation to describe the cusp, or change the handle construction if a smooth join is intended.</violation>
<violation number="2" location="node-graph/libraries/vector-types/src/vector/algorithms/shapes.rs:232">
P2: When `cleavage_depth` and `shoulder_height` are both near their allowed maxima, the shoulder can lie above the notch, and the generated cubic contour can self-intersect. Constrain `shoulder_height` relative to `cleavage_depth` and the handle lengths, or reject/clamp combinations that invert the anchor order before constructing the path.</violation>
<violation number="3" location="node-graph/libraries/vector-types/src/vector/algorithms/shapes.rs:466">
P3: The symmetry test is tautological: both halves are built by explicit mirroring in `heart_bezpath`, so every collected control point is guaranteed to have its mirror present, and the assertion cannot fail. It does not verify that the resulting curves are geometrically symmetric. Prefer asserting real symmetry, e.g. by flipping the right-half control points and checking the mirrored image lies on the sampled path (or that the differences of symmetric samples are ~0), instead of membership in the same mirrored set.</violation>
</file>
<file name="node-graph/nodes/vector/src/generator_nodes.rs">
<violation number="1" location="node-graph/nodes/vector/src/generator_nodes.rs:188">
P3: When `cleavage_angle` is zero, the generated top is a sharp cusp rather than a smooth join. Update the description so users understand that larger angles approach a smooth join.</violation>
</file>
Tip: cubic used a learning from your PR history. Let your coding agent read cubic learnings directly with the cubic MCP.
Re-trigger cubic
Contributor
There was a problem hiding this comment.
1 issue found across 254 files (changes from recent commits).
Confidence score: 5/5
- The new
frontend/_branding/.brandingis a byte-for-byte duplicate of the repo-root./.brandingbut is never read bytools/cargo-run/src/branding.rs, which only loadsworkspace/.branding— risk is low but the duplicate can cause confusion and drift if one copy is updated and the other is not; consider deleting the unused file or wiring it into the loader.
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="frontend/_branding/.branding">
<violation number="1" location="frontend/_branding/.branding:1">
P3: This new `frontend/_branding/.branding` is byte-for-byte identical to the repo-root `./.branding`, but nothing reads it: `tools/cargo-run/src/branding.rs` only loads `workspace/.branding` and writes its marker to `branding/.branding`. Keeping two identical hash-pinned config copies has no consumer and will silently drift if the archive revision is bumped in one place only. Either reference the existing root config instead, or remove this duplicate.</violation>
</file>
Note: This PR contains a large number of files. cubic selects up to 200 of the highest-priority eligible files for this review, so some files may not have been reviewed.
Re-trigger cubic
Ayush2k02
marked this pull request as draft
August 26, 2026 17:55
Ayush2k02
force-pushed
the
gizmo/1-heart-node
branch
from
August 26, 2026 17:56
0bfb34c to
8e5a9cc
Compare
Ayush2k02
marked this pull request as ready for review
August 26, 2026 18:01
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.
Adds a Heart vector generator and a Heart drawing mode to the Shape tool.
heartnode — a radius plus ten shaping proportions: cleavage depth andangle, lobe fullness, shoulder height, width and tilt, upper and lower curvature,
point sharpness, and taper length. Each carries a declared range.
axis, a shoulder either side, and a point at the bottom. Every proportion is a
fraction of the radius, so the shape scales as one piece and stays symmetrical
without storing its left half.
kurbo::BezPath, alongside the rest of the generators.about the vertical axis, linear scaling with radius, and respecting its centre.
Screen.Recording.2026-08-27.at.3.05.54.AM.mov