test(dispatcher): tighten the local_decision backoff tests #107
Reference in New Issue
Block a user
Delete Branch "test/local-decision-tighten-backoff-tests"
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?
What
Test-only follow-up to #106. No production code changes: one file,
tests/test_classifier_modes_dispatch.py, +50 / -7. It was written during review of the backoff fix and was meant to land inside #106, but #106 merged first.Why
Review of the
local_decisionbackoff tests found two weak spots._last_classifier_failure > 0after the skipped second call. A skip that called_record_failure()would hold the circuit open for as long as traffic flows, which is the exact failure the backoff section ofCLAUDE.mddescribes. Both tests now capture the timestamp after the first failure and assert it is unchanged after the second call.confidence_minraise had no test.test_local_decision_low_confidence_does_not_open_circuitactually tripped theparse_logprobscoverage floor (coverage 0.0116 below minimum 0.3), notconfidence_min. It is split in two:test_local_decision_below_confidence_min_does_not_open_circuit(new): four equal letters give coverage about 0.99 and confidence about 0.25, so the verdict lands belowconfidence_minafter a healthy answer.test_local_decision_coverage_floor_does_not_open_circuit: the old test, renamed, with its comment corrected to say what it triggers.Verification
Each mutation below was applied to a scratch export of the dispatcher, and the intended tests failed:
_ClassifierSkippedconfidence_minraise records a failurebelow_confidence_minonlyrequests.RequestExceptionbelow_confidence_minandcoverage_floortests/test_classifier_modes_dispatch.py: 36 passed.main(cc72f20).🤖 Generated with Claude Code
https://claude.ai/code/session_01KkCGRantZsSwmcFpet6FTa