Repository navigation
perf(api): list only the releases a server can pick in apps.json - #1969
Merged
Merged
Conversation
Related #1951 apps.json lists all releases of every app, about 18,000 on production, but a Nextcloud server keeps one per app. It filters the releases on their raw platform and PHP version specs, the nightly flag and whether the version contains "-", then takes the highest version left according to PHP's version_compare(). Of the releases that agree on those four values, only the highest can ever be picked, so leaving out the others changes nothing a server does. On production's catalogue that keeps 5,913 of 18,267 releases. The list falls from 16.1 MB to 5.8 MB with gzip, and on the local copy of production a build through Apache takes about 5 s instead of 9 to 10 s. The rule is a list serializer used only by apps.json, with a port of version_compare() as of PHP 8.4.22 and 8.5.7 for the comparison. Releases that compare equal to the newest of their set are all kept, because which of them a server picks depends on its sort order. A set with a version that ends in a character other than a letter or digit is kept whole: older PHP orders such versions inconsistently, and none exists in the catalogue today. platform/<version>/apps.json and appapi_apps.json are unchanged, and the API docs describe the rule. Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
lukasdotcom
reviewed
Nov 6, 2026
lukasdotcom
left a comment
Member
There was a problem hiding this comment.
Looks nice. Not sure if this is actually faster or even worth it to implement, but it could be worth it to split the versions stuff into two queries one that just gets version, raw_platform_version_spec, raw_php_version_spec, and is_nightly. Based on this find what versions you need everything for. It would save pulling the signature field which ai calculated to be about 77% of the data based of our current apps.json.
Collaborator
Author
|
Thanks, good idea! Loading only I'd like to keep this PR small, so we can do it in a follow-up after the main work is done. |
oleksandr-nc
marked this pull request as ready for review
November 6, 2026 19:28
lukasdotcom
approved these changes
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related #1951
A Nextcloud server keeps only one release per app from
apps.json.It drops the releases that don't fit its platform, PHP version or update channel, and takes the highest version left.
So when two releases have the same
rawPlatformVersionSpec,rawPhpVersionSpec,isNightlyand pre-release state, the lower one can never be picked.This PR leaves those releases out of
apps.json.With the current catalogue it keeps 5,913 of 18,267 releases.
The list goes from 16.1 MB to 5.8 MB with gzip, and Django needs about 5 s instead of 9-10 s to generate it (measured locally).
Versions are compared with a port of PHP's
version_compare(), as it works since PHP 8.4.22 and 8.5.7 (php/php-src#21689).Releases that compare equal to the highest one are all kept, because the server's choice between them depends on sort order.
If a version in a set ends with something other than a letter or digit, the whole set is kept, because older PHP compares such versions inconsistently.
There is no such version in the catalogue today.
platform/<version>/apps.jsonandappapi_apps.jsondon't change.App pages and downloads on the website still show every release.
Tools that look up one exact version should use
platform/<version>/apps.json.For example, a backport like
mail 1.5.5, uploaded after1.6.0with the same requirements, is no longer inapps.json.The ETag of
apps.jsonis based on upload and delete times, not on the content.So copies made from the origin switch to the smaller list with the next release upload or deletion.
🤖 AI (if applicable)