Fix flaky test prop_childLookup#24
Merged
nbloomf merged 2 commits intoconformance-testingfrom Mar 5, 2026
Merged
Conversation
ninioArtillero
approved these changes
Mar 4, 2026
Collaborator
ninioArtillero
left a comment
There was a problem hiding this comment.
Thanks for solving this! I like that this refactor documents the generation of the arbitrary shrinker with the new Shrinker explicitly.
After going through this I found that the "negative index" error could be solved by just limiting the range of the Shrinkerlength to be within chooseInt (1,100)... but we indeed want to have the empty shrinker! Besides, the list equality in the property is less ad hoc than checking for equality of a single child. Nice!
Left some suggestions. Feel free to merge when ready.
Co-authored-by: Xavier Góngora <xavier.gongora@tweag.io>
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.
Description
Fixes tweag/cardano-conformance-testing-of-consensus#104.
For any given shrinking function
f,makeShrinkTree fandfshould be coherent in the sense thatwhenever either side is defined and not
Nothing. Or more intuitively,makeShrinkTree f xshould reify the traces ofshrink xwhenshrink == f. This is important because of the way test cases and shrink indices can persist across test runs.There is a property test to validate this,
prop_childLookup, however it is currently flaky because of edge cases in the generation of arbitrary indices. This presents as a test that randomly fails with either "negative index" or "index too large", neither of which has to do with the property being violated.This patch tweaks the test to check the entire list of child shrinks rather than just one at a specific index. This is equivalent to the original property, since
(restricting
kon the right so that both lookups exist). This sidesteps the partial function(!!)and also checks more evidence per test case.