()
| 773 | // `{"state":"downloaded","version":"99.0.0"}`) seeds a status to exercise the |
| 774 | // renderer card and the install handler without one. Ignored in production. |
| 775 | const applyFakeUpdateFromEnv = () => { |
| 776 | // Never honor the fake seam in a packaged build: a stray env var would seed a |
| 777 | // phantom "downloaded" update whose install quits the app against nothing. |
| 778 | if (app.isPackaged) return; |
| 779 | const raw = process.env.EXECUTOR_DESKTOP_FAKE_UPDATE?.trim(); |
| 780 | if (!raw) return; |
| 781 | // 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 |
| 782 | try { |
| 783 | // oxlint-disable-next-line executor/no-json-parse -- boundary: dev-only env override, shape-checked below |
| 784 | const parsed = JSON.parse(raw) as { readonly state?: string; readonly version?: string }; |
| 785 | const version = typeof parsed.version === "string" ? parsed.version : "0.0.0"; |
| 786 | const state = parsed.state ?? "downloaded"; |
| 787 | if ( |
| 788 | state === "available" || |
| 789 | state === "downloaded" || |
| 790 | state === "downloading" || |
| 791 | state === "installing" |
| 792 | ) { |
| 793 | if (state === "downloaded") downloadedUpdateVersion = version; |
| 794 | setUpdateStatus( |
| 795 | state === "downloading" ? { state, version, percent: 100 } : { state, version }, |
| 796 | ); |
| 797 | } |
| 798 | } catch (error) { |
| 799 | log.warn("[updater] bad EXECUTOR_DESKTOP_FAKE_UPDATE", error); |
| 800 | } |
| 801 | }; |
| 802 | |
| 803 | const promptInstallUpdate = async (version: string) => { |
| 804 | if (updateDialogOpen) return; |
no test coverage detected