Repository navigation
Fix Index Analysis banners, Settings help placement and the estimated-plan card title (#6653) - #6669
Conversation
…-plan card title (#6653)
| .concat((data.databases || []).map(rollupRow)); | ||
| const lead = (data.uptime_warning ? 1 : 0) + (data.dedupe_only_applied ? 1 : 0); | ||
| /* #6653: the notes lead with the uptime caveat only when dedupe-only is not in effect (the tool leaves it out beside the dedupe notice). */ | ||
| const lead = (data.uptime_warning && !data.dedupe_only_applied ? 1 : 0) + (data.dedupe_only_applied ? 1 : 0); |
There was a problem hiding this comment.
Non-blocking: correct as written, and the arithmetic matches the tool's note order at DarlingMcpFinOpsTools.IndexAnalysis.cs:242-244 for all four flag combinations — but nothing fails if the two drift. finops-index-analysis-limit-harness.mjs:97-98 hardcodes uptime_warning: false, dedupe_only_applied: false in every one of its six payloads, so this line is exercised only on the lead = 0 path; a wrong lead here would either bury the dedupe notice inside the collapsed "Analyzer notes (N)" details or promote n1 to a top-level notice strip, and FinOpsIndexAnalysisLimitBehaviourTests would stay green.
The harness already captures notice text (noticeTexts), so a both-flags-true step asserting the dedupe strip is a top-level notice and the analyzer notes sit in the details would cover it. Alternatively, have the payload carry the caveat count so the page reads it instead of re-deriving the rule in a second language.
| var stmt = Statement(); | ||
| Assert.Null(stmt.QueryTimeStats); | ||
| Assert.Equal("Predicted Runtime", PlanDisplayText.RuntimeSummaryTitle(stmt)); | ||
| Assert.Equal("Plan properties", PlanDisplayText.RuntimeSummaryTitle(stmt)); |
There was a problem hiding this comment.
Non-blocking (naming): the method is still RuntimeSummaryTitle_NoQueryTimeStats_IsPredictedRuntime while the assertion now pins "Plan properties". After this PR that test name is the only remaining "Predicted Runtime" string in the C# tree (grep -rn "Predicted Runtime" otherwise hits only docs/changelog/3.9.md:141), so the name points at the title it no longer asserts. ..._IsPlanProperties would keep the grep honest.
| /// </summary> | ||
| public static string RuntimeSummaryTitle(PlanStatement statement) => | ||
| statement.QueryTimeStats == null ? "Predicted Runtime" : "Runtime Summary"; | ||
| statement.QueryTimeStats == null ? "Plan properties" : "Runtime Summary"; |
There was a problem hiding this comment.
Non-blocking (UI copy): every sibling card title in the plan viewer is Title Case — "Server Context" (PerformanceMonitor.Ui/PlanViewerControl.xaml:94), "Runtime Summary" (:115), "Missing Index Suggestions" (:137), "Parameters" (:163), "Wait Stats" (:188), "Operator Properties" (:379) — so "Plan properties" is the one sentence-case title in the strip, and it sits beside an existing "Operator Properties" card. "Plan Properties" would match both conventions; the rename itself reads right for what BuildRuntimeSummaryRows emits when QueryTimeStats is null (DOP/Serial, Compile, Cached plan size, Memory grant — PlanDisplayText.cs:163-235).
| /// the dedupe notice the caveat describes findings that are not there and contradicts it. Both the Viewer's banners and the | ||
| /// get_finops notes (which the web page shows) read this one rule; <see cref="UptimeWarning"/> itself stays the raw fact. | ||
| /// </summary> | ||
| public bool ShowUptimeCaveat => UptimeWarning && !DedupeOnlyApplied; |
There was a problem hiding this comment.
Non-blocking, and not a live defect — but the doc's own "or requested" branch is the one case where this rule drops a true statement without a replacement.
IndexCleanupAnalyzer.cs:87 sets dedupeOnly = options.DedupeOnly || uptime <= 7. On the uptime branch the suppression is self-repairing: the dedupe notice itself says "server uptime is 7 days or less", so the reader still learns the uptime is short. On the requested branch with uptime of 8–13 days, UptimeWarning is true and DedupeOnlyApplied is true, so the only thing shown is a notice asserting "(server uptime is 7 days or less)" — false for that server — while the accurate "under 14 days, usage data may be incomplete" line is suppressed. The rollup grid's workload counters (user_seeks/user_scans/user_lookups) are still the incomplete ones.
Unreachable from either shipped Darling surface today: the single options builder both the viewer and get_finops go through hardcodes DedupeOnly = false (Darling/PerformanceMonitor.Darling.Storage/FinOps/DarlingFinOpsIndexAnalysisReader.cs:273, pinned by ViewerIndexAnalysisTests.cs:321). Since this property is public API in .Common, worth either saying that in the doc ("safe because the dedupe notice carries the uptime fact on the auto branch") or dropping the parenthetical reason from IndexAnalysisDedupeNote so the notice never claims an uptime it did not measure.
|
Two notes on files the diff does not touch but the change reaches. Neither is blocking. 1.
The assertions still hold, and the fixture is still the real worst case: Worth re-running, though: the test plan's Darling filters are 2. That released entry for [#4590] reads: "It's titled "Predicted Runtime" for an estimated-only plan…". The right fix is the |
There was a problem hiding this comment.
Verdict: LGTM
Claims
- VERIFIED —
IndexCleanupAnalysisResult.ShowUptimeCaveat(Common) =UptimeWarning && !DedupeOnlyApplied—PerformanceMonitor.Common/IndexCleanupModels.cs:481, beside the rawUptimeWarningat:470; the record is never serialized wholesale (every consumer projects it), so no payload gains a key. - VERIFIED — the Viewer's
BuildIndexAnalysisBannersreads it, so with dedupe-only in effect only the dedupe banner shows —Darling/PerformanceMonitor.Darling.Viewer/FinOpsTab.IndexAnalysis.cs:75, dedupe banner's ownifuntouched at:82. - VERIFIED — the
get_finopsindex_analysis notes now read the same rule —DarlingMcpFinOpsTools.IndexAnalysis.cs:242; note order unchanged (caveats, thenresult.Notes) at:242-244. - VERIFIED —
index-analysis.jscounts the leading notices with it —index-analysis.js:160; the arithmetic matches the tool's note count on all four flag combinations (inline comment covers drift risk). - VERIFIED — the raw
uptime_warningpayload field is unchanged —DarlingMcpFinOpsTools.IndexAnalysis.cs:253still assignsresult.UptimeWarning, and the new notes test asserts it is stilltruewith the note gone. - VERIFIED — "Lite has no Index Analysis twin" — Lite runs the real proc on the monitored server (
Lite/Services/LocalDataService.FinOps.IndexAnalysis.cs:42,SqlCommand("dbo.sp_IndexCleanup")) and never builds anIndexCleanupAnalysisResult; a repo-wide grep forUptimeWarning/uptime_warning/ShowUptimeCaveathas zero Lite hits. - VERIFIED — each Settings help paragraph moved directly under its own checkbox —
SettingsWindow.xaml:89-98: capture-plans checkbox then its help, backfill checkbox then its help; the top-N Grid and its help stay at:116-127. - VERIFIED — both indented as the backfill one was — both are now
Margin="24,2,0,0"; the capture-plans paragraph wasMargin="0,4,0,0"before the move. - VERIFIED — "Plan properties" for an estimated plan, "Runtime Summary" kept when
QueryTimeStatsexists —PerformanceMonitor.PlanAnalysis/PlanDisplayText.cs:85. - VERIFIED — the helper is shared with Lite through
PerformanceMonitor.Ui— single call sitePerformanceMonitor.Ui/PlanViewerControl.Properties.cs:1603, and both SKUs reference that project (Lite/PerformanceMonitorLite.csproj:61,PerformanceMonitor.Darling.Viewer.csproj:51), so the rename lands on both at once. - VERIFIED — the card "holds compile facts", not a predicted runtime —
BuildRuntimeSummaryRowsgates Elapsed/CPU:Elapsed/CPU onstats != null(PlanDisplayText.cs:163-202), so a null-QueryTimeStatscard is DOP-or-Serial, Compile, Cached plan size and Memory grant (:204-235). - VERIFIED — the test-plan description of
FinOpsIndexAnalysisViewTests(uptime-only keeps the note first; uptime + dedupe-only drops it at 3 notes, dedupe first,uptime_warningstill true; a theory over the four combinations; the old combined test replaced by the two) —FinOpsIndexAnalysisViewTests.cs:139-174, and the diff removesNotes_AreUptimeThenDedupeThenAnalyzerNoteswith itsAssert.Equal(4, notes.Length). - UNVERIFIED — Darling "Total 812, Failed 0, Skipped 14" — needs
dotnet teston .NET 10 (viewer and Lite targetnet10.0-windows); a read-only tree cannot produce a count. The filter list also does not matchFinOpsIndexAnalysisViewSizeTests, whose fixture this change alters — see the top-level comment. - UNVERIFIED — Lite "
*Census*,*Ratchet*,*Plan*: Total 291, Failed 0" — same reason. - UNVERIFIED — "the XAML move and the web script change were not run in a window or browser" — the author's own unchecked box; the XAML hunk is two self-contained
<TextBlock .../>elements moved inside oneStackPanel, well-formed on inspection, but WPF layout and the rendered notice strip need a running app.
Riskiest lines
Darling/PerformanceMonitor.Darling.Service/wwwroot/js/pages/finops/index-analysis.js:160—leadmust equal the number of caveat notes the tool emitted; off by one either way buries the dedupe notice inside the collapsed "Analyzer notes (N)" details or promotes the first analyzer note to a prominent strip — UNCOVERED:finops-index-analysis-limit-harness.mjs:97-98hardcodesuptime_warning: false, dedupe_only_applied: falsein all six payloads, soFinOpsIndexAnalysisLimitBehaviourTestsonly exerciseslead = 0.PerformanceMonitor.Common/IndexCleanupModels.cs:481— the one rule both surfaces read; inverted or widened it silences a caveat that applies or restores the contradiction #6653 reports — covered byNotes_LeaveOutTheUptimeCaveat_WhenDedupeOnlyIsInEffectandShowUptimeCaveat_IsTheUptimeWarning_OnlyWhenDedupeOnlyIsNotInEffect.Darling/PerformanceMonitor.Darling.Viewer/FinOpsTab.IndexAnalysis.cs:75— the Viewer banner decision, the surface #6653 was filed against — UNCOVERED by anything that draws the banner (FinOpsTabisnet10.0-windowsWPF and buildsBorder/TextBlockdirectly, so no unit test reachesBuildIndexAnalysisBanners); the predicate it reads is covered by the theory above, andNoteConstants_EqualTheViewersBannerStringsonly pins the two strings as source text, which is not coverage.
Traps near this diff
- "Lite and Darling ship in parity (CONTRIBUTING's two-store rule): a fix to one SKU's reader, tool, alert or description without the counterpart's is a finding, not a nit" — does not apply — Lite's Index Analysis executes
dbo.sp_IndexCleanupon the monitored server (Lite/Services/LocalDataService.FinOps.IndexAnalysis.cs:42) and has noIndexCleanupAnalysisResult, so there is no Lite caveat pair to fix; the Settings move brings Darling to Lite's existing shape (Lite/Windows/SettingsWindow.xaml:68-72already puts that help under its checkbox); the title rename is in shared code both SKUs read throughPerformanceMonitor.Ui/PlanViewerControl.Properties.cs:1603. - "Two copies of one definition pinned EQUAL to each other fail only after BOTH have drifted (#3684). Alias, do not copy." — does not apply — the shape the trap names is a test pinning copy A to copy B; nothing pins
index-analysis.js:160toDarlingMcpFinOpsTools.IndexAnalysis.cs:242, and the JS mirror predates this diff ((uptime ? 1 : 0) + (dedupe ? 1 : 0)), which this hunk keeps in step rather than forks. Drift risk raised as a non-blocking inline comment with two concrete options. - "Never answer a trap with a test that reads source text or asserts how code is spelled" — does not apply — all three tests touched are behaviour tests: two build a real payload through
BuildIndexAnalysisPayloadand readnotes(FinOpsIndexAnalysisViewTests.cs:140,155), the theory evaluates the property (:173), andViewer4570Tests.cs:32callsRuntimeSummaryTitle. No source-text pin added. - "A
total_*assigned from a.Countis a count of the page unless the set is provably whole" / "truncated = rows.Count >= limit" — do not apply — no count or cut on this payload changed:recommendation_count,truncated,database_count,databases_truncatedare untouched atDarlingMcpFinOpsTools.IndexAnalysis.cs:258-262, andnoteshas never been a paged or truncated list.
Divergence (blind read vs PR body)
Two places, both minor, neither contradicting a claim the body makes.
The body lists the tests it added but does not mention that the change also alters what an unchanged test builds: FinOpsIndexAnalysisViewSizeTests.cs:56 sets both flags, so the size pin's fixture drops from two caveat notes to one and its class doc at :18-23 ("both caveat notes and the analyzer's full note list") stops being true. The assertion survives and the fixture is still the real worst case (the dedupe note is the longer of the two) — but that class is the one the test-plan filters do not match. Detail in the top-level comment.
"index-analysis.js counts the leading notices with it" is accurate but reads as if the page consumes the rule; it re-derives it from the two booleans in a second language, and the existing Node harness pins both false, so the new branch ships with no behaviour test. The unchecked "not run in a window or browser" box covers the manual half of that, not the automated half.
Reviewer checklist
- Run
FinOpsIndexAnalysisViewSizeTests(the test-plan filters miss it, and this change alters the fixture it measures) — expect the budget test to pass with ~160 bytes more headroom. - Open the Darling Viewer against a server with uptime of 7 days or less and confirm the Index Analysis strip shows the dedupe banner alone, then one with uptime between 8 and 13 days and confirm the uptime banner is still there — the WPF banner builder cannot be unit-tested.
- Load the web Index Analysis tab for a dedupe-only server and confirm the dedupe notice renders as a top-level strip with the analyzer notes behind "Analyzer notes (N)", N not off by one.
- Open Darling Settings → Collection in a window and confirm the two moved help paragraphs sit under their checkboxes at the 24px indent and the box's scroll height still looks right.
- Open an estimated-only plan in both the Darling Viewer and Lite and check the retitled card reads well beside "Operator Properties" (casing note on
PlanDisplayText.cs:85).
|
Follow-up pass (120436f..2d509bb). This range is a merge of Both added lines are Checked both are the only places that needed it: No logic, test, or production code changed in this commit — just the stale fixture catching up to the computed property the earlier reviewed commits added. LGTM. |
There was a problem hiding this comment.
Verdict: LGTM
Claims
- VERIFIED — "the fixture was stale, the code is right" —
git diff 728e267fb..2d509bb01 -- Darling/Darling.Tests/Fixtures/FinOpsIndexAnalysis/golden.jsontouches only this file; no production code changed in the commit. - VERIFIED — "the output gained a
ShowUptimeCaveat: falseline the fixture lacked (the first difference, right afterOnlyApplied)" — both added lines sit directly after"DedupeOnlyApplied"at golden.json:388 and :954, matching the property's declaration order inIndexCleanupModels.cs:470-481. - VERIFIED — "the diff is exactly two added
ShowUptimeCaveatlines (the result and the per-server copy); no notes text changed" —git diff --statfor the commit shows2 insertions(+), nothing else; both"Notes"blocks are byte-identical to before. - VERIFIED — "the dedupe-only behaviour stands as reviewed" — no behaviour code is in this commit's diff, so nothing to re-review.
- VERIFIED — "The PR's diff touches no collection loop, store migration or config code" — confirmed by the same stat (one JSON fixture file only).
- UNVERIFIED — "Verified after the fixture change: ... Total 690, Failed 0" and the
DarlingStartWithNoServersLiveTestspass claim — both are livedotnet testruns against PostgreSQL; a read-only tree cannot execute them. - VERIFIED — "The push also carries a merge of current
origin/devinto the branch" —gh pr view 6669 --json commitsshows 728e267, "Merge remote-tracking branch 'origin/dev' into fix/6669-ci", between the two reviewed-and-this commit.
Riskiest lines
Darling/Darling.Tests/Fixtures/FinOpsIndexAnalysis/golden.json:388— wrong literal here would make the golden test pass on a brokenShowUptimeCaveator fail on a correct one — covered byFinOpsIndexAnalysisGoldenLiveTests.IndexAnalysisReads_MatchGoldenFixture_ThroughTheViewer(and the storage-reader twin), both live tests that recompute the value and byte-compare it to this file.Darling/Darling.Tests/Fixtures/FinOpsIndexAnalysis/golden.json:954— same risk, thelongUptime.analysiscopy — covered by the same two tests (both sections are asserted in oneAssert.Equal).- (none further) — the commit touches no other line; no third risk to name.
Traps near this diff
- "Ruling (#5833): tests are load-bearing... never answer a trap with a test that reads source text or asserts how code is spelled" — does not apply — the golden tests are behaviour tests (they run the real viewer/storage reader against a seeded Postgres and byte-compare the serialized result); this commit only updates the comparison fixture, it adds no new pin.
- "Two copies of one definition pinned EQUAL to each other fail only after BOTH have drifted (#3684). Alias, do not copy." — does not apply — the two
ShowUptimeCaveatlines are independent fixture copies of two different seeded scenarios (short- and long-uptime servers), not two copies of one definition pinned against each other. - "Lite and Darling ship in parity" — does not apply — this fixture is Darling-only (
IndexCleanupAnalysisResulthas no Lite equivalent, as established in the prior full review); nothing here needs a Lite counterpart.
Divergence (blind read vs PR body)
None — the body's "CI fixes" account (stale fixture, exactly two added lines, no notes text changed, no behaviour change) matches the diff on every claim graded above.
Reviewer checklist
- Run
FinOpsIndexAnalysisGoldenLiveTestsagainst a live Postgres (DARLING_TEST_PGset) to confirm the regenerated fixture now matches — a read-only tree cannot execute it.
Claude posting for Erik Darling.
Closes #6653.
Why
Three small Viewer defects: Index Analysis showed the "uptime under 14 days, Unused Index findings may be premature" banner beside the "dedupe-only mode, unused indexes were NOT flagged" banner, which contradict each other; the help paragraphs for "Capture execution plans" and "Query Store history backfill" sat under the "Query Store fetch top N" help at the bottom of the Data Collection box; and the estimated-plan card was titled "Predicted Runtime" although it holds compile facts.
What changes
IndexCleanupAnalysisResult.ShowUptimeCaveat(Common) =UptimeWarning && !DedupeOnlyApplied. The Viewer'sBuildIndexAnalysisBannersreads it, so with dedupe-only in effect only the dedupe banner shows. The same pair existed in theget_finopsindex_analysis notes (the web page shows them): the tool now reads the same rule, andindex-analysis.jscounts the leading notices with it. The rawuptime_warningfield on the payload is unchanged. Lite has no Index Analysis twin.SettingsWindow.xaml: each help paragraph moved directly under its own checkbox (Capture execution plans, Query Store history backfill), both indented as the backfill one was.PlanDisplayText.RuntimeSummaryTitle: the estimated-plan title is "Plan properties" ("Runtime Summary" is kept whenQueryTimeStatsexists). This helper is shared with Lite throughPerformanceMonitor.Ui. Its comment said it matched PerformanceStudio@40ade29 (E7), which titled the card "Predicted Runtime"; this is a deliberate departure from that commit and the comment says so.Test plan
FinOpsIndexAnalysisViewTests: uptime-only keeps the uptime note first; uptime plus dedupe-only leaves out the uptime note (3 notes, dedupe first, rawuptime_warningstill true); a theory over the four flag combinations ofShowUptimeCaveat(the Viewer's banner decision). The old combined-notes test was replaced by these two.Viewer4570Testsupdated to pin "Plan properties".*FinOpsIndexAnalysisViewTests*,*Viewer4570Tests*,*ViewerIndexAnalysisTests*,*Settings*,*PlanDisplayText*,*Census*,*Ratchet*: Total 812, Failed 0, Skipped 14 (live classes without a rig).*Census*,*Ratchet*,*Plan*: Total 291, Failed 0.ShowUptimeCaveatdid not exist before.CHANGELOG entry
SECTION: Fixed
ENTRY:
REF:
[Fix Index Analysis banners, Settings help placement and the estimated-plan card title (#6653) #6669]: Fix Index Analysis banners, Settings help placement and the estimated-plan card title (#6653) #6669
CI fixes
Claude posting for Erik Darling.
FinOpsIndexAnalysisGoldenLiveTests(both tests): the fixture was stale, the code is right. The PR added the computedIndexCleanupAnalysisResult.ShowUptimeCaveat. The golden fixture serializes the whole result, so the output gained a"ShowUptimeCaveat": falseline the fixture lacked (the first difference, right afterOnlyApplied). I regeneratedDarling/Darling.Tests/Fixtures/FinOpsIndexAnalysis/golden.jsonwithDARLING_WRITE_GOLDEN=1. The diff is exactly two addedShowUptimeCaveatlines (the result and the per-server copy); no notes text changed. The dedupe-only behaviour stands as reviewed.DarlingStartWithNoServersLiveTests.TheCollectionLoop_StartsWithAnEmptyServerList_...: not changed. It passes locally on a throwaway PostgreSQL (run together with the golden class: 4 tests, only the 2 golden ones failed before the regeneration). The PR's diff touches no collection loop, store migration or config code (Viewer UI, Common model, PlanAnalysis text, one MCP tool note, tests), so it cannot reach this test. The CI failure looks like a flake; I could not fetch the leg 9/16 log to confirm the failure text.FinOpsIndexAnalysisGoldenLiveTests,DarlingStartWithNoServersLiveTests,*IndexAnalysis*,IndexCleanupAnalyzerTests,Viewer4570Tests, every*Census*and*Ratchet*class: Total 690, Failed 0. Not run: the full suite andpre-push.sh(CI decides).origin/devinto the branch.