Skip to content

fix: make admin reset delete gui.db and restart the app - #148

Merged
boscorat merged 4 commits into
masterfrom
fix/admin-reset-restart
Aug 8, 2026
Merged

fix: make admin reset delete gui.db and restart the app#148
boscorat merged 4 commits into
masterfrom
fix/admin-reset-restart

Conversation

@boscorat

@boscorat boscorat commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Summary

Previously Empty Database & Restart would delete and recreate gui.db, then only QApplication.quit() — requiring a manual relaunch.

Now it deletes gui.db and uses os.execv to atomically restart the process. The startup logic in main.py handles recreating gui.db from the current schema spec.

Changes

  • admin_presenter.py: Removed create_gui_db import. empty_gui_db now deletes gui.db and calls os.execv(sys.executable, [sys.executable] + sys.argv) to restart. Error path falls back to QApplication.quit().
  • admin_view.py: Updated description label to clarify that project folders/data are unaffected and can be re-attached via Add Existing Project on startup.

Notes

  • Project folders and their project.db databases live independently on disk — only the gui.db records (which track known projects) are removed.
  • os.execv works in both development (python -m openstan) and frozen builds — it atomically replaces the current process.
  • create_gui_db is still used by main.py:340 for startup; only the redundant call in empty_gui_db was removed.

Previously 'Empty Database & Restart' would delete and recreate gui.db,
then only quit the application — requiring a manual relaunch.

Now it deletes gui.db and uses os.execv to atomically restart the
process. The startup logic in main.py handles recreating gui.db from
the current schema spec. Project folders and data are unaffected —
users can re-attach them via 'Add Existing Project' on startup.
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown

Documentation reminder

The following view file(s) were modified in this PR:

src/openstan/views/admin_view.py

Please review and update the relevant pages in docs/screens/ before merging.

If the UI has visually changed, capture a new screenshot for the affected screen(s) and commit it to docs/assets/screenshots/. See docs/assets/screenshots/SCREENSHOTS.md for the filename, required app state, and capture instructions for each screen.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the Empty Database & Restart admin action so that it actually restarts the application after resetting gui.db, relying on main.py startup bootstrapping to recreate the DB. It also updates the admin UI copy to better explain what data is affected by the reset.

Changes:

  • Update the admin reset flow to delete gui.db and restart the process via os.execv(...) (instead of quitting only).
  • Update the admin reset description text to clarify that project folders/data on disk are unaffected and can be re-attached on startup.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/openstan/presenters/admin_presenter.py Deletes gui.db, closes the Qt DB, and restarts the process instead of only quitting
src/openstan/views/admin_view.py Updates the reset UI description text to clarify impact and recovery path

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/openstan/views/admin_view.py
Comment thread src/openstan/presenters/admin_presenter.py Outdated
Jason Farrar and others added 3 commits August 8, 2026 22:54
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Jason Farrar <farrar.jason1@gmail.com>
@boscorat
boscorat merged commit 0d0f209 into master Aug 8, 2026
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.

2 participants