ocaml: make property-coverage references a call-graph closure#15
Merged
Conversation
The coverage rule harvested references only from the QCheck2.Test.make callback, so an API exercised via the *generator* (`gen_graph` building inputs with `add_dependency`) or via a *higher-order test helper* (`totality (fun s -> Core.parse s)`) went uncounted — a recurring false-negative whack-a-mole. Make expansion uniform and obligatory instead of per-site: - All top-level bindings (not just functions) join the call graph, so a bound generator's references expand transitively. - A property check harvests references from every argument — callback and generator — expanded through the graph. - A binding that reaches a meaningful-property-bearing binding through the call graph (e.g. a property built by a higher-order helper) contributes its references to coverage. The meaningfulness gate is preserved: a linking property over `unit` that only `ignore`s a surface still does not count (regression-tested). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
The core-coverage rule ("property tests must reference every decision API") harvested references only from the
QCheck2.Test.makecallback. So an API exercised through the generator (gen_graphbuilding inputs viaadd_dependency) or through a higher-order test helper (totality (fun s -> Core.parse s)) was invisible — a recurring false-negative we kept patching per-case.Fix — uniform, obligatory call-graph closure
Rather than harvest at one syntactic site, expansion now follows the call graph:
The meaningfulness gate is preserved: a linking property over
unitthat onlyignores a surface still doesn't count.Why syntactic (not semantic)
The remaining hard case after this — a property selected at runtime from a data structure — is genuine dynamic dispatch, which semantic (typed-tree) resolution also wouldn't solve (it's flow, not name resolution; see #6). Call-graph closure is the right tool for reachability and is semantic-independent.
Tests (
ocaml/test.sh)unitproperty thatignores the API must still fail coverage.🤖 Generated with Claude Code
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.