Preventing corrupted packages due to interrupted downloads
Sometimes Pamac complains about corrupted packages while upgrading, which is solved just by cleaning the cache.
My guess is that happens when the background download of packages is interrupted, leading to a broken package. Due to Pamac not having a mechanism for telling when that happens.
The solution could be as simple as putting the current downloading package into a different folder, and move it to the cache only after completion.
On every download attempt Pamac could check if there's any incomplete package, and just remove it.