Skip to content

Preserve configuration during interrupted saves - #4

Merged
lukisch merged 2 commits into
mainfrom
fix/mailprocessor-config-atomic-20261002
Oct 3, 2026
Merged

lukisch merged 2 commits into
mainfrom
fix/mailprocessor-config-atomic-20261002

Conversation

@lukisch

@lukisch lukisch commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Save configuration through a closed sibling temporary file and atomically replace the target, preserving the previous bytes when write or replace fails.
  • Add synthetic regressions for partial temporary writes, replace errors, and preserved error reporting.
  • Add a frozen-only --self-test path that verifies the bundled icon, tray menu, and rendered settings dialog with a synthetic configuration, without loading user configuration or running setup, autostart, scanning, or downloads.
  • Declare Pillow and the test tools in requirements-dev.txt, use them in CI and contributor setup, and provide the tomli fallback required by the Python 3.10 test matrix.

Validation

  • python -B -m pytest -q -p no:cacheprovider — 102 passed, 6 subtests passed (Python 3.12.10; isolated scratch profile).
  • ruff check . — passed.
  • python -B -m compileall -q . — passed.
  • git diff --check — passed.
  • Local PyInstaller 6.21.0 onefile build; frozen MailProcessor.exe --self-test exited 0 with an isolated offscreen profile. Artifact SHA-256: 268CEA2B8F5D6BDAAAA3F8DB71F230AE1174B08BA179EB419FCCAF90B1C8138E.

@lukisch lukisch left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Zweitmodell-Review: CI grün (12/12, Windows/macOS/Linux), keine Blocker.

config.save() schreibt nun über NamedTemporaryFile im Konfigurationsordner und os.replace; ein Fehler lässt die bisherige Konfiguration unberührt, der ursprüngliche Fehler wird nicht durch Aufräumfehler verdeckt. Zwei Tests (Teilwrite, Replace-Fehler) belegen das. requirements-dev.txt und der tomllib-Fallback sind sauber. Keine Credentials oder Nutzerpfade im Diff.

Hinweise:

  1. Kein fsync vor replace (Schutz gegen Prozessabbruch, nicht gegen Stromausfall).
  2. NamedTemporaryFile erzeugt Modus 0600; die Konfiguration erhält dadurch nach dem Speichern 0600 (bei Konfigurationen mit Tool-Pfaden/Accounts eher ein Vorteil, aber eine Verhaltensänderung).
  3. Bei hartem Abbruch bleiben .mp-*.tmp im Konfigurationsordner liegen.

Generated by Claude Code

@lukisch
lukisch marked this pull request as ready for review October 3, 2026 21:17
@lukisch
lukisch merged commit b5be8f2 into main Oct 3, 2026
12 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.

1 participant