Add property-based tests for core.Resolve using pgregory.net/rapid#24
Merged
Add property-based tests for core.Resolve using pgregory.net/rapid#24
Conversation
gregology
approved these changes
Mar 8, 2026
gregology
added a commit
that referenced
this pull request
Mar 9, 2026
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.
Closes #20
The project docs (
docs/testing.md,AGENTS.yamldecisions) explicitly call for property-based tests oncore.Resolveusingpgregory.net/rapid, but they never got written. The existing table-driven tests cover known scenarios well — the gap is the combinatorial stuff you don't think to enumerate by hand. Weird glob interactions, deep nesting, empty match lists paired with non-empty excludes, that kind of thing.This adds the five invariant tests that were already documented:
on: editentries stay out ofActionReadresultsEach test uses
rapid.Checkwith generated inputs so we're exploring the input space rather than just checking the cases we thought of.Why rapid specifically
The docs already prescribed it. But even if they hadn't —
rapidis a good fit here because it integrates directly withtesting.T, does automatic shrinking on failures, and doesn't need a separate test runner. The alternative would begopter, which has a heavier API and less idiomatic Go integration.testing/quickfrom stdlib was another option but it's frozen and lacks shrinking.Why these five invariants and not more
These are the properties that matter for correctness of the resolution engine. Other things (like "valid YAML always parses") are stdlib behavior. The project's own testing guidelines say to test at public API boundaries and avoid testing private functions or Go stdlib behavior, so I stuck to that.
Resolves #20