Skip to content

feat(web): "Restart without saving" button on the config page - #165

Merged
angeloINTJ merged 1 commit into
mainfrom
feat/config-restart-without-saving
Sep 25, 2026
Merged

angeloINTJ merged 1 commit into
mainfrom
feat/config-restart-without-saving

Conversation

@angeloINTJ

Copy link
Copy Markdown
Owner

What

Adds a Restart without saving button to the web config page (/config) — the
counterpart to the topbar's "Salvar e Reiniciar". It restarts the device without
writing config: the staged, uncommitted edits on the page are dropped and the
saved configuration is kept.

Why it's small

The backend already existed: POST /api/action?op=reboot reaches
LogManager::safeReboot() without a saveConfiguration(), is gated by
PERM_SYS_CONFIG, logged as SYS_REBOOT_USER, and is already on the
authorization matrix. So this only wires a button to it — no new route,
handler, or check_authz.py / AUTHORIZATION.md change
.

safeReboot()'s pre-reboot hook still flushes the open history block, so a plain
restart drops unsaved config edits but never loses a measurement.

Changes

  • WebUI.h (CFG_PAGE): a "Restart" section after Touch Calibration with
    reboot_nosave_btn (danger style) and rebootNoSave(), reusing the page's
    sensAction('reboot') helper. Same guards as commit_all: 503 while the panel
    is mid touch-calibration; a socket dropped after the 200 is treated as the
    reboot having started (same as the topbar restart).
  • data/lang/language_pt-BR.lng, language_es-ES.lng: 5 cfg_reboot_*
    keys in @WEBDICT (the check_lang_packs gate requires each key in both
    packs). They sit after the @WEBDICT marker, so they do not touch the resident
    RAM ceiling.

Flash budget

+472 B on pico_w_release (998,324 of 1,000,852). All six images build under
budget — no flash_budget.json bump.

Testing

Local gates: 6 firmware envs build under budget; 7 native suites 410/410;
lang-pack + WebUI-gen gates pass.

On hardware (rig, pico_w_test):

  • Renders in English (source fallback) and pt-BR ("Reiniciar sem salvar") after
    deploying the updated pack.
  • Click -> pt confirm -> "Reiniciando..." toast -> reboot (uptime 852,470 ->
    24,058 ms).
  • Nothing saved: log shows SYS_REBOOT_USER (code 2) in the WEB family at
    the reboot, no SEC_CONFIG_CHANGED (303); config CRC 839F3612 unchanged
    across the reboot.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Jq4auDQppGzmAx1gLKn1z3

The config page had "Salvar e Reiniciar" (commit_all: save + reboot) but no
way to restart the device WITHOUT writing config — i.e. dropping the staged,
uncommitted edits. The backend already existed: POST /api/action?op=reboot
reaches LogManager::safeReboot() without a saveConfiguration(), gated by
PERM_SYS_CONFIG, logged as SYS_REBOOT_USER, and already on the authorization
matrix. This wires a button to it — no new route, handler, or authz change.

safeReboot()'s pre-reboot hook still flushes the open history block, so a plain
restart discards unsaved config edits but never costs a measurement.

- WebUI.h (CFG_PAGE): a "Restart" section after Touch Calibration with the
  reboot_nosave_btn (danger style) and rebootNoSave(), reusing the page's
  sensAction('reboot') helper. Same guards as commit_all: 503 while the panel
  is mid touch-calibration; a socket dropped after the 200 is treated as the
  reboot having started, same as the topbar restart.
- data/lang/{pt-BR,es-ES}.lng: 5 cfg_reboot_* keys in @webdict (the
  check_lang_packs gate requires each key in both packs). They sit after the
  @webdict marker, so they do not touch the resident RAM ceiling.

Flash: +472 B on pico_w_release (998,324 of 1,000,852 budget); all six images
build under budget, no flash_budget.json bump needed.

Verified on hardware (rig, pico_w_test): the button renders in English (source
fallback) and pt-BR ("Reiniciar sem salvar") after deploying the pack; click ->
pt confirm -> "Reiniciando..." toast -> reboot (uptime 852,470 -> 24,058 ms).
Log proves nothing was saved: SYS_REBOOT_USER (code 2) in the WEB family at the
reboot, no SEC_CONFIG_CHANGED (303), config CRC 839F3612 unchanged across it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jq4auDQppGzmAx1gLKn1z3
@github-actions github-actions Bot added i18n Internationalization and translations code Firmware source changes (src/, WebUI.h) labels Sep 24, 2026
@angeloINTJ

Copy link
Copy Markdown
Owner Author

Hardware test — together with #166

Tested on the bench Pico W as one release candidate with #166 (test/rc-integration at 48d5c6a, this branch at 26adf4a), on both pico_w_test and pico_w_release. The combined results are in #166; what concerns this PR, run in Chrome headless on both images:

  • On /config, the device name was edited on the page and not saved, then Restart without saving was pressed.
  • The confirm dialog carried the Portuguese text (Reiniciar agora SEM salvar? … Alterações não salvas nesta página serão perdidas.), and accepting it showed the restarting toast.
  • The device went offline 3.3 s after the click and answered again 26.4 s after it — a real reboot; the log records SYS_REBOOT_USER (code 2) from WEB at the click.
  • After the reboot the stored name was the old one: the unsaved edit was discarded, as intended. The button label reads Reiniciar sem salvar in Portuguese.

@angeloINTJ
angeloINTJ merged commit 45b863c into main Sep 25, 2026
10 checks passed
angeloINTJ pushed a commit that referenced this pull request Sep 25, 2026
SIMUT_VERSION 2.7.2 -> 2.7.3, and everything that names the current release
catches up: CHANGELOG (en, pt-BR), the three READMEs, both user manuals, the
docs index, the landing page in its three languages, and the product manual
(chapters 1, 3, 4, 5, 9, 13, 14 and 28, appendix C), regenerated.

v2.7.3 is #165 (Restart without saving on /config) and #166 (the Ângulo
standard; the firmware version on the login page). The manuals gain both:
the Restart section in chapter 5 and the user manuals' commit section, the
version line in chapter 13 and the authentication section.

Stale since v2.7.2, fixed here:
- the READMEs' "On main, not yet released" row still listed three things
  v2.7.2 shipped; it is gone, and the alpha LCD bullet that carried the same
  label is named for what it does;
- tools/build_manual.py had VERSION typed as "v2.7.1", so the product
  manual's cover and <meta> said v2.7.1 through the whole v2.7.2 release. It
  now reads SIMUT_VERSION from src/SystemDefs_Limits.h, as build_webui_gz.py
  already does;
- the pt-BR and es-ES READMEs counted 61 HTTP routes; check_authz.py counts
  62, as the English one says. All three said 408 host test cases; CI run
  36115353101 on main ran 410 (185+63+33+45+39+16+29).

Flash, all six built locally at this commit: used 998,220 release,
1,003,764 test, 1,011,388 test_https, 1,000,396 asserts, 963,476 alpha,
1,003,328 air. flash_budget.json 'measured' moves to these (#165 had not
moved it); budgets unchanged. Against the published v2.7.2 .bin: release
+168 B, alpha and air the same size to the byte. The images carry the new
version (WebUI_GZ.h stamp ver=2.7.3).

Gates run locally: scan_secrets, gen_logcodes --check, check_authz,
check_license, check_angulo, check_fsguard, check_air_consistency,
test_h5_day_merge; the product manual builds with 1,724 internal links and
none broken. Not flashed at this commit: the version bump is one digit, and
the published .uf2 is flashed on the bench after the release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jq4auDQppGzmAx1gLKn1z3
@angeloINTJ angeloINTJ mentioned this pull request Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code Firmware source changes (src/, WebUI.h) i18n Internationalization and translations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant