Skip to content

Merge: Fix critical OTA bugs and add comprehensive test suite#16

Open
0x687931 wants to merge 109 commits intokevinmcaleer:mainfrom
0x687931:merge/critical-fixes-pr15
Open

Merge: Fix critical OTA bugs and add comprehensive test suite#16
0x687931 wants to merge 109 commits intokevinmcaleer:mainfrom
0x687931:merge/critical-fixes-pr15

Conversation

@0x687931
Copy link
Copy Markdown

Merge Request for PR #15

This PR merges the critical bug fixes and comprehensive test suite into main.

Summary

  • ✅ 4 critical bugs fixed
  • ✅ 2 documentation issues resolved
  • ✅ 106 new tests added (148/148 passing)
  • ✅ No breaking changes
  • ✅ Backward compatible

See PR #15 for full details: #15

Changes

Files Modified:

  • ota.py - Rollback atomicity, tree size limits, version.json timing
  • delta.py - Delta streaming with 91% memory reduction
  • README.md - Transport status clarification
  • manifest_gen.py - Fixed include list behavior

Test Files Added:

  • tests/test_rollback_atomicity.py (20 tests)
  • tests/test_tree_size_validation.py (25 tests)
  • tests/test_delta_streaming.py (37 tests)
  • tests/test_version_json_timing.py (24 tests)

Testing

All 148 tests passing:

pytest tests/ -v
============================== 148 passed in 3.55s ==============================

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

…dater-functionality

Refactor MicroPython OTA updater with release manifests and verification
…set-creation

feat: support manifestless updates using Git tree
…or-ota-client

Add dual channel OTA client with verification and rollback
…re-download

Add startup rollback checks and manifest signing
…ort-error

Add MicroPython compatibility flag and drop future annotations
…for-pico-w

Add MicroPython os.path shim and test instructions
…use-path-helper-xp43dw

Refactor path handling in OTA client
…use-path-helper

Refactor path handling in OTA client
…_client.py

Handle non-200 responses in OTA JSON fetch
…n-_get

feat: support configurable HTTP timeouts
…put-options

Clarify JSON configuration in README
…or-micropython

Handle MicroPython timeout semantics
0x687931 and others added 30 commits September 6, 2025 12:45
…le-for-updates

feat: allow forcing updates and clarify config
…nore-.git-entries

Exclude Git metadata from manifest
…ion-error

chore: add pyproject for packaging
…ease-version

Log release version when updating stable manifest
…lper-method

feat: shorten debug commit hashes
…and-usage

Centralize path filtering across OTA operations
…handling-functions

Add tests for path filtering and candidate selection
…h-validation

Add path normalization to prevent traversal in OTA paths
…/ignore-lists

Normalize OTA allow/ignore path handling
…ltering

docs: document path filtering semantics
…gging

Add info-level messaging and refine debug output
…-normalize-paths

Normalize path checks and improve OTA error handling
…cks-in-ota.py

Log filters and restrict manifest to allowed files
  The OTA updater is now version 3.0.0 with production-ready delta updates and multi-connectivity framework. All critical
  reliability improvements from the IoT expert review have been implemented, tested, and documented. The system is optimized for
   harsh remote deployments including solar-powered sensors, off-grid monitoring stations, and battery-powered IoT devices.
Resolves 4 critical bugs and 2 documentation issues identified in
comprehensive multi-agent code review. All fixes maintain backward
compatibility.

**Critical Fixes:**

1. **Rollback Atomicity** - Changed to 3-tuple (operation, target, backup)
   to properly handle new/replace/delete operations during rollback.
   Prevents corrupted device state after failed updates.

2. **Tree Size Memory Exhaustion** - Added dual validation with
   configurable limits (max_tree_size_kb, max_tree_files). Prevents
   OOM on repos with 500+ files.

3. **Delta Streaming** - Implemented _ChunkedDeltaReader with 64-byte
   buffer, reducing RAM usage by 91% (65KB → 6KB). Essential for
   RP2040's ~200KB usable RAM.

4. **Version.json Timing** - Moved _write_state() after os.sync() to
   prevent version/code mismatch during power loss.

**Documentation Fixes:**

5. **README Transport Status** - Clarified WiFi is production-ready,
   Cellular/LoRa are framework-only.

6. **Manifest Generator** - Fixed hard-coded INCLUDE list ignoring
   --include CLI flag.

**Comprehensive Test Suite:**
- Added 106 new tests across 4 test files (3,058 lines)
- All 148 tests passing (42 original + 106 new)
- Test coverage: rollback atomicity, tree limits, delta streaming,
  version timing

**Testing:** 148/148 tests passing, no breaking changes, backward
compatible.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant