Index-v1 sets suggestedVersionCode instead of upstreamVersionCode

As a result, it breaks the CV calculations (see #1045 (closed)).

This wasn't picked up during our testing, but the index-v1 format incorrectly specifies a suggestedVersionCode when it should suggest an upstreamVersionCode instead. The suggested version code is only for the client to calculate based on their requirements (e.g. compatibility, and in the near future the signature of the installed version if any). The upstream version is for the server to broadcast what it would like the suggested version to be.

By sending through suggestedVersionCode instead of upstreamVersionCode, the following happens:

  • F-Droid attempts to set the suggested version for apps which have an upstream version code set (i.e. zero apps from index-v1).
  • It then falls back to trying to set the suggested version for all apps with no upstream version (i.e. all the apps from index-v1).
  • In this fallback, it tries to get the highest version code available.

This is the cause of #1045 (closed), which is not actually related to 0.103.2 per-se, but rather the fact https://f-droid.org now serves index-v1 correctly.

The reason we didn't notice it is because the test repos didn't make heavy use of beta non-CV apps, and so picking the highest version code was not actually apparent.

I see a few options:

  • Add a Jackson annotation so that upstreamVersionCode is populated by the "suggestedVersionCode" attribute from the JSON (probably the simplest at this point)
  • Iterate over each app from the server after Jackson has finished parsing and add a hack to transfer each apps suggestedVersionCode to upstreamVersionCode
  • Fix the metadata (probably too much to ask now, but a possibility)

CC: @eighthave.