fix(classifier): validate confidence_threshold range, take percent in the UI #47
Reference in New Issue
Block a user
Delete Branch "fix/confidence-threshold-percent-ui"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
classify_zero_shot returns a 0.0-1.0 probability, but the admin UI's confidence_threshold field took a raw number with no conversion and no bound -- typing the intuitive "80" (meaning 80%) stored literal 80.0. Since no real confidence score can exceed 1.0, that silently made every single classification read as below-threshold and fail, with the failure only surfacing on the next service restart (config loads once at startup).
Caught live 2026-09-06 before it took effect: the running process still had the previous config loaded, but the corrupted value was already sitting in
config.local.yamlwaiting for the next restart. Corrected the live overlay directly via the admin API as an immediate mitigation; this PR is the actual fix.Two changes:
classifier.encoder.confidence_thresholdnow validates to[0.0, 1.0]at config load, matching every other new knob's fail-closed pattern in this project -- the backstop for any caller, not just the UI.New regression tests confirmed failing on the unfixed code, passing after. Full suite: 1503 passed, 0 failures.