From 0f32873688876545c2e14e03e9c6301f2e356338 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 22:14:28 +0000 Subject: [PATCH] pm-stack: make the fragment watchdog script valid JavaScript The recovery notice used doubled quotes inside a JS string, so browsers could not parse the watchdog and a failed fragment stayed on its skeleton forever. Build the link with DOM APIs instead, and add a test that parses and runs the emitted script. Fixes #11410 Co-Authored-By: Claude Opus 5.5 --- pm-stack/aggregator/src/render.ts | 5 ++- .../test/frag-watchdog-1503.test.ts | 33 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/pm-stack/aggregator/src/render.ts b/pm-stack/aggregator/src/render.ts index cb4a2a5926..ee256d7310 100644 --- a/pm-stack/aggregator/src/render.ts +++ b/pm-stack/aggregator/src/render.ts @@ -403,7 +403,10 @@ setTimeout(function () { if (!skel) return; var p = document.createElement("p"); p.className = "frag-failed"; - p.innerHTML = "the live view did not arrive — load the full page"; + var a = document.createElement("a"); + a.href = location.pathname + "?full=1"; + a.textContent = "load the full page"; + p.append("the live view did not arrive \u2014 ", a); skel.replaceWith(p); }); }, ${FRAG_WATCHDOG_MS}); diff --git a/pm-stack/aggregator/test/frag-watchdog-1503.test.ts b/pm-stack/aggregator/test/frag-watchdog-1503.test.ts index 007dde2347..fb52cc2732 100644 --- a/pm-stack/aggregator/test/frag-watchdog-1503.test.ts +++ b/pm-stack/aggregator/test/frag-watchdog-1503.test.ts @@ -2,6 +2,7 @@ import { describe, expect, test } from "bun:test"; import { fixtureSource } from "../src/sources/fixtures.ts"; import { FRAG_WATCHDOG_MS, + FRAG_WATCHDOG_SCRIPT, renderAttentionShell, renderBoardShell, renderOverviewShell, @@ -54,4 +55,36 @@ describe("shell fragment watchdog (#1503)", () => { expect(html).toContain("frag-failed"); expect(html.indexOf('class="today-health-strip"')).toBeLessThan(html.indexOf('class="skel"')); }); + + // #11410: the shells only asserted on strings, so a quoting bug that + // made the script unparseable shipped unnoticed. Parse and run it. + test("watchdog script parses and swaps a stalled skeleton for the notice", () => { + const body = FRAG_WATCHDOG_SCRIPT.replace(/^