Many times I have been asked by app developers to beta test their app and very often the beta version had the same package name but of course mismatched signature.
This is an absolute no-go. You are asking your friendly beta testers to discard all their data and settings. Even if an app may have some kind of backup function I have seen too many that don’t restore everything properly.
The solution is dead simple for the developer: change the package name of the testing version to be distinct from released versions - for example by appending a “beta”.
Alternatively - F-droid itself could/should routinely change the app name so this doesn’t happen?
I agree it would be better if app developers would use distinct package names than to mangle the names by F-Droid. However, in my experience “not many” (possibly a gross understatement) actually do this so maybe it is inevitable for F-Droid to step in?
The current state is, if I install an upgrade from F-Droid that turns out to be completely non-working I am busted. Without erasing my data no way to downgrade or try a beta.
For F-Droid to handle this kind of thing, there would need to be a lot more contributors. It is something that the app developer should handle. F-Droid fully supports apps with separate beta/nightly versions, and there are some set up like that on f-droid.org, like Nextcloud