test(determine): lookback coverage — multi-query, malformed-query, non-comprehension
From the mandated lookback audit: three D0 refusal branches were asserted-but-unproven. Now they bite: - not_single_query: reachable from REAL input — a two-question prompt yields two queries. - malformed_query: a unary `member` query (hand-built; the reader only emits arity-2). - not_a_comprehension: a non-Comprehension/Refusal input. No code change — determine.py already refused all three; this closes the schema-proof-obligation gap (each would now fail if its guard were removed).
This commit is contained in:
parent
bf9ad77fda
commit
872fecf478
1 changed files with 31 additions and 0 deletions
|
|
@ -145,3 +145,34 @@ def test_unsupported_query_predicate_is_refused(vocab_persona) -> None:
|
|||
)
|
||||
res = determine(subset_q, ctx)
|
||||
assert isinstance(res, Undetermined) and res.reason == "unsupported_query"
|
||||
|
||||
|
||||
def test_multi_query_is_refused(vocab_persona) -> None:
|
||||
# A two-question input yields TWO queries (reachable from real input); D0 answers
|
||||
# one question at a time.
|
||||
ctx = _ctx(vocab_persona)
|
||||
_tell("Truth is a concept.", ctx)
|
||||
res = _ask("Is truth a concept? Is knowledge a thought?", ctx)
|
||||
assert isinstance(res, Undetermined) and res.reason == "not_single_query"
|
||||
|
||||
|
||||
def test_malformed_member_query_is_refused(vocab_persona) -> None:
|
||||
# `member` is binary; a unary member query is malformed. Hand-built, since the
|
||||
# reader always emits arity-2 member queries — the guard would otherwise be
|
||||
# asserted-but-unproven.
|
||||
from generate.meaning_graph.model import MeaningGraph, MeaningSpan
|
||||
from generate.meaning_graph.reader import Comprehension, Query
|
||||
|
||||
ctx = _ctx(vocab_persona)
|
||||
span = MeaningSpan(source_id="input", start=0, end=5, text="dummy")
|
||||
unary = Comprehension(
|
||||
meaning_graph=MeaningGraph(), queries=(Query("member", ("truth",), span),)
|
||||
)
|
||||
res = determine(unary, ctx)
|
||||
assert isinstance(res, Undetermined) and res.reason == "malformed_query"
|
||||
|
||||
|
||||
def test_non_comprehension_input_is_refused(vocab_persona) -> None:
|
||||
ctx = _ctx(vocab_persona)
|
||||
res = determine(object(), ctx) # neither Comprehension nor Refusal
|
||||
assert isinstance(res, Undetermined) and res.reason == "not_a_comprehension"
|
||||
|
|
|
|||
Loading…
Reference in a new issue