Bug 452000

Summary: System and user remotes with the same name are ambiguous
Product: [Applications] Discover Reporter: Trent M <twilightinzero>
Component: Flatpak BackendAssignee: Dan Leinir Turthra Jensen <leinir>
Status: CONFIRMED ---    
Severity: normal CC: aleixpol, jgrulich, nate, postix
Priority: NOR Keywords: usability
Version: 5.24.3   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Screenshot of inability to tell remotes apart when going to install an application in Discover.
Screenshot of inability to set priority of same-named flathub remotes.

Description Trent M 2022-03-28 15:25:59 UTC
Created attachment 147795 [details]
Screenshot of inability to tell remotes apart when going to install an application in Discover.

SUMMARY
If you want to install an application into the user Flatpak installation, you must also have a remote specifically in that installation. So the most intuitive thing is to add the flathub remote to both the system and user installations. What you end up with as a result, unfortunately, are two remotes that you can't tell apart, and that Discover does not know how to disambiguate or prioritize.

The Flatpak CLI sees this as an entirely valid thing to have, and will go out of its way to disambiguate the remotes in all operations:

```
❯ flatpak install im.riot.Riot
Looking for matches…
Remotes found with refs similar to ‘im.riot.Riot’:

   1) ‘flathub’ (system)
   2) ‘flathub’ (user)

Which do you want to use (0 to abort)? [0-2]:
```

But Discover keeps both remotes ambiguous in multiple places.

STEPS TO REPRODUCE
1. `flatpak --system remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo`
2. `flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo`
3. Search for any application, or go to Settings to try and decide remote priority

OBSERVED RESULT
You can't tell easily which remote you would be installing from, and you can't decide what remote has priority in Discover's settings.

EXPECTED RESULT
There is some way to tell which remote is for the system installation and which remote is for the user installation.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE Neon 5.24.3
(available in About System)
KDE Plasma Version: 5.24.3
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION
This can be worked around by giving the remote a different name when adding it, like "flathub-user". But it's not currently possible to rename remotes. If you've already got apps in the user installation, this gets to be a pain pretty quick. You have to uninstall all of your user apps, do a `flatpak --user uninstall --unused` to remove all the runtimes, delete the remote, re-add it, and then reinstall all of your user apps.
Comment 1 Trent M 2022-03-28 15:26:44 UTC
Created attachment 147796 [details]
Screenshot of inability to set priority of same-named flathub remotes.