tests: make the query and search tests assert results - #10
Open
dingf3ng wants to merge 1 commit into
Open
Conversation
dingf3ng
force-pushed
the
tests-assert-results
branch
from
September 1, 2026 14:17
c942ef9 to
2db7caa
Compare
dingf3ng
force-pushed
the
tests-assert-results
branch
from
September 2, 2026 04:44
2db7caa to
57cce57
Compare
dingf3ng
force-pushed
the
tests-assert-results
branch
from
September 2, 2026 07:36
57cce57 to
ff51c9d
Compare
Both files reported success without checking anything. test_context_search asserted `successful_searches > 0`, where a "success" was any string coming back from coq.search(). It built its interface as CoqInterface(path) with no workspace and no library_paths, so libframac was never mapped, the goal file's statement did not typecheck, no proof was opened, and load() died in coqpyt with "pop from empty list". The return value of load() was discarded and "CoqInterface loaded successfully" printed regardless. Every one of the 15 queries then returned the string "aux_file not accessible" and was counted as a hit: 15/15, 12/12, exit 0, in 12 seconds. Under pytest it was worse -- both functions `return` a bool, which pytest discards, so they were green unconditionally. test_coq_interface_queries had the same construction and the same scoring, reporting 23/23. Both now build the interface from configs/default_config.json and assert load(). Queries are checked by content, never by size: `Search Z.abs` must contain "Z.abs_0", `Locate mult` must contain "Corelib.Init.Peano.mult", `Check (fun x => x + 1)` must contain "fun x : int => x + 1". Sizes and exact text drift with the Rocq version and with which notations are in scope, so only substrings are asserted. The three searches too large to pin that way assert a size floor instead. One assertion is load-bearing: `Search Z.abs` must contain "Abs.Abs_pos", which lives in libautorocq/int/Abs.v. It fails if the libframac mapping is not actually on the load path, which is the defect that made the file vacuous in the first place. test_context_search additionally splits what it was only claiming to test. Ranking and size reduction are driven directly against ResultReducer with synthetic input, because which band a live query lands in is decided purely by len(content) and real output sits close to the boundaries -- `Search to_sint32` is 503 characters against a 500-char threshold. Three characters of library drift would silently drop that coverage with nothing failing. Driving the reducer directly pins all four bands, both sides of 500/501 and 1000/1001, and the goal-context ranking. Verified by mutation: removing the workspace fails 3 tests with "pop from empty list"; changing an expected fragment fails with the real output printed; changing an expected reduction band fails naming both. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
dingf3ng
force-pushed
the
tests-assert-results
branch
from
September 2, 2026 07:57
ff51c9d to
29ca081
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.
Why
Both test files reported success while checking nothing.
test_context_search.pyscoredsuccessful_searches > 0, where a "success" was any string coming back fromcoq.search(). It built its interface asCoqInterface(path)— noworkspace, nolibrary_paths— so libframac was never mapped, the goal file's statement didn't typecheck, no proof opened, andload()died in coqpyt withIndexError: pop from empty list.The return value of
load()was discarded and"✅ CoqInterface loaded successfully"printed regardless. All 15 queries then returned the string"aux_file not accessible"and each was counted as a hit:Under pytest it was worse — both functions
returna bool, which pytest discards:Green unconditionally.
test_coq_interface_queries.pyhad the same construction and the same scoring, reporting 23/23.What changed
Both now build the interface from
configs/default_config.jsonand assertload().Queries are checked by content, never by size:
Search Z.absZ.abs_0Locate multCorelib.Init.Peano.multCheck (fun x => x + 1)fun x : int => x + 1Sizes and exact text drift with the Rocq version and with which notations are in scope, so only substrings are asserted. The three searches too large to pin that way assert a size floor instead.
One assertion is load-bearing:
Search Z.absmust containAbs.Abs_pos, which lives inlibautorocq/int/Abs.v. It fails if the libframac mapping isn't actually on the load path — the exact defect that made the file vacuous.Reduction and ranking are tested directly, not through Rocq
Which size band a live query lands in is decided purely by
len(content), and real output sits right on the boundaries —Search to_sint32is 503 characters against a 500-char threshold. Three characters of library drift would silently delete that coverage with nothing failing.So
ResultReduceris driven directly with synthetic input, pinning all four bands, both sides of 500/501 and 1000/1001, and the goal-context ranking. Instant, no coq-lsp.Verified by mutation
workspacepop from empty list