fix(server): block updates under legacy service launchers (#11940)
This commit is contained in:
1 parent
f0a0ead946
commit
b84f63bb13
2 files changed
+13
-5
No files matched your search
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user