codexctl icon indicating copy to clipboard operation
codexctl copied to clipboard

feat: Support for 3.22 & 3.23, Paper Pro Move, Paper Pro restores, swu extraction.

Open rmitchellscott opened this issue 1 month ago • 3 comments

This PR adds comprehensive support for Paper Pro / Paper Pro Move devices and software versions 3.22-3.23, including enhanced extraction and restore capabilities.

Key Changes:

  • Add support for Paper Pro Move devices
  • Add 3.22 and 3.23 software versions
  • Implement SWU file extraction support for newer software formats
  • Add "Backup version" (version installed to inactive partition) to status command
  • Enable restore functionality for Paper Pro (Move) devices, including handling the 3.20/3.22 partition schema change
  • Add support for downgrades to 3.20 and below using bootloader updates on Paper Pro
  • Integrate additional external software provider for software downloads

I have tested:

  • Paper Pro, 3.20 -> 3.23 (install and restore)
  • Paper Pro, 3.23 -> 3.20 (install and restore)
  • Paper Pro, 3.22 -> 3.23 (install and restore)
  • Paper Pro Move, 3.21 -> 3.23 (install and restore)
  • Paper Pro Move, 3.23 -> 3.21 (restore)
  • reMarkable 2, 3.22 -> 3.23 (install and restore)
  • reMarkable 2, 3.23 -> 3.22 (install and restore)
  • reMarkable 1, 3.22 -> 3.23 (install and restore)
  • reMarkable 1, 3.23 -> 3.22 (install and restore)

Summary by CodeRabbit

  • New Features

    • Support for Paper Pro Move in status/list outputs and restore workflows
    • Automatic bootloader handling during Paper Pro downgrades; metadata-driven version detection and SWU inspection/extraction
    • Multi-provider download fallback for update files
  • Bug Fixes

    • Improved error messages and safer command dispatch reporting
    • Status now reports Backup version and uses it when restoring
  • Documentation

    • Added Paper Pro bootloader update guidance and Move examples
  • Tests

    • Added bootloader boundary detection tests
  • Chores

    • Minor test/makefile and dependency metadata updates

✏️ Tip: You can customize this high-level summary in your review settings.

rmitchellscott avatar Nov 23 '25 07:11 rmitchellscott

Walkthrough

Adds ReMarkable Paper Pro Move (RMPPM) support, SWU inspection/extraction, multi-provider update downloads, bootloader-aware install/downgrade handling (Paper Pro), expanded device status/restore reporting, and related manifest, test, dependency, and documentation updates.

Changes

Cohort / File(s) Summary
Hardware & device management
codexctl/device.py
Adds HardwareType.RMPPM; new helpers for reading partition versions and Paper Pro partition info; get_device_status returns backup version; adds Paper Pro bootloader update path (_update_paper_pro_bootloader); restore_previous_version refactored for RMPP/RMPPM and MMC bootpart paths; install_sw_update accepts optional bootloader_files.
SWU analysis & extraction
codexctl/analysis.py
Adds get_swu_metadata(swu_file) to parse sw-description (version, hardware) and extract_swu_files(swu_file, output_dir=None, filter_files=None) to extract CPIO/SWU contents to disk or memory with filtering and error handling.
Update manager & downloads
codexctl/updates.py
Adds remarkableppm_versions and external_provider_urls; get_remarkable_versions signature/return updated; handles HardwareType.RMPPM in selection; download_version iterates providers and returns first successful download; adds is_bootloader_boundary_downgrade utility; logging tweaks for downloads.
CLI / command flow
codexctl/__init__.py
Detects SWU via 6-byte magic and routes to SWU extraction or existing signed-image flow; uses SWU metadata to infer target version/hardware with fallback prompts; detects bootloader-boundary downgrades and coordinates bootloader extraction/installation; wraps main command in SystemError catch for friendly message.
Version manifest
data/version-ids.json
Adds/updates entries for remarkable1, remarkable2, remarkablepp, introduces new remarkableppm section, renames external-provider-urlexternal-provider-urls, updates last-updated and provider URLs.
Dependencies
requirements.txt
Removes platform exclusion for remarkable-update-image (now unconditional); remarkable-update-fuse remains conditional on linux.
Tests
tests/test.py
Updates expected latest versions (RM1/RM2 → 3.23.0.64); adds tests for UpdateManager.is_bootloader_boundary_downgrade covering multiple scenarios.
Docs & build
README.md, Makefile
Adds Paper Pro bootloader-update docs and examples, SWU extraction example; changes test echo message to plural.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI as codexctl/__init__.py
    participant Analysis as codexctl/analysis.py
    participant Updates as codexctl/updates.py
    participant Device as codexctl/device.py

    User->>CLI: run install/downgrade with file or version
    CLI->>CLI: check 6-byte magic on input
    alt SWU detected
        CLI->>Analysis: get_swu_metadata(swu_file)
        Analysis-->>CLI: (version, hardware)
    else Signed image / remote
        CLI->>Updates: get_latest_version/download_version
        Updates-->>CLI: version_file
    end

    CLI->>Device: get_device_status()
    Device-->>CLI: current_version, backup_version, engine info

    CLI->>Updates: is_bootloader_boundary_downgrade(current, target)
    Updates-->>CLI: boolean

    alt boundary downgrade & new engine
        CLI->>Analysis: extract_swu_files(current_swu, filter=[bootloader files])
        Analysis-->>CLI: {update-bootloader.sh, imx-boot}
        CLI->>Device: install_sw_update(version_file, bootloader_files={...})
        Device->>Device: _update_paper_pro_bootloader()
    else normal install
        CLI->>Device: install_sw_update(version_file)
    end

    Device-->>CLI: result/status
    CLI-->>User: report success/failure

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Pay attention to:
    • codexctl/device.py: partition/version detection, restore script correctness, bootloader upload/preinst/postinst flow.
    • codexctl/init.py: SWU magic detection, metadata fallback prompts, orchestration of bootloader extraction and install.
    • codexctl/analysis.py: CPIO/SWU parsing, libconf usage, resource cleanup and error cases.
    • codexctl/updates.py: multi-provider download logic and downgrade boundary detection edge cases.

Possibly related PRs

  • Jayy001/codexctl#141 — Introduced HardwareType enum and refactored callers; strongly related as this PR adds RMPPM and extends device/update flows tied to that enum.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 78.38% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main changes: support for versions 3.22 & 3.23, Paper Pro Move hardware, Paper Pro restores, and SWU extraction.
✨ Finishing touches
  • [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Nov 23 '25 07:11 coderabbitai[bot]

Could you add some automated tests for UpdateManager.is_bootloader_boundary_downgrade

I added unit tests for this.

rmitchellscott avatar Nov 23 '25 20:11 rmitchellscott

Instead of adding a brand new test job and brand new test code, could you extend the existing test code which is already integrated into the workflow.

Eeems avatar Nov 23 '25 21:11 Eeems