fix(nodes): guard missing roof-segment trim in ridge-vent geometry key (Sentry MONOREPO-EDITOR-ED)#530
Open
anton-pascal wants to merge 1 commit into
Open
fix(nodes): guard missing roof-segment trim in ridge-vent geometry key (Sentry MONOREPO-EDITOR-ED)#530anton-pascal wants to merge 1 commit into
anton-pascal wants to merge 1 commit into
Conversation
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.
Summary
trimschema fieldsegment.trimis missingRoot cause
The public viewer hydrates raw stored nodes without re-running the Zod parser. For legacy roof segments, that means the
RoofSegmentTrimschema default never applies andsegment.trimcan beundefinedat runtime.ridgeVentSegmentGeometryKeythen dereferencedtrim.left, crashing the viewer.buildRidgeVentGeometryalready routes trim handling throughnormalizeRoofSegmentTrim, so no additional guard was needed there.Sentry
7593979332/viewer/project_myTyG1YFgGBVpS6OValidation
bun test packages/nodes/src/ridge-vent/__tests__/geometry.test.ts— 18 pass, 0 failbunx biome check packages/nodes/src/ridge-vent/renderer.tsx— cleanNote
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 25b7add. Bugbot is set up for automated code reviews on this repo. Configure here.