* Add requiredMods to plugin declarations
Plugins can list the Factorio mods they need under requiredMods. When an
instance starts, the host warns in the instance log about each loaded
plugin whose required mods are missing or disabled in the mod pack.
Subspace Storage declares the subspace_storage mod.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* 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>
* Add a Factorio 1.1 variant to the subspace_storage test stub
The 1.1 test jobs failed because the test mod pack asked for
subspace_storage 2.3.11, which the stub did not build. The real mod
publishes 2.3.11 for 1.1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The 1.1 test jobs failed because the test mod pack asked for
subspace_storage 2.3.11, which the stub did not build. The real mod
publishes 2.3.11 for 1.1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI coverage does not measure the ctl processes the integration tests start, so cover the Ctl log and debug event handlers, start-all, stop-all and pickFields with unit tests, and run mod show, user list flags, parse-exchange-string and log follow in process.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
user show, mod list, mod search and mod-pack list deleted fields off the received objects to trim the table, which made their toJSON throw in wire mode. They now pick the fields for the human table only and print the whole objects in json and wire mode.
Add integration cases for config edit on the controller, a host and an instance, user show with instance stats, log query and host pending in human mode, mod-pack show with mods and settings, and wire output of the trimmed lists.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CommandOutput.error takes a human reporter like result, so command errors log their message in human mode and print JSON in json and wire mode. table takes a map applied to each row in human mode, which note list, host plugin list, user list and save list now use. Rename streaming to streamingLog, and print startup errors with errorToJson directly.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
Plugins can list the Factorio mods they need under requiredMods. When an
instance starts, the host warns in the instance log about each loaded
plugin whose required mods are missing or disabled in the mod pack.
Subspace Storage declares the subspace_storage mod.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a wire output format that prints the toJSON format sent over the link. Commands without a result print {"success": true}, or "Command ran successfully" in human mode. The missing URL check throws a StartupError, unexpected command errors are rethrown to the startup handler, and startup errors log as fatal. user list, note list and host plugin list print the objects they received instead of their table rows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Commands print their results through a CommandOutput on the ctl link.
In json mode lists print as arrays of objects, other results as an
object, commands without a result print {} and failures print
{ error: ClassName, message } with exit code 1. log follow and
debug dump-ws print JSON lines.
Human output now goes through the shared asTable printer in every
command, results that were logged to stderr (role create, save and mod
upload/download) print to stdout, and config edit failures are logged
instead of printed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hasFactorioHeadless(version, platform, arch) replaces the host's
hasArm64Headless, and factorioHeadlessUrl takes the platform too and
throws when Factorio has no headless build for it, which for now is
every platform except Linux. headlessUrl is marked deprecated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Factorio publishes a linux-arm64 headless build from 2.1.18. On ARM64
Linux the host now downloads that build, refuses versions older than
2.1.18 that are not already installed, and finds the binary in bin/arm64
or bin/x64, whichever is present.
The host builds the download URL from the version instead of using
headlessUrl from the controller, so the version list on the wire stays
the same.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Only print test output for failing tests
A spec reporter subclass buffers console output, including winston's
ConsoleTransport and the integration child process lines, and prints it
above the failure line when a test or hook fails. VERBOSE_TEST streams
everything as before, and CI sets it on debug re-runs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Replace SILENT_TEST and VERBOSE_TEST with TEST_OUTPUT
The reporter now handles all three modes: verbose prints everything,
normal prints output from failing tests and hooks, silent prints only
the results. The integration spawn helper and setup_logging no longer
filter output themselves.
npm install output in plugin install now goes through the logger
instead of inherited stdio, so it follows the log level and is
captured in tests like the rest.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The middle version adds two jobs without catching anything the top and
bottom of the range would miss. The host whitelist watcher now uses
Set.difference, which every supported Node.js has.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reporter now handles all three modes: verbose prints everything,
normal prints output from failing tests and hooks, silent prints only
the results. The integration spawn helper and setup_logging no longer
filter output themselves.
npm install output in plugin install now goes through the logger
instead of inherited stdio, so it follows the log level and is
captured in tests like the rest.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A spec reporter subclass buffers console output, including winston's
ConsoleTransport and the integration child process lines, and prints it
above the failure line when a test or hook fails. VERBOSE_TEST streams
everything as before, and CI sets it on debug re-runs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The controller polled system info only on the system metrics interval, so
restart required and machine details stayed empty for up to one interval
after the controller started or a host connected. Collect once right away
and then on every interval. Resumed sessions are skipped since the host
process kept running.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The check runs the same parser as scripts/pr_to_changelog.mts, so a
description that passes CI is one the release script accepts. Checks
that need the GitHub API (issue references existing, pointing at this
pull request) still only run at release time.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Keep quick bar slots whose record is not in the blueprint library yet
A save gets a player's blueprint library from the client some seconds
after the join. The data of a player new to the save is applied before
that, so quick bar slots pointing at library records were cleared, and
the next upload stored the quick bar without them.
The entries are now kept. They are set once the record shows up, and an
upload before that stores them again as they came.
Fixes#1219
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JyNnVzRW4jPWaoWTxCyhM7
* Leave missing quick bar records alone once the quick bar is not synced
An instance whose quick bar sync was turned off while a record entry was
pending still set the slot when the library arrived.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JyNnVzRW4jPWaoWTxCyhM7
---------
Co-authored-by: ILLISIS <jayson.harris01@gmail.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
The managing a cluster guide listed whitelist-bulk-import,
admin-bulk-import and banned-bulk-import, which don't exist. Describe
user import, restore and export with the JSON formats they read and
write. Also reword the README known issue now that the installer no
longer offers server_select and discord_bridge.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
A new cluster gets the default mod packs but controller.default_mod_pack_id
stays null, so the first Create save or Start fails with "Default mod pack
not set on controller". When seeding the packs, also point the default at
the newest Base Game pack, unless an admin already set one. Clusters that
already have mod packs are left alone. The config is written with the
mod packs on the next autosave or shutdown.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Fix the "Permamently" typo in the delete instance confirm.
The Search Mod Portal dialog now opens on the default mod pack's
Factorio version, or the newest known version when there is no default
pack. It used to always start on 2.0. A version the user picks still
sticks while the page is open.
The mod portal cache key used request.hide_deprecated directly, and the
web interface never sends it, so the controller logged "2.0-undefined".
A missing value now counts as false, the same default
fetchAllModsFromPortal already uses, so "2.1" and "2.1-false" share a
cache entry.
Closes#1209
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Restart on the Controller and host pages sent the request on click. A
host restart stops every running instance on it, and they stay down
unless instance.auto_start is set, so one misclick takes servers
offline. Both now open a confirm dialog first, and the host one names
the running instances it will stop.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
user list, user show and role list passed UserDetails and Role objects
straight to as-table, whose default String() turns the roleIds,
instances and permissions Sets into "[object Set]". Move the as-table
setup into command_ops.ts with a cell printer that joins Sets with
", ", and use it for the user and role commands.
The integration tests for role list and user list now capture the
output and check it.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
run-controller.sh and run-host.sh ran `exit $?` after the `[[ ]]` test,
so they exited with the test's status (0) even when the process exited
with 8 to ask not to be restarted. Save the status before testing it.
The .cmd scripts now pass 8 to `exit /b` explicitly instead of relying on
a bare `exit /b` to carry the errorlevel through.
Closes#1208.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
A player rejoining before the controller's reply was skipped by
reject_upload, and the join then kept the copy the controller refused.
The rejection now counts while the join still waits for its acquire
reply, which the controller sends after it.
A controller from before the upload response replies with nothing. That
failed validation on a newer host, so its uploads were never confirmed.
It is taken as stored, as before.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JyNnVzRW4jPWaoWTxCyhM7
A save gets a player's blueprint library from the client some seconds
after the join. The data of a player new to the save is applied before
that, so quick bar slots pointing at library records were cleared, and
the next upload stored the quick bar without them.
The entries are now kept. They are set once the record shows up, and an
upload before that stores them again as they came.
Fixes#1219
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JyNnVzRW4jPWaoWTxCyhM7
The controller gave an upload it did not store the same empty reply as
one it stored, and the instance confirmed either to the save. An instance
restarting after a crash uploads the players it had online, and when
another instance had since uploaded the same generation the save took its
own copy for the stored one: the next join kept it, and the leave after
that stored it over the newer data.
The reply now says whether the upload was stored. One that was not marks
the save's copy outdated, so it is not uploaded again and the next join
downloads.
Fixes#1218
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JyNnVzRW4jPWaoWTxCyhM7
* Stop reading rejected save uploads to the controller
When a host pushes a save to a stream that is gone, or that timed out
before anyone downloaded it, the controller answers 404 or 500 without
reading the body. Node then reads and throws away the rest of the body
to keep the connection open, so a proxy in front of the controller that
keeps passing the upload on made the whole save get uploaded for
nothing. Close the connection if the body hasn't ended a second after
the response.
Document turning off request buffering in reverse proxies, as a
buffering proxy holds the upload back until all of it has arrived.
* Remove the close listener when a rejected upload ends
A connection kept open for more requests got one more close listener
for every rejected upload that finished within the grace period.
* Stop reading all rejected uploads and close stalled transfers
Guard the export, save, mod and stream routes with one middleware that
closes the connection of an upload answered before its body was read,
and of a transfer that has made no progress for the new
controller.transfer_idle_timeout.
The save and mod uploads share one handler that responds on the first
error instead of reading the rest of the upload, and uploads cut short
now fail the transfer instead of leaving it hanging.
Node's 5 minute limit on receiving a request is turned off so large
uploads over slow connections are not cut off.
* Close requests moving too little instead of idle ones
Replace controller.transfer_idle_timeout with
controller.transfer_min_progress, the amount a request has to move
every 30 seconds, so a request trickled in is closed too. The check
now runs for every route.
Both ends of a proxy stream are judged on what the receiver has taken,
so a sender held back by a slow receiver is not closed.
Keep the limit on receiving headers, which turning off the request
timeout also turned off.
Replace controller.transfer_idle_timeout with
controller.transfer_min_progress, the amount a request has to move
every 30 seconds, so a request trickled in is closed too. The check
now runs for every route.
Both ends of a proxy stream are judged on what the receiver has taken,
so a sender held back by a slow receiver is not closed.
Keep the limit on receiving headers, which turning off the request
timeout also turned off.
* Sync the page shown on each quick bar row
player_sync restored the content of the quick bar slots but not which
page each row shows, which every save keeps per player on its own. After
switching servers the rows could show other pages, and with them another
set of slots.
Fixes#1201
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JyNnVzRW4jPWaoWTxCyhM7
* Sync every quick bar slot when the pages are wider than 10
From Factorio 2.1 a quick bar page is as wide as the player set it, up to
100 slots. Only the first 100 slots were synced, so with wider pages the
later pages kept the content of the destination, and restoring the page
shown on a row could show those.
---------
Co-authored-by: ILLISIS <jayson.harris01@gmail.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: Danielv123 <danielv@danielv.no>
From Factorio 2.1 a quick bar page is as wide as the player set it, up to
100 slots. Only the first 100 slots were synced, so with wider pages the
later pages kept the content of the destination, and restoring the page
shown on a row could show those.