aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-02 17:53:29 +0200
committerDanilo M. <danix@danix.xyz>2026-08-02 17:53:29 +0200
commit9d7bd35ba32bba04d5241cddee428dba041a6e13 (patch)
tree2072c4580c209379e1ea79b0ece766d22e741150
parentcb3ab1a1f8bb0a982f4ce7e9e371ed316a77c84c (diff)
downloadqtmaildir-9d7bd35ba32bba04d5241cddee428dba041a6e13.tar.gz
qtmaildir-9d7bd35ba32bba04d5241cddee428dba041a6e13.zip
docs: unit-test NotmuchWorker against a throwaway database
The spec deferred NotmuchWorker to manual verification on the grounds that testing it needs a real notmuch database. Building a fake one in a temporary directory answers that objection, so Task 8 now gets real coverage. This is the only code in the project that writes to a notmuch index, so a bug there corrupts real mail state. It was the wrong place to have the weakest verification. Task 13's manual checklist stays, as confirmation against real data rather than as the only coverage. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
-rw-r--r--docs/superpowers/plans/2026-08-02-qtmaildir-v1.md18
-rw-r--r--docs/superpowers/specs/2026-08-02-qtmaildir-design.md10
2 files changed, 22 insertions, 6 deletions
diff --git a/docs/superpowers/plans/2026-08-02-qtmaildir-v1.md b/docs/superpowers/plans/2026-08-02-qtmaildir-v1.md
index b2c3307..1e14105 100644
--- a/docs/superpowers/plans/2026-08-02-qtmaildir-v1.md
+++ b/docs/superpowers/plans/2026-08-02-qtmaildir-v1.md
@@ -2350,9 +2350,21 @@ git commit -S -m "feat: add cross-thread value types and notmuch RAII wrappers"
- Create: `src/notmuchworker.h`, `src/notmuchworker.cpp`
- Modify: `src/CMakeLists.txt`
-Per the spec, `NotmuchWorker` has no unit test: testing it requires a real
-notmuch database. It is verified manually in Task 13. Keep it thin so there is
-little untested logic.
+**Changed 2026-08-02, superseding the spec's "no unit test" position.**
+`NotmuchWorker` IS unit-tested, against a throwaway notmuch database built in
+a temporary directory. The spec deferred this to manual verification on the
+grounds that testing needs a real database; the answer is to build a fake one
+rather than to skip the tests. This matters more than for any other class,
+because `applyTags` is the only code in the project that WRITES to a notmuch
+index, and a bug there corrupts real mail state.
+
+The fixture creates a Maildir tree with a handful of messages, runs
+`notmuch new` against a generated config pointing at it, and sets
+`NOTMUCH_CONFIG` for the test process. Nothing touches the developer's own
+`~/Mail` or `~/.notmuch-config`.
+
+Task 13's manual checklist remains, but as confirmation against real data
+rather than as the only coverage.
- [ ] **Step 1: Write src/notmuchworker.h**
diff --git a/docs/superpowers/specs/2026-08-02-qtmaildir-design.md b/docs/superpowers/specs/2026-08-02-qtmaildir-design.md
index e153203..3089341 100644
--- a/docs/superpowers/specs/2026-08-02-qtmaildir-design.md
+++ b/docs/superpowers/specs/2026-08-02-qtmaildir-design.md
@@ -429,9 +429,13 @@ Qt Test, three targets, all runnable without a real mailbox.
## 14. Known gaps
-- `NotmuchWorker` is not unit-tested. Testing it requires a real notmuch
- database; v1 tests pure logic and leaves the database layer to manual
- verification.
+- ~~`NotmuchWorker` is not unit-tested.~~ **Resolved 2026-08-02.** It is
+ tested against a throwaway notmuch database built in a temporary directory
+ by the test fixture (`notmuch new` over a generated Maildir, with
+ `NOTMUCH_CONFIG` pointed at it). The original reasoning — that testing
+ requires a real database — was answered by building a fake one instead of
+ skipping the tests. This is the only code that writes to a notmuch index,
+ so it warranted the effort.
- Large-message MIME parsing happens on the UI thread and could stutter on
pathological messages. Opening a thread parses every message in it, so this
is more likely to show on a long thread than on a single message. Deferred