Summary
Four repos now depend on facts pulled out of the Factorio game. Three of them run
the game headless to ask it questions, and each wrote the same plumbing from
scratch. The plan is to pull that plumbing into one shared Rust CLI,
factorio-oracle, in its own repo.
This repo is the fourth, and it is the one with the worst provenance problem.
Nothing here changes yet. The agreed migration rule is "new probes only". This
issue records what the tool would fix here so the decision is written down.
The four repos are FactorioTools, factorio-blueprint-editor, FactorioMapWebUI and
this one. Each is getting its own issue.
The problem here
data/factorioraw.json is 21.3 MB and was committed with the message "Added
Factorio raw data, very useful." Three things are wrong with it, and none of them
is visible from the filename.
It is not JSON. It is Lua table syntax, produced by a mod. The first line reads
Script @__DataRawSerpent__/data-final-fixes.lua:1: {. Anything that tries to
json.load it fails.
It is truncated. The last line is
--[[incomplete output with shared/self-references skipped]]. So it is not a
complete picture of the game's data, and nothing in the file says which parts are
missing.
It has no version stamp. Searching it for a version field returns nothing. So
there is no way to answer "which Factorio produced this", which means there is no
way to know whether it still describes the current game.
On top of that sit the hardcoded numbers in factorio_thresholds.py:24-77 - HP and
resistance tuples for every asteroid, biter, spawner, worm and pentapod - plus
factorio_productivity.py and factorio_mining.py. Those feed public wiki
pages. If Factorio changes one of them, nothing here notices. The output stays
plausible and becomes wrong, in public.
That is the exact failure the shared tool exists to catch. FactorioTools hit the
same class of bug twice: effectivity-module-N became efficiency-module-N in
2.0, and directions widened from 8-way to 16-way. Both went unnoticed for a long
time, because plans kept generating - they were just wrong.
What the shared tool would give this repo
A real capture, stamped with the version that produced it. One command that
finds the local Factorio, runs --dump-data with user mods disabled, and writes
the result with the game version, build string and the list of mods that actually
loaded. No hand-rolled serpent mod, no truncation.
Note this repo needs something the other three do not: a full, untrimmed
data.raw, consumed from Python. FactorioTools wants a small trimmed fixture of
ten entities. That difference is now in the design rather than being discovered
later.
A drift check. --check re-captures to a scratch file and diffs it against
what is committed, without dirtying the tree. Run it after a game update and it
tells you whether anything the wiki tables depend on has moved. That answers "is
the published table still true" without reading 21 MB by hand.
The migration table. Factorio ships data/*/migrations/*.json, which is a
complete list of every rename, not a guess. Checking a hardcoded name against it is
how the FactorioTools module rename was proven rather than remembered.
Provenance that is checked, not hoped for. The design copies FactorioMapWebUI's
scheme: a manifest beside the fixtures recording which game version each came from,
an evidence field grading how that was established (stated beats inferred beats
unknown), an always-on test that needs no game and fails if a fixture has no entry,
and a ratchet capping the number of unknown entries so the gap can only shrink.
Today this repo would start with everything unknown, which is at least honest.
Also worth knowing
The WikiArticles/*.json captures record no game version either. Same problem,
smaller stakes.
CLAUDE.md documents a hand-rolled probing method: /c console snippets that hook
defines.events.on_entity_damaged to count Tesla chain hits. That is exactly the
kind of question the shared tool is built to run repeatably, rather than by
retyping console commands. The other repos have 18 such probes between them and the
same technique underneath.
One caution from the FactorioTools work that applies directly here: store raw
values, never derived ones. Factorio's rule for turning a prototype number into a
usable figure is often not one formula. A guessed formula in a captured file is
confidently wrong and drifts invisibly. Derive in the code that consumes it, where
a wrong derivation fails loudly.
Prior art checked
Nothing existing covers this. Four projects re-implement Factorio's data stage in
embedded Lua (YAFC, factorio-draftsman, KirkMcDonald/factorio-tools,
factorio-scanner). They are fast and need no game install, and they are all
approximations. YAFC ships the warning itself: "YAFC loads mods in environment that
is not completely compatible with Factorio." For wiki numbers that people rely on,
an approximation is the wrong foundation.
factorio-rust-tools is the closest match and worth reading. Its CI downloads a
pinned headless Factorio from factorio.com/get-download/<version>/headless/linux64
and diffs against a committed golden file. That is a way to automate the drift
check rather than remember to run it.
Status
Design is agreed in outline: a Rust CLI, JSON in and JSON out, in a new public
repo. The write-up is not finished, and this issue will be updated with a link.
Separately, moving these repos under the FactoryGameFan org is proposed and not
decided. This repo is not a fork and has no deploy wired to GitHub, so a transfer
here is low risk when it happens. Transfers redirect clone, fetch and push,
and preserve secrets and deploy keys.
Related issues
One per affected repo, all describing the same shared tool:
Summary
Four repos now depend on facts pulled out of the Factorio game. Three of them run
the game headless to ask it questions, and each wrote the same plumbing from
scratch. The plan is to pull that plumbing into one shared Rust CLI,
factorio-oracle, in its own repo.This repo is the fourth, and it is the one with the worst provenance problem.
Nothing here changes yet. The agreed migration rule is "new probes only". This
issue records what the tool would fix here so the decision is written down.
The four repos are FactorioTools, factorio-blueprint-editor, FactorioMapWebUI and
this one. Each is getting its own issue.
The problem here
data/factorioraw.jsonis 21.3 MB and was committed with the message "AddedFactorio raw data, very useful." Three things are wrong with it, and none of them
is visible from the filename.
It is not JSON. It is Lua table syntax, produced by a mod. The first line reads
Script @__DataRawSerpent__/data-final-fixes.lua:1: {. Anything that tries tojson.loadit fails.It is truncated. The last line is
--[[incomplete output with shared/self-references skipped]]. So it is not acomplete picture of the game's data, and nothing in the file says which parts are
missing.
It has no version stamp. Searching it for a version field returns nothing. So
there is no way to answer "which Factorio produced this", which means there is no
way to know whether it still describes the current game.
On top of that sit the hardcoded numbers in
factorio_thresholds.py:24-77- HP andresistance tuples for every asteroid, biter, spawner, worm and pentapod - plus
factorio_productivity.pyandfactorio_mining.py. Those feed public wikipages. If Factorio changes one of them, nothing here notices. The output stays
plausible and becomes wrong, in public.
That is the exact failure the shared tool exists to catch. FactorioTools hit the
same class of bug twice:
effectivity-module-Nbecameefficiency-module-Nin2.0, and directions widened from 8-way to 16-way. Both went unnoticed for a long
time, because plans kept generating - they were just wrong.
What the shared tool would give this repo
A real capture, stamped with the version that produced it. One command that
finds the local Factorio, runs
--dump-datawith user mods disabled, and writesthe result with the game version, build string and the list of mods that actually
loaded. No hand-rolled serpent mod, no truncation.
Note this repo needs something the other three do not: a full, untrimmed
data.raw, consumed from Python. FactorioTools wants a small trimmed fixture often entities. That difference is now in the design rather than being discovered
later.
A drift check.
--checkre-captures to a scratch file and diffs it againstwhat is committed, without dirtying the tree. Run it after a game update and it
tells you whether anything the wiki tables depend on has moved. That answers "is
the published table still true" without reading 21 MB by hand.
The migration table. Factorio ships
data/*/migrations/*.json, which is acomplete list of every rename, not a guess. Checking a hardcoded name against it is
how the FactorioTools module rename was proven rather than remembered.
Provenance that is checked, not hoped for. The design copies FactorioMapWebUI's
scheme: a manifest beside the fixtures recording which game version each came from,
an
evidencefield grading how that was established (stated beats inferred beatsunknown), an always-on test that needs no game and fails if a fixture has no entry,
and a ratchet capping the number of
unknownentries so the gap can only shrink.Today this repo would start with everything unknown, which is at least honest.
Also worth knowing
The
WikiArticles/*.jsoncaptures record no game version either. Same problem,smaller stakes.
CLAUDE.mddocuments a hand-rolled probing method:/cconsole snippets that hookdefines.events.on_entity_damagedto count Tesla chain hits. That is exactly thekind of question the shared tool is built to run repeatably, rather than by
retyping console commands. The other repos have 18 such probes between them and the
same technique underneath.
One caution from the FactorioTools work that applies directly here: store raw
values, never derived ones. Factorio's rule for turning a prototype number into a
usable figure is often not one formula. A guessed formula in a captured file is
confidently wrong and drifts invisibly. Derive in the code that consumes it, where
a wrong derivation fails loudly.
Prior art checked
Nothing existing covers this. Four projects re-implement Factorio's data stage in
embedded Lua (YAFC, factorio-draftsman, KirkMcDonald/factorio-tools,
factorio-scanner). They are fast and need no game install, and they are all
approximations. YAFC ships the warning itself: "YAFC loads mods in environment that
is not completely compatible with Factorio." For wiki numbers that people rely on,
an approximation is the wrong foundation.
factorio-rust-toolsis the closest match and worth reading. Its CI downloads apinned headless Factorio from
factorio.com/get-download/<version>/headless/linux64and diffs against a committed golden file. That is a way to automate the drift
check rather than remember to run it.
Status
Design is agreed in outline: a Rust CLI, JSON in and JSON out, in a new public
repo. The write-up is not finished, and this issue will be updated with a link.
Separately, moving these repos under the
FactoryGameFanorg is proposed and notdecided. This repo is not a fork and has no deploy wired to GitHub, so a transfer
here is low risk when it happens. Transfers redirect
clone,fetchandpush,and preserve secrets and deploy keys.
Related issues
One per affected repo, all describing the same shared tool:
definesbug, and the open upstream PR that gates its movefactorio-datatag contention