application.compatibilityVersionproperty returns the compatibility version of the currently loaded application.
environment.application.compatibilityVersionproperty returns the compatibility version of the client.
applicationUpgradeevent script triggers on the first time that a new version of an application is opened and every time a draft version is opened on a client. This gives you the opportunity to handle existing open sessions that may causes issues with the application. For example, you could:
applicationUpgradescript in Application Builder, select Edit Script on the application upgrade settings page (shown above), or select File > Application Scripts > applicationUpgrade.