fix(charts): degrade chart failures to one card and heal stale shells per version

The update poller and the chunk-error reload guard key on the target
version instead of disarming for the whole session, so a second deploy
re-arms the self-heal and a stale shell can no longer strand with
404ing chunks. Lazy chart imports retry once and mount inside a
per-card error boundary with a reload affordance — a failed chunk
degrades to one card instead of replacing the page. The JSON API
client attaches a fifteen-second timeout unless the caller brings its
own signal (the raw streaming path is exempt), chart queries surface
errors with a retry instead of rendering as an empty period, per-type
fetch failures reject instead of caching an empty series as fresh, and
the session and snapshot queries retry once on transient network or
server errors.
This commit is contained in:
Marc-André Bombeck committed 2026-06-11 21:17:27 +02:00
1 parent b346e78cc7
commit b5e799c2d6
27 files changed
+892 -89

No files matched your search

@@ -0,0 +1,50 @@
/**
* Unit tests for the version-poller reload decision.
*
* The guard is keyed on the TARGET (live) version: a repeat mismatch
* against the SAME version is suppressed (no reload loop on a misset
* server), but a SECOND deploy in one session moves the live version
* past the recorded one and the heal flow re-arms. The pre-v1.16.8
* guard disabled all polling after one attempt, which stranded stale
* shells on multi-deploy days.
*/
import { describe, expect, it } from "vitest";
import { resolveVersionPollDecision } from "../version-poller";
describe("resolveVersionPollDecision", () => {
it("is up-to-date when live matches the shell", () => {
expect(resolveVersionPollDecision("1.16.8", "1.16.8", null)).toBe(
"up-to-date",
);
});
it("is up-to-date when the live version cannot be read", () => {
expect(resolveVersionPollDecision(null, "1.16.8", null)).toBe("up-to-date");
});
it("reloads on a mismatch with no prior attempt", () => {
expect(resolveVersionPollDecision("1.16.9", "1.16.8", null)).toBe("reload");
});
it("suppresses a repeat reload for the SAME target version", () => {
expect(resolveVersionPollDecision("1.16.9", "1.16.8", "1.16.9")).toBe(
"already-attempted",
);
});
it("re-arms when a SECOND deploy moves the live version past the recorded one", () => {
expect(resolveVersionPollDecision("1.16.10", "1.16.8", "1.16.9")).toBe(
"reload",
);
});
it("treats a legacy timestamp guard value as no attempt", () => {
// Pre-v1.16.8 sessions stored `String(Date.now())`; it never matches
// a real version string, so a stranded session heals on its next poll.
expect(
resolveVersionPollDecision("1.16.9", "1.16.8", "1765400000000"),
).toBe("reload");
});
});