Skip to content

feat(os): surface reset boot_mode via smp 4.1.0#113

Merged
JPHutchins merged 1 commit into
mainfrom
feature/112-os-reset-boot-mode
Jun 3, 2026
Merged

feat(os): surface reset boot_mode via smp 4.1.0#113
JPHutchins merged 1 commit into
mainfrom
feature/112-os-reset-boot-mode

Conversation

@JPHutchins
Copy link
Copy Markdown
Collaborator

Summary

Resolves #112 — expose the MCUmgr boot_mode field on smpclient's OS reset so a client can request a reboot into the bootloader (MCUboot serial recovery), not just a normal reboot.

The resolution is essentially "bump the lock" as noted on the issue: smp 4.1.0 (JPHutchins/smp#58) adds the optional boot_mode field to ResetWriteRequest. Since smpclient.requests.os_management.ResetWrite subclasses smpos.ResetWriteRequest, the field is surfaced automatically — no wrapper changes needed.

Changes

  • Bump smp floor >=4.0.2>=4.1.0 (and the doc group >=4.0.0>=4.1.0 for consistency); relock smp to 4.1.0.
  • Add parity test cases to tests/test_requests.py confirming ResetWrite(boot_mode=...) serializes identically to smp's ResetWriteRequest, for both the BootMode.BOOTLOADER enum and a combined force=1, boot_mode=1 (int) request.

Usage

from smp.os_management import BootMode
from smpclient.requests.os_management import ResetWrite

await client.request(ResetWrite(boot_mode=BootMode.BOOTLOADER))  # reboot into serial recovery

Consumers import BootMode from smp.os_management directly, matching the existing convention (smpclient does not re-export smp enums).

Verification

ruff format, ruff check, pydoclint, and mypy all clean; full test suite passes (os_management.py at 100% coverage).

Dependency chain

🤖 Generated with Claude Code

Bump the `smp` dependency floor to 4.1.0, which adds the optional
`boot_mode` field to `ResetWriteRequest`. Since `os_management.ResetWrite`
subclasses it, the field is surfaced automatically; a client can now request
a reboot into the bootloader (MCUboot serial recovery) with
`ResetWrite(boot_mode=BootMode.BOOTLOADER)`, not just a normal reboot.

Add parity test cases (enum and force+int) confirming `ResetWrite` serializes
identically to `smp`'s `ResetWriteRequest` with `boot_mode` set.

Closes #112

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 3, 2026 04:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates smpclient to depend on smp>=4.1.0 so that the upstream ResetWriteRequest.boot_mode field (added in smp 4.1.0) is automatically surfaced on smpclient’s ResetWrite request, enabling reboot-to-bootloader / serial recovery via OS reset.

Changes:

  • Bump smp minimum version from >=4.0.2 to >=4.1.0 (including the doc dependency group) and relock uv.lock to smp 4.1.0.
  • Add request-parity tests asserting ResetWrite(boot_mode=...) serializes identically to smp’s ResetWriteRequest, including enum and integer forms.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
uv.lock Relocks dependencies to smp==4.1.0 and updates the recorded version constraints.
pyproject.toml Raises the smp floor to >=4.1.0 in runtime deps and in the doc dependency group.
tests/test_requests.py Adds parity cases covering boot_mode serialization for OS reset requests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JPHutchins JPHutchins merged commit 4157a04 into main Jun 3, 2026
29 checks passed
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.

OSManagement reset: expose boot_mode (reboot to bootloader / serial recovery)

2 participants