mirror of
https://github.com/penpot/penpot.git
synced 2026-04-25 19:28:12 +00:00
* 🐛 Fix nil path content crash by exposing safe public API Move nil-safety for path segment helpers to the public API layer (app.common.types.path) rather than the low-level segment namespace. Add nil-safe wrappers for get-handlers, opposite-index, get-handler-point, get-handler, handler->node, point-indices, handler-indices, next-node, append-segment, points->content, closest-point, make-corner-point, make-curve-point, split-segments, remove-nodes, merge-nodes, join-nodes, and separate-nodes. Update all frontend callers to use path/ instead of path.segment/ for these functions, removing the path.segment require from helpers, drawing, edition, tools, curve, editor and debug. Replace ad-hoc nil checks with impl/path-data coercion in all public wrapper functions in app.common.types.path. The path-data helper already handles nil by returning an empty PathData instance, which provides uniform nil-safety across all content-accepting functions. Update the path-get-points-nil-safe test to expect empty collection instead of nil, matching the new coercion behavior. * ♻️ Clean up path segment dead code and add missing tests Remove dead code from segment.cljc: opposite-handler (duplicate of calculate-opposite-handler) and path-closest-point-accuracy (unused constant). Make update-handler and calculate-extremities private as they are only used internally within segment.cljc. Add missing tests for path/handler-indices, path/closest-point, path/make-curve-point and path/merge-nodes. Update extremities tests to use the local reference implementation instead of the now-private calculate-extremities. Remove tests for deleted/privatized functions. Add empty-content guard in path/closest-point wrapper to prevent ArityException when reducing over zero segments.