Merge remote-tracking branch 'origin/master' into host-pairing

# Conflicts:
#	packages/host/host.ts
This commit is contained in:
Danielv123 committed 2026-10-30 21:50:38 +01:00
commit 95422e6d21
21 files changed
+63 -29

No files matched your search

+25 -9
View File
@@ -28,17 +28,33 @@ jobs:
strategy:
fail-fast: false
matrix:
# Test Node.js 24 and 26 across the Factorio matrix; Node.js 22 runs coverage below.
# To stay within the concurrent job limit, every Factorio version is
# tested on the latest Node.js, and every other supported Node.js
# version only with the latest Factorio. Coverage is performed on the
# oldest supported Node.js.
# Node.js release schedule: https://nodejs.org/en/about/releases/
node-version: [24.x, 26.x]
# Supported factorio versions are latest stable and one minor version before stable (even if from a previous major)
# Supported factorio versions are latest stable and one minor version before stable (even if from a previous major)
node-version: [26.x]
factorio-version: [1.1.110, 2.0.77, 2.1.17]
# Coverage is performed on the older of the supported node versions
# The tests run in two halves of similar length on separate runners,
# the clusterioctl, plugin system and instance integration tests and the rest.
tests: [ctl, other]
include:
- node-version: 24.x
factorio-version: 2.1.17
tests: ctl
- node-version: 24.x
factorio-version: 2.1.17
tests: other
- node-version: 22.x
factorio-version: 2.1.17
tests: ctl
coverage: true
- node-version: 22.x
factorio-version: 2.1.17
tests: other
coverage: true
steps:
@@ -51,10 +67,10 @@ jobs:
run: wget -q -O factorio.tar.gz https://www.factorio.com/get-download/${{ matrix.factorio-version }}/headless/linux64 && tar -xf factorio.tar.gz && rm factorio.tar.gz
- name: Run tests
if: ${{ !matrix.coverage }}
run: pnpm test
run: pnpm test --grep "^(Integration of Clusterio (clusterioctl|plugin system)|Clusterio Instance) " ${{ matrix.tests == 'other' && '--invert' || '' }}
- name: Run coverage
if: ${{ matrix.coverage }}
run: pnpm run ci-cover
run: pnpm run ci-cover --grep "^(Integration of Clusterio (clusterioctl|plugin system)|Clusterio Instance) " ${{ matrix.tests == 'other' && '--invert' || '' }}
- name: Upload coverage to Codecov
if: ${{ matrix.coverage }}
uses: codecov/codecov-action@v7
@@ -67,7 +83,7 @@ jobs:
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: logs-${{ matrix.node-version }}-${{ matrix.factorio-version }}
name: logs-${{ matrix.node-version }}-${{ matrix.factorio-version }}-${{ matrix.tests }}
path: temp/test/logs
version-compat:
+2 -1
View File
@@ -339,7 +339,8 @@ The format of this log should be self explanatory, please follow it carefully. P
For development, use the latest Node.js LTS release, following the [installation instructions](../README.md#installation).
Make sure the Node.js built-in APIs and npm packages you use remain compatible with the supported versions.
The GitHub Actions tests currently run on Node.js 24 and 26 across the Factorio matrix, with Node.js 22 used for coverage; see the [CI workflow](../.github/workflows/node.js.yml) for the version matrix.
The GitHub Actions tests run every Factorio version on the latest Node.js, and every other supported Node.js version with the latest Factorio only, which keeps the number of jobs within GitHub's concurrent job limit.
Coverage is collected on the oldest supported Node.js; see the [CI workflow](../.github/workflows/node.js.yml) for the version matrix.
For Factorio, active support covers the latest stable version and the previous major version, using version lines such as 2.1, 2.0 and 1.1 as described in the [Factorio support policy](decisions.md#factorio).
Older versions from 0.17 onwards receive passive support where it does not restrict actively supported versions.
+1 -1
View File
@@ -28,7 +28,7 @@
]
},
"engines": {
"node": ">=22"
"node": "^22.18.0 || >=24.2.0"
},
"workspaces": [
"packages/*",
+6 -1
View File
@@ -25,10 +25,12 @@ import DailyRotateFile from "winston-daily-rotate-file";
// homebrew modules
// Reduce startup time by lazy compiling schemas.
import "./src/set_lazy_schema_compilation.js";
import * as lib from "@clusterio/lib";
import { ConsoleTransport, levels, logger } from "@clusterio/lib";
import Controller from "./src/Controller.js";
import type Controller from "./src/Controller.js";
import UserManager from "./src/UserManager.js";
import UserRecord from "./src/UserRecord.js";
import packageConfig from "@clusterio/controller/package.json" with { type: "json" };
@@ -194,6 +196,7 @@ async function handleBootstrapCommand(
}
let ctlConfig = new lib.CtlConfig("control");
const { default: Controller } = await import("./src/Controller.js");
ctlConfig.set("ctl.controller_url", Controller.calculateControllerUrl(controllerConfig));
ctlConfig.set(
"ctl.controller_token",
@@ -463,6 +466,8 @@ async function startup() {
return;
}
// Loaded here as the server is not needed by the other commands
const { default: Controller } = await import("./src/Controller.js");
controller = await Controller.fromConfig(
controllerConfig,
pluginInfos,
+1 -1
View File
@@ -32,7 +32,7 @@
"clusteriocontroller": "./dist/node/controller.js"
},
"engines": {
"node": ">=22"
"node": "^22.18.0 || >=24.2.0"
},
"dependencies": {
@@ -0,0 +1,3 @@
// This needs to be a separate file due to ECMAScript Modules evaluating code in
// imported modules before any code in the file that imports it.
(global as any).lazySchemaCompilation = true;
+1 -1
View File
@@ -28,7 +28,7 @@
"clusteriocreate": "./create.js"
},
"engines": {
"node": ">=22"
"node": "^22.18.0 || >=24.2.0"
},
"dependencies": {
+1 -1
View File
@@ -32,7 +32,7 @@
"clusterioctl": "./dist/node/ctl.js"
},
"engines": {
"node": ">=22"
"node": "^22.18.0 || >=24.2.0"
},
"dependencies": {
+5 -1
View File
@@ -20,10 +20,12 @@ import winston from "winston";
import "winston-daily-rotate-file";
// internal libraries
// Reduce startup time by lazy compiling schemas.
import "./src/set_lazy_schema_compilation.js";
import * as lib from "@clusterio/lib";
import { ConsoleTransport, levels, logger } from "@clusterio/lib";
import Host from "./src/Host.js";
import type Host from "./src/Host.js";
import { createScenarioCommand, handleCreateScenarioCommand } from "./src/create_scenario.js";
import { PairingError, ensurePaired } from "./src/pairing.js";
@@ -254,6 +256,8 @@ async function startHost() {
}
}
// Loaded here as the server is not needed by the other commands
const { default: Host } = await import("./src/Host.js");
let hostConnector = new HostConnector(hostConfig, pluginInfos);
host = await Host.fromConfig(
hostConfig,
+1 -1
View File
@@ -33,7 +33,7 @@
"clusteriohost": "./dist/node/host.js"
},
"engines": {
"node": ">=22"
"node": "^22.18.0 || >=24.2.0"
},
"dependencies": {
@@ -0,0 +1,3 @@
// This needs to be a separate file due to ECMAScript Modules evaluating code in
// imported modules before any code in the file that imports it.
(global as any).lazySchemaCompilation = true;
+1 -1
View File
@@ -46,7 +46,7 @@
"compile_validator": "node scripts/compile_validator.js"
},
"engines": {
"node": ">=22"
"node": "^22.18.0 || >=24.2.0"
},
"dependencies": {
+1 -1
View File
@@ -29,7 +29,7 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"engines": {
"node": ">=22"
"node": "^22.18.0 || >=24.2.0"
},
"dependencies": {
+1 -1
View File
@@ -30,7 +30,7 @@
"test": "echo \"Error: run tests from root\" && exit 1"
},
"engines": {
"node": ">=22"
"node": "^22.18.0 || >=24.2.0"
},
"peerDependencies": {
+1 -1
View File
@@ -30,7 +30,7 @@
"test": "echo \"Error: run tests from root\" && exit 1"
},
"engines": {
"node": ">=22"
"node": "^22.18.0 || >=24.2.0"
},
"peerDependencies": {
+1 -1
View File
@@ -30,7 +30,7 @@
"test": "echo \"Error: run tests from root\" && exit 1"
},
"engines": {
"node": ">=22"
"node": "^22.18.0 || >=24.2.0"
},
"peerDependencies": {
+1 -1
View File
@@ -30,7 +30,7 @@
"test": "echo \"Error: run tests from root\" && exit 1"
},
"engines": {
"node": ">=22"
"node": "^22.18.0 || >=24.2.0"
},
"peerDependencies": {
+1 -1
View File
@@ -30,7 +30,7 @@
"test": "echo \"Error: run tests from root\" && exit 1"
},
"engines": {
"node": ">=22"
"node": "^22.18.0 || >=24.2.0"
},
"peerDependencies": {
+1 -1
View File
@@ -30,7 +30,7 @@
"test": "echo \"Error: run tests from root\" && exit 1"
},
"engines": {
"node": ">=22"
"node": "^22.18.0 || >=24.2.0"
},
"peerDependencies": {
+3 -3
View File
@@ -217,17 +217,17 @@ export function exec(command, options = {}) {
}
export function execController(...args) {
args[0] = `node --enable-source-maps ../../packages/controller ${args[0]}`;
args[0] = `node --enable-source-maps ../../packages/controller/dist/node/controller.js ${args[0]}`;
return exec(...args);
}
export function execHost(...args) {
args[0] = `node --enable-source-maps ../../packages/host ${args[0]}`;
args[0] = `node --enable-source-maps ../../packages/host/dist/node/host.js ${args[0]}`;
return exec(...args);
}
export function execCtlProcess(...args) {
args[0] = `node --enable-source-maps ../../packages/ctl ${args[0]}`;
args[0] = `node --enable-source-maps ../../packages/ctl/dist/node/ctl.js ${args[0]}`;
return exec(...args);
}
+3 -1
View File
@@ -169,7 +169,9 @@ describe("Integration of lib/link", function() {
it("should close old connections from the same address", async function() {
slowTest(this);
const hostConnectorFirst = new TestHostConnector(url, 0.2);
// Without a link the disconnect prepare goes unanswered and the controller waits 10 s for it
const hostLinkFirst = new lib.Link(new TestHostConnector(url, 0.2));
const hostConnectorFirst = hostLinkFirst.connector;
hostConnectorFirst.token = hostConnector.token;
hostConnectorFirst.hostId = hostConnector.hostId;
const onceClose = events.once(hostConnectorFirst, "close");