Skip to content

Null variant labels #110

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

Merged
merged 5 commits into from
Aug 12, 2025
Merged

Null variant labels #110

merged 5 commits into from
Aug 12, 2025

Conversation

mgorny
Copy link
Contributor

@mgorny mgorny commented Aug 8, 2025

  1. Add a get_variant_label() helper for convenience.
  2. Use null label for null variants.
  3. Change null variant hash to sha256("").

mgorny added 3 commits August 8, 2025 19:43
Since we are no longer using it as a label, we do not need
a recognizable special value here.  Instead, just use hash of an empty
string, so we can remove the special casing in code.
@mgorny mgorny requested a review from DEKHTIARJonathan August 8, 2025 18:26
Copy link
Member

@DEKHTIARJonathan DEKHTIARJonathan left a comment

Choose a reason for hiding this comment

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

I like the approach but I think letting the user to potentially provide custom label with null-variant is opening the door to bugs and implementation errors.

I would far prefer to take a more "direct" approach.
If you declare a null variant. Either I ignore you custom variant requested or you immediately get a validation error.

I think we would gain to be more drastic. If it's a guarantee then it's a guarantee - the user should not have to / and should not be allowed to potentially do otherwise

@DEKHTIARJonathan
Copy link
Member

You can merge once you're happy with the changes - I'm happy with the implementation (aside of being more drastic in the approach)

@DEKHTIARJonathan DEKHTIARJonathan changed the base branch from main to dev August 8, 2025 18:54
Copy link
Member

@DEKHTIARJonathan DEKHTIARJonathan left a comment

Choose a reason for hiding this comment

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

LGTM after the changes

mgorny added 2 commits August 12, 2025 18:49
Remove `NULL_VARIANT_HASH` since it resembles magic constant too much.
In the few places where we need it, either call hash directly, or get
it from VariantDescription.

Signed-off-by: Michał Górny <[email protected]>
@mgorny mgorny merged commit 4f83aba into dev Aug 12, 2025
44 checks passed
@mgorny mgorny deleted the null-label branch August 12, 2025 17:12
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.

2 participants