Improve QuickCheck shrink candidate ordering - #4149
Open
mizchi wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request reorders QuickCheck shrink candidates to reach simpler counterexamples faster.
Changes:
- Prioritizes zero, empty collections, and
None. - Removes duplicate floating-point zero candidates.
- Updates snapshots and adds regression coverage.
The driver regression test currently reports 27 attempts rather than the documented 15 because a second shrink pass is counted.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
quickcheck/shrink/utils.mbt |
Filters duplicate floating-point zero candidates. |
quickcheck/shrink/shrink.mbt |
Reorders numeric shrink candidates. |
quickcheck/shrink/shrink_test.mbt |
Updates numeric shrink snapshots. |
quickcheck/shrink/composite.mbt |
Prioritizes None candidates. |
quickcheck/shrink/composite_test.mbt |
Updates composite snapshots. |
quickcheck/shrink/collection.mbt |
Allows lists to shrink directly to empty. |
quickcheck/shrink/collection_test.mbt |
Adds list regression coverage and updates snapshots. |
quickcheck/README.mbt.md |
Updates documented shrink output. |
quickcheck/driver_test.mbt |
Adds numeric shrinking budget regression coverage. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Reorders built-in QuickCheck shrink candidates from simpler to more complex values.
NonebeforeSomecandidatesA regression test with an initial value of 10000 previously exhausted all 100 shrink attempts and stopped at 9900. It now reaches the failure boundary at 5000 in one successful shrink (15 candidates examined).
Validation:
moon test --target all,moon check --target all, andmoon info.