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

This commit is contained in:
Theo Browne authored and GitHub committed 2026-07-23 12:58:33 -07:00
1 parent 979854895c
commit 88c69ffff6
2 files changed
+6 -4

No files matched your search

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