()
| 842 | // `{"state":"downloaded","version":"99.0.0"}`) seeds a status to exercise the |
| 843 | // renderer card and the install handler without one. Ignored in production. |
| 844 | const applyFakeUpdateFromEnv = () => { |
| 845 | // Never honor the fake seam in a packaged build: a stray env var would seed a |
| 846 | // phantom "downloaded" update whose install quits the app against nothing. |
| 847 | if (app.isPackaged) return; |
| 848 | const raw = process.env.EXECUTOR_DESKTOP_FAKE_UPDATE?.trim(); |
| 849 | if (!raw) return; |
| 850 | // 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 |
| 851 | try { |
| 852 | // oxlint-disable-next-line executor/no-json-parse -- boundary: dev-only env override, shape-checked below |
| 853 | const parsed = JSON.parse(raw) as { readonly state?: string; readonly version?: string }; |
| 854 | const version = typeof parsed.version === "string" ? parsed.version : "0.0.0"; |
| 855 | const state = parsed.state ?? "downloaded"; |
| 856 | if ( |
| 857 | state === "available" || |
| 858 | state === "downloaded" || |
| 859 | state === "downloading" || |
| 860 | state === "error" || |
| 861 | state === "installing" |
| 862 | ) { |
| 863 | if (state === "downloaded") downloadedUpdateVersion = version; |
| 864 | setUpdateStatus( |
| 865 | state === "downloading" |
| 866 | ? { state, version, percent: 100 } |
| 867 | : state === "error" |
| 868 | ? { state, version, message: "Update failed" } |
| 869 | : { state, version }, |
| 870 | ); |
| 871 | } |
| 872 | } catch (error) { |
| 873 | log.warn("[updater] bad EXECUTOR_DESKTOP_FAKE_UPDATE", error); |
| 874 | } |
| 875 | }; |
| 876 | |
| 877 | const promptInstallUpdate = async (version: string) => { |
| 878 | if (updateDialogOpen) return; |
no test coverage detected