BlueprintZoneConfig and friends should not have to impl Ord/PartialOrd - #11284
Open
davepacheco wants to merge 1 commit into
Open
davepacheco wants to merge 1 commit into
davepacheco wants to merge 1 commit into
Conversation
bnaecker
reviewed
Sep 12, 2026
bnaecker
left a comment
Collaborator
There was a problem hiding this comment.
I think this seems like a good approach. I also don't have enough experience with blippy's reporting to know if this is different in any important way, so I don't think my approval counts for much.
Do we want to remove Ord and other traits further down the chain, to the types like OmicronZoneExternalFloatingIps, which started this?
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.
It's possible this is a bad idea and should just be closed.
This came up while reviewing #11236. There, we had to impl
Ordonzone_type::Nexus, which required impl'ingOrdon "a set of external IP addresses". This felt weird to me -- what does it mean to define an ordering between two sets of IPs (which could have different sizes, overlapping IPs, etc.), and why should we need that? It turns out that the only thing depending on this was thatBlueprintZoneConfig(which stores azone_type::Nexus) implsOrd/PartialOrd, and that's only because it's contained in blippyNotes, which blippy wants to be able to sort. I've instead impl'd some custom logic in blippy to sort without looking at this data, since I don't think it affects the result. Then I removedOrd/PartialOrdfromBlueprintZoneConfigand a few related types.This is a little goofy and I'm not sure if there's a better way to do it. What it boils down to is that blippy notes have a
kind, but this isn't a discriminant -- it's a variant with data that includes the details of the note. It needs to be able to compare them withEq/PartialEq, and that should use all the fields, including these fields that I want to ignore while sorting them. That's not allowed. Rust requires thatPartialOrd/Ord/PartialEq/Eqall agree. So instead, I've impl'd a separate little tree ofcompare_to()helpers that compare based on discriminants. (It's a tree, not just one, becauseKindis itself recursive -- each of its variants has its ownKindenum.) One could imagine wrapping this up into a sort ofAltOrdtrait, but I didn't go that far here.