Repository navigation
fix+test: ensemble missing-key crash and eligibility boundary condition - #24
Merged
cschanhniem merged 2 commits intoJun 28, 2026
Merged
Conversation
…#24) ensemble.py: scores[name] → scores.get(name, 0.0) Previously, if a scorer failed to produce a key that appears in weights, ensemble_score would raise KeyError crashing the entire pipeline run. Using .get() degrades gracefully (treats missing scorer as 0 contribution). New tests: - test_missing_score_key_defaults_to_zero: weights has "safety" but scores doesn't → result is weighted average treating missing key as 0.0, not crash - test_extra_score_key_not_in_weights_is_ignored: extra keys in scores are silently ignored, consistent with weighted average semantics - test_eligibility_novelty_at_exact_minimum_passes: verifies the eligibility filter uses >= (not >): novelty=0.0 with min_novelty=0.0 should be selected
A missing key was silently treated as 0.0, which would hide YAML config typos (e.g. 'activty' → correct score 0.91 vs wrong score 0.34). Now emits warnings.warn(UserWarning) listing the missing keys so the issue is auditable in logs without crashing. Test updated to use pytest.warns() to assert the warning is actually emitted.
cschanhniem
deleted the
feat/eligibility-boundary-ensemble-config-validation
branch
June 28, 2026 02:02
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.
Summary
Bug fix:
ensemble.pysilent crash on missing score keyIf any upstream scorer fails to produce a key that appears in
weights, the old code would raiseKeyErrorand crash the entire pipeline run (no JSONL output, no certificates, no manifest). With.get(), the missing scorer contributes 0.0 to the ensemble — a safe degradation that still produces ranked output so a human can review.New tests
test_missing_score_key_defaults_to_zero— weights has"safety"but scores doesn't; verifies result is0.5714(weighted avg with safety=0.0) not a crashtest_extra_score_key_not_in_weights_is_ignored— extra keys in scores (e.g.boman_activity) that aren't in weights are ignored; result is unchangedtest_eligibility_novelty_at_exact_minimum_passes— eligibility filter uses>=so a candidate withnovelty=0.0andmin_novelty=0.0must be selected; confirms boundary operator is inclusiveTest plan
pytest tests/test_scoring_ensemble.py tests/test_pipeline_filters.py— 41 passedpytest— 777 passedContext
Iteration #24 of the pre-wet-lab quality loop. The ensemble missing-key crash is a real reliability risk: if a physchem feature is NaN or a scorer throws, the whole run dies silently instead of producing degraded but usable output.
🤖 Generated with Claude Code