Restore experimental Z3 SQL correctness-measurement feature#1637
Open
agusaldasoro wants to merge 3 commits into
Open
Restore experimental Z3 SQL correctness-measurement feature#1637agusaldasoro wants to merge 3 commits into
agusaldasoro wants to merge 3 commits into
Conversation
a127e27 to
992ce99
Compare
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.
Overview
Restores the experimental Z3 SQL correctness-measurement feature that was removed in commit
c8712da5, and reinstates thecore → evomaster-client-java-sqldependency it relies on. This is a revert of that removal, merged on top ofdse/memoization.Motivation
When Z3 generates SQL
INSERTdata to satisfy a failingWHEREclause, there was no way to verify that the generated rows actually satisfy the original predicate. This feature adds an optional, self-checking correctness metric so we can measure — during experiments — how often Z3-generated data is truly correct.What it does
Behind a new experimental flag
measureSqlZ3Correctness(defaultfalse, depends ongenerateSqlDataWithZ3=true), after Z3 returns a SAT model the solver:QueryResultSetfrom the generatedSqlActions (toQueryResultSet/extractGeneValue).SqlHeuristicsCalculatorto compute the heuristic distance between the originalWHEREquery and the generated data.distance == 0→ the generated insert satisfies the query.distance > 0→ it does not.Statistics(reportSqlZ3CorrectnessDistance), which emits five new stats when the flag is on:sqlZ3CorrectnessChecks,sqlZ3CorrectnessZeroDistance,sqlZ3CorrectnessNonZero,sqlZ3CorrectnessAvgDist,sqlZ3CorrectnessEvalFailures.INSERTstatements are skipped (noWHEREto evaluate against); DELETE/UPDATE evaluation failures are counted separately and excluded from the average so they don't distort the metric.Changes
core/pom.xml— re-addevomaster-client-java-sqldependency.EMConfig.kt— re-addmeasureSqlZ3Correctnessexperimental option.Statistics.kt— re-add correctness-distance counters andreportSqlZ3CorrectnessDistance.SMTLibZ3DbConstraintSolver.kt— re-addcomputeCorrectnessDistance,toQueryResultSet,extractGeneValue, and the post-SAT measurement hook.Notes
The flag is off by default, so there is no behavioral impact on normal runs; the measurement path is exercised only during correctness experiments.