Fix two Dashboard analysis bugs that drifted from Lite#1155
Merged
Conversation
Both fixes bring Dashboard in line with the already-correct Lite copies; surfaced by a Lite<->Dashboard code-sharing drift audit. 1. SqlServerBaselineProvider: the full (hour, day-of-week) bucket tier was assigned via a copy-paste ternary whose two arms both returned BaselineTier.Full, so sparse buckets (count < CollapseThreshold) were mislabeled HourOnly in baseline_tier. Every bucket on this path is Full; HourOnly/Flat are assigned only on the collapse/flat paths. Matches Lite. 2. SqlServerAnomalyDetector.DetectBlockingAnomalies: blocking/deadlock spike ratios compared a raw window count against a per-hour baseline mean, so the ratio scaled with window length (default 4h) and a steady event rate could trip the spike threshold. Normalize current counts to per-hour before the ratio, mirroring Lite. Dashboard build + 487 Dashboard.Tests pass. No Lite changes (already correct). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.
Summary
A Lite↔Dashboard code-sharing drift audit found two cases where a fix landed in Lite but the duplicated Dashboard copy still carried the bug. Both fixes here bring Dashboard in line with the already-correct Lite behavior.
1.
SqlServerBaselineProvider— tier mislabeled for sparse bucketsThe full
(hour, day-of-week)bucketTierwas assigned by a copy-paste ternary whose two arms both returnedBaselineTier.Full:So any bucket with
count < CollapseThreshold(<10 samples) was written tobaseline_tierasHourOnly. Every bucket on this path is a full bucket;HourOnly/Flatare only assigned on the collapse/flat paths. NowTier = BaselineTier.Full, matchingLite/Analysis/BaselineProvider.cs.2.
SqlServerAnomalyDetector.DetectBlockingAnomalies— ratio scaled with window lengthBlocking/deadlock spike detection compared a raw count over the whole analysis window (default 4h) against a per-hour baseline mean, so the ratio scaled with window length and a steady event rate could trip the spike threshold. Now the current counts are normalized to per-hour before the ratio, mirroring Lite.
Why this happened
Dashboard has no
SqlServerBaselineProvider/SqlServerAnomalyDetectorunit tests, while Lite hasBaselineProviderTests+AnomalyDetectorTests(which is where the Lite fixes were validated). The Dashboard classes are wired directly toSqlConnection, so there's no in-memory test seam today. Durable fix for the drift class is the shared-base extraction recommended by the audit (follow-up) — that would give both apps one tested code path.Test plan
dotnet build Dashboard(+ all shared projects) succeedsdotnet test Dashboard.Tests— 487 passed, 0 failed🤖 Generated with Claude Code