Skip to content

fix: keep user data when AI, plugin import or restore fails - #1076

Merged
LeanBitLab merged 2 commits into
mainfrom
fix/audit-ai-restore
Dec 4, 2026
Merged

LeanBitLab merged 2 commits into
mainfrom
fix/audit-ai-restore

Conversation

@LeanBitLab

Copy link
Copy Markdown
Owner

Fixes

  • Restore: the backup is read completely first, and only what it contains is replaced. Before, a wrong or damaged file deleted the selected data.
  • Proofread and translate no longer select the whole text while working. An error or cancel left it selected, so the next key replaced everything. A result is dropped if the text changed meanwhile.
  • Proofread results under 70% of the input are rejected (was 30%). Translation stays at 30%.
  • Translation cleanup removes a preamble only at the start and only with a colon.
  • Offline AI: a model whose load never finished (Android killed the keyboard) is not preloaded again, which ended in a closing loop.
  • Offline AI: unloading reaches the plugin, and a memory warning cannot unload a model a request is using.
  • Plugin import keeps the previous file until the new one has loaded.

Tests

New tests for the backup contents check, AI result checks and file replacement. Those, BackupPreferencesTest and InputLogicTest pass; the offline debug build succeeds.

Not covered by tests: the selection change, the preload guard and the busy flag. Not yet checked by hand on a device.

A wrong or damaged file deleted the selected data before anything was read.
- do not select the whole text while the AI works, and drop the result if the
  text changed meanwhile
- reject proofread results under 70% of the input
- strip translation preambles only at the start and only with a colon
- do not preload a model again whose last load never finished
- unload the model in the plugin, and not while a request is using it
- keep the previous plugin file until the new one has loaded
@LeanBitLab
LeanBitLab merged commit 0ee02d0 into main Dec 4, 2026
1 check 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.

1 participant