Repository navigation
fix: harden settings cancel, snapshot redaction, store readiness & atomic writes - #14
Conversation
…omic writes Bugsweep iteration WC-20261123-SOFTWARE-BUGSEARCH-MAILPROCESSOR (BS-01..BS-05): - tray.py & settings_dialog.py: restore language/autostart/tools on Cancel without saving config.json; require exact token count & balanced quotes in autostart check. - snapshot_export.py: preserve HOME label on LOCALAPPDATA fallback, avoid CWD expansion on relative paths, normalize '..' before tail redaction, scope TOML version lookup to [project], and write snapshots atomically with temp cleanup. - store_readiness.py: enforce exact version boundaries, reject drive/root/symlink escapes, require rescap namespace for runFullTrust, check PEP-508/503 license tokens, distinguish WACK XML/protocol PASS from prose templates, ignore archive trees, and catch UnicodeDecodeError fail-closed. - update_files.py: clean up temp files on replace failure and catch invalid UTF-8. - tests: add 8 regression tests in test_bugsweep_snapshot_readiness_and_settings_20261123.py.
Zweitprüfung (Cloud-Bot)Ergebnis: freigegeben ✅ (formales Approve geht nicht, weil es derselbe Account ist) CI: Alle 15 Checks sind grün: Windows 3.10–3.13, Source-Smoke auf Ubuntu und macOS, CodeQL. Code-Review (
Lokal (Linux, Python 3.11, ohne libEGL): 72 passed. Die 6 Qt-Testmodule ließen sich mangels Scope-Hinweis: Der PR enthält auch fachfremde Änderungen, nämlich neu erzeugte Generated by Claude Code |
Zweitprüfung (Cloud-Bot)Ergebnis: freigegeben ✅ (formales Approve nicht möglich, da gleicher Account)
Nicht blockierende Hinweise:
Generated by Claude Code |
lukisch
left a comment
There was a problem hiding this comment.
Zweitprüfung (Cloud-Bot): freigabefähig, mit zwei kleinen Hinweisen. Geprüft am Head dc8fe0c.
Geprüft und plausibel
- BS-01 Cancel-Pfad (
tray.py):SettingsDialogschreibt Sprache, Autostart-Registry und Config nur in_on_save(). Bei Cancel stellt der Tray jetzttools,language,start_with_windowsund die UI-Sprache wieder her, ohnecfg_module.save()aufzurufen. Das passt, Registry und Config können nicht auseinanderlaufen._command_tokensmit exakter Tokenlänge:_expected_autostart_command()erzeugt nur"exe"bzw."exe" "main.py". Einträge mit zusätzlichen Flags wurden bisher fälschlich als aktuell erkannt und werden jetzt repariert. - BS-02
write_snapshot: Die atomische Ersetzung samtfinally-Cleanup ist korrekt. EinTOMLDecodeErrorin_extract_pyproject_versionlandet im bestehendenexcept Exceptionvon_read_app_version. Bei_redact_path_hintist die Gleichsetzung LOCALAPPDATA = HOME jetzt richtig aufgelöst. - BS-03/04
store_readiness.py: Der Versions-Lookaround (10.1.0≠0.1.0) ist korrekt. Die Pfadprüfung lehnt Laufwerk, Root,..und Symlinks vorresolve()ab. Die PEP-503-Tokenisierung behebt die Substring-Falschtreffer (ring⊂keyring). Gegengeprüft:ET.fromstring()verträgt auch einen UTF-8-BOM vor der XML-Deklaration, gegenüberET.parse()geht also nichts verloren. - BS-05
update_files.py:temporary_pathwird jetzt vor demwritegesetzt und imfinallyaufgeräumt. Das korrigiert auch das bisherige Leck, wennwrite()fehlschlug. - CI: alle 15 Checks grün (Windows 3.10–3.13, ubuntu/macOS-Smokes, CodeQL).
Hinweise (nicht blockierend)
tempfile.NamedTemporaryFilelegt die Datei unter POSIX mit Modus0600an. Nachos.replacehat der Snapshot deshalb restriktivere Rechte als vorher (umask). Für einen redigierten Diagnose-Export ist das eher ein Vorteil. Falls ein anderer Prozess die Datei lesen soll, wäre einos.chmodnötig.- Lokal konnte ich nur die Nicht-Qt-Teile prüfen, weil der Sandbox-Host kein
libEGLhat. Die Qt-abhängigen Regressionstests sind nur durch die CI belegt.
Generated by Claude Code
ellmos-multi-bot
left a comment
There was a problem hiding this comment.
Independent Second-Instance Review (APPROVE)
- Model & Independence:
Gemini 4 Carbon (Medium)(fresh scheduled operator instance + independent second-instance verification,review_independence = instance) - Reviewed Head SHA:
dc8fe0cc285c44e1c31cbdb1070750fd25a9abef(base:main@c602ff16462edd33600f345f3fba2d67f8d4be3f) - Scope Read: Complete diff across all 7 modified files (
+751 / -73:CHANGELOG.md,settings_dialog.py,snapshot_export.py,store_readiness.py,tray.py,update_files.py,tests/test_bugsweep_snapshot_readiness_and_settings_20261123.py) and adjacent source modules. - Full Test Suite & Verification:
python -m pytest -q: 114 passed, 6 subtests passed (full repository test suite including Qt/PySide6 tray and settings tests)ruff check --no-cache .: 0 issuespython -m compileall -q .: pass- Mermaid syntax check & repository privacy check: pass; version
0.1.0unchanged (pyproject.toml:7); GitHub Actions CI 15/15 green.
Verified Changes & Non-Blocking Follow-up Notes
- Verified: Settings cancel path (
tray.py:147-161) cleanly restorestools,language,start_with_windows, and active UI locale without writingconfig.json; atomic temp-file replacement withfinallycleanup (snapshot_export.py:87-107,update_files.py:196-214);LOCALAPPDATA == HOMEfallback preservation and..normalization in_redact_path_hint()(snapshot_export.py:245-277); and fail-closedrescap:Capability, PEP-503 boundary, exact version boundary, and WACK XML/report checks instore_readiness.py. - [P2 — Follow-up] Trailing unbalanced quote check (
settings_dialog.py:52-60):_command_tokens()rejects unclosed leading quotes (startswith(q) and not endswith(q)), whereas a stray trailing quote without a leading quote (MailProcessor.exe") would passshlex.split(..., posix=False)and be stripped in_normalize_cmd_token()(settings_dialog.py:34). Tightening to symmetricstartswith(q) != endswith(q)in a future cleanup pass will catch that edge case too. - [Nit — Follow-up] Duplicate save on Accepted (
settings_dialog.py:344,tray.py:166):_on_save()already persistsself._cfgbefore_open_settings()callscfg_module.save(self._cfg)again.
Summary
Systematic
[SOFTWARE_BUGSEARCH]bugsweep iteration (WC-20261123-SOFTWARE-BUGSEARCH-MAILPROCESSOR) across the pre-declared focus area (tray.py,settings_dialog.py,snapshot_export.py,store_readiness.py,update_files.py).Fixed Bug Complex (
BS-01–BS-05)BS-01— Settings Cancel Persistence & Autostart Command Validation (tray.py,settings_dialog.py):MailProcessorTray._open_settings()previously restoredtoolsonCancel, but still overwrotecfg.languagefrom globalget_language(), leftstart_with_windowsmutated, and unconditionally calledconfig.save(self._cfg)— writing unintended config state to%LOCALAPPDATA%\MailProcessor\config.jsonwhen the user cancelled the dialog. It now snapshots and restorestools,language,start_with_windows, and UI language onCancelwithout saving to disk.settings_dialog._command_tokens()and_is_current_autostart_command()previously accepted any stored registry command withlen(current) >= len(expected)and split on whitespace onshlex.spliterrors, leaving broken autostart entries with trailing flags (e.g.--self-test) or unbalanced quotes unrepaired. It now enforces exact token length and balanced quoting, and_refresh_table()renders script paths viapathlib.Pathinstead of hardcoded backslashes.BS-02— Snapshot Path Redaction, Scoped TOML Version Lookup & Atomic Export (snapshot_export.py):_redact_path_hint()preserved"LOCALAPPDATA"ahead of"HOME"even whenLOCALAPPDATA_ROOTfell back toPath.home(), mislabeling home paths as"LOCALAPPDATA/..."and making"HOME"unreachable; it also allowed relative paths to expand againstCWDand sliced rawPath.parts[-2:]without normalizing..segments._read_app_version()now scopespyproject.tomllookups to[project].version(viatomllibwith a bracket-aware Python 3.10 fallback), andwrite_snapshot()rejects blank/directory/symlink targets and writes atomically viaos.replace()withfinallytemp-file cleanup.BS-03&BS-04— Fail-Closed Store Readiness Gates (store_readiness.py):(?<![0-9.]){version}(?![0-9.])) inSHA256SUMS.txt(preventing10.1.0from matching0.1.0) and rejects drive-relative, root-relative, and symlink-escaping artifact paths.[project].versionviatomllib(with Python 3.10 fallback) so multiline arrays inside[project]do not truncate version lookup.restrictedcapabilitiesXML namespace (rescap:Capability) forrunFullTrustinAppxManifest.xml.requirements.txtwith PEP-508 environment marker/comment stripping and PEP-503 token-boundary normalization againstTHIRD_PARTY_LICENSES.txt(eliminating substring false positives such asringmatchingkeyring), while catchingUnicodeDecodeErrorfail-closed as ablockercheck.appcert.exe) XMLOVERALL_RESULT="PASS"/ structuredResult: PASSreports from prose templates (Status: PENDING_MSIX_BUILD ... must pass), and excludes.git/.venv/_archive/build/disttrees.BS-05— Maintenance Script Temp Cleanup & UTF-8 Error Handling (update_files.py):_atomic_write()cleans up temporary files infinallyifhandle.write()oros.replace()fails, andplan_updates()turnsUnicodeDecodeErrorintoMaintenanceError(exit code2).Verification
8/8new regression tests intests/test_bugsweep_snapshot_readiness_and_settings_20261123.pyfailed against unmodifiedmain(c602ff1) and pass after the fix.114 passed, 6 subtests passed(QT_QPA_PLATFORM=offscreen).python tests/source_platform_smoke.py(PASS),python store_readiness.py --json(exit 2, valid schemamailprocessor-store-readiness-v1),python update_files.py(exit 0, all 4 targetsalready current), realwrite_snapshot()roundtrip (1,018 bytes).ruff check --no-cache .(All checks passed!),python -m compileall -q .(exit 0),lint_mermaid.py(CLEAN),git diff --check(exit 0).VERDICT: IMPRIMATUR / PASS (0 P0, 0 P1, 0 P2).