BUG: Have updated my mod, found several issues/portal bugs

A place to talk about the official Factorio mod portal (https://mods.factorio.com)
Post Reply
User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 727
Joined: Sun Mar 13, 2016 9:48 am
Contact:

BUG: Have updated my mod, found several issues/portal bugs

Post by DRY411S »

This is the mod. It's not very popular, so I'm leaving it in its current state so you can investigate. https://mods.factorio.com/mods/DRY411S/ ... lBatteries

The first time I uploaded it, I gave it version 0.13.00. It was uploaded as RemoveChemicalBatteries_0.13.00.zip and the portal renamed it as RemoveChemicalBatteries_0.13.0.zip.

The game doesn't think that the zip file having a different name to the version number in info.json is an issue, and the game loads it.

Then I found a bug in info.json. I had accidentally coded it like this:

Code: Select all

{
	"name": "RemoveChemicalBatteries",
	"version": "0.13.00",
	"title": "Remove Chemical Batteries",
	"author": "DRY411S",
	"homepage": "https://github.com/DRY411S/Remove-Chemical-Batteries",
	"contact": "https://forums.factorio.com/memberlist.php?mode=viewprofile&u=15698",
	"description": "Prevents batteries from being made in chemical plants. But only if you have also enabled the AddAssemblerBatteries Mod, so you always have a way of making batteries.",
	"factorio_version":"0.13",
	"dependencies": ["base >= 0.13.00"],
	"dependencies": ["base >= 0.13.00" ,"AddAssemblerBatteries >= 0.13.00"]
}
There are two dependency lines. If I look at the portal version of info.json, it has ignored the first line, so on the portal, it shows info.json as

Code: Select all

{
    "contact": "https://forums.factorio.com/memberlist.php?mode=viewprofile&u=15698",
    "factorio_version": "0.13",
    "title": "Remove Chemical Batteries",
    "version": "0.13.00",
    "dependencies": [
        "base >= 0.13.00",
        "AddAssemblerBatteries >= 0.13.00"
    ],
    "homepage": "https://github.com/DRY411S/Remove-Chemical-Batteries",
    "author": "DRY411S",
    "name": "RemoveChemicalBatteries",
    "description": "Prevents batteries from being made in chemical plants. But only if you have also enabled the AddAssemblerBatteries Mod, so you always have a way of making batteries."
}
In other words, the portal has ignored the first 'dependencies' line.

The game however has not, it has ignored the second line. You can see too that it has ignored the version number in the info.json file (0.13.01) and is displaying the version number in the zip file name (0.13.0)
nodependency.PNG
nodependency.PNG (353.91 KiB) Viewed 2740 times
So the portal has interpreted the info.json a different way to the game, and the game is picking up the version number from the zip, not the info.json.

Anyway, there is definitely a bug in my mod, because the game isn't recognising the dependency. I therefore edit info.json. I uplift the version to v0.13.01, and remove the rogue line. info.json now looks like this.

Code: Select all

{
	"name": "RemoveChemicalBatteries",
	"version": "0.13.01",
	"title": "Remove Chemical Batteries",
	"author": "DRY411S",
	"homepage": "https://github.com/DRY411S/Remove-Chemical-Batteries",
	"contact": "https://forums.factorio.com/memberlist.php?mode=viewprofile&u=15698",
	"description": "Prevents batteries from being made in chemical plants. But only if you have also enabled the AddAssemblerBatteries Mod, so you always have a way of making batteries.",
	"factorio_version":"0.13",
	"dependencies": ["base >= 0.13.00" ,"AddAssemblerBatteries >= 0.13.00"]
}
I produce a new zip RemoveChemicalBatteries_0.13.01.zip and upload it to the portal. This time the portal renames to zip as RemoveChemicalBatteries_0.13.1.zip.

So now the zip file is at 0.13.1 the game menu displays 0.13.1 but the folder in the zip and the info.json is at 0.13.01. On my GitHub the version is v0.13.01. This is very confusing for the user and the developer.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5151
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: BUG: Have updated my mod, found several issues/portal bugs

Post by Klonan »

Seems like you aren't following the format for the info.json correctly, which is causing these discrepancies.

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 727
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: BUG: Have updated my mod, found several issues/portal bugs

Post by DRY411S »

Klonan wrote:Seems like you aren't following the format for the info.json correctly, which is causing these discrepancies.
Could you be more specific please? Is the precise format documented somewhere?

I'd really like the portal (and the game) to display the same version number as in the info.json that is included in the zip.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: BUG: Have updated my mod, found several issues/portal bugs

Post by ssilk »

Hm. I think, there is a bad mixture of different code between mod-portal and game. The development should put much effort in keeping the code around those functionalities equal, because otherwise it implements API functionality in two different ways. :twisted: :roll:
(Which means: Ideally they should use the SAME code, not so ideally they should share the same tests)

For now I would say: In minimum the portal should check the json for validity. Would be easy to be implemented.


Json is a precise format itself. Look here:
https://en.wikipedia.org/wiki/JSON

There are also format-checkers:
https://jsonformatter.curiousconcept.com/

It is recommended to use such checkers, before uploading to mod-portal - I think that's also what Klonan meant. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

User avatar
HanziQ
Former Staff
Former Staff
Posts: 630
Joined: Fri Mar 27, 2015 7:07 am
Contact:

Re: BUG: Have updated my mod, found several issues/portal bugs

Post by HanziQ »

I'll take look at making the version checks more strict, so to disallow leading zeros in both the game and the mod portal

Ignoring the first duplicate key in the mod portal is the correct behaviour, not sure if I can do anything about that in the game because of the library we use. Suffice to say, the JSON file is not valid, so I don't think this is aa big issue.
The game however has not, it has ignored the second line. You can see too that it has ignored the version number in the info.json file (0.13.01) and is displaying the version number in the zip file name (0.13.0)
The info.json files above show version 0.13.00, not .01 so I don't understand.

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 727
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: BUG: Have updated my mod, found several issues/portal bugs

Post by DRY411S »

HanziQ wrote:I'll take look at making the version checks more strict, so to disallow leading zeros in both the game and the mod portal
Thank you. So is this version renumbering caused by me using a leading zero in my version numbers, and the mod portal code not capturing it?
HanziQ wrote:Ignoring the first duplicate key in the mod portal is the correct behaviour, not sure if I can do anything about that in the game because of the library we use. Suffice to say, the JSON file is not valid, so I don't think this is a big issue.
Both the game and the portal are accepting that duplicate key in info.json file though aren't they? Yes it was my mistake, but it isn't being picked up by the game or the portal.
HanziQ wrote:
The game however has not, it has ignored the second line. You can see too that it has ignored the version number in the info.json file (0.13.01) and is displaying the version number in the zip file name (0.13.0)
The info.json files above show version 0.13.00, not .01 so I don't understand.
That's a typo by me. I was referrring to the 0.13.1. version of the mod in the portal. I should have said:

"You can see too that it has ignored the version number in the info.json file (0.13.01) and is displaying the version number in the zip file name (0.13.1)"

Post Reply

Return to “Mod portal Discussion”