What's wrong
ProjectDirector debounces its own options saves:
QueueSaveOptions only stamps SaveOptionsQueuedTime (ProjectDirector/ProjectDirector.cs:285).
SaveOptionsIfRequired (:389-398), called from Tick, writes the file only after 3 seconds with no further queued change.
Nothing flushes a pending save on shutdown:
Main (:62-71) sets no OnClosing handler and does nothing after ImGuiApp.Start returns.
- File > Exit calls
ImGuiApp.Stop() directly (:933).
ktsu.AppDataStorage flushes on dispose or exit only for saves queued through its own QueueSave(). The app never calls that; it calls Options.Save() directly (:81, :283).
Failure scenario
The user runs Set Dev Directory, Add New GitHub Owner or a Scan, or resizes a divider, then closes the window within 3 seconds. The change is gone at the next launch.
Token migration is exposed too. The constructor saves options at :81 before PrepareTokens moves the legacy tokens into the OS secret store (:107-111), and the blanked plaintext token reaches disk only through a queued save. Closing within 3 seconds of startup leaves the plaintext GitHubToken/GitHubOwners in the settings file until a later session re-runs the migration.
This was traced from the code and the library documentation. It was not run, because reproducing it needs the ImGui window.
Suggested fix
- Flush on shutdown: save when
SaveOptionsQueuedTime > LastSaveOptionsTime, from an OnClosing handler and after ImGuiApp.Start returns. Alternatively, switch to AppDataStorage's own QueueSave/SaveIfRequired, which already saves on exit.
- After a startup migration that moved tokens, call
Options.Save() immediately instead of queueing the save.
What's wrong
ProjectDirector debounces its own options saves:
QueueSaveOptionsonly stampsSaveOptionsQueuedTime(ProjectDirector/ProjectDirector.cs:285).SaveOptionsIfRequired(:389-398), called fromTick, writes the file only after 3 seconds with no further queued change.Nothing flushes a pending save on shutdown:
Main(:62-71) sets noOnClosinghandler and does nothing afterImGuiApp.Startreturns.ImGuiApp.Stop()directly (:933).ktsu.AppDataStorageflushes on dispose or exit only for saves queued through its ownQueueSave(). The app never calls that; it callsOptions.Save()directly (:81,:283).Failure scenario
The user runs Set Dev Directory, Add New GitHub Owner or a Scan, or resizes a divider, then closes the window within 3 seconds. The change is gone at the next launch.
Token migration is exposed too. The constructor saves options at
:81beforePrepareTokensmoves the legacy tokens into the OS secret store (:107-111), and the blanked plaintext token reaches disk only through a queued save. Closing within 3 seconds of startup leaves the plaintextGitHubToken/GitHubOwnersin the settings file until a later session re-runs the migration.This was traced from the code and the library documentation. It was not run, because reproducing it needs the ImGui window.
Suggested fix
SaveOptionsQueuedTime > LastSaveOptionsTime, from anOnClosinghandler and afterImGuiApp.Startreturns. Alternatively, switch to AppDataStorage's ownQueueSave/SaveIfRequired, which already saves on exit.Options.Save()immediately instead of queueing the save.