From 7a0e093e467ea39fe4e662f9cd6d135b0f036876 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sun, 2 Aug 2026 17:53:29 +0200 Subject: 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 --- docs/superpowers/plans/2026-08-02-qtmaildir-v1.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'docs/superpowers/plans/2026-08-02-qtmaildir-v1.md') 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** -- cgit v1.2.3