Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions apps/server/src/cloud/servicePreflight.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions apps/server/src/cloud/serviceProtocol.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading