issue-3653 A8 option B: WindowTiles shared tile helpers (lane L1c) - #4167
Merged
Merged
Conversation
erikdarlingdata
force-pushed
the
feat/3653-b-tile-helpers
branch
from
September 24, 2026 15:51
fd91b4d to
adad1b9
Compare
erikdarlingdata
marked this pull request as ready for review
September 24, 2026 15:52
erikdarlingdata
enabled auto-merge (squash)
September 24, 2026 15:52
This was referenced Sep 24, 2026
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.
Part of #3653 (A8 option B, lane L1c)
What
Adds
PerformanceMonitor.Analysis.Baselines.WindowTiles, the shared per-hour tile helpers every detector call site (24 of them, across the SQL Server store, the PostgreSQL target and Lite's DuckDB — design §2) will call. Per the brief, this lane touches only two new files:PerformanceMonitor.Analysis/Baselines/WindowTiles.csDarling/Darling.Tests/WindowTilesTests.csWindowTilesprovides:LocalHourSql— the tile-key SQL const (date_trunc('hour', BaselineLocalClock.LocalCollectionTimeSql)), documented to bind$4..$6fromBaselineBucketMap.WindowClock, never the cached baseline clock.WholeWindow(IReadOnlyList<WindowTile>)— the whole-window aggregate the never-blind fallback feeds to today'sEvaluateZScore. Peak = max; Mean = samples-weighted mean; Samples = sum; PeakTimeUtc = the max-peak tile's, later tile wins a tie; LocalHour = earliest tile's. Empty list or ΣSamples = 0 →defaultwith Samples 0.LocalHourToUtc(DateTime, LocalClockWindow)— invertsLocalCollectionTimeSql: trieslocal − OffsetBeforeMinutes, accepts it if beforeTransitionAtUtc, else falls back tolocal − OffsetAfterMinutes. A repeated (fall-back) local hour maps to its FIRST occurrence, since the before-candidate is tried first.AddTileMetadata(...)— adds exactly the 7 new fired-fact keys the design's §1 lists (tile_local_hour,tile_day_of_week,tile_start_ticks,tiles_scored,tiles_fired,window_peak,window_samples_total). Does not touch the existingpeak_*/baseline_*/deviation_sigmakeys — those stay the detectors' job.ReadTile(IDataRecord, ...)— builds oneWindowTilefrom a row, tolerant of DBNull peak/mean/samples (→ 0) and a negative/DBNull peak-time ordinal (→ null). UsesConvert.ToDouble/Convert.ToInt64so it works against bothNpgsqlDataReaderandDuckDBDataReader.TileVerdictandWindowTilealready existed from #4166 (lane L1a); this lane only consumes them.Tests added (all in
Darling.Tests.WindowTilesTests)LocalHourSql_Contains_LocalCollectionTimeSql_VerbatimWholeWindow_WeightedMean_And_MaxPeak_LaterTileWinsTieWholeWindow_EmptyList_ReturnsDefault_ZeroSamplesWholeWindow_AllTilesZeroSamples_ReturnsDefault_ZeroSamplesLocalHourToUtc_FixedOffset_MapsLocalToUtcLocalHourToUtc_SpringForward_MapsBothSidesOfTheTransitionLocalHourToUtc_FallBack_AmbiguousHourMapsToFirstOccurrenceAddTileMetadata_AddsExactlySevenKeysReadTile_ReadsAllColumns_WhenPresentReadTile_DBNullCells_BecomeZeroOrNoPeakTimeReadTile_NegativePeakTimeOrdinal_MeansNoPeakTimeVerification
dotnet buildgreen forPerformanceMonitor.Analysis,Darling/Darling.Tests(both with-p:EnableWindowsTargeting=true) andLite/PerformanceMonitorLite.csproj(confirms the helper compiles for Lite too).Microsoft.WindowsDesktop.Appstripped from the test runtimeconfig for the run only, then restored):*WindowTiles*(11/11),*AnomalyGateTiles*(12/12),*DocCommentHygiene*(77/77),*LocalClock*→LocalClockBucketKeyTests(13/13). All green.DARLING_TEST_PGunset:Total: 13657, Errors: 0, Failed: 214, Skipped: 727, Not Run: 2. All 214 failures are the pre-existing Windows-only set the brief names (WPF/registry/Windows-service-install classes —ViewerChartContextMenuTests,DarlingInstallLocationTests,TargetProviderTests,BulkServerOnboardingMappingTests, etc.) — none are new, none touchWindowTiles,AnomalyGate, orBaselineBucketMap.scrubcheckon the diff: 0 hits.Not verified
WindowTileshas no store dependency).WindowTilesin this lane — that is later lanes' work per the design's §2 inventory.Base
Based on
origin/feat/3653-b-tile-gate(PR #4166 was still open at start;WindowTileandTileVerdictcame from it) rather thandev, per the brief's stacking rule.CHANGELOG entry
None (per brief).
Coordinator verification (head fd91b4d)
WindowTiles.csmatches the lane-L1c brief.LocalHourToUtcwas checked by hand against both DST cases:*WindowTiles*11/11,*AnomalyGate*23/23,*DocCommentHygiene*77/77,*LocalClock*13 passed with 1 live skip.Lite/builds with the new helper, with 0 errors.