Skip to content

Make the right-sized sentence say what decided the verdict (#6646) - #6666

Merged
erikdarlingdata merged 3 commits into
devfrom
fix/6646-right-sized-sentence
Oct 24, 2026
Merged

erikdarlingdata merged 3 commits into
devfrom
fix/6646-right-sized-sentence

Conversation

@erikdarlingdata

@erikdarlingdata erikdarlingdata commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Claude posting for Erik Darling.

Closes #6646.

Why

ServerHardwareScope.RightSizedExplanation was one fixed sentence ("CPU is moderately loaded ... memory is well-utilized"). RIGHT_SIZED also results when the average CPU is under 15% but one sample reached 40% or more (ProvisioningVerdict.Evaluate), or when the grant utilization is 50% or more, so the sentence contradicted its own numbers (for example avg 0.1%, p95 0%, buffer pool 8%).

What changes

  • RightSizedExplanation takes maxCpuPct and builds the CPU clause from the test that decided: average at or above IdleAvgCpuPercent (15): today's "CPU is moderately loaded (avg, p95)" unchanged; otherwise, a max at or above IdleMaxCpuPercent (40): "CPU averaged X% (p95 Y%), but one sample reached Z%, so this server is not rated over-provisioned"; otherwise: "CPU is lightly loaded (avg, p95), but its memory grants peaked at N% of their target (threshold: 50%), so this server is not rated over-provisioned" (the last remaining way to RIGHT_SIZED; N is the measured grant utilization). On an Azure SQL Database "this server" reads "this database".
  • The memory clause says "well-utilized" only when the buffer pool share is at least 50%; below that it prints "the buffer pool uses N% of {basis}".
  • Callers updated: FinOpsUtilizationFigures.Explanation (Darling Storage, so the Viewer and web) and Lite's FinOpsTab. The verdict rule is unchanged (coordinator ruling: one sample at 40% or more is real peak demand).

Test plan

  • New test RightSizedSentence_ForAnIdleAverageWithOneBusySample_NamesThePeak_NotAModerateLoadOrWellUtilizedMemory in both AzureSqlDatabaseMemoryScopeTests (avg 0.1, p95 0, max 40, 8% must not contain "moderately loaded" or "well-utilized"; the grants case). Revert-proved: with the CPU and memory clauses forced back to the fixed text it fails.
  • Existing tests (avg 40 / p95 62 / 71%) keep their text; only the signature changed.
  • Darling: *AzureSqlDatabaseMemoryScopeTests*, *FinOpsUtilizationFiguresTests*, *AzureSqlDatabaseHardwareTests*, *ViewerFinOpsUtilizationFiguresDelegatesTests*, *Census*, *Ratchet*: Total 584, Failed 0, Skipped 1 (a live class that needs a rig).
  • Lite: *AzureSqlDatabaseMemoryScopeTests*, *AzureSqlDatabaseHardwareTests*, *Census*, *Ratchet*: Total 80, Failed 0.
  • Full suites not run (CI decides).

Round 1 fixes

Round-1 review 5636728548 and its six inline comments, fixed on this branch:

  1. maxCpuPct is now int, like every source of it and like OverProvisionedExplanation; a p95/max transposition no longer compiles.
  2. Both new clauses switch the noun on azureSqlDatabase ("this database" / "this server"), as OverProvisionedExplanation does.
  3. The grant clause prints the measured grant utilization ("memory grants peaked at 62% of their target (threshold: 50%)"), taken from GrantUtilizationPct on the Darling DTO and the Lite row. New parameter decimal grantUtilizationPct; both callers updated.
  4. New test RightSizedSentence_NamesTheArmThatProvisioningVerdictEvaluateUsed (both suites): six (avg, max, p95, grant) cases across the three arms, each asserted RIGHT_SIZED by ProvisioningVerdict.Evaluate, and the sentence must contain its own arm's marker and none of the other two.
  5. FinOpsUtilizationFiguresTests: Explanation_EqualsTheOldSwitch_InTheCurrentCulture (a re-typed copy of the switch, trap The MCP trend reader's tier ladder and hourly SQL were pinned EQUAL to the Storage definitions #3666 moved them to, which fails only after two copies drift — they are now aliases; and the Query Store duration chart, the one Performance Trends chart left untitled, says what served it and where the rollup's floor cut the window's head (#3653) #3684) is deleted. Replaced by literal-sentence tests: Explanation_ForRightSized_NamesTheCauseAndTheMemoryShare (5 cases: peak on a server and on an Azure SQL Database, the 49.99% and 50% memory boundary, and a moderate load below and above the memory cut), Explanation_ForRightSized_WithAnIdleQuietServer_PrintsTheMeasuredGrantUtilization, Explanation_ForTheOtherStatuses_IsTheirSentence (OVER_PROVISIONED on both editions, NOT_APPLICABLE, empty) and Explanation_ForUnderProvisioned_SaysWhyItWasFlagged. The existing Azure tests in AzureSqlDatabaseMemoryScopeTests now assert full sentences.
  6. The RightSizedExplanation summary now says the old sentence returns byte for byte only when the average is at or above IdleAvgCpuPercent and the buffer pool share is at least the well-utilized bar.
  7. The 50% cut is now ProvisioningVerdict.WellUtilizedBufferPoolPercent, outside the "measured, not chosen" block, with a one-line comment that it is a chosen value affecting wording only.
  8. Lite FinOpsTab.xaml.cs: the sentence is built inline in a WPF control's load method (ClassificationExplanation.Text = ...), which needs the control instance and an STA thread, so I left it untested. It only passes data through to RightSizedExplanation, which both suites now test directly. The grant argument comes from data.GrantUtilizationPct, the same field the Darling DTO's reader fills.
  9. StatementCollectionCensusTests.ABlockingRingBufferOfAboutFourMegabytes_IsJudgedInTimeLinearInItsSize: timing test, unrelated, passed locally (1 of 1). Not changed.

Also (in this PR's new text): the low buffer pool arm reads "the buffer pool uses N% ..." (the review's article note). Not done: the semicolon reorder.

Tests run after the fixes (builds 0 errors; 2 warnings, both in files this PR does not touch):

  • Darling: *AzureSqlDatabaseMemoryScope*, *AzureSqlDatabaseHardware*, *FinOpsUtilization*, *ProvisioningVerdict*, StatementCollectionCensusTests, *Census*, *Ratchet*: Total 635, Failed 0, Skipped 16 (live classes that need a rig).
  • Lite: same classes minus the Darling-only one: Total 88, Failed 0.
  • Not run: the full suites, pre-push.sh (CI decides). Revert-proof of the new coupling test not run.

Considered, not added: nothing beyond the nine items.

CHANGELOG entry

SECTION: Fixed
ENTRY:

@erikdarlingdata
erikdarlingdata marked this pull request as ready for review October 24, 2026 03:26
/// </summary>
public static string RightSizedExplanation(decimal avgCpuPct, decimal p95CpuPct, double bufferPoolPct, bool azureSqlDatabase) =>
string.Create(CultureInfo.CurrentCulture, $"CPU is moderately loaded (avg {avgCpuPct:N1}%, p95 {p95CpuPct:N1}%) and memory is well-utilized (buffer pool uses {bufferPoolPct:N0}% of {MemoryBasis(azureSqlDatabase)}). No action needed.");
public static string RightSizedExplanation(decimal avgCpuPct, decimal p95CpuPct, decimal maxCpuPct, double bufferPoolPct, bool azureSqlDatabase)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maxCpuPct should be int, not decimal — as decimal it sits between two other CPU percentages with no type guard against a transposition.

The signature now takes three adjacent decimal CPU percentages, all passed positionally at every call site. Every source of the new argument stores it as an int — UtilizationEfficiencyDto.MaxCpuPct (DarlingFinOpsUtilizationReader.cs:21), UtilizationEfficiencyRow.MaxCpuPct (Lite/Services/LocalDataService.FinOps.cs:22, ViewerDataService.FinOps.cs:40) — and the sibling method six lines below already declares it that way: OverProvisionedExplanation(decimal avgCpuPct, int maxCpuPct, …) (line 260). That int is what makes a p95/max transposition a compile error there.

Failure scenario: write RightSizedExplanation(d.AvgCpuPct, d.MaxCpuPct, d.P95CpuPct, bpPct, azureSqlDb) at FinOpsUtilizationFigures.cs:87 (and the same order in the test copy at FinOpsUtilizationFiguresTests.cs:138 — see my comment there). With decimal it compiles, both suites stay green, and two things go wrong at once: the sentence prints the wrong figures ("CPU averaged 12.5% (p95 40.0%), but one sample reached 35%"), and the branch at line 243 now tests p95 against IdleMaxCpuPercent. A genuinely idle server whose p95 is 0 and whose peak is 95 then falls to line 245 and asserts grant pressure that was never measured — the #2246 fabricated-cause shape this file's sibling comment was written to end.

Suggested change
public static string RightSizedExplanation(decimal avgCpuPct, decimal p95CpuPct, decimal maxCpuPct, double bufferPoolPct, bool azureSqlDatabase)
public static string RightSizedExplanation(decimal avgCpuPct, decimal p95CpuPct, int maxCpuPct, double bufferPoolPct, bool azureSqlDatabase)

(:N0 formats an int the same way, and the three call sites already hand over int; the two new tests would pass 40 and 12 instead of 40m and 12m.)

Comment on lines +243 to +245
: maxCpuPct >= ProvisioningVerdict.IdleMaxCpuPercent
? string.Create(CultureInfo.CurrentCulture, $"CPU averaged {avgCpuPct:N1}% (p95 {p95CpuPct:N1}%), but one sample reached {maxCpuPct:N0}%, so this server is not rated over-provisioned")
: string.Create(CultureInfo.CurrentCulture, $"CPU is lightly loaded (avg {avgCpuPct:N1}%, p95 {p95CpuPct:N1}%), but its memory grants use {ProvisioningVerdict.IdleGrantUtilizationPercent:N0}% or more of their target, so this server is not rated over-provisioned");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both new clauses say "this server" unconditionally, so on an Azure SQL Database one sentence calls the target a server and then names "the database's memory limit".

This method already knows which it is — azureSqlDatabase is a parameter — and the sibling method in this same file switches the noun on it:

// line 261
$"… This {(azureSqlDatabase ? "database" : "server")} may have more resources than it needs."

The new test pins the mixed output. RightSizedExplanation(5m, 8m, 12m, 60.0, azureSqlDatabase: true) produces:

CPU is lightly loaded (avg 5.0%, p95 8.0%), but its memory grants use 50% or more of their target, so this server is not rated over-provisioned and memory is well-utilized (buffer pool uses 60% of the database's memory limit). No action needed.

The whole point of this class is that a host-scoped word is never used for the database (see the class summary, lines 19–48, and MemoryBasis at line 202). ProvisioningVerdict.UnderProvisionedReason says "This server…" on Azure too, but that method has no edition argument to go on; this one does.

Suggest routing both clauses through the same ternary — e.g. a local var target = azureSqlDatabase ? "database" : "server"; and so this {target} is not rated over-provisioned in both arms — and asserting the Azure noun in the new test's grants case.

var old = dto.ProvisioningStatus switch
{
"RIGHT_SIZED" => ServerHardwareScope.RightSizedExplanation(dto.AvgCpuPct, dto.P95CpuPct, bpPct, azure),
"RIGHT_SIZED" => ServerHardwareScope.RightSizedExplanation(dto.AvgCpuPct, dto.P95CpuPct, dto.MaxCpuPct, bpPct, azure),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trap #3684 applies here: this is the second copy of the switch at FinOpsUtilizationFigures.cs:85-98, pinned equal to it — and this PR edits both copies in the same commit.

"Two copies of one definition pinned EQUAL to each other fail only after BOTH have drifted (#3684). Alias, do not copy." — .github/REVIEW-TRAPS.md

Explanation_EqualsTheOldSwitch_InTheCurrentCulture builds old by re-typing the production switch and then asserts Assert.Equal(old, FinOpsUtilizationFigures.Explanation(dto, …)) (line 145). What it proves is that the two copies agree, which they do by construction — this diff changed line 87 and line 138 identically, so the test could not have failed on the new argument either way. It is the only test in the Darling suite that reaches the RIGHT_SIZED arm of Explanation, so the new d.MaxCpuPct argument's position is pinned by nothing.

Concretely: write (d.AvgCpuPct, d.MaxCpuPct, d.P95CpuPct, bpPct, azureSqlDb) in both places and the suite stays green while the Viewer and get_finops?view=utilization print the wrong figures and branch on p95 (see my comment on ServerHardwareScope.cs:239).

Two things would close it, neither a source-text pin:

  • declare the parameter int (that comment) so the transposition cannot compile, and
  • give the RIGHT_SIZED arm a behaviour test that asserts the sentence for a hand-built UtilizationEfficiencyDto against the expected text written out as a literal, rather than against a re-typed copy of the switch. The default Dto (avg 12.5, max 40, bp 4000/8000 = exactly 50%) already exercises the new peak clause and the new memory boundary — it just never asserts what it says.

? string.Create(CultureInfo.CurrentCulture, $"CPU is moderately loaded (avg {avgCpuPct:N1}%, p95 {p95CpuPct:N1}%)")
: maxCpuPct >= ProvisioningVerdict.IdleMaxCpuPercent
? string.Create(CultureInfo.CurrentCulture, $"CPU averaged {avgCpuPct:N1}% (p95 {p95CpuPct:N1}%), but one sample reached {maxCpuPct:N0}%, so this server is not rated over-provisioned")
: string.Create(CultureInfo.CurrentCulture, $"CPU is lightly loaded (avg {avgCpuPct:N1}%, p95 {p95CpuPct:N1}%), but its memory grants use {ProvisioningVerdict.IdleGrantUtilizationPercent:N0}% or more of their target, so this server is not rated over-provisioned");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking, but this is the one clause that names a cause it never reads.

The claim is sound today — Evaluate's idle arm is avg < 15 && max < 40 && grantUtil < 50 (ProvisioningVerdict.cs:196-198), so RIGHT_SIZED with avg < 15 and max < 40 does entail grantUtil >= 50. Two observations:

  1. It restates the threshold instead of the measurement. Both DTOs carry the real figure (UtilizationEfficiencyDto.GrantUtilizationPct, UtilizationEfficiencyRow.GrantUtilizationPct), and every sentence in UnderProvisionedReason names the measured number and the bar ("CPU p95 is 91.2% (threshold: 85%)"); the clause above it names the measured peak. Here an operator reading "use 50% or more of their target" cannot tell 51% from 99%. Also worth matching the clause above on tense: the figure is MAX(100.0 * granted_memory_mb / NULLIF(target_memory_mb, 0)) over the window (DarlingFinOpsUtilizationReader.cs:120), i.e. a peak, not a steady state — "its memory grants peaked at N% of their target" says what was measured.

  2. Nothing couples this branch to Evaluate. The new test pins the string for hand-picked arguments; no test drives the same inputs through Evaluate and this method and checks that the sentence names a condition the inputs actually satisfy. Flip Evaluate's maxCpuPercent < IdleMaxCpuPercent to <=, or raise IdleMaxCpuPercent above the bar this method reads, and this line starts asserting grant pressure on servers whose grants were nowhere near their target — with every test green. A behaviour test over a few (avg, max, grantUtil) triples asserting Evaluate(...) == RightSized ⇒ the sentence's named cause holds for those inputs would fail on that.

Comment on lines +231 to +233
/// The FinOps utilization verdict sentence for a server whose provisioning is RIGHT_SIZED. Off an Azure SQL Database it is
/// the long-standing sentence, byte for byte. On one it says the same, with the share named against the database's memory
/// limit instead of physical RAM.
/// the long-standing sentence, byte for byte, when the average CPU is at or above <see cref="ProvisioningVerdict.IdleAvgCpuPercent"/>.
/// On one it says the same, with the share named against the database's memory limit instead of physical RAM.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: the summary's first sentence is now narrower than the code. "the long-standing sentence, byte for byte, when the average CPU is at or above IdleAvgCpuPercent" holds only when the buffer pool share is also at least 50% — a server with avg 30% CPU and a 35% buffer pool used to read "and memory is well-utilized (buffer pool uses 35% of physical RAM)" and now reads "and buffer pool uses 35% of physical RAM". The <para> below does state the memory rule, so it is only the opening sentence that overstates; adding "and the buffer pool holds at least half of the basis" to it would make the summary match lines 246-248.

Two wording notes on the composed output while you are here:

  • "and buffer pool uses 8% of physical RAM" is missing its article — the low-share arm reads as a fragment where the OverProvisionedExplanation version keeps one ("buffer pool uses only…" after a comma, not after "and"). "and the buffer pool uses 8% of physical RAM" reads straight.
  • In the peak arm the so … and … composition makes the buffer-pool share read as a consequence of the peak: "…so this server is not rated over-provisioned and buffer pool uses 8% of physical RAM." A semicolon or a re-ordered join would keep the two facts apart.

Comment on lines +252 to +253
/// <summary>The share of the memory basis the buffer pool must hold for a RIGHT_SIZED sentence to call memory well-utilized (#6646).</summary>
private const double RightSizedWellUtilizedBufferPoolPercent = 50.0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking, on where this number lives and what it is.

Every other cut point in this decision family sits in ProvisioningVerdict with the fleet distribution that produced it beside it — "Every threshold below was measured, not chosen." (ProvisioningVerdict.cs:27), and each of HighCpuP95Percent, IdleAvgCpuPercent, IdleMaxCpuPercent, HighWorkerRatio, IdleGrantUtilizationPercent, HighStolenMemoryPercent names the measurement. This one is in ServerHardwareScope with no source for the 50.

It also makes a second answer to "is this buffer pool fine?" on the same card: FinOpsHealthCalculator.MemoryScore (FinOpsScoring.cs:24-30) scores any ratio from 0.30 to 0.85 a full 100. So a server with a 35% buffer pool shows a memory term of 100 in the health score and, one line below it, a sentence that pointedly declines to call that memory well-utilized. Neither figure is wrong, but an operator reading both at once gets two bars for one quantity. If 50 is the intended bar, ProvisioningVerdict beside HighStolenMemoryPercent is where a reader of the verdict rules would look for it, and a line on what it was measured against would settle which of the two bars is the considered one.

claude[bot]
claude Bot previously requested changes Oct 24, 2026

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: CHANGES REQUESTED

Claims

  • VERIFIED — RightSizedExplanation was one fixed sentence — the removed line in the hunk, a single string.Create with no branching.
  • VERIFIED — RIGHT_SIZED also results from avg under 15% with a sample at 40% or more, or grant utilization at 50% or more — ProvisioningVerdict.cs:196-203.
  • VERIFIED — the grant clause is "the last remaining way to RIGHT_SIZED" — entailed by that three-term idle arm: with avg under 15 and max under 40, RIGHT_SIZED requires grantUtil at or above 50.
  • VERIFIED — the clause for an average at or above IdleAvgCpuPercent is today's text unchanged — ServerHardwareScope.cs:242 is byte-identical, and the untouched Assert.Equal blocks (Darling/Darling.Tests/AzureSqlDatabaseMemoryScopeTests.cs:120-126) still hold.
  • VERIFIED — "well-utilized" only at a buffer pool share of 50% or more — ServerHardwareScope.cs:246-248 with the constant at line 253.
  • VERIFIED — the verdict rule is unchanged — ProvisioningVerdict.cs is not in gh pr diff --name-only.
  • VERIFIED — callers updated are FinOpsUtilizationFigures.Explanation (Viewer and web) and Lite's FinOpsTab — grep finds only FinOpsUtilizationFigures.cs:87 and Lite/Controls/FinOpsTab.xaml.cs:542; Darling reach is FinOpsTab.Loaders.cs:339 and DarlingMcpFinOpsTools.Utilization.cs:84, which DarlingWebEndpoints.cs:9164 exposes as get_finops. Lite has no FinOps MCP or web surface.
  • VERIFIED — the new test is in both suites under that name with those inputs — Darling/Darling.Tests/AzureSqlDatabaseMemoryScopeTests.cs:130-146, Lite.Tests/AzureSqlDatabaseMemoryScopeTests.cs:156-172.
  • VERIFIED — "only the signature changed" for the existing tests — the edited lines pass 62m for both p95 and max, keeping avg 40 in the first arm and bp 71 in the well-utilized arm.
  • UNVERIFIED — "Revert-proved" — needs the suite run against a reverted implementation.
  • UNVERIFIED — Darling "Total 584, Failed 0, Skipped 1" — no run here; these are net10.0-windows projects and this tree is Linux.
  • UNVERIFIED — Lite "Total 80, Failed 0" — same.

Riskiest lines

  1. PerformanceMonitor.Common/ServerHardwareScope.cs:245 — the one clause naming a cause the method never reads; true only while Evaluate's idle arm stays the exact complement of lines 241 and 243 — UNCOVERED (no test drives Evaluate and this method from the same inputs, so < to <= at ProvisioningVerdict.cs:197 fabricates grant pressure with every test green)
  2. PerformanceMonitor.Common/ServerHardwareScope.cs:239 — a new positional decimal CPU percentage between two others, where sibling OverProvisionedExplanation (line 260) uses int for exactly that guard; a transposition is silent and mis-branches line 243 — UNCOVERED (the only Darling test over this arm is a copy pinned equal to the switch, edited in lockstep)
  3. Lite/Controls/FinOpsTab.xaml.cs:542 — Lite's only RIGHT_SIZED surface; backed only by Assert.Contains("ServerHardwareScope.RightSizedExplanation(") at Lite.Tests/AzureSqlDatabaseHardwareTests.cs:244, a source read — UNCOVERED

Traps near this diff

  • "Two copies of one definition pinned EQUAL to each other fail only after BOTH have drifted (#3684). Alias, do not copy." — applies — Darling/Darling.Tests/FinOpsUtilizationFiguresTests.cs:135-145 re-types the switch at FinOpsUtilizationFigures.cs:85-98; this PR edited line 138 and line 87 identically, so it could not fail on the new argument in either order. Commented inline.
  • "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 — both call sites moved (Lite/Controls/FinOpsTab.xaml.cs:542, FinOpsUtilizationFigures.cs:87) and the test was mirrored into both suites; the only old copy left is deprecated/Dashboard/Controls/FinOpsContent.Loaders.cs:181, the deprecated Full edition, which never called this helper.
  • "Never answer a trap with a test that reads source text or asserts how code is spelled" — applies — the diff adds no such test, but it also means Lite.Tests/AzureSqlDatabaseHardwareTests.cs:244 and Darling/Darling.Tests/AzureSqlDatabaseHardwareTests.cs:246 cannot be counted over either call site.
  • "IsDBNull ? 0: an unmeasured pass is null with a *_measured flag beside it, not 0 MB (#3682)" — does not apply — a 0% buffer pool cannot come from an unmeasured window: both reads are CROSS JOIN mem_latest (DarlingFinOpsUtilizationReader.cs:145, Lite/Services/LocalDataService.FinOps.Utilization.cs:100), so no memory row means no row and the tab shows "No Data" (FinOpsTab.xaml.cs:456).
  • "A threshold that means different units at different surfaces: the File Growth bar meant 'per five minutes' on one store and 'per day' on another until it meant megabytes per hour everywhere (#3631). State the unit at every surface that shows the number." — does not apply — the unit is the same percentage of the same basis at both surfaces (ServerHardwareScope.cs:248, FinOpsScoring.cs:26); only the cut point differs, raised as a non-blocking comment.
  • "An empty analysis window is 'unavailable', not an all-clear (#3553); a server nothing has banded yet is Unknown, not Healthy (#3635)." — does not apply — "" still falls to _ => "" (FinOpsTab.xaml.cs:554, FinOpsUtilizationFigures.cs:99) and NOT_ENOUGH_DATA keeps its own sentence.

Divergence (blind read vs PR body)

Small, and in the code's prose rather than the body's. The body's second bullet states the memory rule correctly, but the new XML summary (ServerHardwareScope.cs:231-233) still promises "the long-standing sentence, byte for byte, when the average CPU is at or above IdleAvgCpuPercent" — which now also needs a 50% buffer pool share, so a RIGHT_SIZED server at avg 30% CPU with a 35% buffer pool gets changed text that both "unchanged" and "byte for byte" read as unaffected.

Two things the diff does that the body does not mention: the new clauses hard-code "this server", so an Azure SQL Database is called a server in the same sentence that names "the database's memory limit" (the new test's grants case pins it); and the sentence reaches MCP clients, not only the Viewer and web, through get_finops.

Otherwise the two accounts agree, including the claim I most expected to be loose — that the grant clause is the only remaining route to RIGHT_SIZED. It is.

Reviewer checklist

  • Build both SKUs on Windows and run the two suites; the 584/80 counts and the revert-proof are the claims a read-only Linux tree could not check.
  • Read the whole sentence in the Viewer's Utilization tab for a genuinely idle server with one sample at 40% or more.
  • Do the same for an Azure SQL Database target, where the sentence mixes "this server" with "the database's memory limit".
  • Hit get_finops?view=utilization for both and confirm verdict_reason matches the tab.
  • Confirm some live server can actually reach the third clause (idle CPU with grant utilization at or above 50%); the fleet distribution at ProvisioningVerdict.cs:34 records a max of 18.8%.

maxCpuPct is an int; the new clauses switch the noun on the edition; the grant clause prints the measured grant utilization; the 50% buffer pool cut moves to ProvisioningVerdict; tests assert literal sentences and tie the sentence to Evaluate.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: LGTM

Claims

  • VERIFIED — maxCpuPct is now int, matching every real source of it and sibling OverProvisionedExplanation — PerformanceMonitor.Common/ServerHardwareScope.cs:241.
  • VERIFIED — both new CPU clauses switch "server"/"database" on azureSqlDatabase via the target local — ServerHardwareScope.cs:242-248.
  • VERIFIED — the grant clause now prints the measured grant utilization next to the fixed threshold, with a new decimal grantUtilizationPct parameter and both callers updated — ServerHardwareScope.cs:241,248; Darling/PerformanceMonitor.Darling.Storage/FinOps/FinOpsUtilizationFigures.cs:87; Lite/Controls/FinOpsTab.xaml.cs:542.
  • VERIFIED — new test ties the sentence's arm to ProvisioningVerdict.Evaluate's verdict for the same six-case inputs, in both suites — RightSizedSentence_NamesTheArmThatProvisioningVerdictEvaluateUsed at Darling/Darling.Tests/AzureSqlDatabaseMemoryScopeTests.cs:160 and Lite.Tests/AzureSqlDatabaseMemoryScopeTests.cs:186. Traced all six (avg, max, grant) cases against Evaluate's idle-arm complement (ProvisioningVerdict.cs:200-207) by hand; the arm boundaries agree exactly, including both </>= edges.
  • VERIFIED — Explanation_EqualsTheOldSwitch_InTheCurrentCulture (the round-1-flagged re-typed-switch copy, trap #3684) is deleted and replaced with literal-sentence tests — Darling/Darling.Tests/FinOpsUtilizationFiguresTests.cs diff, new Explanation_ForRightSized_NamesTheCauseAndTheMemoryShare/..._WithAnIdleQuietServer_PrintsTheMeasuredGrantUtilization/..._ForTheOtherStatuses_IsTheirSentence/..._ForUnderProvisioned_SaysWhyItWasFlagged.
  • VERIFIED — the XML summary now conditions "byte for byte" on both the CPU bar and the buffer-pool share, closing the round-1 divergence — ServerHardwareScope.cs:231-233.
  • VERIFIED — the 50% cut moved to ProvisioningVerdict.WellUtilizedBufferPoolPercent, outside the "measured, not chosen" block, with a comment naming it chosen — PerformanceMonitor.Common/ProvisioningVerdict.cs:81-83; no stale reference to the old private constant remains (grepped the tree).
  • VERIFIED — Lite's FinOpsTab.xaml.cs:542 call site stays behavior-untested (WPF control, STA-bound), and the PR body gives the one-sentence justification the coverage rule accepts (round-1 item 8) rather than adding a source-reading test.
  • UNVERIFIED — the stated local test run counts (Darling 635/0/16, Lite 88/0) and "revert-proved" claim — no .NET test run performed against this read-only Linux checkout (net10.0-windows projects).

Riskiest lines

  1. PerformanceMonitor.Common/ServerHardwareScope.cs:248 — the grant-clause arm is only reachable because Evaluate's idle arm is its exact complement; a cut-point drift between the two would mis-explain a real RIGHT_SIZED server — covered by RightSizedSentence_NamesTheArmThatProvisioningVerdictEvaluateUsed (both suites), which drives Evaluate and RightSizedExplanation from the same inputs across all three arms and the two boundaries.
  2. PerformanceMonitor.Common/ServerHardwareScope.cs:241 — int maxCpuPct sits next to decimal grantUtilizationPct; previously a same-typed decimal/decimal transposition here was silent — now a transposition is a compile error, and the same arm test above exercises both parameters with distinct values.
  3. Lite/Controls/FinOpsTab.xaml.cs:542 — Lite's only caller passing data.GrantUtilizationPct through to the new parameter — UNCOVERED by a behaviour test, answered in the PR body (round-1 item 8) rather than tested, which the coverage rule accepts.

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 — both call sites (Lite/Controls/FinOpsTab.xaml.cs:542, FinOpsUtilizationFigures.cs:87) and both test files were updated identically; diffed byte-for-byte and found no divergence.
  • "Never answer a trap with a test that reads source text or asserts how code is spelled... a trap is answered with a behaviour test that fails on the defect and passes on the fix" — applies, and is now satisfied rather than violated — the round-1-flagged pinned-equal copy test is deleted and its replacements assert literal output strings instead of re-deriving the computation.

Divergence (blind read vs PR body)

None — the PR body's "Round 1 fixes" list matches the diff on every numbered item I could check from the tree, including the one item (#8, Lite's untested call site) that is deliberately not covered by a test.

Reviewer checklist

  • Run the Darling and Lite suites on Windows to confirm the stated counts (635/88 passing, 0 failed) and the revert-proof of the new coupling test.
  • Load the Viewer's/web's Utilization tab for a server genuinely held RIGHT_SIZED by grant use (grant utilization ≥ 50%, avg CPU < 15%, max CPU < 40%) and confirm the sentence reads "memory grants peaked at N% of their target (threshold: 50%)".

@erikdarlingdata
erikdarlingdata dismissed claude[bot]’s stale review October 24, 2026 07:05

Claude posting for Erik Darling. Round 1 findings fixed in e59bd56; round 2 on that head is LGTM.

@erikdarlingdata
erikdarlingdata enabled auto-merge (squash) October 24, 2026 07:05
@erikdarlingdata
erikdarlingdata merged commit 6800aea into dev Oct 24, 2026
25 of 26 checks passed
@erikdarlingdata
erikdarlingdata deleted the fix/6646-right-sized-sentence branch October 24, 2026 08:00
@github-actions github-actions Bot mentioned this pull request Oct 24, 2026
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