mirror of
https://github.com/turnstonelabs/turnstone.git
synced 2026-08-12 23:12:23 -06:00
d7cac3716f
* feat: configurable judge rules with dedicated admin tab Externalize heuristic intent validation rules and output guard patterns from hard-coded module constants into the storage abstraction with full admin UI CRUD. Introduces a dedicated Judge tab in the admin panel that consolidates all judge configuration (scalar settings, heuristic rules, output guard patterns) under a single admin.judge permission scope. - Add heuristic_rules and output_guard_patterns tables (migration 033) - Add RuleRegistry with thread-safe merge of built-in + DB rules - Refactor output_guard.py patterns into structured OutputGuardPatternDef - evaluate_heuristic() and evaluate_output() accept optional rules/patterns - IntentJudge resolves model aliases via ModelRegistry - 15 admin API endpoints under /api/admin/judge/ with regex validation - Judge tab with Settings, Heuristic Rules, and Output Guard sub-panels - Filter judge.* settings from generic Settings tab - ConfigStore.storage public property for backend access * fix: align Judge tab with admin panel design system - Replace raw <table> with grid-based admin-row/admin-colheaders pattern - Replace dynamic innerHTML modals with static overlays using focus traps - Replace confirm() with styled showConfirmModal() - Replace inline badge styles with scope-badge classes - Add mobile responsive breakpoints for Judge tab grids * fix: Judge tab accessibility and polish - Extract sub-section switcher inline styles to CSS classes - Add focus-visible outline and reduced-motion support - Add tab button IDs and fix aria-labelledby on tabpanels - Add tabindex roving and arrow key navigation for sub-tabs - Add role=list and aria-live to table containers - Replace status text with scope-badge classes for scannability * fix: address CodeQL and Copilot review feedback - Remove unused validation constants from rule_registry.py (CodeQL) - Return MappingProxyType from output_patterns for immutability - Fix ThreadPoolExecutor shutdown(wait=False) to prevent hangs - Use separate _VALID_OG_RISK_LEVELS (no "critical") for output guard - Pass pattern_flags to regex validation in update endpoint - Chain redactions in configurable mode (compose pattern + complex) - Initialize RuleRegistry on console app.state - Fix test fixtures to use valid enum values (approve/review/deny) * fix: use Mapping type for evaluate_output patterns param (mypy)