removeStaleServerStateUpdatesForDevice

Removes stale server state updates for a device, based on its current DSC and SSC.

Returns the updated persisted payload if changes were made, null if:

  • no payload file exists,

  • no updates were removed,

  • or an error occurred during decode/encode.

If all updates are stale, the file is deleted and null is returned.