Repository navigation
Keep a first visit's panel reads when the fleet card says the server is stale (#9220) - #9226
Conversation
…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.
… name moves to the server's own name (#9220)
| const agrees = beforeCard && !!painted && serverTabsFor(card) === painted && !(serverIsOffline(exactName) && current.tab && current.tab.readsOffline === true) | ||
| && !!gridNode && gridKey === server + "|" + tabKey && !catalogWaits.has(server); |
There was a problem hiding this comment.
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.testwith a typed range, for example yesterday 14:00–16:00. They then follow a link built under the partial namealpha(the body notes that adopted panels keep such links). The before-card panels read at the preset, because nothing is held foralpha. When the card lands,agreesis 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:keepat :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
alphaand 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.
There was a problem hiding this comment.
Verdict: CHANGES REQUESTED
Claims
- VERIFIED —
route()skipsbeginPageScope()while the rename hold is set —app.js:337(!holdsRenamedServerRoute()), hold exported atserver.js:497 - VERIFIED — the hold is one-shot and cleared in a
finallyright after the synchronoushashchange—server.js:450-455;takeRenamedBatchalso 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 theelse if (beforeCard)/elsearms only recordpaintedOffline(server.js:477-485) - VERIFIED — only Running Jobs on the Activity tab words anything by
ctx.offline— grep findsctx.offlineonly atserver-tabs.js:993andrunningJobsEmptyText(server-tabs.js:2123), andserverIsOfflinehas no other tab reader - VERIFIED — the Activity tab carries
readsOffline: true—server-tabs.js:963 - VERIFIED — a
none/ambiguouscard still shows its message and reads nothing —server.js:423-428is 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)atserver.js:349(takeRenamedBatchcopies 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
hashchangeandroute()keeps … every piece of page state consistent with a normal render under the new name" —customRangesis keyed by route name (server.js:227-238,:250). The new render's picker is built fromcustomRanges.get(exactName)(server.js:700), but the kept grid was read withcustomRanges.get(partial), andagreesdoesn't compare them. See the inline comment onserver.js:448-449.
Riskiest lines
- Darling/PerformanceMonitor.Darling.Service/wwwroot/js/pages/server.js:448 —
agreesdecides 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) - Darling/PerformanceMonitor.Darling.Service/wwwroot/js/app.js:337 — skipping
beginPageScopeon 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) - Darling/PerformanceMonitor.Darling.Service/wwwroot/js/pages/server.js:474 — the offline flip now repaints only on
readsOfflinetabs — 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.csruns the shippedapp.js/server.jsunder Node throughweb-first-visit-front-door-harness.mjsand 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.jsfiles underLite/) - "A diff that touches every line of a file is a line-ending conversion until proven otherwise" — does not apply —
gh pr diff 9226shows small hunks inapp.js,server-tabs.jsandserver.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 atcustomRanges.get(partial). With a fixed range this lasts across polls (keepatserver.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
FirstVisitFrontDoorBehaviourTestswith Node installed and confirm 18/18 pass at head and 7 fail withserver.js/app.jsat 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)
There was a problem hiding this comment.
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, andsameRangeadded toagrees). - VERIFIED — The range follows the move on the restart path too — the move runs before the
agreescheck, so it applies on both paths; the test isFirstVisit_ByPartialServerName_WithACustomRangeHeld_OnTheRestartPath_KeepsTheRange. - VERIFIED — The page-router stand-ins now know about the renamed-route hold —
holdsRenamedServerRoute: () => falseadded 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
- server.js:453 —
sameRangedecides whether the batch in flight is kept or restarted — covered byFirstVisit_ByPartialServerName_WithACustomRangeHeld_KeepsTheBatch_AndTheRangeFollowsTheMove(overview, queries), which fails if the batch is aborted or reads the preset. - server.js:455-456 — the range moves to the exact name and the partial name lets go — covered by the same test's
afterPollhours assertions (the page's next poll under the own name must still carry 36 hours). - 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.mdin 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.
Superseded by claude[bot]'s LGTM on 223fea6: #9226 (review)
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.
display_namenor itsserver_name. The panel reads went out under that name and returned 200 for the right server. When the server's own store's/api/fleetreply 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 theloadServerCardcallback inpages/server.jsstored the card under the card's own name, calledhistory.replaceStateand dispatchedhashchange. That ran a whole new route render:route()inapp.jscalledbeginPageScope()(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 whosedisplay_nameequals its route name has no rewrite and showed none of this.serverIsOffline(server)with a local that starts asfalseon a first visit, so any card withis_online: falsecounted as a disagreement for every tab, andpaintTabs->redrawPanelsaborted 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 synchronoushashchange. The new render takes the hold intakeRenamedBatchand keeps the grid, so the reads out are adopted. The API resolves the partial name to the same single server by the ruleresolveFleetCardmirrors, so those reads are the right ones.app.js:route()skipsbeginPageScope()while that hold is set (holdsRenamedServerRoute()). The hold is cleared in afinallyright after the dispatch, so it cannot outlive that one route change. Going throughhashchangeandroute()keeps the sidebar highlight, the scroll reset and every piece of page state consistent with a normal render under the new name.noneorambiguousstill shows its message and reads nothing. A real navigation to another server still aborts the batch.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 carriesreadsOffline: 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.jsserverItem) and the fleet page cards passc.server_name || c.display_name(cardRouteName's rule).navigateServerinpanels.js,compose.jsand the list rows pass names that came from the store's own data.charts.js:1539,daily-calendar.js:158and 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, harnessweb-first-visit-front-door-harness.mjs)The harness runs the real
app.js,util.jsand Server page behind a front door of three stores, with a fetch that records signals and a wrapper onAbortController.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:Existing cases for the offline card, the control, the bare link and the real navigation are unchanged and pass.
Revert proof: with
pages/server.jsandapp.jsat 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 atredrawPanelsandbeginPageScope, 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
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
smoke.mjsis unchanged.Considered, not added
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.jsthe 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_KeepsTheRangedoes the same for a stale server's Running Jobs tab, which draws afresh. Revert proof: with theserver.jschange 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 inweb-scheduler-harness.mjs(WebRenderSettleTests) andview-folders-harness.mjs(CustomViewFoldersWebTests), each withholdsRenamedServerRoute: () => false.WebWaitsActivityTrendsPageTests.TheActivityTab_DrawsTheSessionStatsTrendfailed for a different reason: its source pin looked forbuild:right after the Activity tab's label, and this PR put a comment andreadsOfflinethere. 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 realpages/server.js).Gate.
GATE STOP(selection is the whole suite). Guard lines:Darling.Tests Total: 4980, Errors: 0, Failed: 0andLite.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.