Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 11 additions & 19 deletions Darling/Darling.Tests/McpPayloadContractCensusTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1512,8 +1512,8 @@ public static readonly (string Key, string[] Files, string WhatWasCut)[] SecondB

public static readonly (string Key, string[] Files, string WhatItExplains)[] CutNoteKeys =
[
("truncation_note", ["DarlingMcpDataTools.cs", "DarlingMcpQueryStoreClutterTools.cs", "DarlingMcpTools.cs", "McpAnalysisTools.cs"],
"the prose beside the flag: on get_analysis_findings (both SKUs) beside truncated, the WindowCoveringLimit read cap observed off a cap + 1 fetch; on get_query_store_top and get_query_store_clutter beside window_truncated, the #2364 window floor — the store's raw retention did not reach the whole requested window (on the clutter view, for the two arms that read the raw tier)"),
("truncation_note", ["DarlingMcpDataTools.cs", "DarlingMcpQueryStoreClutterTools.cs", "DarlingMcpTools.cs", "McpAnalysisTools.cs", "McpQueryTools.cs"],
"the prose beside the flag: on get_analysis_findings (both SKUs) beside truncated, the WindowCoveringLimit read cap observed off a cap + 1 fetch; on get_query_store_top and get_query_store_clutter beside window_truncated, the #2364 window floor — the store's raw retention did not reach the whole requested window (on the clutter view, for the two arms that read the raw tier); on Lite's get_top_queries_by_cpu / get_top_procedures_by_cpu / get_query_store_top (#4231), the same window-floor note, from LocalDataService.GetQueryWindowFloorAsync"),
("findings_truncated_note", ["DarlingMcpTools.cs", "McpAnalysisTools.cs"],
"#4198: the prose beside findings_truncated — how many diagnostic chains were active in the window and that raising limit or narrowing hours_back would show more of them"),
];
Expand Down Expand Up @@ -1763,6 +1763,10 @@ disclosure over query_stats and procedure_stats. */
("DarlingMcpTrendTools.cs", "envelope", 1),
("DarlingMcpTrendTools.cs", "initializer", 1),
("McpQueryTools.cs", "envelope", 1),
/* #4231: Lite's own get_query_store_top initializer (mirroring DarlingMcpDataTools.cs's 2, but Lite's
get_query_store_top has no module_name-miss hint block of its own, so 1), plus get_top_queries_by_cpu
and get_top_procedures_by_cpu, newly given the same raw-tier disclosure. */
("McpQueryTools.cs", "initializer", 4),
];

public static readonly (string File, string Tool)[] WindowFloorTools =
Expand All @@ -1778,7 +1782,10 @@ public static readonly (string File, string Tool)[] WindowFloorTools =
("McpQueryTools.cs", "get_procedure_duration_trend"),
("McpQueryTools.cs", "get_query_duration_trend"),
("McpQueryTools.cs", "get_query_store_duration_trend"),
("McpQueryTools.cs", "get_query_store_top"),
("McpQueryTools.cs", "get_query_trend"),
("McpQueryTools.cs", "get_top_procedures_by_cpu"),
("McpQueryTools.cs", "get_top_queries_by_cpu"),
];

/// <summary>The reach key: the one neighbour only the window floor has.</summary>
Expand Down Expand Up @@ -2003,23 +2010,8 @@ a caller needs to read the payload (the key, and that it is a retention floor, n
is a guardrail and must be served in the head. Unconverted, the head is the whole description. */
Assert.Contains(clause, description!, StringComparison.Ordinal);
var head = McpToolGuide.Split(description!).Head;
if (tool is "get_top_queries_by_cpu" or "get_top_procedures_by_cpu")
{
/* #4231: these two are shared with Lite, and D6's twin pin
(McpToolGuideTests.EverySharedToolName_CarriesTheMarkerOnBothSkus_OrNeither_WithByteIdenticalHeads)
requires their served head stay byte-identical to Lite's until Lite's own #4279 ships the
same disclosure — a Darling-only head guardrail would fail that pin regardless of merge
order. Both facts still ride the wire today, in the tail's WindowTruncatedDescription
clause, so read them from the full description here rather than the head. A follow-up PR
can move one identical sentence into both SKUs' heads once #4279 merges. */
Assert.Contains(WindowFloorKey, description!, StringComparison.Ordinal);
Assert.Contains("not a page cut", description!, StringComparison.Ordinal);
}
else
{
Assert.Contains(WindowFloorKey, head, StringComparison.Ordinal);
Assert.Contains("not a page cut", head, StringComparison.Ordinal);
}
Assert.Contains(WindowFloorKey, head, StringComparison.Ordinal);
Assert.Contains("not a page cut", head, StringComparison.Ordinal);
Assert.DoesNotContain("read truncated", description!, StringComparison.Ordinal);
}
}
Expand Down
14 changes: 8 additions & 6 deletions Darling/Darling.Tests/McpToolGuideHeads.CollectionLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ private static readonly (string Tool, string Fact)[] HeadFacts =
("get_collection_log", "an unknown value is refused, never silently empty"),
("get_query_store_top", "window_truncated"),
("get_query_store_top", "not a page cut"),
("get_query_store_top", "Lite: no such floor"),
];

[Fact]
Expand Down Expand Up @@ -67,13 +66,16 @@ public void CollectionLogTail_CarriesTheThreeHeldBackParameterRemainders()
Assert.Contains("status: THE FAILURE FILTER", tail, StringComparison.Ordinal);
}

/// <summary>get_query_store_top's window-floor clause (#2364/#3653) is Darling-only; the head says so in one
/// clause rather than asserting it's true for Lite too (D6), and Lite's own tail never claims it.</summary>
/// <summary>#4231: get_query_store_top's window-floor clause (#2364/#3653) is now one shared, byte-identical
/// head across both SKUs -- neither the old "Darling: " qualifier nor the false "Lite: no such floor" line
/// survives.</summary>
[Fact]
public void QueryStoreTop_WindowFloorClause_IsScopedToDarlingInTheHead()
public void QueryStoreTop_WindowFloorClause_IsSharedAcrossBothSkusInTheHead()
{
var served = McpToolGuideTests.Served("get_query_store_top");
Assert.Contains("Darling: window_truncated", served.Served, StringComparison.Ordinal);
Assert.Contains("Lite: no such floor", served.Served, StringComparison.Ordinal);
Assert.Contains("window_truncated", served.Served, StringComparison.Ordinal);
Assert.Contains("not a page cut", served.Served, StringComparison.Ordinal);
Assert.DoesNotContain("Darling: window_truncated", served.Served, StringComparison.Ordinal);
Assert.DoesNotContain("Lite: no such floor", served.Served, StringComparison.Ordinal);
}
}
4 changes: 4 additions & 0 deletions Darling/Darling.Tests/McpToolGuideHeads.Data.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ private static readonly (string Tool, string Fact)[] HeadFacts =
("get_perfmon_stats", "LATEST IS A TIME: the newest snapshot, not a window"),
("get_server_properties", "LATEST IS A TIME: the newest snapshot, not a window"),
("get_top_procedures_by_cpu", "LIFETIME extremes, not windowed"),
("get_top_procedures_by_cpu", "window_truncated"),
("get_top_procedures_by_cpu", "not a page cut"),
("get_top_queries_by_cpu", "LIFETIME extremes, not windowed"),
("get_top_queries_by_cpu", "an empty page under it is the window's real answer, not a miss"),
("get_top_queries_by_cpu", "window_truncated"),
("get_top_queries_by_cpu", "not a page cut"),
("get_wait_stats", "Bounded by limit"),
("list_servers", "Darling has no live connection to monitored servers"),
("list_servers", "Lite's status IS a live connection check"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ param get_perfmon_stats.counter_name 61
param get_perfmon_stats.instance_name 57
param get_perfmon_stats.server_name 28

tool get_query_store_top 422
tool get_query_store_top 351
param get_query_store_top.as_of 167
param get_query_store_top.database_name 30
param get_query_store_top.execution_type 72
Expand All @@ -63,14 +63,14 @@ param get_tempdb_trend.bucket_minutes 55
param get_tempdb_trend.hours_back 29
param get_tempdb_trend.server_name 28

tool get_top_procedures_by_cpu 406
tool get_top_procedures_by_cpu 532
param get_top_procedures_by_cpu.as_of 167
param get_top_procedures_by_cpu.database_name 30
param get_top_procedures_by_cpu.hours_back 29
param get_top_procedures_by_cpu.server_name 28
param get_top_procedures_by_cpu.top 37

tool get_top_queries_by_cpu 474
tool get_top_queries_by_cpu 600
param get_top_queries_by_cpu.as_of 167
param get_top_queries_by_cpu.database_name 30
param get_top_queries_by_cpu.group_by 167
Expand Down
6 changes: 5 additions & 1 deletion Darling/Darling.Tests/McpToolsListBudgetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ shared 32 KB budget and is not a served description either. */
#4231 branched from); combined total unchanged from the merge base since #4231 added no head bytes. */
/* #4231 (merge after #4273): re-measured after merging origin/dev (dev now includes #4272+#4273); #4231
still adds no head bytes, so the total is dev's own. */
private const int TotalCeilingBytes = 174_373;
/* #4279 (Lite half of #4231 ships): the exemption above no longer applies once Lite's own head carries the
same disclosure. get_query_store_top's head drops the old Darling/Lite split for the shared sentence
(422 -> 351, banking 71 bytes); get_top_queries_by_cpu and get_top_procedures_by_cpu each gain that same
sentence (474 -> 600 and 406 -> 532, +126 bytes apiece). Net +181, matching Lite's twin change exactly. */
private const int TotalCeilingBytes = 174_554;


private const int ConvertedHeadCap = 1_000;
Expand Down
Loading
Loading