7 Commits

Author SHA1 Message Date
ffa02ca83c Merge pull request 'feat(principles): עיצוב-מחדש עקרונות משפטיים — פאנל-3, תקרת-5, סינון רטרואקטיבי, סינתזה, טרמינולוגיה (#152)' (#304) from worktree-canonical-synthesis into main
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m29s
G12 Leak-Guard / leak-guard (push) Successful in 4s
Lint — undefined names / undefined-names (push) Successful in 10s
Merge PR #304: legal-principles redesign — panel-3 + cap-5 + cull + synthesis + terminology (#152)
2026-06-19 11:17:05 +00:00
ca1f0e8c66 Merge pull request 'feat(halacha-queue): panel deliberation + search on rejected/approved tabs' (#303) from worktree-halacha-restore-panel-search into main
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 45s
G12 Leak-Guard / leak-guard (push) Successful in 4s
Lint — undefined names / undefined-names (push) Successful in 11s
2026-06-19 10:25:22 +00:00
8c455d6ef6 feat(halacha-queue): show panel deliberation + add search on rejected/approved tabs
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 4s
Lint — undefined names / undefined-names (pull_request) Successful in 11s
The 3-judge panel deliberation was only surfaced in the pending queue; the
'rejected'/'approved' tabs hid WHY an item was auto-rejected/approved even
though the data is captured (reviewer='panel:... maj-not-entailed'). And those
tabs had no way to locate a specific item.

- useHalachotByStatus now requests include_panel_round=true and accepts a
  server-side search term (same /api/halachot params the pending queue uses).
- HalachaRestoreCard renders the existing PanelDeliberation component when a
  round exists — same card the chair already sees in pending.
- RestorePanel gains the same locate-bar (debounced, server-side search) +
  a match-count indicator; the bar stays visible on empty/loading so a search
  is always clearable.

Reuses already-approved UI (deliberation = Design card 18, locate-bar = card
19); composition onto a sibling surface, approved directly by chaim. tsc +
eslint clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 10:24:54 +00:00
f9ef664ac9 Merge pull request 'fix(halacha-queue): route only true extraction defects to "needs re-extraction"' (#302) from worktree-halacha-fix-bucket-predicate into main
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 43s
G12 Leak-Guard / leak-guard (push) Successful in 4s
Lint — undefined names / undefined-names (push) Successful in 10s
2026-06-19 10:09:46 +00:00
532bef04a7 fix(halacha-queue): only true defects go to 'needs re-extraction', not all flags
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 3s
Lint — undefined names / undefined-names (pull_request) Successful in 10s
The pending review queue split items into 'להכרעתך' (chair judgment) vs
'דורש תיקון-חילוץ' (needs re-extraction) by a too-blunt predicate: ANY
quality flag + no panel round → re-extraction. That misfiled fact-specific
'application' items (extraction is fine; the open question is whether the
rule generalizes) as extraction defects, contradicting the backend, which
treats only quote_unverified/truncated_quote/thin_restatement/near_duplicate
as defects and routes 'application' to chair judgment.

Now isExtractionFixItem checks the backend's DEFECT set, so 'application'
(and any other non-defect flag) lands in 'להכרעתך'. For 8508-03-24 this
moves 21 application items judgment→correct and leaves 6 thin_restatement
as the only re-extraction items.

Logic-only fix (predicate), no visual change — design-gate exempt per
web-ui/AGENTS.md. tsc + eslint clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 10:09:14 +00:00
639779e6a9 Merge pull request 'feat(halacha): --case-number filter for panel triage script' (#301) from worktree-halacha-panel-case-filter into main
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 21s
G12 Leak-Guard / leak-guard (push) Successful in 4s
Lint — undefined names / undefined-names (push) Successful in 11s
2026-06-19 09:36:35 +00:00
676ae4532b feat(halacha): --case-number filter for panel triage script
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 5s
Lint — undefined names / undefined-names (pull_request) Successful in 11s
Scope halacha_panel_approve.py to a single case's pending halachot so the
3-judge deliberation (#133/FU-2) can be captured on demand for one case
(e.g. after a fresh extraction) instead of running the whole ~1.5k queue.
Capture-only path unchanged; no auto-approval. Applied before --limit.

Invariants: G1 (scope at source, not a parallel route) · G2 (reuses the
existing panel/capture path) · INV-G10 (chair gate untouched — dry-run
captures to halacha_panel_rounds only).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 09:36:04 +00:00
3 changed files with 111 additions and 35 deletions

View File

@@ -115,6 +115,10 @@ async def main(args: argparse.Namespace) -> int:
print(f"judges available — deepseek:{bool(DEEPSEEK_KEY)} gemini:{bool(GEMINI_KEY)} "
f"claude:local\n", flush=True)
pending = await db.list_halachot(review_status="pending_review", limit=5000)
if args.case_number:
want = args.case_number.strip()
pending = [h for h in pending if (h.get("case_number") or "").strip() == want]
print(f"scoped to case {want}: {len(pending)} pending halachot\n", flush=True)
if args.limit:
pending = pending[: args.limit]
@@ -306,6 +310,9 @@ if __name__ == "__main__":
ap = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
ap.add_argument("--limit", type=int, default=0)
ap.add_argument("--case-number", default="",
help="scope the panel to a single case's pending halachot "
"(e.g. 8508-03-24); applied before --limit")
ap.add_argument("--concurrency", type=int, default=6)
ap.add_argument("--apply", action="store_true",
help="write the agreed verdicts (reversible, CSV-backed); default dry-run")

View File

@@ -614,6 +614,8 @@ function HalachaRestoreCard({
))}
</div>
{h.panel_round && <PanelDeliberation round={h.panel_round} />}
<div className="flex items-center gap-2 justify-end pt-1 border-t border-rule-soft">
<Button size="sm" variant="ghost"
onClick={secondaryAction}
@@ -708,7 +710,14 @@ function RestorePanel({
secondaryLabel: string;
getSecondaryStatus: () => "approved" | "rejected" | "pending_review";
}) {
const { data, isPending, error } = useHalachotByStatus(status);
const [searchInput, setSearchInput] = useState("");
const [search, setSearch] = useState("");
useEffect(() => {
const t = setTimeout(() => setSearch(searchInput.trim()), 300);
return () => clearTimeout(t);
}, [searchInput]);
const { data, isPending, error } = useHalachotByStatus(status, { search });
const update = useUpdateHalacha();
const [expandedIds, setExpandedIds] = useState<Set<string>>(new Set());
@@ -716,6 +725,8 @@ function RestorePanel({
() => buildGroups(data?.items ?? []),
[data],
);
const searching = search.length > 0;
const matchCount = data?.count ?? 0;
const restore = async (h: Halacha, newStatus: "approved" | "rejected" | "pending_review") => {
try {
@@ -735,31 +746,19 @@ function RestorePanel({
});
};
if (error) {
return (
const body = error ? (
<div className="rounded bg-danger-bg border border-danger/40 px-6 py-5 text-danger text-center">
{error.message}
</div>
);
}
if (isPending) {
return (
) : isPending ? (
<div className="space-y-3">
{[...Array(3)].map((_, i) => <Skeleton key={i} className="h-24 w-full" />)}
</div>
);
}
if (!groups.length) {
return (
) : !groups.length ? (
<div className="text-center text-ink-muted py-16">
<p className="text-lg">אין הלכות בסטטוס זה.</p>
<p className="text-lg">{searching ? "אין התאמות לחיפוש." : "אין הלכות בסטטוס זה."}</p>
</div>
);
}
return (
) : (
<div className="space-y-3">
{groups.map((g) => {
const isOpen = expandedIds.has(g.caseLawId);
@@ -813,6 +812,54 @@ function RestorePanel({
})}
</div>
);
return (
<div className="space-y-4">
{/* Locate bar — reach any item in this status, not only the top window */}
<div className="flex items-center gap-2.5 rounded-lg border border-rule bg-surface px-3.5 py-2.5 shadow-sm">
<Search className="w-4 h-4 text-ink-muted shrink-0" />
<input
value={searchInput}
onChange={(e) => setSearchInput(e.target.value)}
placeholder="חיפוש — מספר פס״ד, שם-תיק או נוסח-הלכה"
dir="rtl"
className="flex-1 bg-transparent border-0 outline-none text-sm text-ink placeholder:text-ink-muted"
/>
{searchInput && (
<button
type="button"
onClick={() => setSearchInput("")}
className="shrink-0 w-5 h-5 rounded-full bg-rule-soft text-ink-muted hover:text-navy
flex items-center justify-center text-[0.7rem]"
title="נקה"
>
<X className="w-3 h-3" />
</button>
)}
</div>
{searching && !isPending && !error && (
<div className="flex items-center gap-2 flex-wrap rounded-lg border border-gold/50 bg-gold-wash px-3.5 py-2.5 text-sm text-navy">
<span>מציג עבור</span>
<span className="rounded bg-navy text-parchment text-[0.78rem] font-semibold px-2 py-0.5">
{search}
</span>
<span className="text-ink-muted">
· {matchCount} {matchCount === 1 ? "התאמה" : "התאמות"}
</span>
<button
type="button"
onClick={() => setSearchInput("")}
className="ms-auto text-gold-deep font-semibold text-[0.8rem] underline hover:no-underline"
>
נקה חיפוש
</button>
</div>
)}
{body}
</div>
);
}
// ─── Pending queue panel (main review flow) ───────────────────────────────────

View File

@@ -646,21 +646,43 @@ export function useHalachotPending(opts: { limit?: number; search?: string } = {
});
}
/** Genuine extraction defects — the rule TEXT is malformed, so it needs re-extraction
* (not a chair keep/drop judgment). Mirrors the backend's DEFECT set in
* scripts/halacha_panel_approve.py; other flags (e.g. `application` = fact-specific
* application) are judgment signals, NOT defects, and the panel deliberately skips them. */
const EXTRACTION_DEFECT_FLAGS = new Set([
"quote_unverified",
"truncated_quote",
"thin_restatement",
"near_duplicate",
]);
/** A pending item belongs in the "needs extraction fix" segment when it carries a
* quality flag AND the panel never deliberated it (no round). Everything else —
* deliberated items and clean items — is a chair-judgment item. (#133 unified queue) */
* genuine extraction-DEFECT flag AND the panel never deliberated it (no round).
* Everything else — deliberated items, clean items, and items flagged only for
* chair judgment (e.g. `application`) — is a chair-judgment item. (#133 unified queue) */
export function isExtractionFixItem(h: Halacha): boolean {
return !h.panel_round && (h.quality_flags?.length ?? 0) > 0;
return (
!h.panel_round &&
(h.quality_flags ?? []).some((f) => EXTRACTION_DEFECT_FLAGS.has(f))
);
}
export function useHalachotByStatus(status: string, limit = 300) {
export function useHalachotByStatus(
status: string,
opts: { limit?: number; search?: string } = {},
) {
const { limit = 300, search = "" } = opts;
const term = search.trim();
// include_panel_round surfaces the 3-judge deliberation on these tabs too
// (same card as the pending queue), so the chair sees WHY an item was
// auto-rejected/approved; search locates an item server-side beyond the window.
const qs = `review_status=${encodeURIComponent(status)}&include_panel_round=true&limit=${limit}`
+ (term ? `&search=${encodeURIComponent(term)}` : "");
return useQuery({
queryKey: libraryKeys.halachot({ review_status: status, limit: String(limit) }),
queryKey: libraryKeys.halachot({ review_status: status, limit: String(limit), search: term }),
queryFn: ({ signal }) =>
apiRequest<{ items: Halacha[]; count: number }>(
`/api/halachot?review_status=${encodeURIComponent(status)}&limit=${limit}`,
{ signal },
),
apiRequest<{ items: Halacha[]; count: number }>(`/api/halachot?${qs}`, { signal }),
staleTime: 10_000,
refetchOnMount: "always",
});