fix(server): block updates under legacy service launchers (#11940)

This commit is contained in:
Guillermo Casanova authored and GitHub committed 2026-09-15 15:21:25 -07:00
1 parent f0a0ead946
commit b84f63bb13
2 files changed
+13 -5

No files matched your search

+10 -3
View File
@@ -3,15 +3,22 @@ import { expect, it } from "@effect/vitest";
import { runServicePreflight } from "./servicePreflight.ts";
import { SERVICE_LAUNCHER_PROTOCOL } from "./serviceProtocol.ts";
it("requires the database-snapshot launcher protocol", () => {
it.each([1, 2])("blocks legacy launcher protocol %i", (launcherProtocol) => {
expect(
runServicePreflight({
databasePath: "/missing/state.sqlite",
launcherProtocol: SERVICE_LAUNCHER_PROTOCOL - 1,
launcherProtocol,
version: "1.2.3",
}),
).toMatchObject({ status: "blocked", version: "1.2.3" });
).toEqual({
status: "blocked",
version: "1.2.3",
reason:
"This release requires a newer T3 Code service launcher. Update it on the server machine.",
});
});
it("accepts the current launcher protocol", () => {
expect(
runServicePreflight({
databasePath: "/missing/state.sqlite",
+3 -2
View File
@@ -1,7 +1,8 @@
import type { ServerSelfUpdateOutcome } from "@t3tools/contracts";
/** Protocol 2 snapshots SQLite before trials so migrations can be rolled back safely. */
export const SERVICE_LAUNCHER_PROTOCOL = 2 as const;
// Protocol 3 requires the standalone executable layout. Bump when runtimePaths
// or the installed runtime tree changes incompatibly; launchers survive self-updates.
export const SERVICE_LAUNCHER_PROTOCOL = 3 as const;
export const SERVICE_LAUNCHER_CONTEXT_ENV = "T3_SERVICE_LAUNCHER_CONTEXT";
export const SERVICE_STATE_FILE = "service-state.json";
/** Written by the launcher just before an explicit stop kills its child, so