Skip to content

Commit ce8edc4

Browse files
committed
test(clients): cover respawn recovery and desktop token requirements
1 parent 2acaed7 commit ce8edc4

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

‎packages/client-runtime/src/connection/outdatedHostUpdate.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ export const updateOutdatedHost = Effect.fn("clientRuntime.connection.updateOutd
155155
Effect.exit,
156156
);
157157
const selfUpdateMethod = capabilities.serverSelfUpdate;
158-
// Progress confirms the update started. After transport loss,
159-
// wait for the compatible host; desktop still needs its commit token.
158+
// Desktop preparation needs its terminal commit token.
160159
const accepted =
161160
receivedProgress &&
162161
(selfUpdateMethod === "boot-service" || selfUpdateMethod === "respawn")

‎packages/client-runtime/src/state/server.test.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,12 @@ describe("accepted server update recovery", () => {
229229
{ loss: "server_error", resumes: false },
230230
{ loss: "no_progress", resumes: false },
231231
{ loss: "cancel", resumes: false },
232-
] as const)("handles $loss after update progress with recovery=$resumes", ({ loss, resumes }) =>
232+
{ loss: "socket", method: "respawn", resumes: true },
233+
{ loss: "socket", method: "desktop-managed", resumes: false },
234+
] as const)("handles $loss with $method and recovery=$resumes", (scenario) =>
233235
Effect.gen(function* () {
236+
const { loss, resumes } = scenario;
237+
const method = "method" in scenario ? scenario.method : "boot-service";
234238
const observing = yield* Deferred.make<void>();
235239
const cancelFiber = yield* Deferred.make<Fiber.Fiber<unknown, unknown>>();
236240
const oldReadyObserved = yield* Deferred.make<void>();
@@ -241,7 +245,7 @@ describe("accepted server update recovery", () => {
241245
environment: {
242246
...CONFIG.environment,
243247
serverVersion: "0.0.30",
244-
capabilities: { serverSelfUpdate: "boot-service", serverSelfUpdateProgress: true },
248+
capabilities: { serverSelfUpdate: method, serverSelfUpdateProgress: true },
245249
},
246250
} as ServerConfig;
247251
const client = {

‎packages/client-runtime/src/state/server.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -916,9 +916,7 @@ export function createServerEnvironmentAtoms<R, E>(
916916
Effect.exit,
917917
);
918918
const selfUpdateMethod = currentConfig?.environment.capabilities.serverSelfUpdate;
919-
// Progress proves the server started the update. If its transport
920-
// disappears, confirm the outcome through target ready.
921-
// Desktop preparation still needs its terminal commit token.
919+
// Desktop preparation needs its terminal commit token.
922920
const accepted =
923921
receivedProgress &&
924922
(selfUpdateMethod === "boot-service" || selfUpdateMethod === "respawn")

0 commit comments

Comments
 (0)