Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Report a version only in the grammar the control plane compares

Dante0aca15a4a8df
diff --git a/server/environment.test.ts b/server/environment.test.ts
index fa436816f6..70d8323c1b 100644
--- a/server/environment.test.ts
+++ b/server/environment.test.ts
@@ -206,7 +206,12 @@ describe("environment identity", () => {
it("reports only a release version to the control plane", () => {
expect(reportableServerVersion("0.1.153")).toBe("0.1.153");
expect(reportableServerVersion("0.2.0-beta.1")).toBe("0.2.0-beta.1");
+ expect(reportableServerVersion("0.2.0+build.7")).toBe("0.2.0+build.7");
expect(reportableServerVersion("unknown")).toBeUndefined();
+ expect(reportableServerVersion("0.1.153-rc 1")).toBeUndefined();
+ expect(reportableServerVersion("0.1.153-")).toBeUndefined();
+ expect(reportableServerVersion("v0.1.153")).toBeUndefined();
+ expect(reportableServerVersion("1234567890.0.0")).toBeUndefined();
expect(reportableServerVersion("")).toBeUndefined();
});
});
diff --git a/server/environment.ts b/server/environment.ts
index e8592fd48d..b6227020ae 100644
--- a/server/environment.ts
+++ b/server/environment.ts
@@ -146,7 +146,7 @@ export function serverVersion(root = SERVER_ROOT): string {
return "unknown";
}
-const RELEASE_VERSION = /^\d+\.\d+\.\d+(?:[-+].*)?$/;
+const RELEASE_VERSION = /^[0-9]{1,9}\.[0-9]{1,9}\.[0-9]{1,9}(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$/;
/** The version to tell the control plane, or none: it records what it is told, and stops serving a public address to a
* version below its minimum, so a version this server could not read must not stand in for the release it runs. */