Skip to content

Commit abd9742

Browse files
committed
fix version selection on tagged release with a lower minimum version
ZLS 0.13.0 has a minimum zig version of 0.12.0 which was not handled properly.
1 parent 96f91b6 commit abd9742

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

src/select-zls-version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ async function selectOnTaggedRelease(
194194
);
195195
assert(minRuntimeZigVersion !== null);
196196

197-
if (SemanticVersion.satisfies(zigVersion, minRuntimeZigVersion, true)) {
197+
if (SemanticVersion.order(zigVersion, minRuntimeZigVersion) != Order.lt) {
198198
return jsonData;
199199
} else {
200200
return SelectVersionFailureCode.TaggedReleaseIncompatible;

test/select-zls-version.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,32 @@ describe("/v1/zls/select-version", () => {
561561
);
562562
});
563563

564+
test("tagged release with a minimum zig version lower than itself", async () => {
565+
await populateDatabase([
566+
{
567+
date: 0,
568+
zlsVersion: "0.13.0",
569+
zigVersion: "0.13.0",
570+
minimumBuildZigVersion: "0.12.0",
571+
minimumRuntimeZigVersion: "0.12.0",
572+
artifacts: createExampleArtifacts("0.13.0"),
573+
testedZigVersions: {
574+
"0.13.0": VersionCompatibility.Full,
575+
},
576+
},
577+
]);
578+
579+
const response = await selectZLSVersion(
580+
"0.13.0",
581+
VersionCompatibility.Full,
582+
);
583+
584+
expect(response).not.toHaveProperty("message");
585+
assert(!("message" in response));
586+
587+
expect(response.version).toBe("0.13.0");
588+
});
589+
564590
test("explain query plan when searching all tagged releases", async () => {
565591
const response = await env.ZIGTOOLS_DB.prepare(
566592
"EXPLAIN QUERY PLAN SELECT ZLSVersion, JsonData FROM ZLSReleases WHERE IsRelease = 1 ORDER BY ZLSVersionMajor DESC, ZLSVersionMinor DESC, ZLSVersionPatch DESC",

0 commit comments

Comments
 (0)