Add OTA failure reason reporting and extensible status details#84
Open
MathiasKoch wants to merge 4 commits intofeature/mqtt-traitfrom
Open
Add OTA failure reason reporting and extensible status details#84MathiasKoch wants to merge 4 commits intofeature/mqtt-traitfrom
MathiasKoch wants to merge 4 commits intofeature/mqtt-traitfrom
Conversation
Extend OTA status updates to include detailed failure reasons (e.g. SignatureCheckFailed, BadImageState) in job status details. Rework integration tests to self-provision OTA jobs via AWS SDK instead of relying on external shell scripts, with automatic cleanup. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
OtaError::Pal was discarding the inner OtaPalError, so the cleanup path reported Aborted(None) — losing the failure reason (e.g. SignatureCheckFailed) from job status details. Now OtaError::Pal carries the OtaPalError through to the job status update. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Progress was only refreshed for InProgress updates, so Failed status carried the stale value from the last periodic update. Now progress is also updated on Failed, giving an accurate block count at failure time. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Allow PAL implementations to provide custom key-value pairs that are included in every job status update. The PAL defines a StatusDetails associated type implementing StatusDetailsExt, which gets serialized alongside the base OTA status fields via CombinedStatusDetails. This threads the extra context through ProgressState, ControlInterface, and DataInterface as a generic parameter (defaulting to ()). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds granular failure diagnostics to OTA job status updates. When an OTA operation fails, the job status now includes a human-readable
reasonstring and numericerror_codein the status details sent to AWS IoT — enabling cloud-side root cause analysis without device log access.Introduces the
StatusDetailsExttrait, allowing PAL implementations to inject custom key-value pairs (device temperature, battery level, firmware version, etc.) into every job status update alongside the base OTA fields.Also adds self-managed integration test infrastructure that automates OTA job provisioning, S3 upload, and cloud-side assertion against AWS IoT.
Design
Failure Reason Flow
OtaPalErrorvariants map to reason strings and error codes:SignatureCheckFailed→"sig_check_failed"/1001FileWriteFailed→"file_write_failed"/1002FileCloseFailed→"file_close_failed"/1003BadImageState→"bad_image_state"/1004StatusDetailsExt
PAL implementations declare an associated type:
Custom fields are combined with base OTA fields via
CombinedStatusDetails<E>, which flattens both into a single JSON object during serialization. Default impl for()provides zero-cost opt-out.Integration Test Infrastructure (
tests/common/aws_ota.rs)describe_job_execution()asserts cloud-side status and status detailsChangelog
OtaPalErrorvariants witherror_code()andas_reason_str()methodsOtaStatusDetailsstruct withreason,error_code, andprogressfieldsStatusDetailsExttrait andCombinedStatusDetails<E>for extensible job status detailsStatusDetailsExtassociated type toOtaPaltraitOtaPalErrorthrough error handling chain instead of discarding toAborted(None)