Add manifest-driven automatic firmware updates#47
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/core/AutoUpdateModule.h`:
- Line 7: Remove the direct platform/platform.h dependency from AutoUpdateModule
and replace its platform-specific usage with an injected platform-neutral
OTA/HTTP interface. Define or consume the interface in core, provide its
implementation within src/platform/, and wire the runtime layer to inject it
without adding platform includes under src/core/**.
- Around line 150-152: The OTA validation in AutoUpdateModule must reject c.size
== 0 before invoking the checked OTA API, while preserving the existing
oversized-image rejection. In test/unit/core/unit_AutoUpdateModule.cpp, add
manifest cases for an omitted size and an explicit zero size, asserting both are
rejected.
- Around line 183-185: Update AutoUpdateModule::validateUrl to accept only
https:// URLs, while preserving null or empty values as the disabled-checks
case. Also validate the baked-in default manifest URL before any fetch so all
configured and default manifest requests require HTTPS.
- Line 95: Update the OTA lifecycle guard around otaInFlight() to use a separate
atomic or mutex-protected in-flight flag rather than reading g_otaStatus. Set
and clear this flag across the OTA task lifecycle, while keeping g_otaStatus
limited to display/status reporting.
In `@test/unit/core/unit_AutoUpdateModule.cpp`:
- Around line 15-74: Add a test alongside the existing AutoUpdateModule
selection tests for an otherwise valid newer OTA manifest whose installable
object omits size. Assert that selectCandidate returns the appropriate rejection
decision and does not request installation, covering both the standard ota
fixture and the documented size-required behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: d32e49ed-2be2-42dd-a3b1-8f945e148127
⛔ Files ignored due to path filters (3)
moondeck/build/build_esp32.pyis excluded by!**/build/**moondeck/build/generate_build_info.pyis excluded by!**/build/**moondeck/build/generate_manifest.pyis excluded by!**/build/**
📒 Files selected for processing (12)
docs/moonmodules/core/services.mdesp32/main/CMakeLists.txtsrc/core/AutoUpdateModule.hsrc/core/FirmwareUpdateModule.hsrc/main.cppsrc/platform/desktop/platform_desktop.cppsrc/platform/esp32/platform_esp32.cppsrc/platform/esp32/platform_esp32_ota.cppsrc/platform/platform.htest/CMakeLists.txttest/unit/core/unit_AutoUpdateModule.cpptest/unit/core/unit_FirmwareUpdateModule.cpp
Moves shared OTA state into a core-neutral header, injects the auto-update runtime from main, gates all OTA triggers with a real atomic in-flight flag, and rejects HTTP or size-less manifest candidates. Checks: check_specs.py; git diff --check; build_esp32.py --firmware esp32s3-n16r8 (projectMM.bin 0x180dd0, total image 1576280 bytes).
60866fe to
f593a69
Compare
|
Rebased onto current main and updated AutoUpdateModule to the current defineControls/onControlChanged/tick1s lifecycle. The review findings are covered by the injected platform runtime, atomic OTA gate, HTTPS-only manifest validation, mandatory non-zero image sizes, and missing/zero-size tests. Validation: spec check and platform-boundary check passed; desktop production target and focused AutoUpdate test source built; 55 Python host tests passed; esp32s3-n8r8 firmware built (0x182e40, 50% app partition free). The complete desktop test executable is still blocked by the unrelated existing unused 'place' helper in unit_moonlive_ir.cpp under Zig/Werror. |
Summary
Validation
git diff --check origin/main..HEADmoondeck/check/check_specs.pymoondeck/check/check_platform_boundary.pymoondeck/build/build_esp32.py --firmware esp32s3-n16r8esp32s3-n16r8image:0x180c50, 62% app partition freeNot Run
Summary by CodeRabbit
New Features
Bug Fixes
Tests