Runtime compatibility fingerprinting
Editing TypeScript does not guarantee OTA compatibility in NativeScript. Build-time native metadata and static bindings define the exact native surface available to JavaScript in an installed binary.
ota-ns fingerprint computes a deterministic per-platform runtimeContract (ios-rc-<16-hex> or android-rc-<16-hex>) and compares future bundles against a store-binary baseline before allowing ota-ns pack to sign a release.
The five fingerprinted sections
| Section | What is hashed | Catches |
|---|---|---|
runtime | @nativescript/ios or @nativescript/android version, @nativescript/core version, @getcortexlabs/ota-nativescript version + all native bootstrapper files, nativescript.config.*, plus Android android:v8Snapshot, android:v8CodeCache and android:v8Flags | Runtime upgrades, OTA native bootstrapper changes, V8 heap snapshot / codeCache / v8Flags / markingMode config changes |
nativePlugins | Resolved native plugins (platforms/android/dependencies.json + package.json native plugin scan) and every file under each plugin's platforms/<platform>/ | Adding, removing or upgrading plugins with Swift, ObjC, Java, Kotlin, Podfile or Gradle changes |
nativeConfigAndResources | Normalized App_Resources/iOS/ or App_Resources/Android/ | New permissions (NSCameraUsageDescription, AndroidManifest.xml), entitlements, ProGuard rules, minSdk/deployment target changes |
generatedMetadata | iOS Release*/metadata-*.bin + whitelist.mdg/blacklist.mdg + plugins-release.xcconfig; Android assets/metadata/*.dat | Changes in the native API surface exposed to JS |
staticBindings | Normalized Android build-tools/sbg-bindings.txt + tns-java-classes.js + JS-to-native class/protocol registration markers (ObjCProtocols, ObjCExposedMethods, @JavaProxy, .extend) | New JS subclasses of native classes/protocols absent from compiled native bindings |
Normalization prevents false positives
Hashing raw build files would trigger spurious drift on every JS edit or version bump. ota-ns fingerprint normalizes volatile fields automatically:
- iOS
Info.plist: normalizesCFBundleVersion,CFBundleShortVersionString,CortexOtaConfigBase64andCortexOtaRuntimeContractwhile preserving permissions, URL schemes and ATS rules. - Android
app.gradle: normalizesversionCodeandversionNamewhile preservingminSdkVersion,minifyEnabled, ProGuard files and Gradle dependencies. - Android
sbg-bindings.txt: parses NativeScript 9.1's 9-field*-delimited format, stripping volatile bundle filenames and line/column offsets while preserving the exact canonical set ofbaseClass | javaProxyOrExtendName | sortedMethods | sortedInterfaces.
CI drift gating
Record one baseline JSON artifact per store binary build:
sh
npx ota-ns fingerprint --platform ios --project . --write-baseline ./ota.baseline.ios.json
npx ota-ns fingerprint --platform android --project . --write-baseline ./ota.baseline.android.jsonCompare in CI on every OTA release branch:
sh
npx ota-ns fingerprint --platform ios --project . --baseline ./ota.baseline.ios.json- Exit code
0: compatible (runtimeContractmatches baseline). - Exit code
2: native drift detected — prints the exact section diff ([runtime],[nativePlugins],[nativeConfigAndResources],[generatedMetadata],[staticBindings]) showing what requires a new store binary. ota-ns pack --baseline <path>enforces this check automatically and refuses to pack on drift unless--allow-driftis explicitly passed.
