MCPcopy Create free account
hub / github.com/VectifyAI/OpenKB / test_run_eval_reports_coverage_gaps

Function test_run_eval_reports_coverage_gaps

tests/test_skill_evaluator.py:232–262  ·  view source on GitHub ↗

Body alignment must catch the hollow-body case: description fires correctly but the body cannot support the questions it claims.

(tmp_path)

Source from the content-addressed store, hash-verified

230
231@pytest.mark.asyncio
232async def test_run_eval_reports_coverage_gaps(tmp_path):
233 """Body alignment must catch the hollow-body case: description fires
234 correctly but the body cannot support the questions it claims."""
235 skill_dir = _make_skill(tmp_path)
236 eval_set = _build_eval_set(3, 3)
237
238 async def perfect_trigger(description, question, *, model):
239 match = next(p for p in eval_set if p.question == question)
240 return match.expected
241
242 async def hollow_coverage(content, question, *, model):
243 # Body claims to support but actually doesn't for the first two
244 # trigger prompts.
245 if question in {"trig 0", "trig 1"}:
246 return "unsupported", "body has no material"
247 return "supported", ""
248
249 with (
250 patch("openkb.skill.evaluator.grade_one", side_effect=perfect_trigger),
251 patch("openkb.skill.evaluator.grade_coverage", side_effect=hollow_coverage),
252 ):
253 result = await run_eval(skill_dir, model="gpt-4o-mini", eval_set=eval_set)
254
255 # Trigger accuracy is still perfect.
256 assert result.passed == 6
257 # But coverage catches the hollow shell.
258 assert result.trigger_questions == 3
259 assert len(result.coverage_misses) == 2
260 assert {g.prompt.question for g in result.coverage_misses} == {"trig 0", "trig 1"}
261 assert all(g.reason == "body has no material" for g in result.coverage_misses)
262 assert result.coverage_rate == pytest.approx(1 / 3)
263
264
265@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 3

run_evalFunction · 0.90
_build_eval_setFunction · 0.85
_make_skillFunction · 0.70

Tested by

no test coverage detected