Skip to content

Keep a first visit's panel reads when the fleet card says the server is stale (#9220) - #9226

Merged
erikdarlingdata merged 7 commits into
devfrom
fix/9220-first-visit-aborted-reads
Nov 21, 2026
Merged

erikdarlingdata merged 7 commits into
devfrom
fix/9220-first-visit-aborted-reads

Conversation

@erikdarlingdata

@erikdarlingdata erikdarlingdata commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Claude posting for Erik Darling.

Fixes #9220

Summary

Two causes of the same symptom: a first visit to a server page sends its panel reads, then sends them all again when the server's fleet card lands, ending the reads in flight with ERR_ABORTED.

  1. Main cause, from captured browser traffic: a partial route name. The traffic showed every card online, so the offline-card restart below was not what fired. The route's server name was a partial name (an instance name without its domain), equal to neither the card's display_name nor its server_name. The panel reads went out under that name and returned 200 for the right server. When the server's own store's /api/fleet reply landed, the Web: a server page opened by a partial server name draws the panels but no header cards, status or database picker #8741 branch of the loadServerCard callback in pages/server.js stored the card under the card's own name, called history.replaceState and dispatched hashchange. That ran a whole new route render: route() in app.js called beginPageScope() (which aborts the batch), and the new render read every panel again under the card's full name. The field counts were: Overview 10 reads under the partial name then 11 under the full name with 2 aborted, Queries 7 then 28 with 4 aborted. A server whose display_name equals its route name has no rewrite and showed none of this.
  2. Found on the way: an offline card. The repaint test in the same callback compared serverIsOffline(server) with a local that starts as false on a first visit, so any card with is_online: false counted as a disagreement for every tab, and paintTabs -> redrawPanels aborted the batch. Only Running Jobs on the Activity tab words anything by that flag.

Fix

Partial name (new in this push):

  • server.js: when the card matches the route name only in part, the callback still stores the card under the card's own name and replaces the link, as Web: a server page opened by a partial server name draws the panels but no header cards, status or database picker #8741 wants. It now also checks that the batch in flight agrees with the card (the panels started before the card, the card's tab set is the one they were built on, the offline flag does not change what the tab says, and no range is waiting on the catalog). When it agrees, a one-shot hold (renameHold) is set around the synchronous hashchange. The new render takes the hold in takeRenamedBatch and keeps the grid, so the reads out are adopted. The API resolves the partial name to the same single server by the rule resolveFleetCard mirrors, so those reads are the right ones.
  • app.js: route() skips beginPageScope() while that hold is set (holdsRenamedServerRoute()). The hold is cleared in a finally right after the dispatch, so it cannot outlive that one route change. Going through hashchange and route() keeps the sidebar highlight, the scroll reset and every piece of page state consistent with a normal render under the new name.
  • When the batch does not agree (a different tab set, an offline card on the Activity tab, a range waiting on the catalog), the render is the old one: the batch is aborted and drawn again under the card's name. A card that is none or ambiguous still shows its message and reads nothing. A real navigation to another server still aborts the batch.
  • The next poll and any later tab click read with the exact name, because the page is now on the exact name (checked in the tests below).

Offline card (earlier in this PR, kept):

  • server.js: an offline flip repaints only when the tab on screen says it words something by it. Every other tab keeps its panels and the reads in flight and records the new online state.
  • server-tabs.js: the Activity tab carries readsOffline: true, so Running Jobs still draws again with the card.

Links built from a route name

Checked every place that builds a server route: the sidebar (sidebar.js serverItem) and the fleet page cards pass c.server_name || c.display_name (cardRouteName's rule). navigateServer in panels.js, compose.js and the list rows pass names that came from the store's own data. charts.js:1539, daily-calendar.js:158 and the analysis panel file (line 518) pass the server name the page was drawn with. None builds a partial name from nothing, so none needed a change. One consequence: a panel adopted from the partial-name batch keeps the partial name in its own links (for example "Open Queries tab"). Following one opens the page under the partial name, and the same card-arrival move takes it to the exact name again with its reads kept. It does not break, it just goes through the move.

Tests (FirstVisitFrontDoorBehaviourTests, harness web-first-visit-front-door-harness.mjs)

The harness runs the real app.js, util.js and Server page behind a front door of three stores, with a fetch that records signals and a wrapper on AbortController.prototype.abort. It now takes an optional list of cards so a route name can be only part of a card's name. New cases:

  • A first visit by a partial name, Overview and Queries, the card landing both after every read finished and while reads are out: zero aborted reads, zero reads sent twice, zero batch aborts, every read under the route's name, and the link ends on the card's exact name.
  • The same with an offline card on Overview (kept), and on the Activity tab (still drawn again, link on the exact name).
  • After the move, the page's own poll and a tab click read only under the exact name.
  • An ambiguous partial name starts no panel read after the card answers and leaves the link alone.
  • Opening another server after the move aborts the kept reads, none of which had answered.

Existing cases for the offline card, the control, the bare link and the real navigation are unchanged and pass.

Revert proof: with pages/server.js and app.js at the previous head (37c6dc8), 7 of the 18 tests in the class fail (the four partial-name timings, the offline partial case, the poll and tab case, and the leave case). With the change restored, 18 of 18 pass.

What the tests do not show: as the earlier body said, the harness's reads under the old code are joined by apiGetJoined, so the aborted count comes from the batch abort recorded at redrawPanels and beginPageScope, not from a browser's network log. I could not reproduce the browser's ERR_ABORTED fetches. The catalog and data-start reads under the new name are read once more by the new render (small reads, not panel reads). A range longer than the common reach that is waiting on the catalog is not adopted (the plain restart), since nothing is in flight there.

Gate

[guard-darling]    Darling.Tests  Total: 4980, Errors: 0, Failed: 0, Skipped: 0, Not Run: 0
[guard-lite]    Lite.Tests  Total: 1242, Errors: 0, Failed: 0, Skipped: 0, Not Run: 0
classes: darling 575, lite 67
GATE STOP: selection is the whole suite (darling 575, lite 67)

Classes run after the gate: FirstVisitFrontDoorBehaviourTests, ServerPageTabsTests, WebFetchLayerTests, WebChartGapBehaviourTests, WebServerPageRangeTests, WebRouteChangeAbortBehaviourTests, FrontDoorWebPagesTests, WebServerFirstReadsTests, WebServerFleetGateTests, ServerPageTitlePinTests, WebPerfmonPerSecondBehaviourTests, WebTileTruthsTests: 193 tests, 0 failed. No full suite, no Installer.Tests.

Not done

  • The second proposal in the issue (restore the strict first-visit check in ui-smoke) is not done: CI's smoke runs without a front door, and the issue's own tests ask for a three-store scenario, which this harness covers instead. smoke.mjs is unchanged.

Considered, not added

  • Updating Running Jobs in place on an offline flip instead of repainting the Activity tab: it needs a panel-level redraw hook the tab does not have, and the repaint is the existing behavior.
  • Reading the catalog and data-start only once across the move: they are small non-panel reads and the aliasing would add state to two caches for no visible gain.

Release note: Opening a server page for the first time by a partial server name, or when the server has no recent collection, no longer restarts and sends again the page's panel reads, and the link moves to the server's own name as before.

Fix round 1

Defect. The held custom range is keyed by route name. When it was held under the partial name, the panels in flight had read it, but the render under the server's own name found none (or a different one). Its picker, its later polls and the panels then disagreed. On the restart path, where the page draws afresh under the own name, the range was dropped the same way, so dev loses it there too.

Fix. In the rename step in pages/server.js the own name takes the partial name's range and the partial name lets go of it, whether or not the batch in flight is kept. The batch in flight is kept only when the own name will read the same range: the partial name's own, or, with none held there, none held under the own name either. The link carries no range, so there is nothing in the rewritten hash to bring into line.

Test. FirstVisit_ByPartialServerName_WithACustomRangeHeld_KeepsTheBatch_AndTheRangeFollowsTheMove (overview and queries) holds a live 36 hour range under the partial name, lands the card while reads are in flight, and checks zero aborted, zero sent twice, every panel read carrying the 36 hours, the picker naming "Past 36 hours", and the next poll reading the own name with the same range. ..._OnTheRestartPath_KeepsTheRange does the same for a stale server's Running Jobs tab, which draws afresh. Revert proof: with the server.js change taken out, all three fail (the picker showed "Past day" and the poll read 24 hours). The change is restored.

CI red at the previous head. Six tests failed with ReferenceError: holdsRenamedServerRoute is not defined, because the router stand-ins did not export the new hook. Fixed in web-scheduler-harness.mjs (WebRenderSettleTests) and view-folders-harness.mjs (CustomViewFoldersWebTests), each with holdsRenamedServerRoute: () => false. WebWaitsActivityTrendsPageTests.TheActivityTab_DrawsTheSessionStatsTrend failed for a different reason: its source pin looked for build: right after the Activity tab's label, and this PR put a comment and readsOffline there. Its start anchor now stops at the label line. Other stand-ins of the page modules were checked and need nothing (the others load the real pages/server.js).

Gate. GATE STOP (selection is the whole suite). Guard lines: Darling.Tests Total: 4980, Errors: 0, Failed: 0 and Lite.Tests Total: 1242, Errors: 0, Failed: 0. Classes run by hand, all green: FirstVisitFrontDoorBehaviourTests, WebRenderSettleTests, CustomViewFoldersWebTests, WebWaitsActivityTrendsPageTests, ServerPageTabsTests, WebFetchLayerTests, FrontDoorWebPagesTests, WebServerFleetGateTests, WebRouteChangeAbortBehaviourTests, WebPageRefreshIntervalBehaviourTests, WebNotebookRefreshBehaviourTests, WebChartAtTimeBehaviourTests.

…has no recent collection (#9220)

The server page starts its panel reads before the fleet card answers (#8554) and keeps them when the card agrees. A card with is_online false
counted as a disagreement for every tab, so the page aborted the batch and sent it again. Only the Activity tab words something by it (Running Jobs),
so only that tab draws again now. A first-visit harness with a front door of three stores covers it.
@erikdarlingdata
erikdarlingdata marked this pull request as ready for review November 21, 2026 06:32
Comment on lines +448 to +449
const agrees = beforeCard && !!painted && serverTabsFor(card) === painted && !(serverIsOffline(exactName) && current.tab && current.tab.readsOffline === true)
&& !!gridNode && gridKey === server + "|" + tabKey && !catalogWaits.has(server);

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 adopted batch can be read at a different range than the picker the new render draws.

customRanges is keyed by the route name (holdSpec(server, …) at :227, applyCustomRange at :250). The batch in flight was built with rangeContext() while current.server was the partial name. The render under the exact name builds its picker from customRanges.get(exactName) (rangeControl(), :700). agrees doesn't compare the two, so the grid is kept even when they differ:

  • A range already held for the exact name. The reader is on alpha.corp.test with a typed range, for example yesterday 14:00–16:00. They then follow a link built under the partial name alpha (the body notes that adopted panels keep such links). The before-card panels read at the preset, because nothing is held for alpha. When the card lands, agrees is true and the grid is kept. The picker now says yesterday 14:00–16:00 while every panel shows the last N hours. With a fixed range this lasts past the poll too: keep at :343 holds the grid on a poll over a fixed custom range, so it lasts until a manual Refresh or a tab change.
  • A range picked before the card arrives. On a slow own-store fleet read (the case this PR is about), the reader picks a range or drags across a chart. That holds it under alpha and redraws at that range. After the move, the picker shows the exact name's range (the preset) over panels read at the picked one.

Before this change the rename render always redrew, so picker and panels agreed (the range picked under the partial name was dropped, but nothing was shown wrongly).

Suggested fix: add the range to agrees, e.g. && customRanges.get(server) === customRanges.get(exactName) (both undefined in the plain first-visit case the tests cover). When they differ, the render falls back to the old full redraw. A harness case would cover it: set a custom range under the exact name, visit by the partial name, and assert the panel reads' as_of/hours match the picker's range. No current test fails on this.

claude[bot]
claude Bot previously requested changes Nov 21, 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 — route() skips beginPageScope() while the rename hold is set — app.js:337 (!holdsRenamedServerRoute()), hold exported at server.js:497
  • VERIFIED — the hold is one-shot and cleared in a finally right after the synchronous hashchange — server.js:450-455; takeRenamedBatch also clears it on take (server.js:506)
  • VERIFIED — the batch is adopted only when it started before the card, the card's tab set is the one it was built on, the offline flag doesn't change the tab's wording, and no range is waiting on the catalog — server.js:448-449
  • VERIFIED — an offline flip repaints only on a tab with readsOffline — server.js:474; on other tabs the else if (beforeCard) / else arms only record paintedOffline (server.js:477-485)
  • VERIFIED — only Running Jobs on the Activity tab words anything by ctx.offline — grep finds ctx.offline only at server-tabs.js:993 and runningJobsEmptyText (server-tabs.js:2123), and serverIsOffline has no other tab reader
  • VERIFIED — the Activity tab carries readsOffline: true — server-tabs.js:963
  • VERIFIED — a none/ambiguous card still shows its message and reads nothing — server.js:423-428 is unchanged; FirstVisit_ByAmbiguousPartialName_ReadsNothingAfterTheCard
  • VERIFIED — after the move, the poll and a tab click read under the exact name, and a real navigation aborts the kept reads — AfterThePartialNameMoves_ThePollAndATabClick_ReadByTheOwnName, LeavingForAnotherServer_AfterAPartialNameMoved_AbortsTheReadsKept
  • VERIFIED — adopted panels keep the partial name in their own links — they were built by current.tab.build(current.server = partial, …) (server.js:645) and are not rebuilt
  • VERIFIED — the catalog and data-start reads go out once more under the new name — loadServerDataStart(exactName) at server.js:349 (takeRenamedBatch copies only an answer already in), applySampleNote → serverCatalog(exactName)
  • UNVERIFIED — the field traffic counts (Overview 10 then 11 with 2 aborted, Queries 7 then 28 with 4 aborted) — needs the captured browser traffic
  • UNVERIFIED — revert proof: 7 of 18 fail at 37c6dc8, 18 of 18 pass at head — needs a Node run of the harness
  • UNVERIFIED — gate totals (Darling 4980 / Lite 1242, 0 failed) and the 193-test class run — needs a build and test run
  • REFUTED — "Going through hashchange and route() keeps … every piece of page state consistent with a normal render under the new name" — customRanges is keyed by route name (server.js:227-238, :250). The new render's picker is built from customRanges.get(exactName) (server.js:700), but the kept grid was read with customRanges.get(partial), and agrees doesn't compare them. See the inline comment on server.js:448-449.

Riskiest lines

  1. Darling/PerformanceMonitor.Darling.Service/wwwroot/js/pages/server.js:448 — agrees decides whether a batch read under another route name is adopted; it does not check the held custom range, so panels and picker can disagree — UNCOVERED (the partial-name cases set no custom range under either name)
  2. Darling/PerformanceMonitor.Darling.Service/wwwroot/js/app.js:337 — skipping beginPageScope on a route change; a leaked hold would keep a left page's reads alive — covered by FirstVisit_ByPartialServerName_KeepsThePanelBatch_AndMovesTheLinkToTheOwnName (fails if the skip is reverted) and LeavingForAnotherServer_AfterAPartialNameMoved_AbortsTheReadsKept (fails if the hold outlives the move)
  3. Darling/PerformanceMonitor.Darling.Service/wwwroot/js/pages/server.js:474 — the offline flip now repaints only on readsOffline tabs — covered by FirstVisit_OfStaleServer_KeepsThePanelBatch_AndSendsEachReadOnce (fails on the old condition) and FirstVisit_OfStaleServer_OnTheActivityTab_StillDrawsRunningJobsWithTheCard (fails if Activity stops repainting)

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 — FirstVisitFrontDoorBehaviourTests.cs runs the shipped app.js/server.js under Node through web-first-visit-front-door-harness.mjs and asserts on reads aborted and sent; no source-text assertions
  • "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" — does not apply — the change is limited to the Darling web front end (Darling/PerformanceMonitor.Darling.Service/wwwroot/js/…), and Lite has no web UI (no .js files under Lite/)
  • "A diff that touches every line of a file is a line-ending conversion until proven otherwise" — does not apply — gh pr diff 9226 shows small hunks in app.js, server-tabs.js and server.js, not whole-file rewrites

Divergence (blind read vs PR body)

  • The body says the adopted render keeps every piece of page state consistent with a normal render under the new name, and lists the cases that fall back to a redraw (tab set, offline on Activity, catalog wait). The diff does not fall back when the custom range held for the partial name differs from the one held for the exact name. In that case the picker drawn from customRanges.get(exactName) disagrees with panels read at customRanges.get(partial). With a fixed range this lasts across polls (keep at server.js:343). The body doesn't mention this case.
  • Everything else in the body matches the diff, including what it admits it doesn't do (partial-name links in adopted panels, the extra catalog and data-start reads, no smoke change).

Reviewer checklist

  • Run FirstVisitFrontDoorBehaviourTests with Node installed and confirm 18/18 pass at head and 7 fail with server.js/app.js at 37c6dc8
  • In a browser behind a three-store front door: open a server with a custom range, follow a partial-name link to it, and check that the picker and the panels show the same window after the card lands
  • Confirm in a real browser's network log that a partial-name first visit no longer shows ERR_ABORTED panel reads (the harness counts batch aborts, not fetches)

@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 — A custom range held under the partial route name moves to the exact name on a first visit, and the batch in flight is kept only when the exact name will read the same range — server.js:452-459 (partialRange, sameRange, customRanges.set/delete, and sameRange added to agrees).
  • VERIFIED — The range follows the move on the restart path too — the move runs before the agrees check, so it applies on both paths; the test is FirstVisit_ByPartialServerName_WithACustomRangeHeld_OnTheRestartPath_KeepsTheRange.
  • VERIFIED — The page-router stand-ins now know about the renamed-route hold — holdsRenamedServerRoute: () => false added in view-folders-harness.mjs:302 and web-scheduler-harness.mjs:89.
  • UNVERIFIED — The harness scenarios and tests pass — they need node and dotnet, which a read-only tree cannot run.

Riskiest lines

  1. server.js:453 — sameRange decides whether the batch in flight is kept or restarted — covered by FirstVisit_ByPartialServerName_WithACustomRangeHeld_KeepsTheBatch_AndTheRangeFollowsTheMove (overview, queries), which fails if the batch is aborted or reads the preset.
  2. server.js:455-456 — the range moves to the exact name and the partial name lets go — covered by the same test's afterPoll hours assertions (the page's next poll under the own name must still carry 36 hours).
  3. WebWaitsActivityTrendsPageTests.cs:43 — the Between anchor was loosened — this is a source-text test, so it is not coverage. It is not a defect either: it only keeps the test finding the Activity tab block.

Traps near this diff

  • None of the traps I checked applies — the change is client JS plus test harness stand-ins, with no SQL, collector or schema change. I did not re-read .github/REVIEW-TRAPS.md in full for this light pass.

Divergence (blind read vs PR body)

None found. This range is the custom-range follow-through for #9220; the stand-in updates, the new harness scenario and the tests match the commit messages. The large remainder of the range diff (attention compression, QS hash index, TimescaleSupport and so on) comes from the merges of dev and is not the author's change, so I left it alone.

Reviewer checklist

  • Run web-first-visit-front-door-harness.mjs through FirstVisitFrontDoorBehaviourTests and the view-folders and scheduler harnesses under node.

@github-actions
github-actions Bot dismissed claude[bot]’s stale review November 21, 2026 06:57

Superseded by claude[bot]'s LGTM on 223fea6: #9226 (review)

@erikdarlingdata
erikdarlingdata merged commit 32bfdaa into dev Nov 21, 2026
19 checks passed
@erikdarlingdata
erikdarlingdata deleted the fix/9220-first-visit-aborted-reads branch November 21, 2026 07:17
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