Skip to content

feat(app): persist crash-loop state and guard app starts for safe mode (#122) - #317

Merged
rowkav09 merged 1 commit into
mainfrom
feat/safe-mode-wiring
Sep 23, 2026
Merged

rowkav09 merged 1 commit into
mainfrom
feat/safe-mode-wiring

Conversation

@rowkav09

Copy link
Copy Markdown
Member

What changed

  • New src/startup-recovery-store.js:
    • createStartupRecoveryStore({ file }) loads and saves the feat: add startup recovery state core #181 recovery state as a small owner-only JSON file, written atomically. A missing, corrupt or oversized file loads as a clean start, so recovery can't be what stops the app from starting.
    • guardStartup({ store, start }) counts the attempt as a failure before calling start, so a hard crash (process killed, native fault) still counts. Once the app has stayed up for healthyAfterMs (60 s by default) the count is cleared. After three unconfirmed starts in a row, start gets { safeMode: true }. A thrown startup error records which subsystem failed (configuration, provider, discord, updater or unknown, based on startupCode) and is rethrown.
    • Safe mode doesn't clear itself: a safe-mode run staying up says nothing about the parts it turned off. retryNormal() clears it, which is what the tray's "retry normal startup" will call.
    • If the state can't be saved (read-only disk), startup carries on.
  • Tests cover all of the above with a manual timer, so there are no real waits.

Why

First wiring slice for #122. The follow-up PR wires guardStartup into nowplaying.exe start, has startAppFromConfig honour safeMode (no polling, Discord or updates), and adds the tray actions.

Checks

  • Tests pass locally (full suite green)
  • No secrets, tokens, server URLs, or personal media data are committed
  • Docs or tests were updated when behavior changed
  • The change is scoped to one roadmap issue

Issue

Part of #122

@github-actions

Copy link
Copy Markdown
Contributor

/mira pause

@github-actions github-actions Bot added the mira-paused Pause automatic Mira reviews on this pull request label Sep 23, 2026
@codecov

codecov Bot commented Sep 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@rowkav09
rowkav09 force-pushed the feat/safe-mode-wiring branch 2 times, most recently from f775bc3 to 543b9e9 Compare September 23, 2026 23:47
@rowkav09
rowkav09 force-pushed the feat/safe-mode-wiring branch from 543b9e9 to 218bae7 Compare September 23, 2026 23:50
@rowkav09
rowkav09 merged commit cccc45c into main Sep 23, 2026
11 checks passed
@rowkav09
rowkav09 deleted the feat/safe-mode-wiring branch September 23, 2026 23:54
@github-project-automation github-project-automation Bot moved this from Backlog to Done in nowplaying Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mira-paused Pause automatic Mira reviews on this pull request size:M

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant