Merge pull request 'feat(learning): graduated gate — panel-consensus style lessons auto-flow to writer (P0)' (#341) from worktree-graduated-gate into main
This commit was merged in pull request #341.
This commit is contained in:
@@ -110,6 +110,19 @@ def _category(change: dict) -> str:
|
||||
return "style"
|
||||
|
||||
|
||||
# Graduated gate (INV-LRN1, chair decision 2026-06-28): a STYLE lesson the panel
|
||||
# kept by 2/2 consensus flows straight to the writer (review_status='approved'),
|
||||
# reversibly — the chair can veto it in /training. SUBSTANCE (halacha/precedent/
|
||||
# fact) never reaches here (it's filtered to `substance` and skipped, and routes
|
||||
# through the strict 3-judge halacha gate), so every category this panel emits is
|
||||
# style and auto-approves. The constant keeps the gate explicit and future-proof.
|
||||
_STYLE_CATEGORIES = frozenset({"style", "structure", "lexicon", "tabular"})
|
||||
|
||||
|
||||
def _review_status_for(category: str) -> str:
|
||||
return "approved" if category in _STYLE_CATEGORIES else "proposed"
|
||||
|
||||
|
||||
# ── two judges, one signature: (system, user) -> dict|None ──
|
||||
|
||||
async def judge_deepseek(client: httpx.AsyncClient, system: str, user: str) -> dict | None:
|
||||
@@ -323,18 +336,24 @@ async def main(args: argparse.Namespace) -> int:
|
||||
_lesson_text(r["_change"])])
|
||||
|
||||
written = 0
|
||||
approved = 0
|
||||
for r in fresh:
|
||||
cat = _category(r["_change"])
|
||||
rs = _review_status_for(cat)
|
||||
await db.add_decision_lesson(
|
||||
UUID(corpus_id),
|
||||
lesson_text=_lesson_text(r["_change"]),
|
||||
category=_category(r["_change"]),
|
||||
category=cat,
|
||||
source="panel:deepseek+gemini",
|
||||
created_by="panel",
|
||||
review_status=rs,
|
||||
)
|
||||
written += 1
|
||||
approved += (rs == "approved")
|
||||
|
||||
chair = cc["split"] + cc["incomplete"]
|
||||
print(f"\nAPPLIED (reversible): wrote {written} decision_lesson proposals "
|
||||
print(f"\nAPPLIED (reversible): wrote {written} decision_lessons "
|
||||
f"({approved} auto-approved style → writer; graduated gate) "
|
||||
f"(source=panel:deepseek+gemini) · {skipped_dup} כפילויות דולגו · "
|
||||
f"{chair} escalated to chair · {len(substance)} substance skipped")
|
||||
print(f"backup → {backup}")
|
||||
|
||||
Reference in New Issue
Block a user