Repository navigation
Auto-update installed themes and plugins at startup - #689
Conversation
UpdateAvailable now requires the directory release to be compatible with the running goblog, so the admin page stops offering updates Update() would refuse with ErrIncompatible. Both installers gain AutoUpdate(ctx), which applies every compatible update and logs each result. goblog runs it once at startup in the background: themes by default (auto_update_themes), plugins only when auto_update_plugins is turned on. Closes #641 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
🔵 Needs a closer look
It changes startup to auto-apply updates (including executing downloaded plugin code) and enables theme auto-update by default for all existing installs, a broad operational blast radius that warrants final human review.
No open issues 🎉
What changed in this PR
This PR implements auto-updating of installed directory themes and plugins at startup, closing #641 (which arose from the #640 upgrade trap where an outdated theme could lock an admin out after a goblog upgrade). It builds on the existing Update(ctx, name) machinery in both installers, adding a compatibility gate so only runnable updates are offered/attempted, a non-blocking background runner, and user-facing settings to control the behavior.
Changes:
- Makes
UpdateAvailablein both the theme and plugin installers also requireCompatible(running, min_goblog_version), so the admin UI no longer offers updatesUpdate()would refuse withErrIncompatible. - Adds
AutoUpdate(ctx)to both installers (per-item, failure-isolated, logged) and a startup hook ingoblog.gothat runs it in a background goroutine with a 10-minute timeout. - Adds
auto_update_themes(default on) andauto_update_plugins(default off) settings, surfaced on the Directories settings tab and documented in the README, with tests covering compatible/incompatible/parse-failure cases.
| File | Description |
|---|---|
theme/installer/installer.go |
Adds compatibility check to UpdateAvailable; adds AutoUpdate that updates compatible themes and logs/skips failures. |
theme/installer/installer_test.go |
Adds TestAutoUpdate covering compatible apply, incompatible skip, and parse-failure rollback. |
plugin/installer/installer.go |
Adds compatibility check to UpdateAvailable; adds AutoUpdate gated on WasmEnabled with rollback-on-failure semantics. |
plugin/installer/installer_test.go |
Adds TestAutoUpdate verifying incompatible updates are not offered/applied and a compatible one updates the registry. |
goblog.go |
Adds background goroutine (10-min timeout) invoking theme/plugin AutoUpdate based on the new settings; adds context/time imports. |
admin/settings.go |
Adds the two auto-update settings to the Directories group with help text. |
admin/settings_test.go |
Updates expected seeded settings to include the two new checkbox settings. |
tools/migrate.go |
Seeds auto_update_themes=true and auto_update_plugins=false default settings. |
README.md |
Documents the startup auto-update behavior and how to disable it. |
Review effort: Balanced
Closes #641.
What
UpdateAvailablein both installers now also requiresCompatible(running, min_goblog_version). The admin page no longer offers updates thatUpdate()would refuse.AutoUpdate(ctx)on the theme and plugin installers: for each installed item with a compatible update, callUpdate, log the result. A failure leaves that item as it was and doesn't stop the others.goblog.go: runs in a goroutine (10 min timeout), so an unreachable directory can't block or wedge startup.auto_update_themes(default on),auto_update_plugins(default off).Decisions from the issue
Updatealready rolls back.Theme auto-update: Updated X to vY, or the failure and the version kept). I left out the note on the admin page; it would need state persisted across restarts.Test plan
go test ./...TestAutoUpdateintheme/installerandplugin/installer🤖 Generated with Claude Code