From ff7d8176034ff06d1d8c4c1d96d6b54cf7193c4a Mon Sep 17 00:00:00 2001 From: zipg Date: Tue, 29 Sep 2026 12:23:56 +0800 Subject: [PATCH] fix(desktop): add legacy engine startup compatibility notice --- apps/desktop/index.html | 403 ++++++++++++++++++ .../engineCompatNotice.render.spec.ts | 271 ++++++++++++ .../src/__tests__/engineCompatNotice.spec.ts | 87 ++++ .../src/__tests__/startupInputGuard.spec.ts | 7 +- apps/desktop/src/lib/startup/startupTiming.ts | 2 +- .../lib/ui/__tests__/legacyWebView.spec.ts | 48 ++- apps/desktop/src/lib/ui/legacyWebView.ts | 43 ++ apps/desktop/src/main.ts | 12 +- 8 files changed, 869 insertions(+), 4 deletions(-) create mode 100644 apps/desktop/src/__tests__/engineCompatNotice.render.spec.ts create mode 100644 apps/desktop/src/__tests__/engineCompatNotice.spec.ts diff --git a/apps/desktop/index.html b/apps/desktop/index.html index 7a3e0a59c0..da70d59a60 100644 --- a/apps/desktop/index.html +++ b/apps/desktop/index.html @@ -125,6 +125,409 @@ Loading… + diff --git a/apps/desktop/src/__tests__/engineCompatNotice.render.spec.ts b/apps/desktop/src/__tests__/engineCompatNotice.render.spec.ts new file mode 100644 index 0000000000..f4a6cd5383 --- /dev/null +++ b/apps/desktop/src/__tests__/engineCompatNotice.render.spec.ts @@ -0,0 +1,271 @@ +// The notice is the only thing a user with an unusable shell ever sees, so its behaviour matters +// as much as its copy: which engines gate, which only get a banner, how often each comes back, +// and that dismissing one can never silence the other. These tests run the real inline script from +// index.html against stubbed engine capabilities instead of asserting on its source text. + +import { readFileSync } from "node:fs"; +import vm from "node:vm"; +import { describe, expect, it } from "vitest"; + +const indexHtml = readFileSync(new URL("../../index.html", import.meta.url), "utf8"); +const openTag = indexHtml.indexOf("", openTag)); + +const SAFARI_15_2_UA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Safari/605.1.15"; +const SAFARI_16_2_UA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15"; +const CHROME_UA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"; +const WINDOWS_UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"; + +type Capabilities = { + layer: boolean; + oklch: boolean; + colorMix: boolean; + mediaRange: boolean; + has: boolean; + focusVisible: boolean; +}; + +// Capability sets of the engines this notice exists for. +const SAFARI_15_2: Capabilities = { layer: false, oklch: false, colorMix: false, mediaRange: false, has: false, focusVisible: false }; +const SAFARI_16_2: Capabilities = { layer: true, oklch: true, colorMix: true, mediaRange: false, has: true, focusVisible: true }; +// Chromium 109: the last engine some fixed-runtime desktop builds can ever ship. +const CHROMIUM_109: Capabilities = { layer: true, oklch: false, colorMix: false, mediaRange: true, has: true, focusVisible: true }; +const CHROME_120: Capabilities = { layer: true, oklch: true, colorMix: true, mediaRange: true, has: true, focusVisible: true }; + +class FakeElement { + tagName: string; + style: Record = {}; + textContent = ""; + parentNode: FakeElement | null = null; + children: FakeElement[] = []; + attributes: Record = {}; + classList = { contains: () => false, add: () => {}, remove: () => {}, toggle: () => false }; + + constructor(tagName: string) { + this.tagName = tagName; + } + + appendChild(node: FakeElement): FakeElement { + node.parentNode = this; + this.children.push(node); + return node; + } + + removeChild(node: FakeElement): FakeElement { + const index = this.children.indexOf(node); + if (index >= 0) this.children.splice(index, 1); + node.parentNode = null; + return node; + } + + remove(): void { + this.parentNode?.removeChild(this); + } + + setAttribute(name: string, value: string): void { + this.attributes[name] = String(value); + } + + getAttribute(name: string): string | null { + return name in this.attributes ? this.attributes[name] : null; + } + + removeAttribute(name: string): void { + delete this.attributes[name]; + } + + addEventListener(): void {} + removeEventListener(): void {} +} + +function textOf(node: FakeElement): string { + return [node.textContent, ...node.children.map(textOf)].join(" "); +} + +function storageStub(initial: Record = {}) { + const values: Record = { ...initial }; + return { + values, + getItem: (key: string) => (key in values ? values[key] : null), + setItem: (key: string, value: string) => { + values[key] = String(value); + }, + }; +} + +type ProbeOptions = { + capabilities: Capabilities; + userAgent: string; + desktop?: boolean; + session?: Record; + local?: Record; + search?: string; + platform?: string; +}; + +function runProbe(options: ProbeOptions) { + const documentElement = new FakeElement("html"); + const head = new FakeElement("head"); + const body = new FakeElement("body"); + const session = storageStub(options.session); + const local = storageStub(options.local); + + const windowStub: Record = { + location: { search: options.search ?? "", reload: () => {} }, + sessionStorage: session, + localStorage: local, + matchMedia: (query: string) => ({ + matches: options.capabilities.mediaRange && /[<>]=?/.test(query), + media: query, + addEventListener: () => {}, + removeEventListener: () => {}, + }), + getComputedStyle: () => ({ + getPropertyValue: (name: string) => (name === "--dbx-layer-probe" && options.capabilities.layer ? "1" : ""), + }), + addEventListener: () => {}, + dispatchEvent: () => {}, + }; + if (options.desktop) windowStub.__TAURI_INTERNALS__ = {}; + + const context = vm.createContext({ + window: windowStub, + document: { + documentElement, + head, + body, + createElement: (tag: string) => new FakeElement(tag), + querySelector: () => null, + getElementById: () => null, + addEventListener: () => {}, + }, + navigator: { + userAgent: options.userAgent, + platform: options.platform ?? "MacIntel", + languages: ["zh-CN"], + language: "zh-CN", + }, + CSS: { + supports: (first: string, second?: string) => { + if (second === undefined) { + const condition = String(first); + if (condition.includes("selector(:has")) return options.capabilities.has; + if (condition.includes("selector(:focus-visible")) return options.capabilities.focusVisible; + return true; + } + const value = String(second); + if (value.includes("oklch")) return options.capabilities.oklch; + if (value.includes("color-mix")) return options.capabilities.colorMix; + return true; + }, + }, + console: { warn: () => {}, log: () => {} }, + URLSearchParams, + }); + + vm.runInContext(PROBE_SOURCE, context, { filename: "index.html#dbx-compat-probe" }); + + const report = windowStub.__DBX_WEBVIEW_COMPAT__ as { + tier: string; + missing: string[]; + engine: string; + bypassed: boolean; + }; + const notices = body.children.filter((child) => "data-dbx-compat-gate" in child.attributes || "data-dbx-compat-banner" in child.attributes); + return { + tier: report.tier, + missing: report.missing, + engine: report.engine, + bypassed: report.bypassed, + recorded: documentElement.attributes["data-dbx-compat"] ?? null, + notice: notices.length === 0 ? "none" : "data-dbx-compat-gate" in notices[0].attributes ? "gate" : "banner", + noticeText: notices.length === 0 ? "" : textOf(notices[0]), + session: session.values, + local: local.values, + }; +} + +describe("engine compatibility notice rendering", () => { + it("gates an engine whose whole layered stylesheet would be dropped", () => { + const result = runProbe({ capabilities: SAFARI_15_2, userAgent: SAFARI_15_2_UA, desktop: true }); + expect(result.tier).toBe("fatal"); + expect(result.notice).toBe("gate"); + expect(result.recorded).toBe("fatal"); + expect(result.missing).toEqual(["layer", "oklch", "color-mix", "media-query-range", "has-selector", "focus-visible"]); + expect(result.noticeText).toContain("12.7.6"); + expect(result.noticeText).toContain("Safari 17.6"); + }); + + it("only banners an engine that still renders the shell", () => { + const result = runProbe({ capabilities: SAFARI_16_2, userAgent: SAFARI_16_2_UA }); + expect(result.tier).toBe("degraded"); + expect(result.notice).toBe("banner"); + expect(result.missing).toEqual(["media-query-range"]); + }); + + it("banners instead of gating a fixed Chromium-109 webview that lacks the color functions", () => { + // @layer works, so the stylesheet is not dropped wholesale — only color + // declarations are. Blocking every launch of such a build would be + // un-actionable: the runtime is fixed and can never be updated. + const result = runProbe({ capabilities: CHROMIUM_109, userAgent: WINDOWS_UA, desktop: true }); + expect(result.tier).toBe("degraded"); + expect(result.notice).toBe("banner"); + expect(result.missing).toEqual(["oklch", "color-mix"]); + }); + + it("names exactly what to upgrade instead of a bare 'update it'", () => { + const mac = runProbe({ capabilities: SAFARI_16_2, userAgent: SAFARI_16_2_UA, desktop: true }); + expect(mac.noticeText).toContain("把 Safari 升级到最新版"); + + const web = runProbe({ capabilities: SAFARI_16_2, userAgent: SAFARI_16_2_UA }); + expect(web.noticeText).toContain("把浏览器升级到最新版本"); + + // Windows/Linux desktop clients ship their own WebView, so the fix is the operating system. + const windowsDesktop = runProbe({ + capabilities: SAFARI_16_2, + userAgent: WINDOWS_UA, + platform: "Win32", + desktop: true, + }); + expect(windowsDesktop.noticeText).toContain("升级操作系统以更新系统内置的 WebView"); + expect(windowsDesktop.noticeText).not.toContain("Safari"); + }); + + it("re-asks the gate every session but remembers a dismissed banner", () => { + expect(runProbe({ capabilities: SAFARI_15_2, userAgent: SAFARI_15_2_UA, desktop: true }).notice).toBe("gate"); + expect(runProbe({ capabilities: SAFARI_15_2, userAgent: SAFARI_15_2_UA, desktop: true, session: {} }).notice).toBe("gate"); + + const bypassed = runProbe({ capabilities: SAFARI_15_2, userAgent: SAFARI_15_2_UA, desktop: true, session: { "dbx-compat-bypass": "1" } }); + expect(bypassed.notice).toBe("none"); + expect(bypassed.tier).toBe("fatal"); + expect(bypassed.bypassed).toBe(true); + + const dismissed = runProbe({ capabilities: SAFARI_16_2, userAgent: SAFARI_16_2_UA, local: { "dbx-compat-banner-dismissed": "1" } }); + expect(dismissed.notice).toBe("none"); + expect(dismissed.tier).toBe("degraded"); + }); + + it("never lets a dismissed banner silence the blocking gate", () => { + const result = runProbe({ + capabilities: SAFARI_15_2, + userAgent: SAFARI_15_2_UA, + desktop: true, + local: { "dbx-compat-banner-dismissed": "1" }, + }); + expect(result.tier).toBe("fatal"); + expect(result.notice).toBe("gate"); + }); + + it("stays out of the way on an engine that renders the shell", () => { + const result = runProbe({ capabilities: CHROME_120, userAgent: CHROME_UA, desktop: true }); + expect(result.tier).toBe("ok"); + expect(result.notice).toBe("none"); + expect(result.recorded).toBe("ok"); + }); + + it("fails open when the probe itself throws", () => { + const result = runProbe({ capabilities: CHROME_120, userAgent: CHROME_UA, search: "?dbx-compat=reset" }); + expect(result.tier).toBe("ok"); + expect(result.notice).toBe("none"); + }); +}); diff --git a/apps/desktop/src/__tests__/engineCompatNotice.spec.ts b/apps/desktop/src/__tests__/engineCompatNotice.spec.ts new file mode 100644 index 0000000000..1ee939b8a9 --- /dev/null +++ b/apps/desktop/src/__tests__/engineCompatNotice.spec.ts @@ -0,0 +1,87 @@ +// The compatibility notice in index.html has to render on engines whose entire `@layer` output +// is discarded, so its styling and its probe order are load-bearing and easy to break by +// accident. These assertions pin the parts a browser test cannot: that the notice runs before +// the bundle, that it never depends on anything the broken engine would drop, and that the copy +// still tells each kind of user how to fix it. + +import { readFileSync } from "node:fs"; +import { describe, expect, it } from "vitest"; + +const indexHtml = readFileSync(new URL("../../index.html", import.meta.url), "utf8"); + +function probeScriptSource(): string { + const start = indexHtml.indexOf("", start)); +} + +describe("engine compatibility notice", () => { + const script = probeScriptSource(); + + it("runs before the app bundle so a broken shell is never painted first", () => { + expect(indexHtml.indexOf("data-dbx-compat-probe")).toBeLessThan(indexHtml.indexOf('src="/src/main.ts"')); + }); + + it("styles the notice with inline styles only", () => { + // `@layer` blocks are dropped wholesale by the engines this notice targets, and the design + // tokens live in `@layer theme`. Production CSS also rewrites `min-width` media queries into + // range syntax those engines cannot parse. Inline styles avoid all three hazards. + expect(script).toContain("style.cssText"); + expect(script).not.toContain("var(--"); + expect(script).not.toContain("@media"); + }); + + it("probes every capability the layered stylesheet depends on", () => { + for (const probe of ["layer", "oklch", "color-mix", "media-query-range", "has-selector", "focus-visible"]) { + expect(script).toContain(`["${probe}"`); + } + }); + + it("separates a blocking failure from a degraded one", () => { + expect(script).toContain("FATAL_PROBES"); + expect(script).toContain("DEGRADED_PROBES"); + // Only a missing @layer discards the stylesheet wholesale; engines that keep + // @layer but lack the color functions still render and get the banner tier. + // This keeps fixed Chromium-109-based webview builds below the blocking gate. + expect(script).toContain('missingFatal.includes("layer")'); + expect(script).toContain('const missingColors = missingFatal.filter((name) => name !== "layer");'); + expect(script).toContain("missingColors.length || missingDegraded.length"); + }); + + it("fails open when the probe itself throws", () => { + expect(script).toContain("catch (error)"); + expect(script).toContain('report.tier = "ok";'); + }); + + it("publishes the verdict for the bundle and for support", () => { + expect(script).toContain("window.__DBX_WEBVIEW_COMPAT__ = report"); + expect(script).toContain('"dbx-compat"'); + expect(script).toContain("dbx-compat-bypass"); + }); + + it("routes each audience to the upgrade that actually fixes it", () => { + // Desktop users cannot update a browser, and browser users cannot update WebKit. + expect(script).toContain("12.7.6"); + expect(script).toContain("Safari 17.6"); + expect(script).toContain("Chrome、Edge、Firefox、Safari"); + expect(script).toContain("Update your browser to the latest version"); + }); + + it("names the thing to upgrade in the degraded banner", () => { + // "建议升级后使用" was ambiguous: upgrade DBX, macOS, or Safari? + expect(script).not.toContain("建议升级后使用"); + for (const key of ["macBanner", "desktopBanner", "webBanner"]) { + // Every language carries its own copy, and the picker chooses between them. + expect(script.split(key + ":").length - 1).toBe(3); + } + expect(script).toContain("const bannerText = mac ? copy.macBanner : report.desktop ? copy.desktopBanner : copy.webBanner;"); + }); + + it("records the verdict for support and keeps the two notices independent", () => { + expect(script).toContain('document.documentElement.setAttribute("data-dbx-compat", report.tier)'); + expect(script).toContain('report.tier !== "ok" && !report.bypassed'); + // Dismissing the advisory banner must not silence the blocking gate. + expect(script).toContain('const dismissedDegraded = report.tier === "degraded" && storage("localStorage", BANNER_KEY) === "1"'); + expect(script).toContain("!report.bypassed && !dismissedDegraded"); + }); +}); diff --git a/apps/desktop/src/__tests__/startupInputGuard.spec.ts b/apps/desktop/src/__tests__/startupInputGuard.spec.ts index 0ffbb87d68..5a494d6bec 100644 --- a/apps/desktop/src/__tests__/startupInputGuard.spec.ts +++ b/apps/desktop/src/__tests__/startupInputGuard.spec.ts @@ -33,6 +33,11 @@ describe("startup input guard", () => { it("installs before the application module and is released after mount", () => { expect(indexSource.indexOf("data-dbx-startup-input-guard")).toBeLessThan(indexSource.indexOf('src="/src/main.ts"')); - expect(mainSource.indexOf('app.mount("#root")')).toBeLessThan(mainSource.indexOf('window.dispatchEvent(new Event("dbx:startup-ready"))')); + + // The engine-compatibility gate releases the guard earlier on the blocked path, so search + // for the release that belongs to mounting instead of the first one in the file. + const mountIndex = mainSource.indexOf('app.mount("#root")'); + expect(mountIndex).toBeGreaterThan(-1); + expect(mainSource.indexOf('window.dispatchEvent(new Event("dbx:startup-ready"))', mountIndex)).toBeGreaterThan(mountIndex); }); }); diff --git a/apps/desktop/src/lib/startup/startupTiming.ts b/apps/desktop/src/lib/startup/startupTiming.ts index ccff071627..af8ef2c62b 100644 --- a/apps/desktop/src/lib/startup/startupTiming.ts +++ b/apps/desktop/src/lib/startup/startupTiming.ts @@ -1,4 +1,4 @@ -export type StartupPhase = "bootstrap" | "gate-mounted" | "locale-ready" | "auth-ready" | "migration-ready" | "app-mounted" | "settings-ready" | "connections-ready" | "tabs-restored"; +export type StartupPhase = "bootstrap" | "compat-blocked" | "gate-mounted" | "locale-ready" | "auth-ready" | "migration-ready" | "app-mounted" | "settings-ready" | "connections-ready" | "tabs-restored"; export function markStartupPhase(phase: StartupPhase): void { const name = `dbx:startup:${phase}`; diff --git a/apps/desktop/src/lib/ui/__tests__/legacyWebView.spec.ts b/apps/desktop/src/lib/ui/__tests__/legacyWebView.spec.ts index dcbea6dda4..bd03560032 100644 --- a/apps/desktop/src/lib/ui/__tests__/legacyWebView.spec.ts +++ b/apps/desktop/src/lib/ui/__tests__/legacyWebView.spec.ts @@ -1,7 +1,7 @@ // @vitest-environment happy-dom import { afterEach, describe, expect, it, vi } from "vitest"; -import { applyLegacyWebViewClass, isLegacyWebView, LEGACY_WEBVIEW_CLASS, missingLegacyWebViewCapabilities, supportsRegExpLookbehind } from "@/lib/ui/legacyWebView"; +import { applyLegacyWebViewClass, isBlockingCompatFailure, isLegacyWebView, LEGACY_WEBVIEW_CLASS, missingLegacyWebViewCapabilities, supportsRegExpLookbehind, webViewCompatReport } from "@/lib/ui/legacyWebView"; const supportedFeatures = new Set(["oklch", "color-mix-oklab", "color-mix-oklch", "has-selector", "dynamic-viewport", "min-function", "media-query-range"]); @@ -85,6 +85,52 @@ describe("legacy WebView detection", () => { }); }); +describe("inline engine probe report", () => { + const setReport = (report: unknown) => { + (window as unknown as Record).__DBX_WEBVIEW_COMPAT__ = report; + }; + + afterEach(() => { + delete (window as unknown as Record).__DBX_WEBVIEW_COMPAT__; + }); + + it("prefers the verdict the probe recorded before the bundle loaded", () => { + setReport({ tier: "fatal", missing: ["layer"], engine: "Safari 15.2", platform: "macos", desktop: true, bypassed: false }); + + expect(webViewCompatReport()?.engine).toBe("Safari 15.2"); + expect(isLegacyWebView()).toBe(true); + expect(missingLegacyWebViewCapabilities()).toEqual(["layer"]); + }); + + it("treats a clean report as a supported engine", () => { + setReport({ tier: "ok", missing: [], engine: "Safari 17.6", platform: "macos", desktop: true, bypassed: false }); + + expect(isLegacyWebView()).toBe(false); + expect(missingLegacyWebViewCapabilities()).toEqual([]); + }); + + it("ignores a malformed report and falls back to probing", () => { + mockCssSupports(supportedFeatures); + setReport({ tier: "ok" }); + + expect(webViewCompatReport()).toBeUndefined(); + expect(missingLegacyWebViewCapabilities()).toEqual([]); + }); + + it("blocks startup only on a fatal engine the user did not choose to continue past", () => { + expect(isBlockingCompatFailure()).toBe(false); + + setReport({ tier: "degraded", missing: ["media-query-range"], engine: "", platform: "web", desktop: false, bypassed: false }); + expect(isBlockingCompatFailure()).toBe(false); + + setReport({ tier: "fatal", missing: ["layer"], engine: "", platform: "macos", desktop: true, bypassed: false }); + expect(isBlockingCompatFailure()).toBe(true); + + setReport({ tier: "fatal", missing: ["layer"], engine: "", platform: "macos", desktop: true, bypassed: true }); + expect(isBlockingCompatFailure()).toBe(false); + }); +}); + describe("supportsRegExpLookbehind", () => { it("reports support when the engine compiles lookbehind patterns", () => { expect(supportsRegExpLookbehind()).toBe(true); diff --git a/apps/desktop/src/lib/ui/legacyWebView.ts b/apps/desktop/src/lib/ui/legacyWebView.ts index dcb3f4bc88..f3b0ff2ae6 100644 --- a/apps/desktop/src/lib/ui/legacyWebView.ts +++ b/apps/desktop/src/lib/ui/legacyWebView.ts @@ -1,5 +1,28 @@ export const LEGACY_WEBVIEW_CLASS = "dbx-legacy-webview"; +/** + * Verdict recorded by the inline probe in index.html, which runs before this bundle loads. + * Reading it keeps a single source of truth, so the "upgrade your engine" notice and the + * `dbx-legacy-webview` fallback layer can never disagree. Unlike the probes below, the inline + * one also covers `@layer`, which is what decides whether the shell can be styled at all. + */ +export type WebViewCompatTier = "ok" | "degraded" | "fatal"; + +export interface WebViewCompatReport { + tier: WebViewCompatTier; + missing: string[]; + engine: string; + platform: string; + desktop: boolean; + bypassed: boolean; +} + +declare global { + interface Window { + __DBX_WEBVIEW_COMPAT__?: WebViewCompatReport; + } +} + type CssSupportCheck = { name: string; property?: string; @@ -39,10 +62,30 @@ function supports(check: CssSupportCheck): boolean { } } +export function webViewCompatReport(): WebViewCompatReport | undefined { + if (typeof window === "undefined") return undefined; + const report = window.__DBX_WEBVIEW_COMPAT__; + if (!report || typeof report.tier !== "string" || !Array.isArray(report.missing)) return undefined; + return report; +} + export function missingLegacyWebViewCapabilities(): string[] { + const report = webViewCompatReport(); + if (report) return [...report.missing]; + return MODERN_CSS_FEATURES.filter((feature) => !supports(feature)).map((feature) => feature.name); } +/** + * True when the startup notice is blocking the app: the engine drops the whole layered + * stylesheet, so mounting the shell would replace a readable message with an unstyled UI. + * A user who chose "continue anyway" is not blocked again until the next session. + */ +export function isBlockingCompatFailure(): boolean { + const report = webViewCompatReport(); + return report?.tier === "fatal" && report.bypassed !== true; +} + /** * Old WebKit (Safari < 16.4) throws SyntaxError when compiling regular * expressions with lookbehind or the named-group shapes Shiki's JavaScript diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts index 4e8d733763..7e41931288 100644 --- a/apps/desktop/src/main.ts +++ b/apps/desktop/src/main.ts @@ -4,7 +4,7 @@ import "./styles/globals.css"; import { installDebugLogCapture } from "@/lib/backend/debugLog"; import { retryStartupAfterPreloadFailure } from "@/lib/startup/startupPreloadRecovery"; import { markStartupPhase } from "@/lib/startup/startupTiming"; -import { applyLegacyWebViewClass } from "@/lib/ui/legacyWebView"; +import { applyLegacyWebViewClass, isBlockingCompatFailure } from "@/lib/ui/legacyWebView"; function startupErrorMessage(error: unknown): string { if (error instanceof Error) { @@ -77,6 +77,16 @@ function installGlobalInputAttrs() { async function bootstrap() { markStartupPhase("bootstrap"); console.log("[STARTUP] frontend bootstrap begin"); + + // The inline engine probe in index.html has already painted an upgrade notice when this + // engine cannot style the shell; mounting over it would only replace a readable message + // with an unstyled UI. The notice's own button reloads once the user opts to continue. + if (isBlockingCompatFailure()) { + markStartupPhase("compat-blocked"); + console.warn("[STARTUP] blocked by engine compatibility notice"); + window.dispatchEvent(new Event("dbx:startup-ready")); + return; + } const [{ default: i18n, loadSavedLocale }, { default: App }] = await Promise.all([import("./i18n"), import("./StartupGate.vue")]); console.log("[STARTUP] frontend modules loaded"); const localeReady = loadSavedLocale();