I have used WPA3 PPSK to protect my network and allow isolating traffic from different devices. However, /etc/hostapd.wifi_psk is truncated to 0 bytes after attended sysupgrade, causing devices to be unable to connect.
Is it possible to set this configuration via UCI instead? If not, can I place this file in some place it will not be erased?
If it's not backed up, the file is simply not kept across the upgrade. Technically, what happens is that the keep settings relies on the sysupgrade.conf file contents. Things are backed up, the router is flashed, and then the backups are restored (all handled by asu/sysupgrade). So here, the file wasn't specified so it was deleted.
But as for the recreation -- it would seem that the hostapd process noticed that the file was missing and created it so that it wouldn't error out (this is educated speculation, I haven't reviewed the code to verify that this is correct). As such, it would touch the file resulting in an empty but existent file.