Skip to content
THE OTA MANUALCLI & compatibility

Fault-injection fixture server ​

ota-ns serve runs a local server implementing the full @getcortexlabs/ota-protocol HTTP contract with nine built-in response and fault modes so you can test every client failure path without deploying a backend.

Usage ​

sh
ota-ns serve \
  --bundle ./dist-ota/ota-105 \
  --private-key ~/.ota-keys/dev.private.pem \
  --key-id dev \
  --host 127.0.0.1 \
  --port 18787 \
  --mode update \
  --directive-seq 1

Pass --tls-cert <cert.pem> --tls-key <key.pem> to serve over HTTPS (TLS) when testing with allowInsecureHttp: false.

Exposed endpoints ​

EndpointBehavior
GET /healthReturns { ok: true, mode, directiveSeq, releaseId }.
POST /checkValidates UpdateCheckRequest and returns a signed UpdateCheckResponse according to --mode.
GET /manifest.jsonServes the packed SignedManifest (or a corrupted signature in bad-manifest-sig mode).
GET /files/<path>Streams exact bundle bytes with path-traversal protection (400 on unsafe paths).
POST /eventsAccepts OtaLifecycleEvent JSON payloads, logs them, and returns 204.

All 9 server modes ​

ModeBehaviorExpected SDK result
updateSigns and serves an update directive pointing at --bundleDownloads, verifies and stages release (status: "staged")
noneReturns { protocolVersion: 1, status: "none" }No-op (status: "none")
rollback-embeddedSigns a rollback_to_embedded directive with --directive-seqStages clean rollback to embedded bundle (status: "rollback_staged")
bad-directive-sigFlips bytes in the directive's Ed25519 signatureRejects before download with OtaError(SIGNATURE_INVALID)
bad-manifest-sigServes valid directive, flips bytes in manifest.json signatureRejects before file download with OtaError(SIGNATURE_INVALID)
tampered-fileFlips the first byte of the bundle entry file during downloadRejects on streaming SHA-256 with OtaError(HASH_MISMATCH)
wrong-contractSigns directive with <runtimeContract>-mismatchRejects before download with OtaError(RUNTIME_CONTRACT_MISMATCH)
wrong-buildSigns directive with <targetBuild>-mismatchRejects before download with OtaError(TARGET_BUILD_MISMATCH)
drop-mid-downloadWrites half of the entry file and forcefully destroys the TCP socketRejects with OtaError(DOWNLOAD_FAILED), leaves active bundle intact