Skip to content

Plan viewer: show each warning's actionable fix, and take severity colours from one helper - #4584

Merged
erikdarlingdata merged 1 commit into
devfrom
viewer/4572-warning-fix-and-colours
Sep 28, 2026
Merged

erikdarlingdata merged 1 commit into
devfrom
viewer/4572-warning-fix-and-colours

Conversation

@erikdarlingdata

@erikdarlingdata erikdarlingdata commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

Fixes #4572, part of #4511.

Why

PerformanceStudio's viewer (erikdarlingdata/PerformanceStudio@3d717e7) closed a gap where a
warning's MaxBenefitPercent and ActionableFix were computed but not rendered everywhere the
warning itself was shown. PM's properties panel already rendered the benefit percentage in the
warning header, but never read ActionableFix, so a warning with a concrete fix suggestion showed
only its generic message.

Separately, PerformanceStudio (@51d59ca) replaced four copies of the same
Critical ? "#E57373" : Warning ? "#FFB347" : "#6BB5FF" ternary with one
WarningSeverityBrush(severity) helper. PM had the identical duplicated pattern, five times across
PlanViewerControl.Properties.cs and PlanViewerControl.Tooltips.cs.

What changes

  • PerformanceMonitor.PlanAnalysis.PlanWarningDisplay gets a new pure helper,
    WarningSeverityColorHex(PlanWarningSeverity), returning the same three hex values PM already
    used. No colour value changed — this is pure de-duplication, matching PerformanceStudio's shape
    going forward.
  • All five inline ternary sites (two in Properties.cs, two in Tooltips.cs, previously also
    duplicated a third time in Properties.cs) now call the helper instead of repeating the
    literal.
  • Both warning sections in PlanViewerControl.Properties.cs (plan-level warnings and per-node
    warnings) now add an italic TextBlock for w.ActionableFix under the warning message, shown
    only when the field is non-null/non-empty, mirroring PerformanceStudio's Avalonia pattern
    (Margin = new Thickness(16, 2, 0, 0), FontStyle = Italic, same foreground as the message
    line). The tooltip warning list (Tooltips.cs) keeps its existing shorter text — PerformanceStudio
    never added an ActionableFix line there either, only the colour-helper change touches that file.

Lite: gets this too — PlanViewerControl.Properties.cs/Tooltips.cs are in the shared
PerformanceMonitor.Ui project, hosted by both the Darling Viewer and Lite.

PM-ahead / not ported: none identified for this issue's scope.

Nothing user-visible yet. No analyzer rule in PerformanceMonitor sets ActionableFix today (every assignment in PerformanceMonitor.PlanAnalysis is null), and neither does PerformanceStudio dev (its only assignment, in BenefitScorer, is null). So the new italic line renders for no current warning; it is in place for when a rule gains a fix. The colour change is de-duplication with identical values. The italic line is WPF layout with no headless test surface, and with no warning carrying a fix there is nothing to screenshot yet.

Test plan

New file Darling/Darling.Tests/PlanViewerWarningColorAndFixTests.cs:

  • WarningSeverityColorHex_Critical_IsRed / _Warning_IsAmber / _Info_IsBlue — pin the three
    colour values through the new helper. RED on dev: compile failure
    (CS0117: 'PlanWarningDisplay' does not contain a definition for 'WarningSeverityColorHex'),
    confirmed by building this test file against origin/dev in a detached worktree.
  • PlanWarning_WithActionableFix_CarriesTheFixText / _WithoutActionableFix_IsNull — sanity pins
    on the existing model field (not new; documents the contract the rendering code now reads).
  • PlanViewerControl_HasNoInlineSeverityColorLiterals — a census pin: no #E57373/#FFB347/
    #6BB5FF literal remains in any PlanViewerControl.*.cs file. Runtime RED on dev, confirmed
    the same way (this assertion built cleanly against dev and failed with Assert.DoesNotContain() Failure: Sub-string found — the old ternaries are still there).

Build (all 0 warnings / 0 errors, Release, -p:EnableWindowsTargeting=true):
Darling.Tests, PerformanceMonitor.Ui, Lite/PerformanceMonitorLite.csproj, Lite.Tests,
Darling/PerformanceMonitor.Darling.Viewer.

Run, in-process on macOS (Microsoft.WindowsDesktop.App stripped from the runtimeconfig):
the new class, every PlanSync*/Viewer* class and the plan-analysis classes:
Total: 1810, Errors: 0, Failed: 86, Skipped: 137. All 86 failures are pre-existing
System.IO.FileNotFoundException: PresentationFramework (and one TypeInitializationException
wrapping the same) platform failures in classes this change doesn't touch (ViewerDrillDownTests,
ViewerChartContextMenuTests, ViewerHistoryWindowTests, etc. — WPF-type-dependent tests that
can't load PresentationFramework on macOS). None of the failing test
names are in a PlanViewer* file. The macOS-runnable subset (the new class, the PlanSync* classes and the plan-analysis classes) ran green at Total: 249, Errors: 0, Failed: 0, Skipped: 2.

Lite.Tests builds (0/0) but cannot run on macOS (discovery dies on WindowsBase); this change adds
no new Lite.Tests file since the touched files are shared through PerformanceMonitor.Ui and
already covered by the Darling.Tests pins above. CI decides Lite/Darling.Tests-on-Windows and the
WPF-dependent classes.

Screenshot plan (pure layout, for a human on Windows):

  1. Open a captured plan with at least one warning that has a non-null ActionableFix (any serial-
    plan or missing-index warning the analyzer scores). In the Properties panel's "Plan Warnings" or
    node "Warnings" section, confirm an italic line appears under the warning message, indented to
    match the message (not the header), in the same muted foreground colour as the message text.
  2. Confirm a warning with no ActionableFix shows no extra line (no blank italic row).
  3. Confirm the warning header colour (critical/warning/info) is visually unchanged from before this
    PR in both the properties panel and node tooltips — the colour helper returns the same hex
    values, so there should be no difference to see.
  4. Repeat in both the Darling Viewer and Lite (shared control).

CHANGELOG

None: no user-visible change yet. The fix line renders only for a warning that carries an ActionableFix, and no rule sets one today; the severity colours are unchanged.

…lours from one helper

The properties panel already showed a warning's benefit percentage in
its header, but never rendered the ActionableFix text underneath the
message even when the analyzer supplied one. Both the plan-level and
node-level warning sections now add an italic line for it when present.

The properties panel and the tooltip warning list each re-derived the
same critical/warning/info colour from the same three-way ternary
against literal hex, five times across two files. They now call
PlanWarningDisplay.WarningSeverityColorHex, so the colour for a
severity is defined once. The colour values are unchanged.

Refs #4572, part of #4511.

## CHANGELOG entry
SECTION: Changed
ENTRY: The plan viewer's warning panel now shows a fix suggestion, when the analyzer has one, under the warning message. ([#PR])
[#PR]: https://github.com/erikdarlingdata/PerformanceMonitor/pull/PR
@erikdarlingdata
erikdarlingdata marked this pull request as ready for review September 28, 2026 14:36
@erikdarlingdata
erikdarlingdata merged commit 8244e9f into dev Sep 28, 2026
18 of 20 checks passed
@erikdarlingdata
erikdarlingdata deleted the viewer/4572-warning-fix-and-colours branch September 28, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant