You always ask such great questions!
I can confirm that our back-end does identify the version of system firmware that the user app binary was compiled against – regardless if it was done in the IDE or compiled locally. When the firmware gets uploaded to the cloud via the dashboard, this information gets saved in our database.
I can also confirm that a mechanism called “Safe Mode Healer” will correct a device that receives a user application that was compiled against a newer system firmware than what the device is currently runs. When this type of OTA occurs, the device will go immediately go into Safe Mode.
When the device goes into Safe Mode, it will publish an event to the cloud signaling the state of the device. This is where Safe Mode Healer kicks in. The Particle cloud will identify what version of system firmware the device is currently running, check the requirements of the user app that was just flashed, and trigger an OTA of the required system parts to resolve the dependencies. This will happen in two consecutive OTA flashes (system part 1, system part 2). The device will then reset and begin running the new user app firmware.
This mechanism is true for devices that must update forward in system modules. That is, if the device is running
0.4.6 system modules and receives a binary compiled against
0.4.9, Safe Mode Healer will trigger an OTA of
0.4.9 system modules for that device. However, this mechanism is not required for devices receiving a user app compiled against an older system firmware than the user app. As mentioned, this is because system modules are backwards-compatible.
Hope this helps fill the gap!