Skip to content

test(firmware): gated USB flash round-trip + validated end-to-end flash (#99) - #118

Merged
millsmillsymills merged 3 commits into
phase1from
fix/99-flash-roundtrip-test-r2
Jun 10, 2026
Merged

test(firmware): gated USB flash round-trip + validated end-to-end flash (#99)#118
millsmillsymills merged 3 commits into
phase1from
fix/99-flash-roundtrip-test-r2

Conversation

@millsmillsymills

Copy link
Copy Markdown
Contributor

Addresses the remaining open items in #99 (USB firmware-flash hardening / end-to-end validation).

What's here

A gated integration+usb test, test_usb_firmware_flash_roundtrip, that drives the real flipperzero_firmware_install tool over USB: it reads the device's current flavor, flashes to the opposite flavor, asserts after_confirmed and the observed flavor, then flashes back to the starting flavor (leaving no net change). Guarded behind FLIPPER_RUN_FLASH_TEST=1 so it never runs in the ordinary integration/usb sweep — each direction reboots the device and takes ~20 min.

End-to-end validation (real hardware, Momentum mntm-012 device "Lun10n", USB)

First successful full flash — every prior attempt aborted before the reboot step.

Momentum mntm-012 -> Official 1.4.3   after_confirmed: True, target f7   (no wedge, no power-cycle)

Round-trip back to Momentum validated in the same way. The earlier storage_md5sum-returns-None-after-large-write and session-wedge failure modes from #99 were already addressed by #104/#105; this run exercised them on real hardware without a wedge.

Findings

  • The flash completes reliably but the chunked storage_write push is slow — ~19 min to push the ~2.5 MB Official bundle, and it emits no log lines mid-push (looks like a hang at 0% CPU but is I/O-bound pacing). Worth a follow-up to surface push progress and/or tune pacing.
  • SD leftover folders (/ext/update/diag, /ext/update/mcp-update) were already absent on the device — no cleanup needed.
  • Official + Momentum golden fixtures already exist under tests/golden/fixtures/{official,momentum}/ (from test(golden): dual-firmware golden fixtures (Momentum + Official) #106).

ruff + ty clean; test collects (gated-skip without the env flag).

Part of #99

🤖 Generated with Claude Code

Supersedes #115 (rebased onto phase1). Review change: the restore flash now runs in a finally, so an assertion failure on the forward flash still flashes the device back to its starting flavor.

millsmillsymills and others added 3 commits June 10, 2026 01:28
Drives the real flipperzero_firmware_install tool over USB to flash the
device to the opposite firmware flavor and back, asserting after_confirmed
and the observed flavor each direction. Restores the device to its
starting flavor so it leaves no net change. Guarded behind
FLIPPER_RUN_FLASH_TEST so it never runs in the ordinary integration/usb
sweep (each direction reboots the device and takes minutes).

Part of #99

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
End-to-end USB validation flashed Official -> Momentum successfully, but
the tool raised "device did not reconnect after the update" because the
Momentum bundle's larger resources made the on-device updater re-enumerate
just past the 300 s budget - a false negative on a flash that had applied.
The device returned to mntm-012 moments after the budget expired. Raise the
budget to 600 s so the slow apply is awaited instead of misreported.

Part of #99

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A forward-flash assertion failure previously skipped the flash back,
leaving the device on the opposite firmware despite the docstring's
no-net-change promise. Run the restore in a finally block and type the
helper return.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@millsmillsymills
millsmillsymills merged commit 9b1db3c into phase1 Jun 10, 2026
5 checks passed
@millsmillsymills
millsmillsymills deleted the fix/99-flash-roundtrip-test-r2 branch June 10, 2026 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant