diff --git a/apps/desktop/src/i18n/translations/de.json b/apps/desktop/src/i18n/translations/de.json index 92f2ec88b3bdb..8e39e7585f60d 100644 --- a/apps/desktop/src/i18n/translations/de.json +++ b/apps/desktop/src/i18n/translations/de.json @@ -55,6 +55,8 @@ "6994444f4fec4070": "Browservorschau", "49de6209699eb616": "Unbenannter Passkey", "b4a5bb1075d95154": "Passkey auswählen", + "61aa0109862ff7ca": "Nightly", + "f3430cac09a505a0": "Stable", "1f12213f4d809e89": "Du bist auf dem neuesten Stand!", "c6399b55619e2f67": "T3 Code {version} ist derzeit die neueste verfügbare Version.", "b6e5b31255e011c5": "OK", @@ -74,6 +76,7 @@ "2f0a8211a72e29aa": "Neu starten", "116a21f6cc215e5f": "Suche nach Updates fehlgeschlagen", "32c88cd9421abf33": "Es konnte nicht nach Updates gesucht werden.", + "9e5ada64a94c10de": "Dieser {build}-Build kann sich über den Kanal {saved} nicht selbst aktualisieren. Stelle den Update-Kanal wieder auf {build} um oder nutze Review neben Update-Kanal, um den Wechsel zu {saved} erneut zu versuchen.", "b37aca07d3c644d9": "Ein unbekannter Fehler ist aufgetreten. Bitte versuche es später erneut.", "c8c23435e780a60c": "Updates nicht verfügbar", "aecf7c98b81bef7a": "Automatische Updates sind derzeit nicht verfügbar.", diff --git a/apps/desktop/src/i18n/translations/en.json b/apps/desktop/src/i18n/translations/en.json index 964d6a7ed12f7..9a07ef060cbc9 100644 --- a/apps/desktop/src/i18n/translations/en.json +++ b/apps/desktop/src/i18n/translations/en.json @@ -55,6 +55,8 @@ "6994444f4fec4070": "Browser preview", "49de6209699eb616": "Unnamed passkey", "b4a5bb1075d95154": "Choose a passkey", + "61aa0109862ff7ca": "Nightly", + "f3430cac09a505a0": "Stable", "1f12213f4d809e89": "You're up to date!", "c6399b55619e2f67": "T3 Code {version} is currently the newest version available.", "b6e5b31255e011c5": "OK", @@ -74,6 +76,7 @@ "2f0a8211a72e29aa": "Restart", "116a21f6cc215e5f": "Update check failed", "32c88cd9421abf33": "Could not check for updates.", + "9e5ada64a94c10de": "This {build} build can't update from the {saved} track on its own. Switch the update track back to {build}, or use Review beside Update track to retry the switch to {saved}.", "b37aca07d3c644d9": "An unknown error occurred. Please try again later.", "c8c23435e780a60c": "Updates unavailable", "aecf7c98b81bef7a": "Automatic updates are not available right now.", diff --git a/apps/desktop/src/i18n/translations/es.json b/apps/desktop/src/i18n/translations/es.json index c1a64c21e241d..f891e9eaf850b 100644 --- a/apps/desktop/src/i18n/translations/es.json +++ b/apps/desktop/src/i18n/translations/es.json @@ -55,6 +55,8 @@ "6994444f4fec4070": "Vista previa del navegador", "49de6209699eb616": "Llave de acceso sin nombre", "b4a5bb1075d95154": "Elige una llave de acceso", + "61aa0109862ff7ca": "Nightly", + "f3430cac09a505a0": "Estable", "1f12213f4d809e89": "¡Estás al día!", "c6399b55619e2f67": "T3 Code {version} es la versión más reciente disponible.", "b6e5b31255e011c5": "Aceptar", @@ -74,6 +76,7 @@ "2f0a8211a72e29aa": "Reiniciar", "116a21f6cc215e5f": "Error al buscar actualizaciones", "32c88cd9421abf33": "No se pudo buscar actualizaciones.", + "9e5ada64a94c10de": "Esta compilación {build} no puede actualizarse por sí sola desde el canal {saved}. Vuelve a poner el canal de actualizaciones en {build} o usa Revisar junto a Canal de actualizaciones para reintentar el cambio a {saved}.", "b37aca07d3c644d9": "Se produjo un error desconocido. Vuelve a intentarlo más tarde.", "c8c23435e780a60c": "Actualizaciones no disponibles", "aecf7c98b81bef7a": "Las actualizaciones automáticas no están disponibles ahora mismo.", diff --git a/apps/desktop/src/i18n/translations/fr.json b/apps/desktop/src/i18n/translations/fr.json index 4a0376ba9c94a..0bb5a47518581 100644 --- a/apps/desktop/src/i18n/translations/fr.json +++ b/apps/desktop/src/i18n/translations/fr.json @@ -55,6 +55,8 @@ "6994444f4fec4070": "Aperçu du navigateur", "49de6209699eb616": "Clé d’accès sans nom", "b4a5bb1075d95154": "Choisir une clé d’accès", + "61aa0109862ff7ca": "Nightly", + "f3430cac09a505a0": "Stable", "1f12213f4d809e89": "Vous êtes à jour !", "c6399b55619e2f67": "T3 Code {version} est actuellement la version la plus récente.", "b6e5b31255e011c5": "OK", @@ -74,6 +76,7 @@ "2f0a8211a72e29aa": "Redémarrer", "116a21f6cc215e5f": "Échec de la recherche de mises à jour", "32c88cd9421abf33": "Impossible de rechercher des mises à jour.", + "9e5ada64a94c10de": "Cette version {build} ne peut pas se mettre à jour seule depuis le canal {saved}. Remettez le canal de mise à jour sur {build}, ou utilisez Consulter à côté de Canal de mise à jour pour relancer le passage à {saved}.", "b37aca07d3c644d9": "Une erreur inconnue s’est produite. Veuillez réessayer plus tard.", "c8c23435e780a60c": "Mises à jour indisponibles", "aecf7c98b81bef7a": "Les mises à jour automatiques ne sont pas disponibles pour le moment.", diff --git a/apps/desktop/src/i18n/translations/ja.json b/apps/desktop/src/i18n/translations/ja.json index 4b5db0e253a42..df89efe466261 100644 --- a/apps/desktop/src/i18n/translations/ja.json +++ b/apps/desktop/src/i18n/translations/ja.json @@ -55,6 +55,8 @@ "6994444f4fec4070": "ブラウザープレビュー", "49de6209699eb616": "名前のないパスキー", "b4a5bb1075d95154": "パスキーを選択", + "61aa0109862ff7ca": "Nightly", + "f3430cac09a505a0": "安定版", "1f12213f4d809e89": "最新の状態です", "c6399b55619e2f67": "T3 Code {version} が現在利用できる最新バージョンです。", "b6e5b31255e011c5": "OK", @@ -74,6 +76,7 @@ "2f0a8211a72e29aa": "再起動", "116a21f6cc215e5f": "更新の確認に失敗しました", "32c88cd9421abf33": "更新を確認できませんでした。", + "9e5ada64a94c10de": "この {build} ビルドは {saved} トラックから単独では更新できません。更新トラックを {build} に戻すか、更新トラックの横にある「レビュー」を使って {saved} への切り替えを再試行してください。", "b37aca07d3c644d9": "不明なエラーが発生しました。しばらくしてからもう一度お試しください。", "c8c23435e780a60c": "更新を利用できません", "aecf7c98b81bef7a": "現在、自動更新は利用できません。", diff --git a/apps/desktop/src/i18n/translations/ko.json b/apps/desktop/src/i18n/translations/ko.json index ccebba3366e84..566724b9b91c1 100644 --- a/apps/desktop/src/i18n/translations/ko.json +++ b/apps/desktop/src/i18n/translations/ko.json @@ -55,6 +55,8 @@ "6994444f4fec4070": "브라우저 미리 보기", "49de6209699eb616": "이름 없는 패스키", "b4a5bb1075d95154": "패스키 선택", + "61aa0109862ff7ca": "Nightly", + "f3430cac09a505a0": "Stable", "1f12213f4d809e89": "최신 버전입니다!", "c6399b55619e2f67": "T3 Code {version}이(가) 현재 사용 가능한 최신 버전입니다.", "b6e5b31255e011c5": "확인", @@ -74,6 +76,7 @@ "2f0a8211a72e29aa": "다시 시작", "116a21f6cc215e5f": "업데이트 확인 실패", "32c88cd9421abf33": "업데이트를 확인할 수 없습니다.", + "9e5ada64a94c10de": "이 {build} 빌드는 {saved} 트랙에서 스스로 업데이트할 수 없습니다. 업데이트 트랙을 다시 {build}(으)로 바꾸거나, 업데이트 트랙 옆의 검토를 사용해 {saved}(으)로 전환을 다시 시도하세요.", "b37aca07d3c644d9": "알 수 없는 오류가 발생했습니다. 나중에 다시 시도하세요.", "c8c23435e780a60c": "업데이트를 사용할 수 없음", "aecf7c98b81bef7a": "지금은 자동 업데이트를 사용할 수 없습니다.", diff --git a/apps/desktop/src/i18n/translations/pt-BR.json b/apps/desktop/src/i18n/translations/pt-BR.json index 11e80a2f667bb..67f4eefd1c9ec 100644 --- a/apps/desktop/src/i18n/translations/pt-BR.json +++ b/apps/desktop/src/i18n/translations/pt-BR.json @@ -55,6 +55,8 @@ "6994444f4fec4070": "Pré-visualização do navegador", "49de6209699eb616": "Chave de acesso sem nome", "b4a5bb1075d95154": "Escolha uma chave de acesso", + "61aa0109862ff7ca": "Nightly", + "f3430cac09a505a0": "Estável", "1f12213f4d809e89": "Você está atualizado!", "c6399b55619e2f67": "O T3 Code {version} é a versão mais recente disponível.", "b6e5b31255e011c5": "OK", @@ -74,6 +76,7 @@ "2f0a8211a72e29aa": "Reiniciar", "116a21f6cc215e5f": "Falha ao verificar atualizações", "32c88cd9421abf33": "Não foi possível verificar atualizações.", + "9e5ada64a94c10de": "Esta build {build} não consegue se atualizar sozinha pelo canal {saved}. Volte o canal de atualização para {build} ou use Revisar ao lado de Canal de atualização para tentar de novo a mudança para {saved}.", "b37aca07d3c644d9": "Ocorreu um erro desconhecido. Tente novamente mais tarde.", "c8c23435e780a60c": "Atualizações indisponíveis", "aecf7c98b81bef7a": "As atualizações automáticas não estão disponíveis no momento.", diff --git a/apps/desktop/src/i18n/translations/ru.json b/apps/desktop/src/i18n/translations/ru.json index cdcf02d0648dd..46364dfabe488 100644 --- a/apps/desktop/src/i18n/translations/ru.json +++ b/apps/desktop/src/i18n/translations/ru.json @@ -55,6 +55,8 @@ "6994444f4fec4070": "Предпросмотр в браузере", "49de6209699eb616": "Безымянный ключ доступа", "b4a5bb1075d95154": "Выберите ключ доступа", + "61aa0109862ff7ca": "Nightly", + "f3430cac09a505a0": "Стабильный", "1f12213f4d809e89": "У вас последняя версия!", "c6399b55619e2f67": "T3 Code {version} — новейшая доступная версия.", "b6e5b31255e011c5": "OK", @@ -74,6 +76,7 @@ "2f0a8211a72e29aa": "Перезапустить", "116a21f6cc215e5f": "Ошибка проверки обновлений", "32c88cd9421abf33": "Не удалось проверить обновления.", + "9e5ada64a94c10de": "Эта сборка {build} не может сама обновиться с канала «{saved}». Верните канал обновлений на «{build}» или нажмите «Ревью» рядом с «Канал обновлений», чтобы повторить переход на «{saved}».", "b37aca07d3c644d9": "Произошла неизвестная ошибка. Повторите попытку позже.", "c8c23435e780a60c": "Обновления недоступны", "aecf7c98b81bef7a": "Автоматические обновления сейчас недоступны.", diff --git a/apps/desktop/src/i18n/translations/sv.json b/apps/desktop/src/i18n/translations/sv.json index e2a204965fec2..67bcaf6a380aa 100644 --- a/apps/desktop/src/i18n/translations/sv.json +++ b/apps/desktop/src/i18n/translations/sv.json @@ -55,6 +55,8 @@ "6994444f4fec4070": "Förhandsvisning i webbläsaren", "49de6209699eb616": "Namnlös lösenordsnyckel", "b4a5bb1075d95154": "Välj en lösenordsnyckel", + "61aa0109862ff7ca": "Nightly", + "f3430cac09a505a0": "Stable", "1f12213f4d809e89": "Du har den senaste versionen!", "c6399b55619e2f67": "T3 Code {version} är den senaste tillgängliga versionen.", "b6e5b31255e011c5": "OK", @@ -74,6 +76,7 @@ "2f0a8211a72e29aa": "Starta om", "116a21f6cc215e5f": "Sökningen efter uppdateringar misslyckades", "32c88cd9421abf33": "Kunde inte söka efter uppdateringar.", + "9e5ada64a94c10de": "Den här {build}-versionen kan inte uppdatera sig själv från spåret {saved}. Byt tillbaka uppdateringsspåret till {build}, eller använd Granska bredvid Uppdateringsspår för att försöka byta till {saved} igen.", "b37aca07d3c644d9": "Ett okänt fel inträffade. Försök igen senare.", "c8c23435e780a60c": "Uppdateringar är inte tillgängliga", "aecf7c98b81bef7a": "Automatiska uppdateringar är inte tillgängliga just nu.", diff --git a/apps/desktop/src/i18n/translations/zh.json b/apps/desktop/src/i18n/translations/zh.json index 6a89cd600c37a..72122de01df62 100644 --- a/apps/desktop/src/i18n/translations/zh.json +++ b/apps/desktop/src/i18n/translations/zh.json @@ -55,6 +55,8 @@ "6994444f4fec4070": "浏览器预览", "49de6209699eb616": "未命名通行密钥", "b4a5bb1075d95154": "选择通行密钥", + "61aa0109862ff7ca": "Nightly 版", + "f3430cac09a505a0": "稳定版", "1f12213f4d809e89": "已是最新版本!", "c6399b55619e2f67": "T3 Code {version} 已是最新版本。", "b6e5b31255e011c5": "确定", @@ -74,6 +76,7 @@ "2f0a8211a72e29aa": "重启", "116a21f6cc215e5f": "检查更新失败", "32c88cd9421abf33": "无法检查更新。", + "9e5ada64a94c10de": "此 {build} 构建无法自行从 {saved} 通道更新。请将更新通道切回 {build},或使用“更新通道”旁的“查看”重新尝试切换到 {saved}。", "b37aca07d3c644d9": "发生未知错误,请稍后重试。", "c8c23435e780a60c": "更新不可用", "aecf7c98b81bef7a": "目前无法自动更新。", diff --git a/apps/desktop/src/updates/DesktopUpdates.test.ts b/apps/desktop/src/updates/DesktopUpdates.test.ts index 33ed00a764738..535e1123d2911 100644 --- a/apps/desktop/src/updates/DesktopUpdates.test.ts +++ b/apps/desktop/src/updates/DesktopUpdates.test.ts @@ -79,6 +79,17 @@ const stableUpdateInfo = ( }; }; +// Subscribes before emitting, so the state the emit publishes is the one awaited, not a scheduler yield. +const nextPublishedState = (emit: () => void) => + Effect.gen(function* () { + const updates = yield* DesktopUpdates.DesktopUpdates; + const { changes } = yield* updates.subscribe; + const published = yield* Stream.runHead(changes).pipe(Effect.forkChild); + emit(); + yield* Fiber.join(published); + return yield* updates.getState; + }); + describe("DesktopUpdates", () => { it.effect("updates Linux .deb installs and leaves other non-AppImage installs off", () => Effect.gen(function* () { @@ -1191,16 +1202,49 @@ describe("DesktopUpdates", () => { const updates = yield* DesktopUpdates.DesktopUpdates; yield* updates.configure; yield* updates.check("startup"); - harness.emit("update-available", { version: "1.2.4-nightly.20261027.1" }); - yield* flushCallbacks; - - assert.equal((yield* updates.getState).channel, "nightly"); - assert.isNull((yield* updates.getState).availableVersion); + const state = yield* nextPublishedState(() => + harness.emit("update-available", { version: "1.2.4-nightly.20261027.1" }), + ); + assert.equal(state.channel, "nightly"); + assert.isNull(state.availableVersion); + assert.equal(state.status, "error"); + assert.equal(state.errorContext, "check"); + assert.isTrue(state.canRetry); + assert.deepEqual(state.trackMismatch, { buildChannel: "latest" }); assert.deepEqual(harness.checkAllowedDowngrade, [false]); }), ).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer))); }); + it.effect("reports a track mismatch when the feed offers no release at all", () => { + const harness = makeHarness({ savedChannel: "nightly" }); + + return Effect.scoped( + Effect.gen(function* () { + const updates = yield* DesktopUpdates.DesktopUpdates; + yield* updates.configure; + yield* updates.check("startup"); + const state = yield* nextPublishedState(() => harness.emit("update-not-available")); + assert.equal(state.status, "error"); + assert.equal(state.errorContext, "check"); + assert.isTrue(state.canRetry); + assert.deepEqual(state.trackMismatch, { buildChannel: "latest" }); + + // A later failure has its own reason, so the mismatch must not stay attached to it. + const failed = yield* nextPublishedState(() => + harness.emit("error", new Error("background updater failure")), + ); + assert.isUndefined(failed.trackMismatch); + + const mismatched = yield* nextPublishedState(() => harness.emit("update-not-available")); + assert.isDefined(mismatched.trackMismatch); + yield* updates.check("menu"); + assert.equal((yield* updates.getState).status, "checking"); + assert.isUndefined((yield* updates.getState).trackMismatch); + }), + ).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer))); + }); + it.effect("never offers an older Nightly to a Nightly build's own checks", () => { const harness = makeHarness({ appVersion: "1.2.4-nightly.20261027.1" }); @@ -1389,6 +1433,28 @@ describe("DesktopUpdates under a managed policy", () => { ).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer))); }); + it.effect("does not name a blocked build track as the one to switch back to", () => { + const harness = makeHarness({ + appVersion: "1.2.4-nightly.20261027.1", + savedChannel: "latest", + policy: managed({ allowNightly: false, feedUrl: "https://updates.example.com/t3code" }), + }); + + return Effect.scoped( + Effect.gen(function* () { + const updates = yield* DesktopUpdates.DesktopUpdates; + yield* updates.configure; + yield* updates.check("startup"); + const state = yield* nextPublishedState(() => harness.emit("update-not-available")); + + assert.equal(state.channel, "latest"); + assert.equal(state.status, "error"); + assert.equal(state.errorContext, "check"); + assert.isUndefined(state.trackMismatch); + }), + ).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer))); + }); + it.effect("does not report the channel as the only block when updates are off anyway", () => { const harness = makeHarness({ appVersion: "1.2.3-nightly.20261028.1", diff --git a/apps/desktop/src/updates/DesktopUpdates.ts b/apps/desktop/src/updates/DesktopUpdates.ts index 775a9ff6b04ff..7976503d9e761 100644 --- a/apps/desktop/src/updates/DesktopUpdates.ts +++ b/apps/desktop/src/updates/DesktopUpdates.ts @@ -368,6 +368,13 @@ function getAutoUpdateDisabledReason(args: { return null; } +const trackLabel = (channel: DesktopUpdateChannel) => + channel === "nightly" ? "Nightly" : "Stable"; + +// Clients localize `trackMismatch`; this English text serves older renderers and remote reports. +const trackMismatchMessage = (build: DesktopUpdateChannel, saved: DesktopUpdateChannel) => + `This ${trackLabel(build)} build can't update from the ${trackLabel(saved)} track on its own. Switch the update track back to ${trackLabel(build)}, or use Review beside Update track to retry the switch to ${trackLabel(saved)}.`; + function isArm64HostRunningIntelBuild(runtimeInfo: DesktopRuntimeInfo): boolean { return runtimeInfo.hostArch === "arm64" && runtimeInfo.appArch === "x64"; } @@ -496,6 +503,26 @@ export const make = Effect.gen(function* () { ) : Option.none(); + // Without a release floor, a build on another track than its saved one never offers anything. + // A track the policy blocks is never named as the one to switch to. + const noOfferState = (state: DesktopUpdateState, checkedAt: string) => + Effect.map(Ref.get(releaseFloorRef), (floor) => { + const buildChannel = desktopUpdateChannelOf(environment.appVersion); + if (Option.isSome(floor) || buildChannel === state.channel) { + return reduceDesktopUpdateStateOnNoUpdate(state, checkedAt); + } + const blocked = channelBlockedReason(buildChannel); + if (Option.isSome(blocked)) { + return reduceDesktopUpdateStateOnCheckFailure(state, blocked.value, checkedAt); + } + return reduceDesktopUpdateStateOnCheckFailure( + state, + trackMismatchMessage(buildChannel, state.channel), + checkedAt, + { buildChannel }, + ); + }); + const resolveStateDisabledReason = (channel: DesktopUpdateChannel) => resolveDisabledReason.pipe(Effect.map(Option.orElse(() => channelBlockedReason(channel)))); @@ -1070,7 +1097,7 @@ export const make = Effect.gen(function* () { channel: state.channel, }); const checkedAt = yield* currentIsoTimestamp; - yield* setState(reduceDesktopUpdateStateOnNoUpdate(state, checkedAt)); + yield* setState(yield* noOfferState(state, checkedAt)); yield* Ref.set(lastLoggedDownloadMilestoneRef, -1); return; } @@ -1117,7 +1144,7 @@ export const make = Effect.gen(function* () { const handleUpdateNotAvailable = Effect.gen(function* () { const checkedAt = yield* currentIsoTimestamp; const state = yield* Ref.get(updateStateRef); - yield* setState(reduceDesktopUpdateStateOnNoUpdate(state, checkedAt)); + yield* setState(yield* noOfferState(state, checkedAt)); yield* Ref.set(lastLoggedDownloadMilestoneRef, -1); yield* logUpdaterInfo("no updates available"); }).pipe(Effect.withSpan("desktop.updates.handleUpdateNotAvailable")); @@ -1145,7 +1172,7 @@ export const make = Effect.gen(function* () { if (Option.isNone(activeAction)) { const checkedAt = yield* currentIsoTimestamp; - yield* updateState((current) => ({ + yield* updateState(({ trackMismatch: _trackMismatch, ...current }) => ({ ...current, status: "error", message: error.message, diff --git a/apps/desktop/src/updates/updateMachine.ts b/apps/desktop/src/updates/updateMachine.ts index 4d3852446b189..80751315657c0 100644 --- a/apps/desktop/src/updates/updateMachine.ts +++ b/apps/desktop/src/updates/updateMachine.ts @@ -11,6 +11,14 @@ function nextStatusAfterDownloadFailure( return currentState.availableVersion ? "available" : "error"; } +// A mismatch describes only the check that found it. +function withoutTrackMismatch({ + trackMismatch: _trackMismatch, + ...state +}: DesktopUpdateState): DesktopUpdateState { + return state; +} + function getCanRetryAfterDownloadFailure(currentState: DesktopUpdateState): boolean { return currentState.availableVersion !== null; } @@ -46,7 +54,7 @@ export function reduceDesktopUpdateStateOnCheckStart( ): DesktopUpdateState { const hasDownloadedUpdate = state.downloadedVersion !== null; return { - ...state, + ...withoutTrackMismatch(state), status: "checking", checkedAt, releaseNotes: hasDownloadedUpdate ? state.releaseNotes : [], @@ -62,10 +70,11 @@ export function reduceDesktopUpdateStateOnCheckFailure( state: DesktopUpdateState, message: string, checkedAt: string, + trackMismatch?: DesktopUpdateState["trackMismatch"], ): DesktopUpdateState { if (state.downloadedVersion !== null) { return { - ...state, + ...withoutTrackMismatch(state), status: "downloaded", message: null, checkedAt, @@ -76,13 +85,14 @@ export function reduceDesktopUpdateStateOnCheckFailure( } return { - ...state, + ...withoutTrackMismatch(state), status: "error", message, checkedAt, downloadPercent: null, errorContext: "check", canRetry: true, + ...(trackMismatch === undefined ? {} : { trackMismatch }), }; } @@ -96,7 +106,7 @@ export function reduceDesktopUpdateStateOnUpdateAvailable( const isDownloadedVersion = state.downloadedVersion === version; const preserveReleaseNotes = isDownloadedVersion && releaseNotes.length === 0; return { - ...state, + ...withoutTrackMismatch(state), status: isDownloadedVersion ? "downloaded" : "available", availableVersion: version, downloadedVersion: isDownloadedVersion ? version : null, @@ -116,7 +126,7 @@ export function reduceDesktopUpdateStateOnNoUpdate( ): DesktopUpdateState { if (state.downloadedVersion !== null) { return { - ...state, + ...withoutTrackMismatch(state), status: "downloaded", availableVersion: state.downloadedVersion, downloadPercent: 100, @@ -128,7 +138,7 @@ export function reduceDesktopUpdateStateOnNoUpdate( } return { - ...state, + ...withoutTrackMismatch(state), status: "up-to-date", availableVersion: null, downloadedVersion: null, @@ -146,7 +156,7 @@ export function reduceDesktopUpdateStateOnDownloadStart( state: DesktopUpdateState, ): DesktopUpdateState { return { - ...state, + ...withoutTrackMismatch(state), status: "downloading", downloadPercent: 0, message: null, @@ -160,7 +170,7 @@ export function reduceDesktopUpdateStateOnDownloadFailure( message: string, ): DesktopUpdateState { return { - ...state, + ...withoutTrackMismatch(state), status: nextStatusAfterDownloadFailure(state), message, downloadPercent: null, @@ -174,7 +184,7 @@ export function reduceDesktopUpdateStateOnDownloadProgress( percent: number, ): DesktopUpdateState { return { - ...state, + ...withoutTrackMismatch(state), status: "downloading", downloadPercent: percent, message: null, @@ -188,7 +198,7 @@ export function reduceDesktopUpdateStateOnDownloadComplete( version: string, ): DesktopUpdateState { return { - ...state, + ...withoutTrackMismatch(state), status: "downloaded", availableVersion: version, downloadedVersion: version, @@ -204,7 +214,7 @@ export function reduceDesktopUpdateStateOnInstallFailure( message: string, ): DesktopUpdateState { return { - ...state, + ...withoutTrackMismatch(state), status: "downloaded", message, errorContext: "install", diff --git a/apps/desktop/src/window/DesktopApplicationMenu.ts b/apps/desktop/src/window/DesktopApplicationMenu.ts index 392208d5b54c9..543d8d245731b 100644 --- a/apps/desktop/src/window/DesktopApplicationMenu.ts +++ b/apps/desktop/src/window/DesktopApplicationMenu.ts @@ -4,6 +4,7 @@ import * as Layer from "effect/Layer"; import * as Option from "effect/Option"; import * as Schema from "effect/Schema"; +import type { DesktopUpdateChannel } from "@t3tools/contracts"; import * as Electron from "electron"; import { msg } from "gt-i18n"; @@ -68,6 +69,11 @@ const runMainContentsCommand = Effect.fn("desktop.menu.runMainContentsCommand")( yield* desktopWindow.runMainContentsCommand(command); }); +const trackLabel = (channel: DesktopUpdateChannel) => + channel === "nightly" + ? m(msg("Nightly", { $context: "release track" })) + : m(msg("Stable", { $context: "release track" })); + const checkForUpdatesFromMenu = Effect.gen(function* () { const updates = yield* DesktopUpdates.DesktopUpdates; const electronDialog = yield* ElectronDialog.ElectronDialog; @@ -134,7 +140,18 @@ const checkForUpdatesFromMenu = Effect.gen(function* () { type: "warning", title: m(msg("Update check failed")), message: m(msg("Could not check for updates.")), - detail: updateState.message ?? m(msg("An unknown error occurred. Please try again later.")), + detail: + updateState.trackMismatch !== undefined + ? m( + msg( + "This {build} build can't update from the {saved} track on its own. Switch the update track back to {build}, or use Review beside Update track to retry the switch to {saved}.", + ), + { + build: trackLabel(updateState.trackMismatch.buildChannel), + saved: trackLabel(updateState.channel), + }, + ) + : (updateState.message ?? m(msg("An unknown error occurred. Please try again later."))), buttons: [m(msg("OK"))], }); } diff --git a/apps/mobile/src/i18n/translations/de.json b/apps/mobile/src/i18n/translations/de.json index 1ca61edb42844..37ef54a516c22 100644 --- a/apps/mobile/src/i18n/translations/de.json +++ b/apps/mobile/src/i18n/translations/de.json @@ -732,6 +732,8 @@ "b50da99bbfd59a6d": "Das Update auf t3@{version} wurde zurückgerollt.", "31dc4da5813e0846": "Das Update auf t3@{version} ist fehlgeschlagen.", "b060872e18e91755": "Server-Update fehlgeschlagen.", + "77231250643f4943": "Dieser {build, select, nightly {Nightly} other {Stable}}-Build kann sich über den Kanal {saved, select, nightly {Nightly} other {Stable}} nicht selbst aktualisieren. Stelle den Update-Kanal wieder auf {build, select, nightly {Nightly} other {Stable}} um oder nutze Review neben Update-Kanal, um den Wechsel zu {saved, select, nightly {Nightly} other {Stable}} erneut zu versuchen.", + "43ed503038717b90": "Server-Update fehlgeschlagen:", "a8cb0a2b46270859": "Die Umgebungsdaten konnten nicht synchronisiert werden.", "4731d4616735186c": "{count, plural, one {{count} Subagent gestartet} other {{count} Subagenten gestartet}}", "885110d4e416d2cd": "{count, plural, one {{count} Subagent ausgeführt} other {{count} Subagenten ausgeführt}}", diff --git a/apps/mobile/src/i18n/translations/en.json b/apps/mobile/src/i18n/translations/en.json index 0c37b2d400c94..07497d40185c3 100644 --- a/apps/mobile/src/i18n/translations/en.json +++ b/apps/mobile/src/i18n/translations/en.json @@ -732,6 +732,8 @@ "b50da99bbfd59a6d": "The t3@{version} update rolled-back.", "31dc4da5813e0846": "The t3@{version} update failed.", "b060872e18e91755": "Server update failed.", + "77231250643f4943": "This {build, select, nightly {Nightly} other {Stable}} build can't update from the {saved, select, nightly {Nightly} other {Stable}} track on its own. Switch the update track back to {build, select, nightly {Nightly} other {Stable}}, or use Review beside Update track to retry the switch to {saved, select, nightly {Nightly} other {Stable}}.", + "43ed503038717b90": "Server update failed:", "a8cb0a2b46270859": "Could not synchronize environment data.", "4731d4616735186c": "{count, plural, one {Kicked off {count} subagent} other {Kicked off {count} subagents}}", "885110d4e416d2cd": "{count, plural, one {Ran {count} subagent} other {Ran {count} subagents}}", diff --git a/apps/mobile/src/i18n/translations/es.json b/apps/mobile/src/i18n/translations/es.json index 09e9b73026ad9..e21ead3965f65 100644 --- a/apps/mobile/src/i18n/translations/es.json +++ b/apps/mobile/src/i18n/translations/es.json @@ -732,6 +732,8 @@ "b50da99bbfd59a6d": "La actualización a t3@{version} se revirtió.", "31dc4da5813e0846": "La actualización a t3@{version} falló.", "b060872e18e91755": "Falló la actualización del servidor.", + "77231250643f4943": "Esta compilación {build, select, nightly {Nightly} other {Estable}} no puede actualizarse por sí sola desde el canal {saved, select, nightly {Nightly} other {Estable}}. Vuelve a poner el canal de actualizaciones en {build, select, nightly {Nightly} other {Estable}} o usa Revisar junto a Canal de actualizaciones para reintentar el cambio a {saved, select, nightly {Nightly} other {Estable}}.", + "43ed503038717b90": "Falló la actualización del servidor:", "a8cb0a2b46270859": "No se pudieron sincronizar los datos del entorno.", "4731d4616735186c": "{count, plural, one {Se inició {count} subagente} other {Se iniciaron {count} subagentes}}", "885110d4e416d2cd": "{count, plural, one {Se ejecutó {count} subagente} other {Se ejecutaron {count} subagentes}}", diff --git a/apps/mobile/src/i18n/translations/fr.json b/apps/mobile/src/i18n/translations/fr.json index 69183070867dd..80afd3aa9c4a4 100644 --- a/apps/mobile/src/i18n/translations/fr.json +++ b/apps/mobile/src/i18n/translations/fr.json @@ -732,6 +732,8 @@ "b50da99bbfd59a6d": "La mise à jour t3@{version} a été annulée.", "31dc4da5813e0846": "La mise à jour t3@{version} a échoué.", "b060872e18e91755": "Échec de la mise à jour du serveur.", + "77231250643f4943": "Cette version {build, select, nightly {Nightly} other {Stable}} ne peut pas se mettre à jour seule depuis le canal {saved, select, nightly {Nightly} other {Stable}}. Remettez le canal de mise à jour sur {build, select, nightly {Nightly} other {Stable}}, ou utilisez Consulter à côté de Canal de mise à jour pour relancer le passage à {saved, select, nightly {Nightly} other {Stable}}.", + "43ed503038717b90": "Échec de la mise à jour du serveur :", "a8cb0a2b46270859": "Impossible de synchroniser les données de l’environnement.", "4731d4616735186c": "{count, plural, one {{count} sous-agent lancé} other {{count} sous-agents lancés}}", "885110d4e416d2cd": "{count, plural, one {{count} sous-agent exécuté} other {{count} sous-agents exécutés}}", diff --git a/apps/mobile/src/i18n/translations/ja.json b/apps/mobile/src/i18n/translations/ja.json index fd55b3e454fa2..16e5c51eb8b92 100644 --- a/apps/mobile/src/i18n/translations/ja.json +++ b/apps/mobile/src/i18n/translations/ja.json @@ -732,6 +732,8 @@ "b50da99bbfd59a6d": "t3@{version} の更新はロールバックされました。", "31dc4da5813e0846": "t3@{version} の更新に失敗しました。", "b060872e18e91755": "サーバーの更新に失敗しました。", + "77231250643f4943": "この {build, select, nightly {Nightly} other {安定版}} ビルドは {saved, select, nightly {Nightly} other {安定版}} トラックから単独では更新できません。更新トラックを {build, select, nightly {Nightly} other {安定版}} に戻すか、更新トラックの横にある「レビュー」を使って {saved, select, nightly {Nightly} other {安定版}} への切り替えを再試行してください。", + "43ed503038717b90": "サーバーの更新に失敗しました:", "a8cb0a2b46270859": "環境のデータを同期できませんでした。", "4731d4616735186c": "{count, plural, other {{count} 個のサブエージェントを開始しました}}", "885110d4e416d2cd": "{count, plural, other {{count} 個のサブエージェントを実行しました}}", diff --git a/apps/mobile/src/i18n/translations/ko.json b/apps/mobile/src/i18n/translations/ko.json index 0489c6184e35e..fde064367a5e7 100644 --- a/apps/mobile/src/i18n/translations/ko.json +++ b/apps/mobile/src/i18n/translations/ko.json @@ -732,6 +732,8 @@ "b50da99bbfd59a6d": "t3@{version} 업데이트가 롤백되었습니다.", "31dc4da5813e0846": "t3@{version} 업데이트에 실패했습니다.", "b060872e18e91755": "서버 업데이트에 실패했습니다.", + "77231250643f4943": "이 {build, select, nightly {Nightly} other {Stable}} 빌드는 {saved, select, nightly {Nightly} other {Stable}} 트랙에서 스스로 업데이트할 수 없습니다. 업데이트 트랙을 다시 {build, select, nightly {Nightly} other {Stable}}(으)로 바꾸거나, 업데이트 트랙 옆의 검토를 사용해 {saved, select, nightly {Nightly} other {Stable}}(으)로 전환을 다시 시도하세요.", + "43ed503038717b90": "서버 업데이트에 실패했습니다:", "a8cb0a2b46270859": "환경 데이터를 동기화할 수 없습니다.", "4731d4616735186c": "{count, plural, other {서브에이전트 {count}개 시작함}}", "885110d4e416d2cd": "{count, plural, other {서브에이전트 {count}개 실행함}}", diff --git a/apps/mobile/src/i18n/translations/pt-BR.json b/apps/mobile/src/i18n/translations/pt-BR.json index 03d50749e39cd..65bc13288a86c 100644 --- a/apps/mobile/src/i18n/translations/pt-BR.json +++ b/apps/mobile/src/i18n/translations/pt-BR.json @@ -732,6 +732,8 @@ "b50da99bbfd59a6d": "A atualização t3@{version} foi revertida.", "31dc4da5813e0846": "A atualização t3@{version} falhou.", "b060872e18e91755": "Falha ao atualizar o servidor.", + "77231250643f4943": "Esta build {build, select, nightly {Nightly} other {Estável}} não consegue se atualizar sozinha pelo canal {saved, select, nightly {Nightly} other {Estável}}. Volte o canal de atualização para {build, select, nightly {Nightly} other {Estável}} ou use Revisar ao lado de Canal de atualização para tentar de novo a mudança para {saved, select, nightly {Nightly} other {Estável}}.", + "43ed503038717b90": "Falha ao atualizar o servidor:", "a8cb0a2b46270859": "Não foi possível sincronizar os dados do ambiente.", "4731d4616735186c": "{count, plural, one {{count} subagente iniciado} other {{count} subagentes iniciados}}", "885110d4e416d2cd": "{count, plural, one {{count} subagente executado} other {{count} subagentes executados}}", diff --git a/apps/mobile/src/i18n/translations/ru.json b/apps/mobile/src/i18n/translations/ru.json index b5700f2a091af..fec57a0856800 100644 --- a/apps/mobile/src/i18n/translations/ru.json +++ b/apps/mobile/src/i18n/translations/ru.json @@ -732,6 +732,8 @@ "b50da99bbfd59a6d": "Обновление t3@{version} откачено.", "31dc4da5813e0846": "Ошибка обновления t3@{version}.", "b060872e18e91755": "Не удалось обновить сервер.", + "77231250643f4943": "Эта сборка {build, select, nightly {Nightly} other {Стабильный}} не может сама обновиться с канала «{saved, select, nightly {Nightly} other {Стабильный}}». Верните канал обновлений на «{build, select, nightly {Nightly} other {Стабильный}}» или нажмите «Ревью» рядом с «Канал обновлений», чтобы повторить переход на «{saved, select, nightly {Nightly} other {Стабильный}}».", + "43ed503038717b90": "Не удалось обновить сервер:", "a8cb0a2b46270859": "Не удалось синхронизировать данные окружения.", "4731d4616735186c": "{count, plural, one {Запущен {count} субагент} few {Запущено {count} субагента} many {Запущено {count} субагентов} other {Запущено {count} субагента}}", "885110d4e416d2cd": "{count, plural, one {Отработал {count} субагент} few {Отработали {count} субагента} many {Отработали {count} субагентов} other {Отработали {count} субагента}}", diff --git a/apps/mobile/src/i18n/translations/sv.json b/apps/mobile/src/i18n/translations/sv.json index 387410edf127e..39f0195297e50 100644 --- a/apps/mobile/src/i18n/translations/sv.json +++ b/apps/mobile/src/i18n/translations/sv.json @@ -732,6 +732,8 @@ "b50da99bbfd59a6d": "Uppdateringen till t3@{version} återställdes.", "31dc4da5813e0846": "Uppdateringen till t3@{version} misslyckades.", "b060872e18e91755": "Serveruppdateringen misslyckades.", + "77231250643f4943": "Den här {build, select, nightly {Nightly} other {Stable}}-versionen kan inte uppdatera sig själv från spåret {saved, select, nightly {Nightly} other {Stable}}. Byt tillbaka uppdateringsspåret till {build, select, nightly {Nightly} other {Stable}}, eller använd Granska bredvid Uppdateringsspår för att försöka byta till {saved, select, nightly {Nightly} other {Stable}} igen.", + "43ed503038717b90": "Serveruppdateringen misslyckades:", "a8cb0a2b46270859": "Kunde inte synkronisera miljöns data.", "4731d4616735186c": "{count, plural, one {Startade {count} subagent} other {Startade {count} subagenter}}", "885110d4e416d2cd": "{count, plural, one {Körde {count} subagent} other {Körde {count} subagenter}}", diff --git a/apps/mobile/src/i18n/translations/zh.json b/apps/mobile/src/i18n/translations/zh.json index c526a2f9eb1e3..38c2cce3a056d 100644 --- a/apps/mobile/src/i18n/translations/zh.json +++ b/apps/mobile/src/i18n/translations/zh.json @@ -732,6 +732,8 @@ "b50da99bbfd59a6d": "t3@{version} 更新已回滚。", "31dc4da5813e0846": "t3@{version} 更新失败。", "b060872e18e91755": "服务器更新失败。", + "77231250643f4943": "此 {build, select, nightly {Nightly 版} other {稳定版}} 构建无法自行从 {saved, select, nightly {Nightly 版} other {稳定版}} 通道更新。请将更新通道切回 {build, select, nightly {Nightly 版} other {稳定版}},或使用“更新通道”旁的“查看”重新尝试切换到 {saved, select, nightly {Nightly 版} other {稳定版}}。", + "43ed503038717b90": "服务器更新失败:", "a8cb0a2b46270859": "无法同步环境数据。", "4731d4616735186c": "{count, plural, other {已启动 {count} 个子智能体}}", "885110d4e416d2cd": "{count, plural, other {已运行 {count} 个子智能体}}", diff --git a/apps/server/src/desktopUpdate/DesktopAppUpdate.test.ts b/apps/server/src/desktopUpdate/DesktopAppUpdate.test.ts index b38dc6efb66d3..4d447ff7e85fa 100644 --- a/apps/server/src/desktopUpdate/DesktopAppUpdate.test.ts +++ b/apps/server/src/desktopUpdate/DesktopAppUpdate.test.ts @@ -204,6 +204,35 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("desktop app upda }), ); + it.effect.each([true, false])( + "carries the track mismatch only for its own failure (%s)", + (matchingReason) => + Effect.gen(function* () { + const mismatch = "This Stable build can't update from the Nightly track on its own."; + const reason = matchingReason ? mismatch : "The desktop update was cancelled."; + const { service } = yield* makeHarness({ + reports: (requestId) => [ + report( + requestId, + makeState({ + status: "error", + channel: "nightly", + message: mismatch, + errorContext: "check", + trackMismatch: { buildChannel: "latest" }, + }), + { outcome: "failed", reason }, + ), + ], + }); + const error = yield* service.run(() => Effect.void).pipe(Effect.flip); + expect(error.reason).toBe(reason); + expect(error.trackMismatch).toEqual( + matchingReason ? { buildChannel: "latest", savedChannel: "nightly" } : undefined, + ); + }), + ); + it.effect("fails when the desktop stops reporting before a terminal outcome", () => Effect.gen(function* () { const { service } = yield* makeHarness({ diff --git a/apps/server/src/desktopUpdate/DesktopAppUpdate.ts b/apps/server/src/desktopUpdate/DesktopAppUpdate.ts index 4963c09b2f6e5..ed1d3bba7f822 100644 --- a/apps/server/src/desktopUpdate/DesktopAppUpdate.ts +++ b/apps/server/src/desktopUpdate/DesktopAppUpdate.ts @@ -137,9 +137,18 @@ export const make = Effect.fn("desktopUpdate.desktopAppUpdate.make")(function* ( `The T3 Code desktop app on this machine is already up to date on ${report.state.currentVersion}.`, ); } - return yield* failWith( - report.reason ?? report.state.message ?? "The desktop app update failed.", - ); + const reason = report.reason ?? report.state.message ?? "The desktop app update failed."; + const mismatch = report.state.trackMismatch; + if (mismatch !== undefined && reason === report.state.message) { + return yield* new ServerSelfUpdateError({ + reason, + trackMismatch: { + buildChannel: mismatch.buildChannel, + savedChannel: report.state.channel, + }, + }); + } + return yield* failWith(reason); }); const run: DesktopAppUpdate["Service"]["run"] = Effect.fn("desktopUpdate.desktopAppUpdate.run")( diff --git a/apps/web/src/components/desktopUpdate.logic.ts b/apps/web/src/components/desktopUpdate.logic.ts index b853c448a10bb..d3d4f618c8268 100644 --- a/apps/web/src/components/desktopUpdate.logic.ts +++ b/apps/web/src/components/desktopUpdate.logic.ts @@ -1,3 +1,4 @@ +import { desktopTrackMismatchText } from "@t3tools/client-runtime/state/server"; import type { DesktopUpdateActionResult, DesktopUpdateState } from "@t3tools/contracts"; import { desktopUpdateChannelOf } from "@t3tools/shared/cliRelease"; import { msg } from "gt-react"; @@ -159,6 +160,14 @@ export function getDesktopUpdateButtonTooltip( }), ); } + if (state.trackMismatch !== undefined) { + return resolve( + desktopTrackMismatchText({ + buildChannel: state.trackMismatch.buildChannel, + savedChannel: state.channel, + }), + ); + } return state.message ?? resolve(msg("Update failed")); } // The updater discards every release of the other track, so "up to date" would be false here. diff --git a/apps/web/src/i18n/translations/de.json b/apps/web/src/i18n/translations/de.json index acdfd90c95938..41f5df9a64866 100644 --- a/apps/web/src/i18n/translations/de.json +++ b/apps/web/src/i18n/translations/de.json @@ -733,6 +733,8 @@ "b50da99bbfd59a6d": "Das Update auf t3@{version} wurde zurückgerollt.", "31dc4da5813e0846": "Das Update auf t3@{version} ist fehlgeschlagen.", "b060872e18e91755": "Server-Update fehlgeschlagen.", + "77231250643f4943": "Dieser {build, select, nightly {Nightly} other {Stable}}-Build kann sich über den Kanal {saved, select, nightly {Nightly} other {Stable}} nicht selbst aktualisieren. Stelle den Update-Kanal wieder auf {build, select, nightly {Nightly} other {Stable}} um oder nutze Review neben Update-Kanal, um den Wechsel zu {saved, select, nightly {Nightly} other {Stable}} erneut zu versuchen.", + "43ed503038717b90": "Server-Update fehlgeschlagen:", "a8cb0a2b46270859": "Die Umgebungsdaten konnten nicht synchronisiert werden.", "4731d4616735186c": "{count, plural, one {{count} Subagent gestartet} other {{count} Subagenten gestartet}}", "885110d4e416d2cd": "{count, plural, one {{count} Subagent ausgeführt} other {{count} Subagenten ausgeführt}}", diff --git a/apps/web/src/i18n/translations/en.json b/apps/web/src/i18n/translations/en.json index bf9125e821f5d..07817e9c694ce 100644 --- a/apps/web/src/i18n/translations/en.json +++ b/apps/web/src/i18n/translations/en.json @@ -733,6 +733,8 @@ "b50da99bbfd59a6d": "The t3@{version} update rolled-back.", "31dc4da5813e0846": "The t3@{version} update failed.", "b060872e18e91755": "Server update failed.", + "77231250643f4943": "This {build, select, nightly {Nightly} other {Stable}} build can't update from the {saved, select, nightly {Nightly} other {Stable}} track on its own. Switch the update track back to {build, select, nightly {Nightly} other {Stable}}, or use Review beside Update track to retry the switch to {saved, select, nightly {Nightly} other {Stable}}.", + "43ed503038717b90": "Server update failed:", "a8cb0a2b46270859": "Could not synchronize environment data.", "4731d4616735186c": "{count, plural, one {Kicked off {count} subagent} other {Kicked off {count} subagents}}", "885110d4e416d2cd": "{count, plural, one {Ran {count} subagent} other {Ran {count} subagents}}", diff --git a/apps/web/src/i18n/translations/es.json b/apps/web/src/i18n/translations/es.json index e0f52492df584..2c93c1f36d1fe 100644 --- a/apps/web/src/i18n/translations/es.json +++ b/apps/web/src/i18n/translations/es.json @@ -733,6 +733,8 @@ "b50da99bbfd59a6d": "La actualización a t3@{version} se revirtió.", "31dc4da5813e0846": "La actualización a t3@{version} falló.", "b060872e18e91755": "Falló la actualización del servidor.", + "77231250643f4943": "Esta compilación {build, select, nightly {Nightly} other {Estable}} no puede actualizarse por sí sola desde el canal {saved, select, nightly {Nightly} other {Estable}}. Vuelve a poner el canal de actualizaciones en {build, select, nightly {Nightly} other {Estable}} o usa Revisar junto a Canal de actualizaciones para reintentar el cambio a {saved, select, nightly {Nightly} other {Estable}}.", + "43ed503038717b90": "Falló la actualización del servidor:", "a8cb0a2b46270859": "No se pudieron sincronizar los datos del entorno.", "4731d4616735186c": "{count, plural, one {Se inició {count} subagente} other {Se iniciaron {count} subagentes}}", "885110d4e416d2cd": "{count, plural, one {Se ejecutó {count} subagente} other {Se ejecutaron {count} subagentes}}", diff --git a/apps/web/src/i18n/translations/fr.json b/apps/web/src/i18n/translations/fr.json index 97cd5bc681a6f..a343fa1d58293 100644 --- a/apps/web/src/i18n/translations/fr.json +++ b/apps/web/src/i18n/translations/fr.json @@ -733,6 +733,8 @@ "b50da99bbfd59a6d": "La mise à jour t3@{version} a été annulée.", "31dc4da5813e0846": "La mise à jour t3@{version} a échoué.", "b060872e18e91755": "Échec de la mise à jour du serveur.", + "77231250643f4943": "Cette version {build, select, nightly {Nightly} other {Stable}} ne peut pas se mettre à jour seule depuis le canal {saved, select, nightly {Nightly} other {Stable}}. Remettez le canal de mise à jour sur {build, select, nightly {Nightly} other {Stable}}, ou utilisez Consulter à côté de Canal de mise à jour pour relancer le passage à {saved, select, nightly {Nightly} other {Stable}}.", + "43ed503038717b90": "Échec de la mise à jour du serveur :", "a8cb0a2b46270859": "Impossible de synchroniser les données de l’environnement.", "4731d4616735186c": "{count, plural, one {{count} sous-agent lancé} other {{count} sous-agents lancés}}", "885110d4e416d2cd": "{count, plural, one {{count} sous-agent exécuté} other {{count} sous-agents exécutés}}", diff --git a/apps/web/src/i18n/translations/ja.json b/apps/web/src/i18n/translations/ja.json index 43ee223b82fe4..b28e05ec2900b 100644 --- a/apps/web/src/i18n/translations/ja.json +++ b/apps/web/src/i18n/translations/ja.json @@ -733,6 +733,8 @@ "b50da99bbfd59a6d": "t3@{version} の更新はロールバックされました。", "31dc4da5813e0846": "t3@{version} の更新に失敗しました。", "b060872e18e91755": "サーバーの更新に失敗しました。", + "77231250643f4943": "この {build, select, nightly {Nightly} other {安定版}} ビルドは {saved, select, nightly {Nightly} other {安定版}} トラックから単独では更新できません。更新トラックを {build, select, nightly {Nightly} other {安定版}} に戻すか、更新トラックの横にある「レビュー」を使って {saved, select, nightly {Nightly} other {安定版}} への切り替えを再試行してください。", + "43ed503038717b90": "サーバーの更新に失敗しました:", "a8cb0a2b46270859": "環境のデータを同期できませんでした。", "4731d4616735186c": "{count, plural, other {{count} 個のサブエージェントを開始しました}}", "885110d4e416d2cd": "{count, plural, other {{count} 個のサブエージェントを実行しました}}", diff --git a/apps/web/src/i18n/translations/ko.json b/apps/web/src/i18n/translations/ko.json index 0536a957dcf87..ab4ace291466e 100644 --- a/apps/web/src/i18n/translations/ko.json +++ b/apps/web/src/i18n/translations/ko.json @@ -733,6 +733,8 @@ "b50da99bbfd59a6d": "t3@{version} 업데이트가 롤백되었습니다.", "31dc4da5813e0846": "t3@{version} 업데이트에 실패했습니다.", "b060872e18e91755": "서버 업데이트에 실패했습니다.", + "77231250643f4943": "이 {build, select, nightly {Nightly} other {Stable}} 빌드는 {saved, select, nightly {Nightly} other {Stable}} 트랙에서 스스로 업데이트할 수 없습니다. 업데이트 트랙을 다시 {build, select, nightly {Nightly} other {Stable}}(으)로 바꾸거나, 업데이트 트랙 옆의 검토를 사용해 {saved, select, nightly {Nightly} other {Stable}}(으)로 전환을 다시 시도하세요.", + "43ed503038717b90": "서버 업데이트에 실패했습니다:", "a8cb0a2b46270859": "환경 데이터를 동기화할 수 없습니다.", "4731d4616735186c": "{count, plural, other {서브에이전트 {count}개 시작함}}", "885110d4e416d2cd": "{count, plural, other {서브에이전트 {count}개 실행함}}", diff --git a/apps/web/src/i18n/translations/pt-BR.json b/apps/web/src/i18n/translations/pt-BR.json index 5003e05f792b7..f02d52f178a36 100644 --- a/apps/web/src/i18n/translations/pt-BR.json +++ b/apps/web/src/i18n/translations/pt-BR.json @@ -733,6 +733,8 @@ "b50da99bbfd59a6d": "A atualização t3@{version} foi revertida.", "31dc4da5813e0846": "A atualização t3@{version} falhou.", "b060872e18e91755": "Falha ao atualizar o servidor.", + "77231250643f4943": "Esta build {build, select, nightly {Nightly} other {Estável}} não consegue se atualizar sozinha pelo canal {saved, select, nightly {Nightly} other {Estável}}. Volte o canal de atualização para {build, select, nightly {Nightly} other {Estável}} ou use Revisar ao lado de Canal de atualização para tentar de novo a mudança para {saved, select, nightly {Nightly} other {Estável}}.", + "43ed503038717b90": "Falha ao atualizar o servidor:", "a8cb0a2b46270859": "Não foi possível sincronizar os dados do ambiente.", "4731d4616735186c": "{count, plural, one {{count} subagente iniciado} other {{count} subagentes iniciados}}", "885110d4e416d2cd": "{count, plural, one {{count} subagente executado} other {{count} subagentes executados}}", diff --git a/apps/web/src/i18n/translations/ru.json b/apps/web/src/i18n/translations/ru.json index 9d9c58696fd16..4530c77c7bf14 100644 --- a/apps/web/src/i18n/translations/ru.json +++ b/apps/web/src/i18n/translations/ru.json @@ -733,6 +733,8 @@ "b50da99bbfd59a6d": "Обновление t3@{version} откачено.", "31dc4da5813e0846": "Ошибка обновления t3@{version}.", "b060872e18e91755": "Не удалось обновить сервер.", + "77231250643f4943": "Эта сборка {build, select, nightly {Nightly} other {Стабильный}} не может сама обновиться с канала «{saved, select, nightly {Nightly} other {Стабильный}}». Верните канал обновлений на «{build, select, nightly {Nightly} other {Стабильный}}» или нажмите «Ревью» рядом с «Канал обновлений», чтобы повторить переход на «{saved, select, nightly {Nightly} other {Стабильный}}».", + "43ed503038717b90": "Не удалось обновить сервер:", "a8cb0a2b46270859": "Не удалось синхронизировать данные окружения.", "4731d4616735186c": "{count, plural, one {Запущен {count} субагент} few {Запущено {count} субагента} many {Запущено {count} субагентов} other {Запущено {count} субагента}}", "885110d4e416d2cd": "{count, plural, one {Отработал {count} субагент} few {Отработали {count} субагента} many {Отработали {count} субагентов} other {Отработали {count} субагента}}", diff --git a/apps/web/src/i18n/translations/sv.json b/apps/web/src/i18n/translations/sv.json index 0a645b45857ae..98405a900990d 100644 --- a/apps/web/src/i18n/translations/sv.json +++ b/apps/web/src/i18n/translations/sv.json @@ -733,6 +733,8 @@ "b50da99bbfd59a6d": "Uppdateringen till t3@{version} återställdes.", "31dc4da5813e0846": "Uppdateringen till t3@{version} misslyckades.", "b060872e18e91755": "Serveruppdateringen misslyckades.", + "77231250643f4943": "Den här {build, select, nightly {Nightly} other {Stable}}-versionen kan inte uppdatera sig själv från spåret {saved, select, nightly {Nightly} other {Stable}}. Byt tillbaka uppdateringsspåret till {build, select, nightly {Nightly} other {Stable}}, eller använd Granska bredvid Uppdateringsspår för att försöka byta till {saved, select, nightly {Nightly} other {Stable}} igen.", + "43ed503038717b90": "Serveruppdateringen misslyckades:", "a8cb0a2b46270859": "Kunde inte synkronisera miljöns data.", "4731d4616735186c": "{count, plural, one {Startade {count} subagent} other {Startade {count} subagenter}}", "885110d4e416d2cd": "{count, plural, one {Körde {count} subagent} other {Körde {count} subagenter}}", diff --git a/apps/web/src/i18n/translations/zh.json b/apps/web/src/i18n/translations/zh.json index b933baac631c6..d1f4142720531 100644 --- a/apps/web/src/i18n/translations/zh.json +++ b/apps/web/src/i18n/translations/zh.json @@ -733,6 +733,8 @@ "b50da99bbfd59a6d": "t3@{version} 更新已回滚。", "31dc4da5813e0846": "t3@{version} 更新失败。", "b060872e18e91755": "服务器更新失败。", + "77231250643f4943": "此 {build, select, nightly {Nightly 版} other {稳定版}} 构建无法自行从 {saved, select, nightly {Nightly 版} other {稳定版}} 通道更新。请将更新通道切回 {build, select, nightly {Nightly 版} other {稳定版}},或使用“更新通道”旁的“查看”重新尝试切换到 {saved, select, nightly {Nightly 版} other {稳定版}}。", + "43ed503038717b90": "服务器更新失败:", "a8cb0a2b46270859": "无法同步环境数据。", "4731d4616735186c": "{count, plural, other {已启动 {count} 个子智能体}}", "885110d4e416d2cd": "{count, plural, other {已运行 {count} 个子智能体}}", diff --git a/packages/client-runtime/src/connection/outdatedHostUpdate.ts b/packages/client-runtime/src/connection/outdatedHostUpdate.ts index 442a54b928ada..0af68e0edc892 100644 --- a/packages/client-runtime/src/connection/outdatedHostUpdate.ts +++ b/packages/client-runtime/src/connection/outdatedHostUpdate.ts @@ -24,7 +24,11 @@ import * as Socket from "effect/socket/Socket"; import { fetchRemoteEnvironmentDescriptor } from "../environment/descriptor.ts"; import { makeWsRpcProtocolClient, PING_TIMEOUT } from "../rpc/protocol.ts"; -import { isLegacyUpdateHandoffLoss, resolveServerUpdateProgressResult } from "../state/server.ts"; +import { + isLegacyUpdateHandoffLoss, + localizeServerSelfUpdateError, + resolveServerUpdateProgressResult, +} from "../state/server.ts"; import * as RelayEnvironmentDiscovery from "../relay/discovery.ts"; import * as ConnectionResolver from "./resolver.ts"; import * as EnvironmentRegistry from "./registry.ts"; @@ -206,7 +210,7 @@ export const updateOutdatedHost = Effect.fn("clientRuntime.connection.updateOutd } return updateResult; }), - ); + ).pipe(Effect.mapError(localizeServerSelfUpdateError)); yield* onStage("resuming"); const pollUrls = [ diff --git a/packages/client-runtime/src/state/server.test.ts b/packages/client-runtime/src/state/server.test.ts index 1778f91ebc764..782e5fc62a75e 100644 --- a/packages/client-runtime/src/state/server.test.ts +++ b/packages/client-runtime/src/state/server.test.ts @@ -66,12 +66,14 @@ import { resolveServerUpdateProgressResult, serverUpdateStateForProgressEvent, serverUpdateStateAtom, + serverUpdateFailureText, serverUpdateStateForServerVersion, validateServerUpdateReadyEvent, waitForNextEnvironmentReconnect, waitForDesktopUpdateTarget, runDesktopCommitWithReconnectObserver, } from "./server.ts"; +import { errorDisplayMessage, errorI18nMessage } from "../errors/translatable.ts"; import { runAtomCommand } from "./runtime.ts"; import { applyServerConfigProjection } from "./serverConfigProjection.ts"; @@ -239,14 +241,21 @@ describe("accepted server update recovery", () => { { loss: "interrupt", resumes: true }, { loss: "socket", resumes: true }, { loss: "server_error", resumes: false }, + { loss: "track_mismatch", method: "desktop-managed", resumes: false }, + { loss: "track_mismatch", method: "desktop-managed", unary: true, resumes: false }, { loss: "no_progress", resumes: false }, { loss: "cancel", resumes: false }, { loss: "socket", method: "respawn", resumes: true }, { loss: "socket", method: "desktop-managed", resumes: false }, - ] as const)("handles $loss with $method and recovery=$resumes", (scenario) => + ] as const)("handles $loss with $method, unary=$unary and recovery=$resumes", (scenario) => Effect.gen(function* () { const { loss, resumes } = scenario; const method = "method" in scenario ? scenario.method : "boot-service"; + const trackMismatch = new ServerSelfUpdateError({ + reason: + "This Stable build can't update from the Nightly track on its own. Switch the update track back to Stable, or use Review beside Update track to retry the switch to Nightly.", + trackMismatch: { buildChannel: "latest", savedChannel: "nightly" }, + }); const observing = yield* Deferred.make(); const cancelFiber = yield* Deferred.make>(); const oldReadyObserved = yield* Deferred.make(); @@ -257,7 +266,10 @@ describe("accepted server update recovery", () => { environment: { ...CONFIG.environment, serverVersion: "0.0.30", - capabilities: { serverSelfUpdate: method, serverSelfUpdateProgress: true }, + capabilities: { + serverSelfUpdate: method, + serverSelfUpdateProgress: !("unary" in scenario), + }, }, } as ServerConfig; const ready = (serverVersion: string) => @@ -283,6 +295,7 @@ describe("accepted server update recovery", () => { ), ) : Stream.make(ready("0.0.30")).pipe(Stream.concat(Stream.never)), + [WS_METHODS.serverUpdateServer]: () => Effect.fail(trackMismatch), [WS_METHODS.serverUpdateServerWithProgress]: () => Stream.unwrap( Effect.sync(() => { @@ -306,9 +319,11 @@ describe("accepted server update recovery", () => { ? new ServerSelfUpdateError({ reason: "Archive verification failed.", }) - : new RpcClientError.RpcClientError({ - reason: new Socket.SocketCloseError({ code: 1006 }), - }), + : loss === "track_mismatch" + ? trackMismatch + : new RpcClientError.RpcClientError({ + reason: new Socket.SocketCloseError({ code: 1006 }), + }), ), ), ), @@ -377,10 +392,22 @@ describe("accepted server update recovery", () => { ); if (!resumes) { expect(first).toBe("settled"); - expect(AsyncResult.isFailure(yield* Effect.promise(() => pending))).toBe(true); - expect(registry.get(serverUpdateStateAtom(TARGET.environmentId))).toMatchObject({ - status: "failed", - }); + const failure = yield* Effect.promise(() => pending); + expect(AsyncResult.isFailure(failure)).toBe(true); + const failed = registry.get(serverUpdateStateAtom(TARGET.environmentId)); + expect(failed).toMatchObject({ status: "failed" }); + if ( + loss === "track_mismatch" && + AsyncResult.isFailure(failure) && + failed.status === "failed" + ) { + const cause = Cause.squash(failure.cause); + const marked = errorI18nMessage(cause); + expect(marked).toHaveLength(2); + expect(failed.i18nMessage).toEqual(marked); + expect(errorDisplayMessage(cause)).toBe(trackMismatch.message); + expect(serverUpdateFailureText(failed)).toBe(trackMismatch.message); + } return; } expect(first).toBe("observing"); diff --git a/packages/client-runtime/src/state/server.ts b/packages/client-runtime/src/state/server.ts index 8cf0be6f31705..3179f0c149e4b 100644 --- a/packages/client-runtime/src/state/server.ts +++ b/packages/client-runtime/src/state/server.ts @@ -4,8 +4,10 @@ import { markedTextEnglish, resolveMarkedText, thrownErrorMessage, + withI18nMessage, } from "../errors/translatable.ts"; import { + type DesktopUpdateChannel, type EnvironmentId, type ProviderInstanceId, type ServerConfig, @@ -13,6 +15,7 @@ import { type ServerLifecycleWelcomePayload, type ServerLifecycleStreamReadyEvent, type ServerProviderWorkspaceSnapshot, + ServerSelfUpdateError, type ServerSelfUpdateProgressEvent, type ServerSelfUpdateResult, shouldRecommendDatabaseCompaction, @@ -388,6 +391,29 @@ export function serverUpdateFailure(error: unknown): { : { message: serverUpdateFailureMessage(error), i18nMessage }; } +/** Marked text for a desktop app whose build track differs from its saved update track. */ +export function desktopTrackMismatchText(mismatch: { + readonly buildChannel: DesktopUpdateChannel; + readonly savedChannel: DesktopUpdateChannel; +}): string { + return msg( + "This {build, select, nightly {Nightly} other {Stable}} build can't update from the {saved, select, nightly {Nightly} other {Stable}} track on its own. Switch the update track back to {build, select, nightly {Nightly} other {Stable}}, or use Review beside Update track to retry the switch to {saved, select, nightly {Nightly} other {Stable}}.", + { build: mismatch.buildChannel, saved: mismatch.savedChannel }, + ); +} + +const isServerSelfUpdateError = Schema.is(ServerSelfUpdateError); + +/** Gives a host's track mismatch marked text; older hosts send only the English `reason`. */ +export function localizeServerSelfUpdateError(error: E): E { + if (!isServerSelfUpdateError(error) || error.trackMismatch === undefined) return error; + return withI18nMessage( + error, + msg("Server update failed:"), + desktopTrackMismatchText(error.trackMismatch), + ); +} + export function serverUpdateFailureText( state: Extract, resolve: MFunctionType = mFallback, @@ -1218,7 +1244,7 @@ export function createServerEnvironmentAtoms( targetVersion, }); return updateResult; - }), + }).pipe(Effect.mapError(localizeServerSelfUpdateError)), ); // A track switch's desktop host already on its track's newest build only saved the diff --git a/packages/contracts/src/ipc.ts b/packages/contracts/src/ipc.ts index 77a523c03608f..dc0e70f7dad92 100644 --- a/packages/contracts/src/ipc.ts +++ b/packages/contracts/src/ipc.ts @@ -292,6 +292,8 @@ export interface DesktopUpdateState { notAppliedVersion?: string; /** Off only because a managed policy rules out this channel; switching channels turns it on. */ channelBlockedByPolicy?: true; + /** The check failed only because this build's track differs from the saved `channel`. */ + trackMismatch?: { readonly buildChannel: DesktopUpdateChannel }; } export interface DesktopUpdateReleaseNote { @@ -336,6 +338,7 @@ export const DesktopUpdateStateSchema = Schema.Struct({ canRetry: Schema.Boolean, notAppliedVersion: Schema.optionalKey(Schema.String), channelBlockedByPolicy: Schema.optionalKey(Schema.Literal(true)), + trackMismatch: Schema.optionalKey(Schema.Struct({ buildChannel: DesktopUpdateChannelSchema })), }); export const DesktopCliCommandStateSchema = Schema.Struct({ diff --git a/packages/contracts/src/server.ts b/packages/contracts/src/server.ts index f074b8f6a3e46..afd870ef97cc7 100644 --- a/packages/contracts/src/server.ts +++ b/packages/contracts/src/server.ts @@ -1070,6 +1070,13 @@ export class ServerSelfUpdateError extends Schema.TaggedError