authorgravatar for me@t3.ggTheo Browne <me@t3.gg> 2026-07-23 12:58:33-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-07-23 12:58:33-07:00
log88c69ffff6ca3a025eec6a2ea597d4048e851266
tree8d90ac6a62107e1a680a03199bf0f00859b5ebc8
parent979854895cc539269213915cd6581cf444089bdc
signature Signed by PGP key B5690EEEBB952194

fix(server): parse CLI version in update preflight (#4389)


2 files changed, 6 insertions(+), 4 deletions(-)

apps/server/src/cloud/selfUpdate.test.ts+2-2
...@@ -54,7 +54,7 @@ const makeRecordingRunnerLayer = (...@@ -54,7 +54,7 @@ const makeRecordingRunnerLayer = (
54 return {54 return {
55 stdout:55 stdout:
56 options?.stdoutFor?.(input.command, input.args) ??56 options?.stdoutFor?.(input.command, input.args) ??
57 (versionFromPath === undefined ? "" : `${versionFromPath}\n`),57 (versionFromPath === undefined ? "" : `t3 v${versionFromPath}\n`),
58 stderr: failed ? `${input.command} exploded` : "",58 stderr: failed ? `${input.command} exploded` : "",
59 code: ChildProcessSpawner.ExitCode(failed ? 1 : 0),59 code: ChildProcessSpawner.ExitCode(failed ? 1 : 0),
60 timedOut: false,60 timedOut: false,
...@@ -427,7 +427,7 @@ it.layer(NodeServices.layer)("ServerSelfUpdate.update", (it) => {...@@ -427,7 +427,7 @@ it.layer(NodeServices.layer)("ServerSelfUpdate.update", (it) => {
427 Effect.gen(function* () {427 Effect.gen(function* () {
428 const context = yield* makeContext({428 const context = yield* makeContext({
429 stdoutFor: (command, args) =>429 stdoutFor: (command, args) =>
430 command === NODE_PATH && args[1] === "--version" ? "0.0.28\n" : undefined,430 command === NODE_PATH && args[1] === "--version" ? "t3 v0.0.28\n" : undefined,
431 });431 });
432 const versionDir = context.path.join(context.baseDir, "runtime", "versions", "0.0.29");432 const versionDir = context.path.join(context.baseDir, "runtime", "versions", "0.0.29");
433433
apps/server/src/cloud/selfUpdate.ts+4-2
...@@ -273,8 +273,10 @@ export const make = Effect.fn("cloud.server_self_update.make")(function* (option...@@ -273,8 +273,10 @@ export const make = Effect.fn("cloud.server_self_update.make")(function* (option
273 failWith(`Could not verify the installed t3@${targetVersion}.`, cause),273 failWith(`Could not verify the installed t3@${targetVersion}.`, cause),
274 ),274 ),
275 );275 );
276 const preflightVersion = preflight.stdout.trim();276 // Effect CLI's unstable formatVersion currently emits `${name} v${version}`.
277 if (preflight.code !== 0 || preflightVersion !== targetVersion) {277 // Extract the version token so surrounding presentation changes do not break updates.
278 const reportedVersion = /\bv(\S+)\s*$/.exec(preflight.stdout)?.[1];
279 if (preflight.code !== 0 || reportedVersion !== targetVersion) {
278 // A completed npm install can still be unusable under this Node or on280 // A completed npm install can still be unusable under this Node or on
279 // this machine. Remove its sentinel and tree so a retry of the same281 // this machine. Remove its sentinel and tree so a retry of the same
280 // version performs a clean install instead of reusing a known-bad one.282 // version performs a clean install instead of reusing a known-bad one.