Skip to content

Conversation

alecgrieser
Copy link
Collaborator

This adds test cases to cover situations where we might have a byte array that could plausibly be either a Tuple or a Protobuf message. It enumerates through the Tuple types, and in each case, it either identifies why the Tuple code could not be a valid message, or it constructs a case that could. The upshot is that it's clear that parsing as Protobuf without an error is not enough to say that something was definitely a Protobuf, though the stars do kind of need to align for this to happen.

Part of my hope here is that we can use this reference whenever this kind of situation comes up. For example, in our current thinking for #3397, we'll want to employ a strategy of guessing the origin of a byte string. If we want to test what happens if we start with a Tuple and then try to parse it as a Protobuf, this could be used to inform such a test case.

This adds test cases to cover situations where we might have a byte array that could plausibly be either a `Tuple` or a `Protobuf` message. It enumerates through the `Tuple` types, and in each case, it either identifies why the `Tuple` code could not be a valid message, or it constructs a case that could. The upshot is that it's clear that parsing as Protobuf without an error is not enough to say that something was definitely a Protobuf, though the stars do kind of need to align for this to happen.

Part of my hope here is that we can use this reference whenever this kind of situation comes up. For example, in our current thinking for FoundationDB#3397, we'll want to employ a strategy of guessing the origin of a byte string. If we want to test what happens if we start with a `Tuple` and then try to parse it as a Protobuf, this could be used to inform such a test case.
@alecgrieser alecgrieser added the testing improvement Change that improves our testing label Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing improvement Change that improves our testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant