()
| 890 | // `{"state":"downloaded","version":"99.0.0"}`) seeds a status to exercise the |
| 891 | // renderer card and the install handler without one. Ignored in production. |
| 892 | const applyFakeUpdateFromEnv = () => { |
| 893 | // Never honor the fake seam in a packaged build: a stray env var would seed a |
| 894 | // phantom "downloaded" update whose install quits the app against nothing. |
| 895 | if (app.isPackaged) return; |
| 896 | const raw = process.env.EXECUTOR_DESKTOP_FAKE_UPDATE?.trim(); |
| 897 | if (!raw) return; |
| 898 | // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: dev-only env override is untrusted text; a malformed value is logged and ignored, not fatal |
| 899 | try { |
| 900 | // oxlint-disable-next-line executor/no-json-parse -- boundary: dev-only env override, shape-checked below |
| 901 | const parsed = JSON.parse(raw) as { readonly state?: string; readonly version?: string }; |
| 902 | const version = typeof parsed.version === "string" ? parsed.version : "0.0.0"; |
| 903 | const state = parsed.state ?? "downloaded"; |
| 904 | if ( |
| 905 | state === "available" || |
| 906 | state === "downloaded" || |
| 907 | state === "downloading" || |
| 908 | state === "error" || |
| 909 | state === "installing" |
| 910 | ) { |
| 911 | if (state === "downloaded") downloadedUpdateVersion = version; |
| 912 | setUpdateStatus( |
| 913 | state === "downloading" |
| 914 | ? { state, version, percent: 100 } |
| 915 | : state === "error" |
| 916 | ? { state, version, message: "Update failed" } |
| 917 | : { state, version }, |
| 918 | ); |
| 919 | } |
| 920 | } catch (error) { |
| 921 | log.warn("[updater] bad EXECUTOR_DESKTOP_FAKE_UPDATE", error); |
| 922 | } |
| 923 | }; |
| 924 | |
| 925 | const promptInstallUpdate = async (version: string) => { |
| 926 | if (updateDialogOpen) return; |
no test coverage detected