Refuse to start without required mods and download them

requiredMods entries are now Factorio dependency strings, and a mod
listed twice gives a version range. The plugin loader validates them.

The host refuses to start an instance whose mod pack is missing a
required mod of a loaded plugin, has it disabled or has it outside the
version range.

On start the controller resolves the required mods of its plugins and
their dependencies for the default mod pack's Factorio version and
downloads the ones missing from the mod store. The resolver and portal
download move from the ControlConnection handlers into Controller
methods so both paths share them.

Subspace Storage requires subspace_storage >= 1.99.0, and the
integration tests build a stub of that mod for the test mod pack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-11-19 15:19:05 +00:00
1 parent a845b7ac52
commit bf33f4f52e
12 files changed
+437 -240

No files matched your search

+18
View File
@@ -24,4 +24,22 @@ describe("lib/plugin", function() {
}
});
});
describe("pluginRequiredMods()", function() {
it("should parse dependency strings", function() {
const mods = lib.pluginRequiredMods({
name: "foo", title: "Foo", requiredMods: ["bar", "baz >= 1.2.0", "baz < 2.0.0"],
});
assert.deepEqual(mods.map(mod => [mod.name, mod.version?.toString()]), [
["bar", undefined], ["baz", ">= 1.2.0"], ["baz", "< 2.0.0"],
]);
});
it("should return an empty list without requiredMods", function() {
assert.deepEqual(lib.pluginRequiredMods({ name: "foo", title: "Foo" }), []);
});
it("should reject dependency prefixes and invalid versions", function() {
for (const spec of ["? bar", "! bar", "~ bar", "bar >= 1..2"]) {
assert.throws(() => lib.pluginRequiredMods({ name: "foo", title: "Foo", requiredMods: [spec] }));
}
});
});
});