From 507a98a460bf39e61804b50f4acaabfa743265db Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 3 Aug 2026 09:01:32 +0200 Subject: feat: add MailSync process wrapper Runs the configured sync script through QProcess, merging stdout and stderr into one log so a failing mbsync run has something to show. The script is never run through a shell: the command is a config value, and splitCommand keeps its arguments literal. Two fixes against the drafted version: - start() no longer calls waitForStarted(). It blocked the UI thread for up to five seconds, which contradicts the spec's requirement that the UI stay usable during sync, and it swallowed launch failures into a bare false return. A missing script now surfaces asynchronously through errorOccurred as finished(false, -1) with an explanatory log line, so the spinner cannot hang with nothing to explain it. - Removed a double-emit guard I had added on the assumption that QProcess follows errorOccurred(FailedToStart) with finished(). Verified it does not: FailedToStart is emitted instead of finished, never before it. The guard was dead state and the comment justifying it was wrong. Also corrects the sync interval throughout: the user's cron runs every 10 minutes, not hourly. The shorter interval strengthens the flock rationale rather than weakening it, since collisions with a manual sync are that much more likely. Co-Authored-By: Claude Opus 5 --- docs/superpowers/specs/2026-08-02-qtmaildir-design.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/superpowers/specs') diff --git a/docs/superpowers/specs/2026-08-02-qtmaildir-design.md b/docs/superpowers/specs/2026-08-02-qtmaildir-design.md index 37a0078..2d7e760 100644 --- a/docs/superpowers/specs/2026-08-02-qtmaildir-design.md +++ b/docs/superpowers/specs/2026-08-02-qtmaildir-design.md @@ -94,7 +94,7 @@ notmuch access happens on that thread; the UI never blocks. **Sync.** qtmaildir runs a configured external command rather than reimplementing `mbsync` orchestration. The decisive reason is the `flock` guard in the existing script: it is the shared mutex between the user's -hourly cron sync and any manual sync. Reimplementing the sync internally +cron sync (every 10 minutes) and any manual sync. Reimplementing it internally would place qtmaildir outside that mutex, and two concurrent `mbsync -a` runs on one Maildir corrupt UID state. Calling the script joins the mutex for free. Reimplementing would also not remove the dependency, since `mbsync` @@ -379,7 +379,7 @@ query re-runs so new mail appears. On non-zero, the status bar shows the last stderr lines with a "Show log" link. Sync never runs automatically in v1: no timer, no sync on startup. The user's -cron already syncs hourly, and a second scheduler competing with the first is +cron already syncs every 10 minutes, and a second scheduler competing with it is exactly what the script's `flock` guard exists to prevent. The button means "now". -- cgit v1.2.3