Skip to content

Commit 0fe5e74

Browse files
committed
fix(server): block updates under legacy service launchers
1 parent 3efdcc5 commit 0fe5e74

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

‎apps/server/src/cloud/servicePreflight.test.ts‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,22 @@ import { expect, it } from "@effect/vitest";
33
import { runServicePreflight } from "./servicePreflight.ts";
44
import { SERVICE_LAUNCHER_PROTOCOL } from "./serviceProtocol.ts";
55

6-
it("requires the database-snapshot launcher protocol", () => {
6+
it.each([1, 2])("blocks legacy launcher protocol %i", (launcherProtocol) => {
77
expect(
88
runServicePreflight({
99
databasePath: "/missing/state.sqlite",
10-
launcherProtocol: SERVICE_LAUNCHER_PROTOCOL - 1,
10+
launcherProtocol,
1111
version: "1.2.3",
1212
}),
13-
).toMatchObject({ status: "blocked", version: "1.2.3" });
13+
).toEqual({
14+
status: "blocked",
15+
version: "1.2.3",
16+
reason:
17+
"This release requires a newer T3 Code service launcher. Update it on the server machine.",
18+
});
19+
});
1420

21+
it("accepts the current launcher protocol", () => {
1522
expect(
1623
runServicePreflight({
1724
databasePath: "/missing/state.sqlite",

‎apps/server/src/cloud/serviceProtocol.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import type { ServerSelfUpdateOutcome } from "@t3tools/contracts";
22

3-
/** Protocol 2 snapshots SQLite before trials so migrations can be rolled back safely. */
4-
export const SERVICE_LAUNCHER_PROTOCOL = 2 as const;
3+
// Protocol 3 requires the standalone executable layout. Bump when runtimePaths
4+
// or the installed runtime tree changes incompatibly; launchers survive self-updates.
5+
export const SERVICE_LAUNCHER_PROTOCOL = 3 as const;
56
export const SERVICE_LAUNCHER_CONTEXT_ENV = "T3_SERVICE_LAUNCHER_CONTEXT";
67
export const SERVICE_STATE_FILE = "service-state.json";
78
/** Written by the launcher just before an explicit stop kills its child, so

0 commit comments

Comments
 (0)