Skip to content

Web pages say MCP field names and raw collector counts in words (#6649) - #6670

Merged
erikdarlingdata merged 3 commits into
devfrom
fix/6649-web-mcp-names
Oct 24, 2026
Merged

erikdarlingdata merged 3 commits into
devfrom
fix/6649-web-mcp-names

Conversation

@erikdarlingdata

@erikdarlingdata erikdarlingdata commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Claude posting for Erik Darling.

Closes #6649.

Why

Messages written for MCP callers still reached the web pages with field names a person cannot act on: (see databases_left_out), baseline_start / effective_start, latest_memory_mb, "in 1 source(s)" in the Alert History audit detail, and raw key=value collector counts.

What changes

All in wwwroot/js; the service text is unchanged, so MCP clients see what they saw before. Lite has no web UI.

  • plain-text.js: drops (see databases_left_out); says the baseline-window sentence as "Here the window starts before the baseline period, so the baseline holds only the part the store has."; says latest_memory_mb as "Latest MB", the Queries tab's column label; the count-pair rule now accepts a negative or fractional value (=-?\d+(?:\.\d+)?), which used to end the run and leave the whole note raw. The two count rules moved into measurementCountsText, and a new plainTextCounts (named tokens plus counts, nothing else) is exported.
  • Where the raw collector notes really came from: the Server Health tab's Collection Log grid, its Error column (error_message), which was not run through plainText at all. A successful run leaves its counts in that column, a failed run leaves a real error message. The Collectors table's Note column was already plain: true (checked by running plainText under node on the issue's strings). The three error_message surfaces (read-fields.js get_collection_log, server-tabs.js COLLECTION_LOG_COLUMNS, collector-run.js result table) now use plain: "counts" / plainTextCounts, so an error message keeps everything but its counts and the named tokens (a lone timeout=30 stays).
  • plain-text.js clerk note: memory_clerk.note has four arms (DarlingMcpQueryStoreClutterTools); the first version of this PR fixed only the two that name latest_memory_mb. All four are now handled: the other two (No memory_clerks capture ... and memory_clerks stores the top 25 clerks ...) say "memory clerk capture" and "The memory clerks collector stores ...".
  • util.js localizeAlertDetail: the audit sentence (Retained history for ...) goes through plainText, so "1 source(s)" reads "1 source". Only that sentence (up to its ". " or the end of the text): CollectionHistoryAudit.Render writes the whole body as ONE line of ". "-joined clauses, so a line-scoped match would have run the whole body through plainText; the clauses after the sentence (source names, ranges, the "Not read" list) print as written.

Test plan

  • New: FieldNamesInTheServicesOwnSentences_ReadAsThePagesWords, ACountRunWithANegativeOrFractionalValue_StillReadsAsWords, TheCollectionLogMessage_SaysItsCountsInWords_AndLeavesAnErrorAlone (WebPlainTextTests), TheCollectionHistoryAuditAlert_AgreesItsSourceCount_AndLeavesAStatementLineAlone (WebPartialWindowBehaviourTests). Revert-proved: all four fail with the old plain-text.js / util.js, pass with the fix.
  • WebPlainTextTests, WebPartialWindowBehaviourTests, WebClampCellBehaviourTests, WebWordingFixesTests, every *Census* and *Ratchet* class: 541 run, 0 failed, 1 skipped.
  • Full suite and pre-push.sh not run (laptop at thermal limit; CI decides).
  • No live page check against a running service.

Round 1 fixes

Claude posting for Erik Darling. Fixes for the round-1 review (CHANGES_REQUESTED 5636718691):

  1. util.js audit rewrite: matches the "Retained history for ..." sentence only (to its ". " or the end), not the line; comment corrected. The harness fixture is now CollectionHistoryAudit.Render's real output (one flagged source, every other real hourly source in the "Not read" list), passed to web-partial-window-harness.mjs as an argument. Test TheCollectionHistoryAuditAlert_AgreesItsSourceCount_AndKeepsEveryOtherClauseAsWritten: the rendered body equals itself with only "in 1 source(s)" changed to "in 1 source", and a later clause a full plainText pass would rewrite ((see databases_left_out)) stays as written. No real audit body is changed by a whole-body plainText beyond the count, so that probe clause is the only way to pin the scope; it is labelled as a probe, not as a shape the engine emits.
  2. plain-text.js: all four memory_clerk.note arms (see What changes).
  3. The C#-owned sentences are read from C# in WebPlainTextTests: QueryStoreRegressionRules.BaselineWindowTail (new public const in Common; Darling's regressions read AND Lite's McpQueryTools now use it, so Lite's copy is aliased, not re-typed), and DarlingMcpQueryStoreClutterTools.ClerkNoteNoCapture / ClerkNoteNeverAppeared / ClerkNoteInNewestCapture / ClerkNoteDroppedOut (new internal const). Two more test copies of the baseline sentence (DarlingQueryStoreRegressionsTests, WebDataStartNoteTests) now alias the constant. The (see databases_left_out) input stays typed in the test: it is a generic suffix strip, three producers share it, and the rule does not depend on the rest of the sentence. Text of every sentence is unchanged.
  4. panels.js: the counts/plain arms of cell() are indented as one chain. New ACellsPlainMode_PicksItsOwnPass_CountsKeepsAToolNameInARealError (WebClampCellBehaviourTests, via web-clamp-cell-harness.mjs): one note through plain: "counts", true, "named" and no key; counts says the measurement counts in words and keeps get_collection_health, full turns it into "Collection Health", named leaves the counts, none prints as stored.
  5. Riskiest line 2 (the shared pairs regex): left as is, already covered.

Tests: built Darling.Tests (Debug, -m:1): 0 errors; the 2 warnings are a null-dereference in Darling.Viewer/MainWindow.xaml.cs(559), a file this PR does not touch. Built Lite.Tests: 0 errors. Ran WebPlainTextTests, *WebPartialWindow*, *WebClampCell*, *CollectionHistoryAudit*, *QueryStoreClutter*, *QueryStoreRegressions*, *WebDataStartNote*, every *Census* and *Ratchet* class: 685 run, 0 failed, 39 skipped (live classes, no rig); Node 22.14 was on PATH so the harness tests ran, not skipped. Revert-proved: with the old util.js and plain-text.js restored, FieldNamesInTheServicesOwnSentences_ReadAsThePagesWords and the audit test both fail. Not run: pre-push.sh, the full suite, Lite.Tests classes, any live class (CI decides). The cpucap and testslot wrappers were refused by this agent's shell (a git-form check on the bash wrapper; the pwsh route failed with MSB1008), so builds and tests ran as plain commands with -m:1.

The audit alert's e-mail, Slack and Viewer copies still read "in 1 source(s)": the page rewrite is the ruled design; the C# ternary the review suggested is not in this PR.

Considered, not added

  • Running plainText (full) on the log Error column: a failed run's error can quote a real name or a get_ word, which is why Last Error uses the named-only mode; the counts mode keeps that property.
  • A key/value list or expander for notes (the issue's alternative): the words form already reads correctly and needs no new control.

CHANGELOG entry

SECTION: Fixed
ENTRY:

@erikdarlingdata
erikdarlingdata marked this pull request as ready for review October 24, 2026 03:27
let out = text.replace(/^(\s*(?:Incident Since|Started|Failed At|Snapshot|From|To|Window): )(.*)$/gm,
/* #6649: the collection-history audit's sentence says "N source(s)"; the count is known, so the word agrees with it. Only that
sentence: the rest of a body carries SQL and query text that must print as written. */
let out = text.replace(/Retained history for .*$/gm, (line) => plainText(line));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The comment's guarantee ("Only that sentence: the rest of a body carries SQL and query text that must print as written") does not hold for this alert, because this alert's body has no other line. CollectionHistoryAudit.Render builds the whole detail text on one StringBuilder with ". " separators and never writes a newline (CollectionHistoryAudit.cs:424-464), so /Retained history for .*$/gm — . stopping at a newline that does not exist — matches from the first character to the last. The entire audit body goes through the full plainText() pipeline, not one sentence.

That pipeline is not sentence-safe. withoutToolNames (plain-text.js:259-277) drops a whole sentence that names a registered tool, rewrites <snake_case> collector and collector '<name>' to title case, and lowerEmphasisWords lower-cases any all-caps word in EMPHASIS_WORDS. Nothing is lost today — I checked every source name the body can carry (TimescaleSupport.HourlyAggregates plus the perfmon baseline view: query_store_stats_hourly, query_stats_io_hourly, …) against TOOL_NAME_SET/ACTION_TOOL_SET and none is a registered tool — so this is latent, not broken. But the body is composed in C# from a list that grows, and the first source name or sentence that collides with a tool name silently deletes a sentence of an alert body with no test to catch it.

The count is already known where the sentence is written: findings.Count at CollectionHistoryAudit.cs:426. Fixing it there ({(findings.Count == 1 ? "source" : "sources")}) needs no JS rule, cannot over-reach, and also fixes the surfaces that never pass through plain-text.js — the e-mail and Slack bodies and the WPF Viewer's alert history, all of which still read "in 1 source(s)" after this PR. If the rewrite must stay on the page, anchor it to the sentence rather than the line (e.g. /^Retained history for [^.]*\./) so the guarantee the comment states is the one the code has.

Comment on lines +116 to +119
const auditBody = [
"Retained history for 2026-10-20 (UTC) fell below half of the usual pace for that hour in 1 source(s), where usual is the median of the 7 days before.",
" Blocked Query: SELECT 1 WHERE note = '3 file(s)'",
].join("\n");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This fixture is not a shape the service emits, and the second line is what makes the companion assertion look like a guard. CollectionHistoryAudit.Render (CollectionHistoryAudit.cs:424-464) appends every clause with ". " and never a newline, so a real audit body is exactly one line, and no audit body has ever carried a Blocked Query: statement line. So Assert.Contains("note = '3 file(s)'", body) in TheCollectionHistoryAuditAlert_AgreesItsSourceCount_AndLeavesAStatementLineAlone passes on a line that only exists in this harness: against a real body there is no line outside the match, and plainText runs over the whole thing (see my note on util.js:287).

REVIEW-TRAPS: "A test that constructs a 'four maintenance anomalies in one run' fixture is testing a shape no live run produces (#3709...). Fixtures should carry the population the engine actually emits, or say they do not." Build the fixture from CollectionHistoryAudit.Render's real output (or a verbatim single-line copy of it) and assert on what that produces. The in 1 source half of the test is good and would survive the change; only the invented second line needs to go.

Comment on lines +381 to +382
/* The Queries tab's memory clerk column is "Latest MB". */
t = t.replace(/\blatest_memory_mb\b/g, "Latest MB");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The clerk sweep stops two branches short, and the two it misses are the ones a quiet server actually shows. memory_clerk.note is a four-way conditional (DarlingMcpQueryStoreClutterTools.cs:403-409); only the two arms that mention latest_memory_mb are fixed here. The other two still name the collector's relation:

  • :404 — "No memory_clerks capture in the window: the collector wrote nothing for this server, so nothing is known about the clerk."
  • :406 — "The clerk never appeared in the window. memory_clerks stores the top 25 clerks over 1 MB per capture, so this is a RANK, not a zero: ..."

All four reach the page through the same field: noteKey: "qs_overhead.memory_clerk.note" on the "Query Store Memory Clerk" panel (pages/server-tabs.js:2189) → noticeStrip → plainText (util.js:203). memory_clerks is not rewritten by anything — it is not in TOOL_NAME_SET/ACTION_TOOL_SET (the registered tool is get_memory_clerks), the <name> collector rule at :250 needs the literal word "collector" after it, and there is no FIELD_WORDS entry — so "No memory_clerks capture in the window" prints verbatim, which is the exact defect class #6649 is about. The clerk-present arms the PR did fix are the less common ones: these two fire whenever the clerk is below the collector's floor or the collector wrote nothing.

The precedent is right above, at :324: pg_wraparound_stats → "the freeze-headroom collector". One more line beside it does it, e.g.

Suggested change
/* The Queries tab's memory clerk column is "Latest MB". */
t = t.replace(/\blatest_memory_mb\b/g, "Latest MB");
/* The Queries tab's memory clerk column is "Latest MB"; the clerk notes also name the collector's own relation. */
t = t.replace(/\blatest_memory_mb\b/g, "Latest MB");
t = t.replace(/\bmemory_clerks\b/g, "the memory clerks collector");

(the panel's own emptyText already calls it "the top 25 clerks over 1 MB", so pick whichever wording matches the Memory tab).

Comment on lines +106 to +112
var o = Run(
[
"No Query Store rows in the 24-hour window for a database this server still has. 29 database(s) the server no longer lists were left out of this read (see databases_left_out).",
"Here the window starts at baseline_start, so the baseline holds only the part from effective_start to baseline_end.",
"The clerk is in the newest capture's top 25; latest_memory_mb is its current footprint.",
"The clerk appeared earlier in the window and has since dropped out of the collector's top 25; latest_memory_mb is its last observed footprint, not its current one.",
], out _);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

These four sentences are copied into the test rather than read from the service, so the test cannot fail the way this fix actually dies. Three of the rules added in plain-text.js are whole-sentence literal matches against strings owned by C#:

  • DarlingMcpQueryStoreRegressionTools.cs:111 (and Lite/Mcp/McpQueryTools.cs:642) — the baseline tail
  • DarlingMcpQueryStoreClutterTools.cs:408 / :409 — the two clerk notes
  • DarlingMcpQueryStoreClutterTools.cs:182, DarlingMcpFinOpsTools.IndexAnalysis.cs:215, PerformanceMonitor.Common/CollectorRunFacts.cs:80 — (see databases_left_out) (this one is a generic suffix strip, so it is the safe one)

Reword any of those C# sentences by one character and the JS replace stops matching, the field name is back on the page, and all four assertions here still pass, because they are asserting against this file's own copy of the old wording. REVIEW-TRAPS: "Two copies of one definition pinned EQUAL to each other fail only after BOTH have drifted (#3684). Alias, do not copy."

This file already knows the better way twice: TheEngineGateSentence_NamesAzureSqlDatabase_WhenThatIsTheEngine (:429) and TheTempDbFileIoAzureAnswer_IsNotCollected_AndBecomesTheAzureLine (:440) build their input by calling the producer (CollectorEngineCapability.NotCollectedMessage, DarlingEngineCapability.TempDbFileIoNotCollectedStatus) and then assert the page's words. Lifting these sentences to const on their tool classes and feeding them in the same way makes the drift fail here instead of shipping silently.

Comment on lines 1318 to 1324
: c.plain === "named"
? plainTextNamed(String(raw))
: c.plain === "counts"
? plainTextCounts(String(raw))
: c.plain
? plainText(String(raw))
: String(raw);

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: this new branch is the one link in the chain with no behaviour test. cell()'s plain dispatch is exercised only by web-clamp-cell-harness.mjs:50, which sets plain: true; nothing sets plain: "named" or the new plain: "counts". Because the chain falls through to c.plain ? plainText(...) : String(raw), a mistyped descriptor key would quietly route the Collection Log's Error column to full plainText — the mode the PR body explicitly rejects for that column, since a failed run's error can quote a real get_ name — and every new test here would still pass, as they all call plainTextCounts directly rather than through cell(). One row in that harness with { plain: "counts" } over a key=value note would close it.

(Also, the two new lines sit one indent level shallower than the "named" arm above them, which reads as if they belong to a different nesting level than they do.)

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 — "All in wwwroot/js; the service text is unchanged" — every non-test file in the diff is under the Darling service's wwwroot/js; no producer .cs changed.
  • VERIFIED — "Lite has no web UI" — wwwroot and plain-text.js exist only under Darling; no Lite/ file references plainText.
  • VERIFIED — "drops (see databases_left_out)" — plain-text.js:376; verbatim in DarlingMcpQueryStoreClutterTools.cs:182, DarlingMcpFinOpsTools.IndexAnalysis.cs:215, CollectorRunFacts.cs:80.
  • VERIFIED — the baseline-window sentence rewrite — plain-text.js:377-380 matches DarlingMcpQueryStoreRegressionTools.cs:111 verbatim; it reaches the page as truncation_note → windowFloorStrip (util.js:415) → noticeStrip → plainText (util.js:203).
  • VERIFIED — "latest_memory_mb as 'Latest MB', the Queries tab's column label" — plain-text.js:382; label confirmed at pages/server-tabs.js:4161.
  • VERIFIED — "a negative or fractional value used to end the run and leave the whole note raw" — the pre-image =\d+ cannot cross =-12, and the surviving lone pairs (plans_rendered, plan_fetch_ms, deferred_hit) are absent from MEASUREMENT_LABELS:106-116, so the gate at :204 left each raw.
  • VERIFIED — the two count rules moved into measurementCountsText, plainTextCounts exported — plain-text.js:198-220; plainText calls it at :327, so the paths cannot drift.
  • VERIFIED — the Collection Log Error column had no plainText at all — pre-images of pages/server-tabs.js:5518 and read-fields.js:369 carry no plain key.
  • VERIFIED — "a successful run leaves its counts there, a failed run a real error" — CollectionHealthStatements.cs:120; DarlingPgStatementReader.cs:262 parses statements_dealloc=N back out of the stored column, so presentation-only is the right layer.
  • VERIFIED — "the Collectors table's Note column was already plain: true" — pages/server-tabs.js:5618.
  • VERIFIED — the three error_message surfaces now use plain: "counts" / plainTextCounts — read-fields.js:369, pages/server-tabs.js:5518, pages/collector-run.js:162; grep finds no fourth render site.
  • VERIFIED — "a lone timeout=30 stays" — the LABEL_SET gate at plain-text.js:204; TheCollectionLogMessage_SaysItsCountsInWords_AndLeavesAnErrorAlone fails if that changes.
  • VERIFIED — "'1 source(s)' reads '1 source'" — util.js:287 into plainText, whose (s) rule is plain-text.js:357.
  • UNVERIFIED — "Revert-proved: all four fail with the old files" — needs the node harness plus xunit; execution was unavailable here. Static reading is consistent for all four.
  • UNVERIFIED — "541 run, 0 failed, 1 skipped" — a test run.
  • UNVERIFIED — the Collectors Note column "checked by running plainText under node" — the descriptor is confirmed from the tree, the run is not.
  • UNVERIFIED — "Full suite and pre-push.sh not run … No live page check" — self-declared; see the checklist.
  • REFUTED — "Only that line; the other lines of an alert body (SQL, query text) are untouched." — CollectionHistoryAudit.Render (CollectionHistoryAudit.cs:424-464) appends every clause with ". " and never a newline, so this body is one line: /Retained history for .*$/gm matches first character to last and the whole detail goes through full plainText, withoutToolNames' sentence drop included. There is no other line to leave untouched.

Riskiest lines

  1. Darling/PerformanceMonitor.Darling.Service/wwwroot/js/util.js:287 — a line-scoped match over a body that is one line, so the whole audit detail is rewritten by a pipeline that deletes sentences naming a registered tool — UNCOVERED (the only test uses a two-line fixture Render cannot produce)
  2. Darling/PerformanceMonitor.Darling.Service/wwwroot/js/plain-text.js:203 — the widened pairs regex is now shared by plainText and plainTextCounts, so an over-wide match rewrites a real driver error on the Collection Log — covered by TheCollectionLogMessage_SaysItsCountsInWords_AndLeavesAnErrorAlone and ACountRunWithANegativeOrFractionalValue_StillReadsAsWords
  3. Darling/PerformanceMonitor.Darling.Service/wwwroot/js/panels.js:1320 — the new plain === "counts" arm of cell(); a mistyped key falls through to c.plain ? plainText(...), the full mode the body rejects for an error column — UNCOVERED (web-clamp-cell-harness.mjs:50 sets plain: true only; the new tests never go through cell())

Traps near this diff

  • "A test that constructs a 'four maintenance anomalies in one run' fixture is testing a shape no live run produces (#3709...). Fixtures should carry the population the engine actually emits, or say they do not." — applies — web-partial-window-harness.mjs:116-119 joins two lines and the new test asserts the second survives; Render emits one line and never a Blocked Query: line.
  • "Two copies of one definition pinned EQUAL to each other fail only after BOTH have drifted (#3684). Alias, do not copy." — applies — the sentence rules at plain-text.js:377-382 are pinned only against literals re-typed at WebPlainTextTests.cs:106-112, not against DarlingMcpQueryStoreRegressionTools.cs:111 / DarlingMcpQueryStoreClutterTools.cs:408-409.
  • "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 — plain-text.js is a Darling-web layer with no Lite counterpart (Lite/ has no wwwroot), the shared sentence is identical in both SKUs (Lite/Mcp/McpQueryTools.cs:642 = DarlingMcpQueryStoreRegressionTools.cs:111), and no reader, tool or payload changed.
  • "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 — all four new tests run the shipped JS under node and assert output (WebPlainTextTests.cs:102, :134, :149); no census added.
  • ".gitattributes says text=auto eol=crlf: a diff that touches every line of a file is a line-ending conversion until proven otherwise" — does not apply — every hunk is local (plain-text.js +38/-8, util.js +4/-1).
  • "Every MCP filter is part of the query, not a post-filter on the page (#3641)" / "A total_* assigned from a .Count (#3699)" / "A JSON number above 2^53 (#3487)" — do not apply — nothing here reads the store or shapes a payload; the MCP answers are byte-identical.

Divergence (blind read vs PR body)

Two places, both on the alert half.

  1. "Only that line" describes a guard this alert cannot use. The body and the comment at util.js:287 frame the line-scoped regex as what protects SQL and query text in the rest of a body; for this alert there is no rest, so the regex equals running plainText on the whole detail_text. Nothing is mangled today — every source name the body can carry (TimescaleSupport.HourlyAggregates minus UnauditedHourlyViews, plus the perfmon baseline view) is absent from TOOL_NAME_SET/ACTION_TOOL_SET, so withoutToolNames returns early at plain-text.js:259 — but stated scope and real scope differ, and the first colliding name deletes a sentence with nothing to catch it. The count is known in C# at CollectionHistoryAudit.cs:426 (findings.Count), where one ternary fixes it without over-reach and also reaches the e-mail, Slack and Viewer copies, all of which still read "in 1 source(s)" after this PR — a surface the body does not mention.

  2. A diff change the body does not mention: the clerk sweep is partial. memory_clerk.note is a four-way conditional (DarlingMcpQueryStoreClutterTools.cs:403-409); only the two arms naming latest_memory_mb are handled. The other two still print "No memory_clerks capture in the window…" and "memory_clerks stores the top 25 clerks over 1 MB per capture…" through the same noteKey: "qs_overhead.memory_clerk.note" (pages/server-tabs.js:2189) → noticeStrip → plainText, with no rule for memory_clerks anywhere. Those are the arms a quiet server shows, so the half left raw is the half seen more often; one line beside :382, shaped like the pg_wraparound_stats precedent at :324, closes it.

Everything else matches claim for claim, including the regex diagnosis, the three error_message surfaces, and the deliberate choice of the counts mode over full plainText for an error column.

Reviewer checklist

  • Run the suite and pre-push.sh — both marked unrun, and the four new tests shell out to node, so confirm the agent has it or they skip rather than pass.
  • Read the Server Health Collection Log Error cell on a server with a partial-failure note, for a successful run (counts in words) and a failed run (timeout=30 and any get_-looking object name intact).
  • Open the Query Store Memory Clerk panel where the clerk is below the collector's floor or has no capture, and see whether "memory_clerks" is on the page.
  • Read a real collection-history audit alert's whole detail in Alert History, then compare the same alert's e-mail/Slack body and the Viewer's copy for "in 1 source(s)".
  • Confirm the Queries tab's regressions grid still shows the baseline sentence: windowNoteText (util.js:508-513) recomposes the note and discards the server's text, baseline tail included, when window_start_utc/window_end_utc/oldest_shown_utc are present.

…6649)

The audit alert rewrite matches its own sentence, not the line (the body is one line); all four memory clerk note arms are handled; the C# sentences the page rewrites are read from their owners (one shared constant for Darling and Lite); the cell() counts mode has a behaviour test.

@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 — "util.js audit rewrite: matches the 'Retained history for ...' sentence only (to its '. ' or the end), not the line" — util.js:290, /Retained history for .*?(?:\.(?=\s)|$)/gs; CollectionHistoryAudit.Render (CollectionHistoryAudit.cs:424-464) is the sole producer and joins every clause with ". " into one line, so the new lazy match stops at the audit's own closing period. Proven by WebPartialWindowBehaviourTests.TheCollectionHistoryAuditAlert_AgreesItsSourceCount_AndKeepsEveryOtherClauseAsWritten's auditBodyWithProbe case, which appends a (see databases_left_out) clause after the sentence and asserts it prints verbatim.
  • VERIFIED — "all four memory_clerk.note arms are now handled" — DarlingMcpQueryStoreClutterTools.cs gained ClerkNoteNoCapture/ClerkNoteNeverAppeared alongside the two already-fixed arms, and plain-text.js:384-385 adds the memory_clerks capture / memory_clerks stores rewrites; WebPlainTextTests.FieldNamesInTheServicesOwnSentences_ReadAsThePagesWords now runs all four constants through the pipeline and asserts no memory_clerks survives.
  • VERIFIED — "the C#-owned sentences are read from C#... QueryStoreRegressionRules.BaselineWindowTail (new public const in Common; Darling's regressions read AND Lite's McpQueryTools now use it)" — confirmed at Lite/Mcp/McpQueryTools.cs:642 and DarlingMcpQueryStoreRegressionTools.cs:111, both now reference the one Common constant; DarlingQueryStoreRegressionsTests.cs and WebDataStartNoteTests.cs alias it too. This directly answers the traps file's "#3684: alias, do not copy" line that round 1 flagged against this exact sentence.
  • VERIFIED — "panels.js: the counts/plain arms of cell() are indented as one chain" + new behaviour test for the previously-uncovered counts arm — panels.js:1320 diff is whitespace-only; WebClampCellBehaviourTests.ACellsPlainMode_PicksItsOwnPass_CountsKeepsAToolNameInARealError drives cell() through all three plain modes plus the no-key case via web-clamp-cell-harness.mjs, and the expected strings line up with measurementCountsText/namedTokenText/withoutToolNames as written.
  • UNVERIFIED — "685 run, 0 failed, 39 skipped" and the revert-proof claim — a live test run; this tree supports only static reading, which was consistent with every test file reviewed.
  • UNVERIFIED — "Full suite and pre-push.sh not run... No live page check against a running service" — self-declared process state, not checkable read-only.

Riskiest lines

  1. Darling/PerformanceMonitor.Darling.Service/wwwroot/js/util.js:290 — the sentence-scoped regex that was round 1's top finding (a line-scoped match over a body that is actually one line) — covered by WebPartialWindowBehaviourTests.TheCollectionHistoryAuditAlert_AgreesItsSourceCount_AndKeepsEveryOtherClauseAsWritten
  2. Darling/PerformanceMonitor.Darling.Service/wwwroot/js/plain-text.js:384-385 — the two new memory_clerks rewrites, the other round-1 finding (partial clerk-note sweep) — covered by WebPlainTextTests.FieldNamesInTheServicesOwnSentences_ReadAsThePagesWords
  3. Darling/PerformanceMonitor.Darling.Service/wwwroot/js/panels.js:1320 — the plain === "counts" arm of cell(), round 1's third UNCOVERED line — covered by WebClampCellBehaviourTests.ACellsPlainMode_PicksItsOwnPass_CountsKeepsAToolNameInARealError

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, and this commit is the fix: QueryStoreRegressionRules.BaselineWindowTail replaces three re-typed literals (DarlingMcpQueryStoreRegressionTools.cs:111, Lite/Mcp/McpQueryTools.cs:642, and the two test files) with one aliased constant.
  • "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 new ACellsPlainMode_PicksItsOwnPass_CountsKeepsAToolNameInARealError runs the shipped panels.js/plain-text.js under node via web-clamp-cell-harness.mjs and asserts rendered text, not source spelling.
  • "Lite and Darling ship in parity (CONTRIBUTING's two-store rule)." — applies and holds — the shared baseline sentence is aliased in both SKUs; the memory-clerk note has no Lite counterpart to keep in parity, since Lite registers no get_query_store_clutter tool (grep -rln query_store_clutter Lite/ finds only a config-tools reference, no implementation).

Divergence (blind read vs PR body)

None — the "Round 1 fixes" section of the PR body matches the diff point for point: the sentence-scoped regex, all four clerk-note arms, the shared BaselineWindowTail/ClerkNote* constants, and the new cell() counts-mode test. The body's disclosed non-fix ("the audit alert's e-mail, Slack and Viewer copies still read 'in 1 source(s)'... the C# ternary the review suggested is not in this PR") is accurate: those surfaces never call plainText (it is Darling-web-only), so this is an acknowledged scope limit, not a regression.

Reviewer checklist

  • Run Darling.Tests' WebPlainTextTests, WebPartialWindowBehaviourTests, WebClampCellBehaviourTests, WebDataStartNoteTests and DarlingQueryStoreRegressionsTests under a real node/xunit run to confirm the 685-run / 0-failed claim and the revert-proof.
  • On a running service, open the Query Store Memory Clerk panel for a server where the clerk has no capture or never appeared, and confirm neither memory_clerks phrase reaches the page.

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

Claude posting for Erik Darling. Round 1 findings fixed; round 2 (5637290416) is LGTM.

@erikdarlingdata
erikdarlingdata enabled auto-merge (squash) October 24, 2026 07:31
@erikdarlingdata
erikdarlingdata merged commit 6a468cf into dev Oct 24, 2026
43 of 45 checks passed
@erikdarlingdata
erikdarlingdata deleted the fix/6649-web-mcp-names branch October 24, 2026 08:21
@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