feat(os): surface reset boot_mode via smp 4.1.0#113
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
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
smpminimum version from>=4.0.2to>=4.1.0(including thedocdependency group) and relockuv.locktosmp 4.1.0. - Add request-parity tests asserting
ResetWrite(boot_mode=...)serializes identically tosmp’sResetWriteRequest, 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.
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
Resolves #112 — expose the MCUmgr
boot_modefield on smpclient's OSresetso 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_modefield toResetWriteRequest. Sincesmpclient.requests.os_management.ResetWritesubclassessmpos.ResetWriteRequest, the field is surfaced automatically — no wrapper changes needed.Changes
smpfloor>=4.0.2→>=4.1.0(and thedocgroup>=4.0.0→>=4.1.0for consistency); relocksmpto 4.1.0.tests/test_requests.pyconfirmingResetWrite(boot_mode=...)serializes identically tosmp'sResetWriteRequest, for both theBootMode.BOOTLOADERenum and a combinedforce=1, boot_mode=1(int) request.Usage
Consumers import
BootModefromsmp.os_managementdirectly, matching the existing convention (smpclient does not re-export smp enums).Verification
ruff format,ruff check,pydoclint, andmypyall clean; full test suite passes (os_management.pyat 100% coverage).Dependency chain
boot_modeon resetos reset --boot-mode🤖 Generated with Claude Code