Skip to content

Crash-safe apply: journal + recovery, no copy of big folders, progress on the web page - #48

Draft
sd88me wants to merge 3 commits into
mainfrom
robust/journal-progress
Draft

sd88me wants to merge 3 commits into
mainfrom
robust/journal-progress

Conversation

@sd88me

@sd88me sd88me commented Nov 21, 2026

Copy link
Copy Markdown
Member

Roadmap items 1 to 3 (crash-safe apply, instant safety copy, progress while MPC is stopped). Draft: offline only, needs a device run before merge.

What changes

  • Journal and recovery. apply.sh records each step it begins and ends in <base>/.openmpcpm-journal (on the settings drive, so it survives a power cut). The new src/recover.sh finishes or undoes a step that was cut off. A folder in place is kept; a missing one is put back from the safety copy, the installer's .<folder>.old or the failed folder; leftovers are removed; a cut-off theme swap is put back. The Manager runs it at start and apply.sh runs it first. It does nothing while the apply.sh that wrote the journal is still running (the background server refreshes during an apply). The user sees "The last update did not finish. : ..." once.
  • No copy of big folders. A folder over 48 MB is no longer copied when its installer stages and swaps (every install.sh since 2026-09-29) or for a removal. This removes the multi-minute copy from Self-update 1.3.5 to 1.3.6 left the Manager unlisted: plugin.json rewritten to a binary that isn't in the folder #46. Trade-off: if such an install fails after the installer's swap (a settings edit), the new files stay and MPC.settings is put back, instead of the old version returning. Small folders keep the full RAM copy; older installers keep the copy beside the folder.
  • Progress. apply.sh writes /tmp/openmpc-pm/progress; /api/state reports it as apply and the web page shows "Installing X 1.2 (step 2 of 5). Don't switch the MPC off…". Not yet on the MPC's own screen: that needs a device, since a display grab still held when MPC starts crash-loops it.

Checks

  • Full tests/run.sh: every section OK. New: a real cut-off apply (installer killed mid-stage, next start recovers), recover.sh on six crash states, the web state during an apply.
  • Device: self-update of the Manager on a Live III and a Force; pull the power during an update and check the next start.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CpoP2r5JUpLdH8zRMecf2A

sd88me and others added 3 commits November 21, 2026 11:54
…s on the web page

Roadmap items 1-3 (offline only, not yet on a device):
- apply.sh keeps a journal on the settings drive (pid, begin/end per step). src/recover.sh finishes or undoes a step
  that was cut off (power cut, switch-off): a folder in place is kept, a missing one is put back from the safety copy,
  the installer's .<folder>.old or the failed folder; leftovers go; a cut-off skin swap is put back. Run by the Manager
  at start and by apply.sh first; does nothing while the apply.sh that wrote the journal still runs. Shown once as
  "The last update did not finish".
- A folder over 48 MB is no longer copied when its installer stages and swaps (STAGE=, every install.sh since
  2026-09-29) or it is a removal: the old folder stays in place until the installer's own swap. A failure after the
  swap keeps the files in place and puts MPC.settings back. Older installers still get the copy.
- apply.sh writes /tmp/openmpc-pm/progress; /api/state carries it as "apply" while a journal exists and the web page
  shows the step (MPC's screen is dark). The on-screen version waits for a device.
- Tests: a real cut-off apply (installer killed mid-stage, next start recovers), recover.sh on six crash states, the
  web state during an apply; fixture "Slowy"; the "one" driver looks through more pages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CpoP2r5JUpLdH8zRMecf2A
src/splash.c draws apply.sh's progress file (step, of, act, id, version) on
/dev/dri/card0: takes DRM master or gives up at once, sets the connected
panel's mode with one dumb buffer and redraws at 8 fps (the current step
pulses). It lets go of the display on SIGTERM, when its parent dies, when
the progress file goes away and after an hour, so MPC always finds the
display free. Portrait panels are drawn rotated 90 degrees with
force-shadow's transform; PM_SPLASH_ROT overrides.

--ppm renders one frame offline. tests/run.sh "splash" checks frames for
every act, the rotation, the ioctl numbers against the kernel's values and
the no-display exit. vst/build_splash.sh builds static aarch64/armv7
binaries; vst/gen_splash_font.py bakes DejaVu Sans Bold.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CpoP2r5JUpLdH8zRMecf2A
…oads

On Gen2 MPC OS 3.x az0x-splash owns the display whenever MPC does not, and
az0x-splashctl show-image shows a 1280x800 PNG (its own Update Mode screen
works the same way). The update screen now writes each frame as a PNG and
shows it with --drop, so the splash lets go of the display at once and MPC
can start at any time; with the default --keep MPC fails to start until
drop-display. Tried on a Live III: frames, the pulse (~80 ms a frame) and
MPC starting straight after --drop frames. Elsewhere it still draws on
the display itself.

It exits as soon as MPC runs (an older installer may start it). apply.sh
copies it to /tmp/openmpc-pm with the plugins' names, starts it once MPC
is stopped (again after an installer restarted MPC), and stops it plus
drop-display before starting MPC. It ships in bgserver/ and
bgserver-gen1/, so the release workflow is unchanged.

Tests: PNG frames always with --drop, no frame while MPC runs, stop once
MPC appears, a failing splashctl gives up; apply.sh runs the screen only
between stopping and starting MPC.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CpoP2r5JUpLdH8zRMecf2A
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