Skip to content

feat(app): offer a restart when an update changes where data is kept - #216

Draft
ehennestad wants to merge 1 commit into
migrate-project-foldersfrom
prompt-restart-after-update
Draft

ehennestad wants to merge 1 commit into
migrate-project-foldersfrom
prompt-restart-after-update

Conversation

@ehennestad

Copy link
Copy Markdown
Collaborator

Problem

A session started before an update looks for its data where the new code expects it. The warning for that reaches the command window only, and only on the next path lookup. An open app can sit idle for days.

Change

nansen.internal.user.RestartMonitor calls a check once a minute. When the check returns true, the monitor stops and fires RestartNeeded, so the user is asked once. A check that throws an error counts as a check that found nothing.

NansenUserSession.isRestartNeeded is the check. It is true when UserDataLayout.CURRENT_VERSION or ProjectFolderLayout.CURRENT_VERSION differs from the value the session started with, and when the version stored with the user data is later than the session started with, which means that another MATLAB migrated it. An ordinary commit does not change those numbers, so it does not trigger the prompt.

nansen.App asks through MessageDisplay.ask, with the answers Restart Now and Later. The default is Later, because the dialog opens while the user can be typing. Restart Now runs nansen.restart.

nansen.restart ran nansen.quit, which resets the session even when the user decided against quitting, for example with tasks running, and the open app then lost its session. It now stops if the app is still open.

The monitor only exists in an app started on code that has it. The update that brings in this PR relies on the command window warning from #126.

🤖 Generated with Claude Code

A session started before an update looks for its data where the new
code expects it, and the warning for that only reaches the command
window on the next path lookup. An open app can sit idle for days.

RestartMonitor checks once a minute whether the code or the data has
moved to another layout than the session started with, and the app then
asks once whether to restart. The check is on the layout versions, so
an ordinary commit in a checkout does not trigger it. The default answer
is Later, because the dialog opens while the user can be typing.

nansen.restart reset the session even when the user decided against
quitting, for example with tasks running. It now stops if the app is
still open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ehennestad
ehennestad added this pull request to stack #212 November 9, 2026 09:21
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Test Results

819 tests  +8   817 ✅ +8   2m 6s ⏱️ +19s
 63 suites +1     2 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit e38ed72. ± Comparison against base commit 44bf03c.

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