Skip to content

Add emulator reboot button and install-failure reboot prompt#53

Merged
ericmigi merged 16 commits into
coredevices:mainfrom
jmsunseri:reboot-emulator
May 24, 2026
Merged

Add emulator reboot button and install-failure reboot prompt#53
ericmigi merged 16 commits into
coredevices:mainfrom
jmsunseri:reboot-emulator

Conversation

@jmsunseri
Copy link
Copy Markdown
Contributor

@jmsunseri jmsunseri commented May 9, 2026

Summary

  • Adds a "Reboot" button to the emulator config popover that disconnects and re-launches the emulator, then re-installs the last build.
  • Adds a reboot prompt modal that appears on emulator-specific install failures (e.g. app rejection due to emulator state), offering "Reboot & Retry" to disconnect → reconnect → re-install.
  • Implements SharedPebble.reboot() (disconnect + getPebble with saved connection type) — reuses the existing launch/connect flow with no new backend endpoint.
  • Includes tests for the launch and kill endpoints exercised by the reboot flow.
  • Includes code coverage reports being added to pull requests

I was unable to reproduce the issue where the install would fail locally. The reboot was only tested via the button in the emulator config window.

Files changed

File Change
cloudpebble/ide/static/ide/js/pebble.js Added SharedPebble.reboot() — disconnect + getPebble
cloudpebble/ide/static/ide/js/emulator.js Added "Reboot" button to popover, doReboot handler
cloudpebble/ide/static/ide/js/compile.js Added show_reboot_prompt() + catch handler on install failures
cloudpebble/ide/static/ide/js/qemu.js Null-safe mToken.substr() guard
cloudpebble/ide/templates/ide/run.html Added #emulator-reboot-prompt modal HTML
cloudpebble/ide/tests/test_emulator_reboot.py Tests for launch endpoint used by reboot flow
cloudpebble-qemu-controller/test_controller.py Tests for kill and launch endpoints

jmsunseri added 6 commits May 9, 2026 13:20
Frontend:
- SharedPebble.reboot(): disconnect(true) then getPebble(kind) — reuses
  existing launch/connect flow instead of a dedicated reboot endpoint
- QEmu: removed reboot() method (not needed with simplified flow)
- Emulator config popover: added yellow 'Reboot' button next to 'Shut down'
  with margin-top to form a second row
- Install failure modal: new #emulator-reboot-prompt with 'Reboot & Retry'
  button that reboots emulator and re-installs the app
- pebble.js: reboot saves connection type, disconnects, then reconnects

Backend:
- Removed /qemu/<uuid>/reboot endpoint from controller (no longer needed)
- Removed reboot_emulator Django view and URL route (no longer needed)

Tests:
- test_emulator_reboot.py: tests for the launch endpoint used by reboot flow
- test_controller.py: tests for kill and launch endpoints
libsdl2-dev libpixman-1-dev libglib2.0-dev \
libpcre2-dev libffi-dev zlib1g-dev \
nettle-dev \
libpng-dev nettle-dev \
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Container build was failing for some reason and I'm unsure why.... Maybe something isn't pinned to a specific version and it got updated and the new version has a new requirement?

@jmsunseri
Copy link
Copy Markdown
Contributor Author

jmsunseri commented May 9, 2026

Just noticed there were no JS unit tests so i added vitest and then added that to the pipeline. I also added code coverage stats.

@jmsunseri jmsunseri marked this pull request as draft May 9, 2026 14:01
jmsunseri added 7 commits May 10, 2026 12:35
- Extract CompileReboot into its own compile-reboot.js module
- Refactor showRebootPrompt to accept a rebootModal parameter (DI)
- Pass $('#emulator-reboot-prompt') from compile.js call site
- Rewrite tests to load compile-reboot.js via vm.runInNewContext
- Remove pebble.test.js (tested copies, not real code)
- Add script tags for compile-reboot.js in run.html and project.html
- Convert compile-reboot.js to ES module exports for testability
- Guard global CloudPebble assignment for browser compatibility
- Add type=module to script tags in run.html and project.html
- Rewrite tests to use direct ES imports instead of vm.runInNewContext
- Add @vitest/coverage-v8 with cobertura reporter for CI
- Add irongut/CodeCoverageSummary and sticky-pull-request-comment
  actions for PR coverage comments and job summaries
- Coverage: 71% statements, 100% functions, 87.5% branches on compile-reboot.js
- Add coverage==7.8.0 to requirements.txt
- Add .coveragerc configured for Docker container paths
- Run Django tests with 'coverage run manage.py test'
- Generate cobertura XML and post coverage summary to PR comments
  and job summary using irongut/CodeCoverageSummary
@jmsunseri
Copy link
Copy Markdown
Contributor Author

jmsunseri commented May 11, 2026

The reason for the failing tests is because the coverage report github action doesn't have permission to add comments to this github repo for security purposes. This will look like this once merged

image

I opened a different PR from the same reboot-emulator branch into the main branch in my repo and you can see how all the tests pass and the code coverage is reported

jmsunseri#2

@jmsunseri jmsunseri marked this pull request as ready for review May 11, 2026 00:36
@ericmigi ericmigi requested a review from jplexer May 11, 2026 02:59
@jplexer
Copy link
Copy Markdown
Member

jplexer commented May 12, 2026

@jmsunseri in general this looks good to me but could you clean up the commits a bit? there are commits adding then reverting something right next to eachother i.e. :)

@jmsunseri
Copy link
Copy Markdown
Contributor Author

jmsunseri commented May 12, 2026 via email

@jplexer
Copy link
Copy Markdown
Member

jplexer commented May 12, 2026

usually we do merge commits or rebase and merge

@jmsunseri
Copy link
Copy Markdown
Contributor Author

usually we do merge commits or rebase and merge

I think that's my point this ends up being a merge commit. Because i was working on a branch in my own forked repo this will all merge as one commit in your repo. See how in my other pull request #46 it's two commits in my branch but only one in the core devices repo.

…to project.html

- Bind SharedPebble.reboot to SharedPebble when passing as callback
  to showRebootPrompt, preventing TypeError on this.disconnect
- Add #emulator-reboot-prompt modal to project.html (was only in
  run.html), so install errors show the reboot prompt instead of
  silently swallowing the error
@jmsunseri
Copy link
Copy Markdown
Contributor Author

@jplexer I asked for a review from Devin and it found a pair of potential bugs. I have pushed a couple updates but I need to test more.

@jmsunseri
Copy link
Copy Markdown
Contributor Author

It seems like the fixes were for a code path i haven't been able to test manually because i was unable to force an install failure locally.

@jmsunseri
Copy link
Copy Markdown
Contributor Author

@ericmigi can we get this merged?

@ericmigi
Copy link
Copy Markdown
Contributor

test failing - is the test broken?

@jmsunseri
Copy link
Copy Markdown
Contributor Author

test failing - is the test broken?

The reason for the failing tests is because the coverage report github action doesn't have permission to add comments to this github repo for security purposes. This will look like this once merged

see above #53 (comment)

@ericmigi ericmigi merged commit 60416ae into coredevices:main May 24, 2026
0 of 2 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.

3 participants