fix(principles): cap ranks consensus-first (votes, then score) — criterion A (#152)
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 4s
Lint — undefined names / undefined-names (pull_request) Successful in 10s

chaim 2026-06-20: a unanimous 3-vote principle must outrank a 2-vote one
regardless of score (cross-model agreement is the more reliable keep signal).
apply_cap now sorts survivors by (votes, score), matching cluster_candidates.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-20 09:21:51 +00:00
parent bfc034b44c
commit 29b1da534c
2 changed files with 21 additions and 8 deletions

View File

@@ -136,7 +136,10 @@ def apply_cap(judged: list[dict], max_new: int | None = None) -> list[dict]:
"""
max_new = config.HALACHA_PANEL_MAX_NEW if max_new is None else max_new
survivors = [j for j in judged if j.get("verdict") in ("approved", "pending_review")]
survivors.sort(key=lambda j: j.get("score", 0.0), reverse=True)
# Rank consensus-first, then confidence (chaim 2026-06-20): a unanimous 3-vote
# principle outranks a 2-vote one regardless of score — cross-model agreement is
# the more reliable keep signal (AC1=0.92). Mirrors cluster_candidates' ordering.
survivors.sort(key=lambda j: (j.get("votes", 0), j.get("score", 0.0)), reverse=True)
keep_ids = {id(j) for j in survivors[:max_new]}
out = []
for j in judged: