From ac80fca512bbc9ff18798052b5760e25316786b5 Mon Sep 17 00:00:00 2001 From: TB516 <77514919+TB516@users.noreply.github.com> Date: Wed, 4 Nov 2026 17:20:18 +0000 Subject: [PATCH 1/2] chore(flatpak): update T3 Code to v0.1.7 --- flatpak/com.t3tools.t3code.metainfo.xml | 4 ++++ flatpak/modules/t3code.yml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/flatpak/com.t3tools.t3code.metainfo.xml b/flatpak/com.t3tools.t3code.metainfo.xml index c86c5a2..05a55cf 100644 --- a/flatpak/com.t3tools.t3code.metainfo.xml +++ b/flatpak/com.t3tools.t3code.metainfo.xml @@ -19,6 +19,10 @@ com.t3tools.t3code.desktop https://t3.codes + + https://github.com/pingdotgg/t3code/releases/tag/v0.1.7 + + https://github.com/pingdotgg/t3code/releases/tag/v0.1.6 diff --git a/flatpak/modules/t3code.yml b/flatpak/modules/t3code.yml index ddb63cc..6b816a1 100644 --- a/flatpak/modules/t3code.yml +++ b/flatpak/modules/t3code.yml @@ -59,8 +59,8 @@ test-commands: sources: - type: git url: https://github.com/pingdotgg/t3code.git - tag: v0.1.6 - commit: 2359643cffa6ba9ee84d6f2694b935de54a8013e + tag: v0.1.7 + commit: 322f6544dfad0a3c8a0c8cbecf2c7f7874b14268 x-checker-data: type: json url: https://api.github.com/repos/pingdotgg/t3code/releases/latest From e08629193bd9c5631d858bcddbaf33dc83f2bd22 Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 4 Nov 2026 19:34:20 -0500 Subject: [PATCH 2/2] Refresh Flatpak patches for T3 Code 0.1.7 Rebase the patches onto 0.1.7. Drop the window class override now that upstream removed the --class switch, keep Flatpak update handling ahead of upstream's new managed update policy, and update tests for upstream's changes. Read the host's managed policy so the desktop and its host server follow the same /etc/t3code/policy.json. --- README.md | 3 +- flatpak/com.t3tools.t3code.metainfo.xml | 6 +- flatpak/com.t3tools.t3code.yml | 2 + flatpak/modules/t3code.yml | 1 + .../0001-flatpak-desktop-integration.patch | 35 ++++----- patches/0002-flatpak-host-backend.patch | 4 +- patches/0003-flatpak-host-environment.patch | 26 +++---- .../0006-flatpak-document-portal-paths.patch | 20 ++--- patches/0007-flatpak-editor-discovery.patch | 14 ++-- patches/0009-flatpak-server-updates.patch | 32 ++++---- .../0010-flatpak-browser-requirements.patch | 16 ++-- .../0011-flatpak-database-maintenance.patch | 75 ++++++++++--------- patches/0012-flatpak-update-channel.patch | 22 +++--- patches/0013-flatpak-startup-recovery.patch | 12 +-- patches/0014-flatpak-managed-policy.patch | 13 ++++ 15 files changed, 150 insertions(+), 131 deletions(-) create mode 100644 patches/0014-flatpak-managed-policy.patch diff --git a/README.md b/README.md index 378926e..9d585f5 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,8 @@ outside the sandbox. Preview tab downloads save to your Downloads folder. On KDE, T3 Code can store its secrets in KWallet. With Network access on, Settings shows the host's -Tailscale HTTPS address. +Tailscale HTTPS address. A managed policy at `/etc/t3code/policy.json` applies +to both the app and its host server. For local builds, see [Building](docs/building.md). Maintainers can find update and release instructions in [Publishing](docs/publishing.md). diff --git a/flatpak/com.t3tools.t3code.metainfo.xml b/flatpak/com.t3tools.t3code.metainfo.xml index 05a55cf..966b9bf 100644 --- a/flatpak/com.t3tools.t3code.metainfo.xml +++ b/flatpak/com.t3tools.t3code.metainfo.xml @@ -21,7 +21,11 @@ https://github.com/pingdotgg/t3code/releases/tag/v0.1.7 - + + Update to T3 Code 0.1.7. + The desktop now follows an organization's managed policy at + /etc/t3code/policy.json, matching the T3 server on the host. + https://github.com/pingdotgg/t3code/releases/tag/v0.1.6 diff --git a/flatpak/com.t3tools.t3code.yml b/flatpak/com.t3tools.t3code.yml index 369a83e..d7ab3b6 100644 --- a/flatpak/com.t3tools.t3code.yml +++ b/flatpak/com.t3tools.t3code.yml @@ -28,6 +28,8 @@ finish-args: - --filesystem=xdg-download # The host server hands the sandboxed browser a /tmp path for preview downloads. - --filesystem=/tmp + # The desktop reads the host's managed policy at /run/host/etc/t3code/policy.json. + - --filesystem=host-etc:ro - --filesystem=~/.ssh/config:ro - --filesystem=~/.ssh/config.d:ro - --filesystem=~/.ssh/known_hosts:ro diff --git a/flatpak/modules/t3code.yml b/flatpak/modules/t3code.yml index 6b816a1..9ea55dd 100644 --- a/flatpak/modules/t3code.yml +++ b/flatpak/modules/t3code.yml @@ -82,6 +82,7 @@ sources: - ../../patches/0011-flatpak-database-maintenance.patch - ../../patches/0012-flatpak-update-channel.patch - ../../patches/0013-flatpak-startup-recovery.patch + - ../../patches/0014-flatpak-managed-policy.patch use-git: true - type: dir path: ../package diff --git a/patches/0001-flatpak-desktop-integration.patch b/patches/0001-flatpak-desktop-integration.patch index adefc02..865368f 100644 --- a/patches/0001-flatpak-desktop-integration.patch +++ b/patches/0001-flatpak-desktop-integration.patch @@ -11,7 +11,7 @@ index 11f975a6b8..586db466b6 100644 devServerUrl: Config.URL("VITE_DEV_SERVER_URL").pipe(Config.option), appUserModelIdOverride: trimmedString("T3CODE_DESKTOP_APP_USER_MODEL_ID"), diff --git a/apps/desktop/src/app/DesktopEarlyElectronStartup.ts b/apps/desktop/src/app/DesktopEarlyElectronStartup.ts -index 00a355bf49..e3d56b16c4 100644 +index 3c571bcf02..4f1cf91396 100644 --- a/apps/desktop/src/app/DesktopEarlyElectronStartup.ts +++ b/apps/desktop/src/app/DesktopEarlyElectronStartup.ts @@ -1,3 +1,5 @@ @@ -20,16 +20,14 @@ index 00a355bf49..e3d56b16c4 100644 import { fromLenientJson } from "@t3tools/shared/schemaJson"; import * as Option from "effect/Option"; import * as Schema from "effect/Schema"; -@@ -144,10 +146,11 @@ export function resolveEarlyLinuxElectronOptions( +@@ -143,9 +145,10 @@ export function resolveEarlyLinuxElectronOptions( ): EarlyLinuxElectronOptions { const preference = resolveEarlyLinuxPasswordStorePreference(input); const isDevelopment = isDevelopmentEnvironment(input.env); + const appId = flatpakAppId(input.env, "linux"); return { isDevelopment, -- linuxWmClass: isDevelopment ? "t3code-dev" : "t3code", - linuxDesktopEntryName: resolveLinuxDesktopEntryName(isDevelopment), -+ linuxWmClass: appId ?? (isDevelopment ? "t3code-dev" : "t3code"), + linuxDesktopEntryName: appId ? `${appId}.desktop` : resolveLinuxDesktopEntryName(isDevelopment), passwordStore: resolveLinuxPasswordStoreSwitch({ preference, @@ -58,10 +56,10 @@ index 200745f111..2b9aa94ef0 100644 Effect.gen(function* () { const environment = yield* makeEnvironment({ diff --git a/apps/desktop/src/app/DesktopEnvironment.ts b/apps/desktop/src/app/DesktopEnvironment.ts -index 1066198b8f..6f42471060 100644 +index d5fed4b228..05f90aedf5 100644 --- a/apps/desktop/src/app/DesktopEnvironment.ts +++ b/apps/desktop/src/app/DesktopEnvironment.ts -@@ -168,10 +168,14 @@ const make = Effect.fn("desktop.environment.make")(function* ( +@@ -167,10 +167,14 @@ const make = Effect.fn("desktop.environment.make")(function* ( input.isPackaged && input.platform === "win32" ? path.join(input.resourcesPath, "server.asar") : appRoot; @@ -77,21 +75,19 @@ index 1066198b8f..6f42471060 100644 const displayName = branding.displayName; const stateDir = resolveDesktopStateDir({ baseDir, -@@ -231,8 +235,10 @@ const make = Effect.fn("desktop.environment.make")(function* ( +@@ -230,7 +234,9 @@ const make = Effect.fn("desktop.environment.make")(function* ( appUserModelId: Option.getOrElse(config.appUserModelIdOverride, () => isDevelopment ? "com.t3tools.t3code.dev" : "com.t3tools.t3code", ), - linuxDesktopEntryName: resolveLinuxDesktopEntryName(isDevelopment), -- linuxWmClass: isDevelopment ? "t3code-dev" : "t3code", + linuxDesktopEntryName: flatpakId + ? `${flatpakId}.desktop` + : resolveLinuxDesktopEntryName(isDevelopment), -+ linuxWmClass: flatpakId ?? (isDevelopment ? "t3code-dev" : "t3code"), linuxApplicationsDir, desktopLauncherPath: config.desktopLauncherPath, appImagePath: config.appImagePath, diff --git a/apps/desktop/src/app/DesktopLinuxUrlHandler.test.ts b/apps/desktop/src/app/DesktopLinuxUrlHandler.test.ts -index 9404b0ac30..c68935c3be 100644 +index 16d2f8e241..df911a745a 100644 --- a/apps/desktop/src/app/DesktopLinuxUrlHandler.test.ts +++ b/apps/desktop/src/app/DesktopLinuxUrlHandler.test.ts @@ -1,5 +1,5 @@ @@ -101,7 +97,7 @@ index 9404b0ac30..c68935c3be 100644 import * as HostProcess from "@t3tools/shared/HostProcess"; import * as Cause from "effect/Cause"; import * as Deferred from "effect/Deferred"; -@@ -166,6 +166,15 @@ const emptyRecording = (): RecordedRegistration => ({ +@@ -165,6 +165,15 @@ const emptyRecording = (): RecordedRegistration => ({ }); describe("DesktopLinuxUrlHandler", () => { @@ -118,7 +114,7 @@ index 9404b0ac30..c68935c3be 100644 const entry = DesktopLinuxUrlHandler.renderUrlHandlerDesktopEntry({ displayName: "T3 Code (Nightly)", diff --git a/apps/desktop/src/app/DesktopLinuxUrlHandler.ts b/apps/desktop/src/app/DesktopLinuxUrlHandler.ts -index ebd7d71b25..9ba0fd1fc2 100644 +index cfa8498ae6..4626a2601c 100644 --- a/apps/desktop/src/app/DesktopLinuxUrlHandler.ts +++ b/apps/desktop/src/app/DesktopLinuxUrlHandler.ts @@ -9,6 +9,7 @@ import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner"; @@ -129,7 +125,7 @@ index ebd7d71b25..9ba0fd1fc2 100644 import * as DesktopEnvironment from "./DesktopEnvironment.ts"; import { makeComponentLogger } from "./DesktopObservability.ts"; -@@ -286,7 +287,10 @@ export const make = Effect.gen(function* () { +@@ -287,7 +288,10 @@ export const make = Effect.gen(function* () { ); const register = Effect.gen(function* () { @@ -142,10 +138,10 @@ index ebd7d71b25..9ba0fd1fc2 100644 } yield* writeDesktopEntry; diff --git a/apps/desktop/src/app/DesktopPreReadyPlatform.test.ts b/apps/desktop/src/app/DesktopPreReadyPlatform.test.ts -index f2b176ee37..72a944f961 100644 +index f2b176ee37..0baac17608 100644 --- a/apps/desktop/src/app/DesktopPreReadyPlatform.test.ts +++ b/apps/desktop/src/app/DesktopPreReadyPlatform.test.ts -@@ -60,6 +60,28 @@ vi.mock("node:child_process", () => ({ +@@ -60,6 +60,23 @@ vi.mock("node:child_process", () => ({ import * as DesktopPreReadyPlatform from "./DesktopPreReadyPlatform.ts"; describe("DesktopPreReadyPlatform", () => { @@ -154,11 +150,6 @@ index f2b176ee37..72a944f961 100644 + return Effect.gen(function* () { + yield* DesktopPreReadyPlatform.DesktopPreReadyElectronOptions; + assert.deepEqual(setDesktopNameMock.mock.calls, [["com.t3tools.t3code.desktop"]]); -+ assert.isTrue( -+ appendSwitchMock.mock.calls.some( -+ ([name, value]) => name === "class" && value === "com.t3tools.t3code", -+ ), -+ ); + assert.equal(mkdirSyncMock.mock.calls.length, 0); + assert.equal(writeFileSyncMock.mock.calls.length, 0); + }).pipe( @@ -175,7 +166,7 @@ index f2b176ee37..72a944f961 100644 appendSwitchMock.mockReset(); getSwitchValueMock.mockReset(); diff --git a/apps/desktop/src/app/DesktopPreReadyPlatform.ts b/apps/desktop/src/app/DesktopPreReadyPlatform.ts -index 8bef7366e3..920599c521 100644 +index d77544f54b..cbf87853eb 100644 --- a/apps/desktop/src/app/DesktopPreReadyPlatform.ts +++ b/apps/desktop/src/app/DesktopPreReadyPlatform.ts @@ -9,6 +9,7 @@ import * as Layer from "effect/Layer"; @@ -282,7 +273,7 @@ index 8bef7366e3..920599c521 100644 + } // Chromium caches portal identity; set it before any asynchronous initialization. Electron.app.setDesktopName(linux.linuxDesktopEntryName); - Electron.app.commandLine.appendSwitch("class", linux.linuxWmClass); + if (linux.passwordStore !== null && linuxPasswordStoreCommandLine === null) { diff --git a/apps/desktop/src/app/Flatpak.ts b/apps/desktop/src/app/Flatpak.ts new file mode 100644 index 0000000000..006f94e000 diff --git a/patches/0002-flatpak-host-backend.patch b/patches/0002-flatpak-host-backend.patch index 6196deb..f205bd9 100644 --- a/patches/0002-flatpak-host-backend.patch +++ b/patches/0002-flatpak-host-backend.patch @@ -1,5 +1,5 @@ diff --git a/apps/desktop/src/backend/DesktopBackendConfiguration.ts b/apps/desktop/src/backend/DesktopBackendConfiguration.ts -index 4929031395..69c2ad3ded 100644 +index 69a70b68a4..bcf48615be 100644 --- a/apps/desktop/src/backend/DesktopBackendConfiguration.ts +++ b/apps/desktop/src/backend/DesktopBackendConfiguration.ts @@ -1,5 +1,8 @@ @@ -20,7 +20,7 @@ index 4929031395..69c2ad3ded 100644 executablePath: process.execPath, // Packaged builds have a separate cache; --require prevents cache settings leaking to provider subprocesses. args: [ -@@ -541,6 +544,15 @@ const resolvePrimaryStartConfig = Effect.fn("desktop.backendConfiguration.resolv +@@ -542,6 +545,15 @@ const resolvePrimaryStartConfig = Effect.fn("desktop.backendConfiguration.resolv captureOutput: true, preflightFailure: Option.none(), } satisfies DesktopBackendManager.DesktopBackendStartConfig; diff --git a/patches/0003-flatpak-host-environment.patch b/patches/0003-flatpak-host-environment.patch index 48fa8b6..fab663b 100644 --- a/patches/0003-flatpak-host-environment.patch +++ b/patches/0003-flatpak-host-environment.patch @@ -1,8 +1,8 @@ diff --git a/apps/desktop/src/shell/DesktopShellEnvironment.test.ts b/apps/desktop/src/shell/DesktopShellEnvironment.test.ts -index 4804823069..609a1432bd 100644 +index 124dbbeae8..3ad3a5dd3b 100644 --- a/apps/desktop/src/shell/DesktopShellEnvironment.test.ts +++ b/apps/desktop/src/shell/DesktopShellEnvironment.test.ts -@@ -118,6 +118,21 @@ function runShellEnvironment(input: { +@@ -163,6 +163,21 @@ function runShellEnvironment(input: { } describe("DesktopShellEnvironment", () => { @@ -21,14 +21,14 @@ index 4804823069..609a1432bd 100644 + }).pipe(Effect.tap(() => Effect.sync(() => assert.equal(env.PATH, "/app/bin:/usr/bin")))); + }); + - it.effect("rejects PATH output from a failed shell and tries the next candidate", () => + it.effect("does not wait for discovery when the cache is missing", () => Effect.gen(function* () { - const env: NodeJS.ProcessEnv = { SHELL: "/bin/failing", PATH: "/usr/bin" }; + const started = yield* Deferred.make(); diff --git a/apps/desktop/src/shell/DesktopShellEnvironment.ts b/apps/desktop/src/shell/DesktopShellEnvironment.ts -index 6e0fdbd380..365313b48d 100644 +index 37826f8ee5..4843080432 100644 --- a/apps/desktop/src/shell/DesktopShellEnvironment.ts +++ b/apps/desktop/src/shell/DesktopShellEnvironment.ts -@@ -14,6 +14,7 @@ import * as Stream from "effect/Stream"; +@@ -22,6 +22,7 @@ import * as Stream from "effect/Stream"; import * as ChildProcess from "effect/process/ChildProcess"; import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner"; @@ -36,7 +36,7 @@ index 6e0fdbd380..365313b48d 100644 import * as DesktopEnvironment from "../app/DesktopEnvironment.ts"; type EnvironmentPatch = Record; -@@ -503,6 +504,7 @@ const installShellEnvironment = ( +@@ -529,6 +530,7 @@ const installShellEnvironment = ( never, ChildProcessSpawner.ChildProcessSpawner | FileSystem.FileSystem > => { @@ -45,7 +45,7 @@ index 6e0fdbd380..365313b48d 100644 return installWindowsEnvironment(config); } diff --git a/apps/desktop/src/updates/DesktopUpdates.test.ts b/apps/desktop/src/updates/DesktopUpdates.test.ts -index c6bcd46b8c..37d6276a4a 100644 +index 3b45d80bbc..cc2cc4c537 100644 --- a/apps/desktop/src/updates/DesktopUpdates.test.ts +++ b/apps/desktop/src/updates/DesktopUpdates.test.ts @@ -1,4 +1,4 @@ @@ -54,7 +54,7 @@ index c6bcd46b8c..37d6276a4a 100644 import { DESKTOP_UPDATE_RESTART_MARKER_FILE } from "@t3tools/contracts"; import * as Cause from "effect/Cause"; import * as Deferred from "effect/Deferred"; -@@ -22,6 +22,28 @@ import * as DesktopUpdates from "./DesktopUpdates.ts"; +@@ -23,6 +23,28 @@ import * as DesktopUpdates from "./DesktopUpdates.ts"; import { flushCallbacks, makeHarness } from "./updatesTestHarness.ts"; describe("DesktopUpdates", () => { @@ -84,7 +84,7 @@ index c6bcd46b8c..37d6276a4a 100644 Effect.gen(function* () { const linuxState = (packageType: string | undefined) => diff --git a/apps/desktop/src/updates/DesktopUpdates.ts b/apps/desktop/src/updates/DesktopUpdates.ts -index 3a0b41cd9e..f72a430e39 100644 +index 6279e8b614..637b0bc113 100644 --- a/apps/desktop/src/updates/DesktopUpdates.ts +++ b/apps/desktop/src/updates/DesktopUpdates.ts @@ -1,3 +1,4 @@ @@ -92,13 +92,13 @@ index 3a0b41cd9e..f72a430e39 100644 import { DESKTOP_UPDATE_RESTART_MARKER_FILE, DesktopUpdateChannelSchema, -@@ -323,6 +324,9 @@ function getAutoUpdateDisabledReason(args: { +@@ -338,6 +339,9 @@ function getAutoUpdateDisabledReason(args: { disabledByEnv: boolean; hasUpdateFeedConfig: boolean; }): string | null { + if (flatpakAppId(process.env, args.platform) !== null) { + return "Updates are managed by Flatpak."; + } - if (!args.hasUpdateFeedConfig) { - return "Automatic updates are not available because no update feed is configured."; + if (args.policy.mode === "off") { + return args.policy.message ?? "Updates are turned off on this machine."; } diff --git a/patches/0006-flatpak-document-portal-paths.patch b/patches/0006-flatpak-document-portal-paths.patch index 06bd0dd..5000381 100644 --- a/patches/0006-flatpak-document-portal-paths.patch +++ b/patches/0006-flatpak-document-portal-paths.patch @@ -183,7 +183,7 @@ index 4f9ab12edd..30db8e3217 100644 pickFiles: Effect.fn("desktop.electron.dialog.pickFiles")(function* (input) { const ownerWindowId = Option.match(input.owner, { diff --git a/apps/desktop/src/ipc/DesktopIpc.ts b/apps/desktop/src/ipc/DesktopIpc.ts -index 354acc5a81..64f54412fa 100644 +index 354acc5a81..e8e89d9502 100644 --- a/apps/desktop/src/ipc/DesktopIpc.ts +++ b/apps/desktop/src/ipc/DesktopIpc.ts @@ -17,7 +17,7 @@ export type DesktopIpcHandleListener = ( @@ -191,7 +191,7 @@ index 354acc5a81..64f54412fa 100644 ) => unknown | Promise; -export type DesktopIpcSyncListener = (event: DesktopIpcSyncEvent) => void; -+export type DesktopIpcSyncListener = (event: DesktopIpcSyncEvent, payload: unknown) => void; ++export type DesktopIpcSyncListener = (event: DesktopIpcSyncEvent, payload?: unknown) => void; export interface DesktopIpcMain { removeHandler(channel: string): void; @@ -219,10 +219,10 @@ index 354acc5a81..64f54412fa 100644 Effect.annotateLogs({ channel }), Effect.withSpan("desktop.ipc.invokeSync"), diff --git a/apps/desktop/src/ipc/DesktopIpcHandlers.ts b/apps/desktop/src/ipc/DesktopIpcHandlers.ts -index 35333ac3d3..98001d96f3 100644 +index a46dbafab0..8be9e500a7 100644 --- a/apps/desktop/src/ipc/DesktopIpcHandlers.ts +++ b/apps/desktop/src/ipc/DesktopIpcHandlers.ts -@@ -47,6 +47,7 @@ import { +@@ -48,6 +48,7 @@ import { revealWindow, pickFolder, pickProjectFavicon, @@ -230,16 +230,16 @@ index 35333ac3d3..98001d96f3 100644 pickThemeFiles, setTheme, showContextMenu, -@@ -93,6 +94,7 @@ export const installDesktopIpcHandlers = Effect.fn("desktop.ipc.installHandlers" +@@ -94,6 +95,7 @@ export const installDesktopIpcHandlers = Effect.fn("desktop.ipc.installHandlers" yield* ipc.handleSync(getAppBranding); - yield* ipc.handleSync(getRelayTelemetryEnabled); + yield* installRelayTelemetryEnabled(); yield* ipc.handleSync(getSystemLocale); + yield* ipc.handleSync(resolveHostPath); yield* ipc.handleSync(getWindowFullscreenState); yield* ipc.handleSync(getLocalEnvironmentBootstraps); yield* ipc.handleSync(getLocalEnvironmentEnabled); diff --git a/apps/desktop/src/ipc/channels.ts b/apps/desktop/src/ipc/channels.ts -index 538dd06b0b..c2bb874846 100644 +index 0f125c05de..9ca25157de 100644 --- a/apps/desktop/src/ipc/channels.ts +++ b/apps/desktop/src/ipc/channels.ts @@ -1,6 +1,7 @@ @@ -251,10 +251,10 @@ index 538dd06b0b..c2bb874846 100644 export const SET_THEME_CHANNEL = "desktop:set-theme"; export const CONTEXT_MENU_CHANNEL = "desktop:context-menu"; diff --git a/apps/desktop/src/ipc/methods/window.ts b/apps/desktop/src/ipc/methods/window.ts -index f0d661b58b..95a4cc779a 100644 +index 63b8db03da..063a1a54a4 100644 --- a/apps/desktop/src/ipc/methods/window.ts +++ b/apps/desktop/src/ipc/methods/window.ts -@@ -250,10 +250,24 @@ export const pickProjectFavicon = DesktopIpc.makeIpcMethod({ +@@ -267,10 +267,24 @@ export const pickProjectFavicon = DesktopIpc.makeIpcMethod({ }, ], }); @@ -281,7 +281,7 @@ index f0d661b58b..95a4cc779a 100644 channel: IpcChannels.SET_THEME_CHANNEL, payload: DesktopThemeSchema, diff --git a/apps/desktop/src/preload.ts b/apps/desktop/src/preload.ts -index 950ed972c6..4d9e156341 100644 +index da56807186..907b74c481 100644 --- a/apps/desktop/src/preload.ts +++ b/apps/desktop/src/preload.ts @@ -82,7 +82,13 @@ contextBridge.exposeInMainWorld("desktopBridge", { diff --git a/patches/0007-flatpak-editor-discovery.patch b/patches/0007-flatpak-editor-discovery.patch index e9b2b2f..9f8fec0 100644 --- a/patches/0007-flatpak-editor-discovery.patch +++ b/patches/0007-flatpak-editor-discovery.patch @@ -1,8 +1,8 @@ diff --git a/apps/server/src/process/externalLauncher.test.ts b/apps/server/src/process/externalLauncher.test.ts -index 3262c555bc..775dc589cd 100644 +index 9f975ee209..0ae8ece943 100644 --- a/apps/server/src/process/externalLauncher.test.ts +++ b/apps/server/src/process/externalLauncher.test.ts -@@ -256,6 +256,55 @@ it.effect("launches an installed editor with platform-safe arguments", () => +@@ -257,6 +257,55 @@ it.effect("launches an installed editor with platform-safe arguments", () => }).pipe(Effect.scoped, Effect.provide(NodeServices.layer)), ); @@ -59,10 +59,10 @@ index 3262c555bc..775dc589cd 100644 "reveals a WSL file in Windows File Explorer through its UNC path", () => diff --git a/apps/server/src/process/externalLauncher.ts b/apps/server/src/process/externalLauncher.ts -index 6a2eb14516..656ac49d78 100644 +index 7f4417d1fb..310e0efac5 100644 --- a/apps/server/src/process/externalLauncher.ts +++ b/apps/server/src/process/externalLauncher.ts -@@ -126,6 +126,67 @@ const CommandLookupEnvConfig = Config.all({ +@@ -122,6 +122,67 @@ const CommandLookupEnvConfig = Config.all({ const readBrowserLaunchEnv = BrowserLaunchEnvConfig.pipe(Effect.orElseSucceed(() => ({}))); const readCommandLookupEnv = CommandLookupEnvConfig.pipe(Effect.orElseSucceed(() => ({}))); @@ -130,7 +130,7 @@ index 6a2eb14516..656ac49d78 100644 function parseTargetPathAndPosition(target: string): Option.Option { const match = TARGET_WITH_POSITION_PATTERN.exec(target); if (!match?.[1] || !match[2]) { -@@ -407,6 +468,7 @@ const buildAvailableEditors = Effect.fn("externalLauncher.buildAvailableEditors" +@@ -403,6 +464,7 @@ const buildAvailableEditors = Effect.fn("externalLauncher.buildAvailableEditors" FileSystem.FileSystem | Path.Path | ChildProcessSpawner.ChildProcessSpawner > { const available: EditorId[] = []; @@ -138,7 +138,7 @@ index 6a2eb14516..656ac49d78 100644 for (const editor of EDITORS) { if (editor.commands === null) { -@@ -417,7 +479,7 @@ const buildAvailableEditors = Effect.fn("externalLauncher.buildAvailableEditors" +@@ -413,7 +475,7 @@ const buildAvailableEditors = Effect.fn("externalLauncher.buildAvailableEditors" } const command = yield* resolveEditorCommand(editor, env); @@ -147,7 +147,7 @@ index 6a2eb14516..656ac49d78 100644 available.push(editor.id); } } -@@ -486,8 +548,24 @@ const resolveEditorLaunch = Effect.fn("resolveEditorLaunch")(function* ( +@@ -476,8 +538,24 @@ const resolveEditorLaunch = Effect.fn("resolveEditorLaunch")(function* ( } if (editorDef.commands) { diff --git a/patches/0009-flatpak-server-updates.patch b/patches/0009-flatpak-server-updates.patch index 497cbb5..28001da 100644 --- a/patches/0009-flatpak-server-updates.patch +++ b/patches/0009-flatpak-server-updates.patch @@ -1,8 +1,8 @@ diff --git a/apps/server/src/cloud/selfUpdate.test.ts b/apps/server/src/cloud/selfUpdate.test.ts -index 1e3157adff..8117d2298b 100644 +index a938d67788..8e3f30eea5 100644 --- a/apps/server/src/cloud/selfUpdate.test.ts +++ b/apps/server/src/cloud/selfUpdate.test.ts -@@ -128,6 +128,28 @@ const makeHarness = Effect.fn("test.make_self_update_harness")(function* ( +@@ -160,6 +160,28 @@ const makeHarness = Effect.fn("test.make_self_update_harness")(function* ( }); it.layer(NodeServices.layer)("server self update", (it) => { @@ -32,18 +32,18 @@ index 1e3157adff..8117d2298b 100644 it.effect("rejects invalid versions and desktop-managed servers before staging", () => Effect.gen(function* () { diff --git a/apps/server/src/cloud/selfUpdate.ts b/apps/server/src/cloud/selfUpdate.ts -index d72c5e9218..242983807b 100644 +index 58baa160ad..85835f020a 100644 --- a/apps/server/src/cloud/selfUpdate.ts +++ b/apps/server/src/cloud/selfUpdate.ts -@@ -128,6 +128,7 @@ export const make = Effect.fn("cloud.server_self_update.make")(function* () { - yield* Config.String(CLI_RELEASE_BASE_URL_ENV).pipe(Config.option), - ); +@@ -138,6 +138,7 @@ export const make = Effect.fn("cloud.server_self_update.make")(function* () { + mirror?.feedUrl ?? + Option.getOrUndefined(yield* Config.String(CLI_RELEASE_BASE_URL_ENV).pipe(Config.option)); const inFlight = yield* Ref.make(false); + const flatpakManaged = Boolean((yield* HostProcess.Environment).T3CODE_FLATPAK_SERVER); yield* pruneRuntimesOnStart({ baseDir: serverConfig.baseDir, managed: launcher.managed }).pipe( Effect.forkScoped, -@@ -151,6 +152,11 @@ export const make = Effect.fn("cloud.server_self_update.make")(function* () { +@@ -161,6 +162,11 @@ export const make = Effect.fn("cloud.server_self_update.make")(function* () { const update: ServerSelfUpdate["Service"]["update"] = Effect.fn( "cloud.server_self_update.update", )(function* (input, reportProgress = () => Effect.void, onHandoffAccepted = () => Effect.void) { @@ -52,10 +52,10 @@ index d72c5e9218..242983807b 100644 + "Updates are managed by Flatpak. Update the Flatpak package on this machine.", + ); + } - if (capability === "desktop-managed") { - const unsafeCrossing = input.channel === undefined ? null : crossesTrackUnsafely(input); - if (unsafeCrossing !== null) return yield* failWith(unsafeCrossing); -@@ -299,6 +305,11 @@ export const make = Effect.fn("cloud.server_self_update.make")(function* () { + const policyRefusal = managedUpdateRefusal( + policy.document, + capability === "boot-service" ? cliReleaseChannelOf(input.targetVersion.trim()) : undefined, +@@ -322,6 +328,11 @@ export const make = Effect.fn("cloud.server_self_update.make")(function* () { update, commitDesktopUpdate: Effect.fn("ServerSelfUpdate.commitDesktopUpdate")( function (requestId, onHandoffAccepted) { @@ -68,10 +68,10 @@ index d72c5e9218..242983807b 100644 }, ), diff --git a/apps/server/src/environment/ServerEnvironment.test.ts b/apps/server/src/environment/ServerEnvironment.test.ts -index 7cebccb2a1..8eb81cb64e 100644 +index 3960b5b8d1..5016da75a2 100644 --- a/apps/server/src/environment/ServerEnvironment.test.ts +++ b/apps/server/src/environment/ServerEnvironment.test.ts -@@ -90,7 +90,11 @@ it.layer(NodeServices.layer)("ServerEnvironmentLive", (it) => { +@@ -91,7 +91,11 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("ServerEnvironmen yield* fs.symlink(entry, `${prefix}/bin/t3`); const config = yield* makeServerConfig(baseDir); yield* fs.makeDirectory(config.stateDir, { recursive: true }); @@ -84,7 +84,7 @@ index 7cebccb2a1..8eb81cb64e 100644 const descriptor = yield* Effect.gen(function* () { const environment = yield* ServerEnvironment.ServerEnvironment; return yield* environment.getDescriptor; -@@ -98,13 +102,15 @@ it.layer(NodeServices.layer)("ServerEnvironmentLive", (it) => { +@@ -99,13 +103,15 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("ServerEnvironmen Effect.provide( ServerEnvironment.layer.pipe( Layer.provide(layerEmptySecretStore), @@ -102,7 +102,7 @@ index 7cebccb2a1..8eb81cb64e 100644 ); expect(descriptor.capabilities.serverInstallation).toEqual( mode === "web" ? { kind: "npm-global", prefix } : undefined, -@@ -112,6 +118,9 @@ it.layer(NodeServices.layer)("ServerEnvironmentLive", (it) => { +@@ -113,6 +119,9 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("ServerEnvironmen expect(descriptor.capabilities.serverSelfUpdate).toBe( mode === "web" ? undefined : "desktop-managed", ); @@ -113,7 +113,7 @@ index 7cebccb2a1..8eb81cb64e 100644 settledWorktreeCleanup: true, storageCleanupRun: true, diff --git a/apps/server/src/environment/ServerEnvironment.ts b/apps/server/src/environment/ServerEnvironment.ts -index 72d7f0c2de..1b5c18675b 100644 +index 0787a3702c..e8edc3cfee 100644 --- a/apps/server/src/environment/ServerEnvironment.ts +++ b/apps/server/src/environment/ServerEnvironment.ts @@ -201,8 +201,11 @@ export const make = Effect.gen(function* () { diff --git a/patches/0010-flatpak-browser-requirements.patch b/patches/0010-flatpak-browser-requirements.patch index da4e078..4124074 100644 --- a/patches/0010-flatpak-browser-requirements.patch +++ b/patches/0010-flatpak-browser-requirements.patch @@ -76,10 +76,10 @@ index 1847e5f232..eea911ee35 100644 // Playwright reports Chrome's refusal to sandbox as root as a sandbox failure too. return (yield* HostProcess.UserId) === 0 diff --git a/apps/server/src/preview/ServerBrowser.ts b/apps/server/src/preview/ServerBrowser.ts -index 84299d3e92..3f27e72264 100644 +index e03d7e3b35..a70ff7d236 100644 --- a/apps/server/src/preview/ServerBrowser.ts +++ b/apps/server/src/preview/ServerBrowser.ts -@@ -2653,7 +2653,9 @@ const make = Effect.gen(function* () { +@@ -2710,7 +2710,9 @@ const make = Effect.gen(function* () { (yield* PreviewBrowserHost.sandboxBlocked) ) { yield* Effect.logWarning( @@ -91,7 +91,7 @@ index 84299d3e92..3f27e72264 100644 } diff --git a/apps/server/src/preview/ServerBrowserStream.test.ts b/apps/server/src/preview/ServerBrowserStream.test.ts -index 5f2c685fa6..da8c227a38 100644 +index c4a709ed8a..f4ba04e2e5 100644 --- a/apps/server/src/preview/ServerBrowserStream.test.ts +++ b/apps/server/src/preview/ServerBrowserStream.test.ts @@ -375,6 +375,17 @@ it.effect("passes uploaded files to the page's open picker and needs operate sco @@ -131,10 +131,10 @@ index 5f2c685fa6..da8c227a38 100644 }).pipe(Effect.scoped), ); diff --git a/apps/server/src/preview/ServerBrowserStream.ts b/apps/server/src/preview/ServerBrowserStream.ts -index 8d8164cd91..8c398f83be 100644 +index e46a0c76ad..643870286c 100644 --- a/apps/server/src/preview/ServerBrowserStream.ts +++ b/apps/server/src/preview/ServerBrowserStream.ts -@@ -212,9 +212,9 @@ const makeHandler = Effect.fnUntraced(function* (browser: ServerBrowser.ServerBr +@@ -213,9 +213,9 @@ const makeHandler = Effect.fnUntraced(function* (browser: ServerBrowser.ServerBr const hostSetup = (cause: unknown): PreviewStreamHostSetup | undefined => isSandboxError(cause) @@ -162,10 +162,10 @@ index e32e8f76f1..28578f27cd 100644 Try again diff --git a/packages/client-runtime/src/preview/serverBrowserStream.ts b/packages/client-runtime/src/preview/serverBrowserStream.ts -index b71fff335f..9d5ab790a2 100644 +index 617c1d1842..48cde9433b 100644 --- a/packages/client-runtime/src/preview/serverBrowserStream.ts +++ b/packages/client-runtime/src/preview/serverBrowserStream.ts -@@ -454,7 +454,13 @@ const decodeHostSetup = (reason: string): PreviewStreamHostSetup => { +@@ -463,7 +463,13 @@ const decodeHostSetup = (reason: string): PreviewStreamHostSetup => { return { need: "sandbox", command: "sudo npx t3 browser setup" }; }; @@ -182,7 +182,7 @@ index b71fff335f..9d5ab790a2 100644 : "This server's host is missing libraries its browser needs. Run this once on the host, then try again:"; +}; diff --git a/packages/contracts/src/preview.ts b/packages/contracts/src/preview.ts -index cbf8ac60b2..b329300905 100644 +index 1790a4797d..5c80cad2be 100644 --- a/packages/contracts/src/preview.ts +++ b/packages/contracts/src/preview.ts @@ -143,6 +143,7 @@ export type PreviewRuntime = typeof PreviewRuntime.Type; diff --git a/patches/0011-flatpak-database-maintenance.patch b/patches/0011-flatpak-database-maintenance.patch index 7163a2f..388f117 100644 --- a/patches/0011-flatpak-database-maintenance.patch +++ b/patches/0011-flatpak-database-maintenance.patch @@ -1,3 +1,23 @@ +diff --git a/apps/desktop/src/app/DesktopApp.test.ts b/apps/desktop/src/app/DesktopApp.test.ts +index 66fc83adae..b095321153 100644 +--- a/apps/desktop/src/app/DesktopApp.test.ts ++++ b/apps/desktop/src/app/DesktopApp.test.ts +@@ -54,6 +54,7 @@ import * as DesktopBackendConfiguration from "../backend/DesktopBackendConfigura + import * as DesktopCliCommand from "./DesktopCliCommand.ts"; + import * as DesktopClientSettings from "../settings/DesktopClientSettings.ts"; + import * as DesktopConnectionCatalogStore from "./DesktopConnectionCatalogStore.ts"; ++import * as DesktopDatabaseMaintenance from "./DesktopDatabaseMaintenance.ts"; + import * as DesktopIpc from "../ipc/DesktopIpc.ts"; + import * as DesktopLocalEnvironmentAuth from "../backend/DesktopLocalEnvironmentAuth.ts"; + import * as DesktopManagedPolicy from "./DesktopManagedPolicy.ts"; +@@ -193,6 +194,7 @@ it.effect( + Layer.mock(DesktopCliCommand.DesktopCliCommand, {}), + Layer.mock(DesktopClientSettings.DesktopClientSettings, {}), + Layer.mock(DesktopConnectionCatalogStore.DesktopConnectionCatalogStore, {}), ++ Layer.mock(DesktopDatabaseMaintenance.DesktopDatabaseMaintenance, { supported: false }), + Layer.mock(DesktopIpc.DesktopIpc, {}), + Layer.mock(DesktopLocalEnvironmentAuth.DesktopLocalEnvironmentAuth, {}), + Layer.mock(DesktopManagedPolicy.DesktopManagedPolicy, {}), diff --git a/apps/desktop/src/app/DesktopDatabaseMaintenance.test.ts b/apps/desktop/src/app/DesktopDatabaseMaintenance.test.ts new file mode 100644 index 0000000000..7799a47cea @@ -504,10 +524,10 @@ index 0000000000..2b44350768 + +export const layer = Layer.effect(DesktopDatabaseMaintenance, make); diff --git a/apps/desktop/src/ipc/DesktopIpcHandlers.ts b/apps/desktop/src/ipc/DesktopIpcHandlers.ts -index 98001d96f3..2dfed48350 100644 +index 8be9e500a7..71e31275ed 100644 --- a/apps/desktop/src/ipc/DesktopIpcHandlers.ts +++ b/apps/desktop/src/ipc/DesktopIpcHandlers.ts -@@ -80,6 +80,12 @@ import { +@@ -81,6 +81,12 @@ import { uninstallCliCommand, } from "./methods/cliCommand.ts"; @@ -520,7 +540,7 @@ index 98001d96f3..2dfed48350 100644 export const installDesktopIpcHandlers = Effect.fn("desktop.ipc.installHandlers")(function* () { const ipc = yield* DesktopIpc.DesktopIpc; yield* installNotificationBadge(); -@@ -89,6 +95,9 @@ export const installDesktopIpcHandlers = Effect.fn("desktop.ipc.installHandlers" +@@ -90,6 +96,9 @@ export const installDesktopIpcHandlers = Effect.fn("desktop.ipc.installHandlers" yield* ipc.handle(AppActivationIpc.complete); yield* ipc.handle(WebLinksIpc.setReady); @@ -531,10 +551,10 @@ index 98001d96f3..2dfed48350 100644 yield* ipc.handle(completeLegacyLocalStorage); yield* ipc.handleSync(getAppBranding); diff --git a/apps/desktop/src/ipc/channels.ts b/apps/desktop/src/ipc/channels.ts -index c2bb874846..e182c5249f 100644 +index 9ca25157de..b425244c66 100644 --- a/apps/desktop/src/ipc/channels.ts +++ b/apps/desktop/src/ipc/channels.ts -@@ -124,3 +124,7 @@ export const RECEIVE_PROVIDER_AUTH_CALLBACK_CHANNEL = "desktop:receive-provider- +@@ -125,3 +125,7 @@ export const RECEIVE_PROVIDER_AUTH_CALLBACK_CHANNEL = "desktop:receive-provider- export const CANCEL_PROVIDER_AUTH_CALLBACK_CHANNEL = "desktop:cancel-provider-auth-callback"; export const TAKE_LEGACY_LOCAL_STORAGE_CHANNEL = "desktop:take-legacy-local-storage"; export const COMPLETE_LEGACY_LOCAL_STORAGE_CHANNEL = "desktop:complete-legacy-local-storage"; @@ -582,10 +602,10 @@ index 0000000000..00cb4b9191 + }), +}); diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts -index 9a3c327e6b..d735fbb5a3 100644 +index d109518be1..9e4c7f3f36 100644 --- a/apps/desktop/src/main.ts +++ b/apps/desktop/src/main.ts -@@ -40,6 +40,7 @@ import * as DesktopAppIdentity from "./app/DesktopAppIdentity.ts"; +@@ -41,6 +41,7 @@ import * as DesktopAppIdentity from "./app/DesktopAppIdentity.ts"; import * as DesktopConnectionCatalogStore from "./app/DesktopConnectionCatalogStore.ts"; import * as DesktopClerk from "./app/DesktopClerk.ts"; import * as DesktopCliCommand from "./app/DesktopCliCommand.ts"; @@ -593,7 +613,7 @@ index 9a3c327e6b..d735fbb5a3 100644 import * as DesktopApplicationMenu from "./window/DesktopApplicationMenu.ts"; import * as DesktopAssets from "./app/DesktopAssets.ts"; import * as DesktopBackendConfiguration from "./backend/DesktopBackendConfiguration.ts"; -@@ -208,6 +209,7 @@ const layerDesktopApplication = Layer.mergeAll( +@@ -212,6 +213,7 @@ const layerDesktopApplication = Layer.mergeAll( DesktopApplicationMenu.layer, DesktopLinuxUrlHandler.layer, DesktopCliCommand.layer, @@ -602,10 +622,10 @@ index 9a3c327e6b..d735fbb5a3 100644 ).pipe( Layer.provideMerge(layerDesktopSnapShot), diff --git a/apps/desktop/src/preload.ts b/apps/desktop/src/preload.ts -index 4d9e156341..b8b8a9a62e 100644 +index 907b74c481..29b59ebedb 100644 --- a/apps/desktop/src/preload.ts +++ b/apps/desktop/src/preload.ts -@@ -278,6 +278,15 @@ contextBridge.exposeInMainWorld("desktopBridge", { +@@ -279,6 +279,15 @@ contextBridge.exposeInMainWorld("desktopBridge", { downloadUpdate: () => ipcRenderer.invoke(IpcChannels.UPDATE_DOWNLOAD_CHANNEL), installUpdate: (expectedVersion) => ipcRenderer.invoke(IpcChannels.UPDATE_INSTALL_CHANNEL, expectedVersion), @@ -622,28 +642,28 @@ index 4d9e156341..b8b8a9a62e 100644 getState: () => ipcRenderer.invoke(IpcChannels.CLI_COMMAND_GET_STATE_CHANNEL), install: () => ipcRenderer.invoke(IpcChannels.CLI_COMMAND_INSTALL_CHANNEL), diff --git a/apps/server/src/binCli.ts b/apps/server/src/binCli.ts -index 7c136ae532..1206d73e1d 100644 +index 15a3a9321f..5b13325ec5 100644 --- a/apps/server/src/binCli.ts +++ b/apps/server/src/binCli.ts @@ -1,4 +1,4 @@ -import { doctorCommand } from "./cli/doctor.ts"; +import { doctorCommand, flatpakDatabaseMaintenanceCommand } from "./cli/doctor.ts"; + import { policyCommand } from "./cli/policy.ts"; import * as NodeRuntime from "@effect/platform-node/NodeRuntime"; - import * as NodeServices from "@effect/platform-node/NodeServices"; - import * as Effect from "effect/Effect"; -@@ -95,6 +95,7 @@ export const makeCli = ({ cloudEnabled = hasCloudPublicConfig } = {}) => - themeCommand, + import * as NodeCrypto from "@effect/platform-node/NodeCrypto"; +@@ -98,6 +98,7 @@ export const makeCli = ({ cloudEnabled = hasCloudPublicConfig } = {}) => traceCommand, doctorCommand, + policyCommand, + flatpakDatabaseMaintenanceCommand, triageCommand, cloudEnabled ? connectCommand : connectUnavailableCommand, ]), diff --git a/apps/server/src/cli/doctor.test.ts b/apps/server/src/cli/doctor.test.ts -index 2b9abe89f2..3aa03a5c38 100644 +index 2b9abe89f2..23a2121dbd 100644 --- a/apps/server/src/cli/doctor.test.ts +++ b/apps/server/src/cli/doctor.test.ts -@@ -1,10 +1,21 @@ +@@ -1,10 +1,18 @@ import * as NodeServices from "@effect/platform-node/NodeServices"; import { assert, it } from "@effect/vitest"; import * as Effect from "effect/Effect"; @@ -654,9 +674,6 @@ index 2b9abe89f2..3aa03a5c38 100644 +import * as HostProcess from "@t3tools/shared/HostProcess"; +import * as NetService from "@t3tools/shared/Net"; +import * as NodeSqliteClient from "@t3tools/shared/nodeSqliteClient"; -+import * as EventStore from "../orchestration-v2/EventStore.ts"; -+import * as ProjectionMaintenance from "../orchestration-v2/ProjectionMaintenance.ts"; -+import * as ProjectionStore from "../orchestration-v2/ProjectionStore.ts"; +import * as Sqlite from "../persistence/Sqlite.ts"; import * as Layer from "effect/Layer"; @@ -666,7 +683,7 @@ index 2b9abe89f2..3aa03a5c38 100644 import { DatabaseMaintenance } from "../persistence/DatabaseMaintenance.ts"; it.effect( -@@ -53,3 +64,51 @@ it.effect( +@@ -53,3 +61,41 @@ it.effect( assert.deepEqual(calls, ["pause", "compact", "resume"]); }), ); @@ -680,17 +697,7 @@ index 2b9abe89f2..3aa03a5c38 100644 + const baseDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-flatpak-compact-" }); + const dbPath = path.join(baseDir, "userdata", "statev2.sqlite"); + const legacy = path.join(baseDir, "userdata", "state.sqlite"); -+ yield* Effect.flatMap( -+ ProjectionMaintenance.ProjectionMaintenanceV2, -+ (projections) => projections.rebuild, -+ ).pipe( -+ Effect.provide( -+ ProjectionMaintenance.layer.pipe( -+ Layer.provide(Layer.merge(EventStore.layer, ProjectionStore.layer)), -+ Layer.provideMerge(Sqlite.layerFromPath(dbPath)), -+ ), -+ ), -+ ); ++ yield* Effect.void.pipe(Effect.provide(Sqlite.layerFromPath(dbPath))); + yield* Effect.flatMap(SqlClient.SqlClient, (sql) => sql`CREATE TABLE rollback (id)`).pipe( + Effect.provide(NodeSqliteClient.layer({ filename: legacy })), + ); @@ -909,10 +916,10 @@ index 08ccf816a9..fa8f1d484c 100644 Promise; onUpdateState: (listener: (state: DesktopUpdateState) => void) => () => void; diff --git a/patches/0012-flatpak-update-channel.patch b/patches/0012-flatpak-update-channel.patch index a422b35..42eb1cc 100644 --- a/patches/0012-flatpak-update-channel.patch +++ b/patches/0012-flatpak-update-channel.patch @@ -1,8 +1,8 @@ diff --git a/apps/desktop/src/updates/DesktopUpdates.test.ts b/apps/desktop/src/updates/DesktopUpdates.test.ts -index 37d6276a4a..41e97af472 100644 +index cc2cc4c537..7e5bdf2ac7 100644 --- a/apps/desktop/src/updates/DesktopUpdates.test.ts +++ b/apps/desktop/src/updates/DesktopUpdates.test.ts -@@ -37,6 +37,11 @@ describe("DesktopUpdates", () => { +@@ -38,6 +38,11 @@ describe("DesktopUpdates", () => { const result = yield* updates.check("manual"); assert.isFalse(result.checked); assert.equal(harness.checkCount(), 0); @@ -15,24 +15,24 @@ index 37d6276a4a..41e97af472 100644 Effect.scoped, Effect.provide(harness.layer), diff --git a/apps/desktop/src/updates/DesktopUpdates.ts b/apps/desktop/src/updates/DesktopUpdates.ts -index f72a430e39..b08e7dada1 100644 +index 637b0bc113..c8be030780 100644 --- a/apps/desktop/src/updates/DesktopUpdates.ts +++ b/apps/desktop/src/updates/DesktopUpdates.ts -@@ -1145,6 +1145,9 @@ export const make = Effect.gen(function* () { +@@ -1202,6 +1202,9 @@ export const make = Effect.gen(function* () { options?: { readonly minimumVersion?: string | undefined }, ) { yield* Effect.annotateCurrentSpan({ channel: nextChannel }); + if (flatpakAppId(process.env, environment.platform) !== null) { + return yield* Ref.get(updateStateRef); + } - // A background check holds the updater only briefly, so wait it out instead of refusing. - const activeAction = yield* tryStartChannelChange.pipe( - Effect.repeat({ + if (Option.isSome(channelBlockedReason(nextChannel))) { + return yield* new DesktopUpdateChannelManagedError({ + channel: nextChannel, diff --git a/apps/web/src/components/settings/SettingsPanels.tsx b/apps/web/src/components/settings/SettingsPanels.tsx -index dca3eabc86..fe17e9e378 100644 +index 362210f96e..20e160eafd 100644 --- a/apps/web/src/components/settings/SettingsPanels.tsx +++ b/apps/web/src/components/settings/SettingsPanels.tsx -@@ -326,6 +326,8 @@ function AboutVersionSection() { +@@ -347,6 +347,8 @@ function AboutVersionSection() { Review > @@ -41,7 +41,7 @@ index dca3eabc86..fe17e9e378 100644 ) : ( "Switches this app and every connected machine whose database the target release supports." ) -@@ -333,6 +335,7 @@ function AboutVersionSection() { +@@ -355,6 +357,7 @@ function AboutVersionSection() { control={ { if (value !== selectedUpdateChannel) { setSwitchChannel(value as DesktopUpdateChannel); -@@ -343,7 +346,7 @@ function AboutVersionSection() { +@@ -365,7 +368,7 @@ function AboutVersionSection() { size="sm" className="w-full sm:w-40" aria-label="Update track" diff --git a/patches/0013-flatpak-startup-recovery.patch b/patches/0013-flatpak-startup-recovery.patch index 114d4d7..983b08d 100644 --- a/patches/0013-flatpak-startup-recovery.patch +++ b/patches/0013-flatpak-startup-recovery.patch @@ -1,5 +1,5 @@ diff --git a/apps/desktop/src/app/DesktopStartupRecovery.ts b/apps/desktop/src/app/DesktopStartupRecovery.ts -index 4d2dbcfb14..3723bedeaf 100644 +index c8228183aa..ab23819f60 100644 --- a/apps/desktop/src/app/DesktopStartupRecovery.ts +++ b/apps/desktop/src/app/DesktopStartupRecovery.ts @@ -17,6 +17,7 @@ import type { BackendStartupFailure } from "../backend/DesktopBackendManager.ts" @@ -10,7 +10,7 @@ index 4d2dbcfb14..3723bedeaf 100644 const RELEASES_URL = "https://github.com/pingdotgg/t3code/releases"; const LAST_STARTED_VERSION_FILE = "desktop-last-started-version"; -@@ -74,7 +75,25 @@ const escapeHtml = (value: string) => +@@ -78,7 +79,25 @@ const escapeHtml = (value: string) => const actionLink = (action: StartupRecoveryAction, label: string, primary = false) => `${escapeHtml(label)}`; @@ -37,7 +37,7 @@ index 4d2dbcfb14..3723bedeaf 100644 switch (offer._tag) { case "Checking": return { text: "Checking for a newer version…", action: "" }; -@@ -106,8 +125,9 @@ function buildStartupRecoveryHtml(input: { +@@ -115,8 +134,9 @@ function buildStartupRecoveryHtml(input: { readonly failure: BackendStartupFailure; readonly offer: StartupRecoveryOffer; readonly logDir: string; @@ -48,7 +48,7 @@ index 4d2dbcfb14..3723bedeaf 100644 const output = input.failure.output.trim(); return `T3 Code could not start
Update to T3 Code 0.1.7.
The desktop now follows an organization's managed policy at + /etc/t3code/policy.json, matching the T3 server on the host.