dashboard: guard stability ratio when every observation is UNKNOWN#247
Merged
Zac-HD merged 1 commit intoZac-HD:masterfrom Apr 18, 2026
Merged
dashboard: guard stability ratio when every observation is UNKNOWN#247Zac-HD merged 1 commit intoZac-HD:masterfrom
Zac-HD merged 1 commit intoZac-HD:masterfrom
Conversation
Test.stability returns None only when rolling_observations is empty, but the ratio is still count_stable / (count_stable + count_unstable). If every observation is UNKNOWN (the third Stability variant), both counts are 0 and the division raises ZeroDivisionError. The dashboard websocket caller then tears down with every poll, leaving the UI unresponsive (Zac-HD#245). Compute the denominator explicitly, return None when it is 0, and keep the existing ratio otherwise. No behaviour change for any call where at least one observation reports a stable or unstable verdict. Fixes Zac-HD#245 Signed-off-by: SAY-5 <SAY-5@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Test.stabilityonly treats the "no rolling observations" case specially:If every rolling observation records
Stability.UNKNOWN(the thirdvariant) — which happens routinely while a test is still being
collected — both counts are 0 and the division raises
ZeroDivisionError. The stack in #245 has it bubbling up throughwebsocket.send_tests, so every subsequent poll re-triggers theexception and the dashboard websocket stays broken.
Fix
Compute the denominator explicitly, return
Nonewhen it is 0, andkeep the existing ratio otherwise.
No behaviour change for any test that has at least one stable or
unstable observation — they continue to return the same float as
before.
Fixes #245