Repository navigation
Conversation
Found while testing crates/geom/src/crop.rs:59 (CropGeometry::constrained, via crates/engine/src/cmd/develop.rs:524 crop.set) Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
bogusyogi
added a commit
to Orthic-Labs/ember
that referenced
this pull request
Oct 15, 2026
) Applied from storytold/lightcraft PR storytold#1816 (open upstream, not yet merged). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Thank you @Silvertree2010! This landed on main in integration batch 36 (#1843). If you haven't already, please join our Discord: https://discord.gg/artcraft. We'd love to have you there. |
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.
Found while testing
crates/geom/src/crop.rs:59 (CropGeometry::constrained, via crates/engine/src/cmd/develop.rs:524 crop.set)(no existing issue): crop.set with an extreme rect stores a NaN crop.Cause
CropGeometry::constrainedshrinks a crop that won't fit by the scale frommax_inscribed_scale. For a rect like[0,0,1e308,1e308]the pixel width becomes infinite and that scale becomes 0, soinf * 0produced a NaN crop, whichcrop.setthen stored and reported as a success.Fix
If the shrunk crop in
constrainedhas any non-finite coordinate, it now falls back tocrop_fit_angle: the largest centred crop that fits at the current angle. That crop keeps the rect's aspect ratio when the ratio is finite, and otherwise uses the image's own.Verified
constrained_huge_rect_is_finite_and_inside,crop_set_huge_rect_stays_finite: fail onmainwithout the fix and pass with it (cargo test -p lightcraft-geom constrained_huge_rect_is_finite_and_inside && cargo test -p lightcraft-engine crop_set_huge_rect_stays_finite).cargo xtask cipasses.Not changed
crop.setstill accepts any numbers and doesn't return a validation error. A huge rect is clamped to a finite crop inside the image, as other out-of-range rects already are.🤖 Generated with Claude Code