Skip to content

Conversation

@PyvesB
Copy link
Member

@PyvesB PyvesB commented Oct 19, 2025

Continuing the dependency audit started in #11425.

We use the bytes dependency in a single place, to convert strings specified in fetchLimit from a 10MB to a number of bytes. The vast majority of users never care about this parameter, given it only affects self-hosted Shields instances, most of which will leave the default value anyway.

In addition to the superfluous dependency, validation, and parsing, bytes() has two function aliases, one that converts numbers to strings and one that converts strings to numbers. IDEs get confused and assume we're converting from number to string even though we're doing the opposite. In got.js, the typechecker mistakenly thinks we're comparing a number to a (potentially null) string, which is confusing:
Screenshot 2025-10-19 at 10 50 22

I propose the following course of action:

  • (this PR) Introduce a fetchLimitBytes config that behaves the same way as fetchLimit, but with a bytes value directly specified as a number. If anyone has overridden the value of fetchLimit, they will get a warning when starting up the server, otherwise the new fetchLimitBytes default will be used.
  • Wait for one new self-hosted release get published with changes from this PR shipped.
  • Remove support for fetchLimit and and error out if someone still has it overridden in their config.
  • In a few months time, pull out the remaining check, similar to Remove legacy configuration checks #11424.

Let me know what you think and whether it's worth it!

@PyvesB PyvesB added the core Server, BaseService, GitHub auth, Shared helpers label Oct 19, 2025
@github-actions
Copy link
Contributor

Warnings
⚠️ This PR modified the server but none of its tests.
That's okay so long as it's refactoring existing code.
Messages
📖 ✨ Thanks for your contribution to Shields, @PyvesB!

Generated by 🚫 dangerJS against eb84873

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Server, BaseService, GitHub auth, Shared helpers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant