From 2a473086cf6cd1d245e014ed56ed44f9594038cd Mon Sep 17 00:00:00 2001 From: ZverGuy Date: Wed, 4 Nov 2026 19:11:05 +0700 Subject: [PATCH] fix(dashboard): advise a shorter range unless the proxy already did Any "; " in a 422 message was taken as the proxy's own remedy, but the proxy passes vmselect's 422 bodies through, and their advice (raise the -search.max* flags) is for operators. Those lost the one thing a tenant can do. Only the remedies the proxy itself appends now replace the console's advice. Assisted-by: LLM Signed-off-by: ZverGuy --- .../src/components/observability/ProxyNotice.test.tsx | 7 +++++++ .../src/components/observability/ProxyNotice.tsx | 10 ++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/system/dashboard/images/console/apps/console/src/components/observability/ProxyNotice.test.tsx b/packages/system/dashboard/images/console/apps/console/src/components/observability/ProxyNotice.test.tsx index 6e85ced33..c4b4e89c1 100644 --- a/packages/system/dashboard/images/console/apps/console/src/components/observability/ProxyNotice.test.tsx +++ b/packages/system/dashboard/images/console/apps/console/src/components/observability/ProxyNotice.test.tsx @@ -38,6 +38,13 @@ describe("ProxyNotice", () => { expect(screen.getByRole("alert").textContent).toBe(`${message}.`) }) + it("still advises a shorter range for a store limit whose own advice is for operators", () => { + const message = "the number of matching timeseries exceeds 300000; either narrow down the search or increase -search.max* command-line flag values" + render() + + expect(screen.getByRole("alert").textContent).toBe(`${message}. Choose a shorter range.`) + }) + it("shows the server message for a rejected query", () => { render() diff --git a/packages/system/dashboard/images/console/apps/console/src/components/observability/ProxyNotice.tsx b/packages/system/dashboard/images/console/apps/console/src/components/observability/ProxyNotice.tsx index ee68e4633..1fb30c8ff 100644 --- a/packages/system/dashboard/images/console/apps/console/src/components/observability/ProxyNotice.tsx +++ b/packages/system/dashboard/images/console/apps/console/src/components/observability/ProxyNotice.tsx @@ -5,6 +5,10 @@ interface ProxyNoticeProps { error: unknown } +// Remedies the observability proxy itself appends; vmselect's 422 text carries +// advice for operators (raise -search.max* flags), so it still gets ours. +const PROXY_REMEDIES = ["; use a shorter range", "; raise step"] + function describe(what: ProxyNoticeProps["what"], error: unknown): { quiet: boolean; text: string } { const lower = what.toLowerCase() if (!(error instanceof ProxyError)) { @@ -20,8 +24,10 @@ function describe(what: ProxyNoticeProps["what"], error: unknown): { quiet: bool case "forbidden": return { quiet: false, text: `You do not have permission to read ${lower} here.` } case "limit": - // The proxy puts its own remedy after "; " (e.g. "use a shorter range", "raise step"). - return { quiet: false, text: error.message.includes("; ") ? `${error.message}.` : `${error.message}. Choose a shorter range.` } + return { + quiet: false, + text: PROXY_REMEDIES.some((r) => error.message.endsWith(r)) ? `${error.message}.` : `${error.message}. Choose a shorter range.`, + } case "rate-limited": return { quiet: false, text: "Too many requests. Try again in a moment." } case "timeout":