addons-linter icon indicating copy to clipboard operation
addons-linter copied to clipboard

Increase extension file size limit for JSON files

Open qqzm opened this issue 6 months ago • 7 comments

Hi, You recently increased the file size limit for js files in extensions to 5MB as noted on this ticket: https://github.com/mozilla/addons-linter/issues/4942 and @diox asked me to raise a separate issue specifically for JSON files.

My extension has a number of data files containing JSON arrays of data. The extension is related to collectable card games so has data about all the cards in each game. Most of the files are small but one of them is about 10MB: https://github.com/Obtuse-Goose/AutocardAnywhere/blob/main/games/mtg/mtg-data.json

My current workaround is to package 4MB of data with the extension and then download the full 10MB file in the background on first launch. But this adds complexity to my build process as I have to compile a full copy of the extension for Chrome, Opera and Edge, then chop the file down to 4MB and create a separate package just for Firefox. This is also a little odd for users as the extension doesn't fully work out-of-the-box. I have tried zipping the file but that does not make it small enough to upload.

The file is growing all the time as new cards come out. It would be really helpful to me if you could increase the limit for JSON files to 15MB or more so that this file can be included in full for the foreseeable future.

Thank you for considering this suggestion, Stephen

qqzm avatar Jun 03 '25 18:06 qqzm

Seconded. 5MB is tiny compared to what modern webapps are doing; it's not uncommon for websites to be loading hundreds of MB of data. I don't know what the constraints are for this particular case, but 5MB seems quite paltry as a size limit in 2025.

KingSupernova31 avatar Jun 03 '25 23:06 KingSupernova31

What's especially silly about this situation is that the max size limit currently blocking us from having large JSON files was apparently created to encourage migrating larger datasets from JavaScript to JSON:

https://github.com/mozilla/addons-linter/blob/3dbc73b00fb1845b9eb0fa98bdb46dac4caa5ffd/src/const.js#L104-105

// A singular CSS/JS file over 5MB seems bad and may actually be full of data // best stored in JSON/some other data format rather than code.

In a way, the apparent intent of the rule is being undermined.

Gudahtt avatar Jun 06 '25 12:06 Gudahtt

Broad JSON linting was introduced in #779 (commit: 23748e4a5e84a2cd707f1f96c5d687a13a070cdc) with the intent of catching errors in manifest.json.

There is no point in linting ALL JSON files; We should only lint JSON files that we care about:

  • manifest.json
  • _locales/*/messages.json
  • Possibly JSON files referenced in manifest.json's declarative_net_request.rule_resources (MDN).

Patches are welcome.

Rob--W avatar Jun 19 '25 12:06 Rob--W

Note to myself and other maintainers: we cannot land a patch until other components that follow the linter behavior are also accepting larger JSON file limits (e.g. the internal customs component according to Mat from AMO).

Rob--W avatar Jul 07 '25 15:07 Rob--W

Hi @Rob--W, since you mentioned you can't land a patch for a while. For a temporary solution, can we get a max file size limit bump to 10MB?

https://github.com/mozilla/addons-linter/pull/5765

ssahillppatell avatar Aug 23 '25 21:08 ssahillppatell

Hi @Rob--W, since you mentioned you can't land a patch for a while. For a temporary solution, can we get a max file size limit bump to 10MB?

Bumping the limit to 10 in the linter is not enough; there are other components that enforce the limit.

This issue here is about bumping the limit for JSON files; I see that you opened a PR to bump the limit from 5 MB to 10MB. I'll comment there separately:

  • #5765 (That is a significant increase and unlikely to be accepted)

Rob--W avatar Aug 28 '25 12:08 Rob--W

Note to myself and other maintainers: we cannot land a patch until other components that follow the linter behavior are also accepting larger JSON file limits (e.g. the internal customs component according to Mat from AMO).

That has since been solved (internal ticket: https://mozilla-hub.atlassian.net/browse/AMOENG-2059), so there are no blockers left. Note that we still want to apply the existing limit to some JSON files as described in https://github.com/mozilla/addons-linter/issues/5685#issuecomment-2987921694

diox avatar Nov 24 '25 12:11 diox