Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert back to min/max representation of empty AABB #184

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

adamreichold
Copy link
Member

@adamreichold adamreichold commented Nov 5, 2024

  • I agree to follow the project's code of conduct.
  • I added an entry to rstar/CHANGELOG.md if knowledge of this change could be valuable to users.

This reverts back to the min/max representation of empty AABB due to regressions introduced by the numerically more tame but not invariant for merging representation.

To avoid regressing #161, it also adds a single check to avoid computing the distance to an empty envelope (of the root node of an empty tree). Integer coordinates are always prone to overflow but in the empty case we are forcing this onto the caller whereas every non-empty tree will have AABB that the caller supplied and where we can reasonably ask them to control for overflow or use a custom Point impl based on saturating arithmetic.

Fixes #183

@adamreichold
Copy link
Member Author

This would be my personally preferred alternative to #181 and #182 trying to keep #161 working.

Generally speaking, I am really unsure whether the problems caused by fixed-precision integer coordinates are worth it, but this fix seems to be rather targeted and should not add measurable costs to the majority of floating-point coordinate users.

@adamreichold
Copy link
Member Author

(Whatever choice we make, we should probably yank 0.12.1 after releasing 0.12.2 to crates.io.)

This reverts back to the min/max representation of empty AABB
due to regressions introduced by the numerically more tame but
not invariant for merging representation.

To avoid regressing #161, it also adds a single check to avoid
computing the distance to an empty envelope (of the root node
of an empty tree). Integer coordinates are always prone to overflow
but in the empty case we are forcing this onto the caller whereas
every non-empty tree will have AABB that the caller supplied and
where we can reasonably ask them to control for overflow or
use a custom `Point` impl based on saturating arithmetic.
@urschrei
Copy link
Member

urschrei commented Nov 5, 2024

OK – shall we merge this, release a patch version, and yank?

Copy link
Member

@michaelkirk michaelkirk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable!

@adamreichold
Copy link
Member Author

OK – shall we merge this, release a patch version, and yank?

If there are no objections from elsewhere, yes, I think that would be best to provide a quick resolution for affected projects.

I think the risk of an error in the fix is small for most users (as we are going back to the previous behaviour) and we'll just have to deal with any fallout from fixed-precision integer coordinate users. I tried to avoid it but I am admittedly not confident that it can be avoided.

@adamreichold adamreichold added this pull request to the merge queue Nov 5, 2024
Merged via the queue into master with commit 4b44c03 Nov 5, 2024
6 checks passed
@urschrei
Copy link
Member

urschrei commented Nov 5, 2024

0.12.1 is yanked

@adamreichold adamreichold deleted the new-empty-min-max branch November 5, 2024 21:56
@adamreichold
Copy link
Member Author

0.12.1 is yanked

I think it is customary to yank only after an upgrade is available. Otherwise, the degree of eyebrow raising can be problematic. But I suspect you'll push 0.12.2 soon as well?

@urschrei
Copy link
Member

urschrei commented Nov 5, 2024

Released!

@michaelkirk
Copy link
Member

I think it is customary to yank only after an upgrade is available.

At first I thought this made sense, but now I'm not sure.

Assuming the fix is patch compatible (0.0.x++), if you wait to have the fix published before running cargo yank, it seems like the only practical consequence of cargo yank is to annotate what's shown on crates.io (and other indexes).

Screenshot 2024-11-05 at 14 09 07

If you already have the patch-compatible version published, cargo update will update to that fixed version, skipping the broken one anyway, right?

So it can be used to prevent people from updating. But it's not useful for "skipping" the broken one, since cargo already installs the most recent semver compatible one when running cargo update.

@michaelkirk
Copy link
Member

To summarize, it's my conclusion that cargo yank should be used precisely in the time after you know you have a problem, but before a fix is available.

@urschrei
Copy link
Member

urschrei commented Nov 5, 2024

Delightfully, we can unyank.

@adamreichold
Copy link
Member Author

A lot of CI runs tools like cargo audit or cargo deny which will warn about yanked dependencies. Warnings which are not actionable because no semver-compatible replacement is available is what I was referring to. Admittedly, this is not so bad if an earlier patch release is available because you can most likely downgrade successfully, but for example yanking 0.12.0 is significantly worse.

@adamreichold
Copy link
Member Author

Delightfully, we can unyank.

I would not recommend that due to as written, cargo update is not the only concern. Yanking sends a relevant signal to different tools and also users with existing locked dependencies.

@michaelkirk
Copy link
Member

michaelkirk commented Nov 5, 2024

It's my conclusion that cargo yank should be used precisely in the time after you know you have a problem, but before a fix is available.

I phrased this poorly — In case there was confusion, I'm not recommending unyanking in this case.

I'll try again:

You should yank as soon as you know there is a problem, to keep people from updating to the broken version, even before a fix is available, ensuring legacy users stay on the old version until the fix is available.

yanking after a fix is published isn't harmful it's just not very useful.

As @adamreichold points out, there is some utility to yanking, even if you've already shipped the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance degradation following 0.12.1 release
3 participants