fix(nodes): guard missing roof-segment trim in ridge-vent geometry key (Sentry MONOREPO-EDITOR-ED)
Summary
- tolerate roof segments whose stored data predates the
trimschema field - keep the ridge-vent geometry dependency key stable by reading trim fields from an empty partial object when
segment.trimis missing
Root cause
The public viewer hydrates raw stored nodes without re-running the Zod parser. For legacy roof segments, that means the RoofSegmentTrim schema default never applies and segment.trim can be undefined at runtime. ridgeVentSegmentGeometryKey then dereferenced trim.left, crashing the viewer.
buildRidgeVentGeometry already routes trim handling through normalizeRoofSegmentTrim, so no additional guard was needed there.
Sentry
- MONOREPO-EDITOR-ED
- Issue
7593979332 - Observed July 22, 2026 on
/viewer/project_myTyG1YFgGBVpS6O
Validation
bun test packages/nodes/src/ridge-vent/__tests__/geometry.test.ts— 18 pass, 0 failbunx biome check packages/nodes/src/ridge-vent/renderer.tsx— clean
[!NOTE] Low Risk Narrow defensive null-coalescing in a geometry cache key; no auth, data, or geometry-building logic changes beyond avoiding a runtime dereference.
Overview Fixes a viewer crash when legacy roof segments are hydrated without a
trimfield (Zod defaults never run on raw stored nodes in the public viewer).
ridgeVentSegmentGeometryKeynow treats missingsegment.trimas an empty partial object before reading trim fields for the memo dependency string, so undefined trim no longer throws when building ridge-vent geometry keys.Reviewed by Cursor Bugbot for commit 25b7add31b631809b91e7de5d104223ac27a6b81. Bugbot is set up for automated code reviews on this repo. Configure here.