--- /dev/null
+Return-Path: <dkg@fifthhorseman.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 0BA806DE00BB\r
+ for <notmuch@notmuchmail.org>; Mon, 11 Apr 2016 12:19:01 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.02\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.02 tagged_above=-999 required=5 tests=[AWL=-0.020]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id K77ZJGdMs0Jx for <notmuch@notmuchmail.org>;\r
+ Mon, 11 Apr 2016 12:18:52 -0700 (PDT)\r
+Received: from che.mayfirst.org (che.mayfirst.org [162.247.75.118])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 8D3EE6DE00E1\r
+ for <notmuch@notmuchmail.org>; Mon, 11 Apr 2016 12:18:52 -0700 (PDT)\r
+Received: from fifthhorseman.net (unknown [38.109.115.130])\r
+ by che.mayfirst.org (Postfix) with ESMTPSA id 29168F991;\r
+ Mon, 11 Apr 2016 15:18:48 -0400 (EDT)\r
+Received: by fifthhorseman.net (Postfix, from userid 1000)\r
+ id 55E9E20072; Mon, 11 Apr 2016 15:18:48 -0400 (EDT)\r
+From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
+To: David Bremner <david@tethera.net>, Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: Re: [PATCH v4 7/7] complete\r
+ ghost-on-removal-when-shared-thread-exists\r
+In-Reply-To: <87r3ed6l35.fsf@zancas.localnet>\r
+References: <1459445693-3900-1-git-send-email-dkg@fifthhorseman.net>\r
+ <1460166892-29721-1-git-send-email-dkg@fifthhorseman.net>\r
+ <1460166892-29721-7-git-send-email-dkg@fifthhorseman.net>\r
+ <87r3ed6l35.fsf@zancas.localnet>\r
+User-Agent: Notmuch/0.21+124~gbf604e9 (http://notmuchmail.org) Emacs/24.5.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Mon, 11 Apr 2016 15:18:44 -0400\r
+Message-ID: <87zit0t0mj.fsf@alice.fifthhorseman.net>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; boundary="=-=-=";\r
+ micalg=pgp-sha512; protocol="application/pgp-signature"\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 11 Apr 2016 19:19:01 -0000\r
+\r
+--=-=-=\r
+Content-Type: text/plain\r
+\r
+On Sun 2016-04-10 20:33:02 -0400, David Bremner <david@tethera.net> wrote:\r
+> Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:\r
+>\r
+>> To fully complete the ghost-on-removal-when-shared-thread-exists\r
+>> proposal, we need to clear all ghost messages when the last active\r
+>> message is removed from a thread.\r
+>\r
+> For me this patch breaks T530 as follows\r
+>\r
+> T530-upgrade: Testing database upgrade\r
+> FAIL ghost message retains thread ID\r
+> --- T530-upgrade.13.expected 2016-04-11 00:25:19.482196274 +0000\r
+> +++ T530-upgrade.13.output 2016-04-11 00:25:19.482196274 +0000\r
+> @@ -1 +1 @@\r
+> -thread:000000000000001d\r
+> +thread:0000000000000011\r
+> No new mail.\r
+> No new mail. Removed 1 message.\r
+>\r
+> I pushed my rebased version of the patches to\r
+>\r
+> https://git.notmuchmail.org/git?p=notmuch;a=shortlog;h=refs/heads/thread-fix\r
+>\r
+> in case the problem is some mistake on my part.\r
+\r
+After having done "make download-test-databases", I can confirm that\r
+this is happening for me as well: it's not an issue with bremner's\r
+config.\r
+\r
+however, i think this particular test is wrong, and should probably be\r
+removed.\r
+\r
+For review, here's the final test:\r
+\r
+----------\r
+# Ghost messages are difficult to test since they're nearly invisible.\r
+# However, if the upgrade works correctly, the ghost message should\r
+# retain the right thread ID even if all of the original messages in\r
+# the thread are deleted. That's what we test. This won't detect if\r
+# the upgrade just plain didn't happen, but it should detect if\r
+# something went wrong.\r
+test_begin_subtest "ghost message retains thread ID"\r
+# Upgrade database\r
+notmuch new\r
+# Get thread ID of real message\r
+thread=$(notmuch search --output=threads id:4EFC743A.3060609@april.org)\r
+# Delete all real messages in that thread\r
+rm $(notmuch search --output=files $thread)\r
+notmuch new\r
+# "Deliver" ghost message\r
+add_message '[subject]=Ghost' '[id]=4EFC3931.6030007@april.org'\r
+# If the ghost upgrade worked, the new message should be attached to\r
+# the existing thread ID.\r
+nthread=$(notmuch search --output=threads id:4EFC3931.6030007@april.org)\r
+test_expect_equal "$thread" "$nthread"\r
+-------------\r
+\r
+I don't think this reasoning is sensible. If the entire thread is\r
+deleted, and a new message comes in, it should *not* get the same mesage\r
+ID. ghosts should only exist in the database when other messages point\r
+to them.\r
+\r
+So i'd be fine with killing this entire last test, unless someone can\r
+propose a good reason to keep it.\r
+\r
+ --dkg\r
+\r
+--=-=-=\r
+Content-Type: application/pgp-signature; name="signature.asc"\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v2\r
+\r
+iQJ8BAEBCgBmBQJXC/iVXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w\r
+ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRFREIyRTc0RjU2RkNGMkI2NzI5N0I3MzUy\r
+NEVDRkY1QUZGNjgzNzBBAAoJECTs/1r/aDcK0mMP/2uFFlhIVN90Elg2y0qb7ahb\r
+iA+i9iI9tARYaKyo26zxlOVCMfrzYPfgyQC9F1T4VZzTj9mtigOLzR1bEtoYTvoG\r
+XuZK78Ytkjx2INeWzLEw/QxNFcJahDMEkC80UiGNMYwYnPUYjNPLprIrWQ9SAM7T\r
+vTBVYjjkkNJpcYMIRd7uTz63sC/kuk8MWK9CmnuUdpMYnnJayOAUFAeJNjR0b/ZG\r
+hGNWY9vbJrehKKYxozayn500NfDuASdpdtdGXLXjFxzMwQEVDSl99men6nxaTijT\r
+gYKTotB6A3/YF1XIptMmo7IHu6DnhthlfEXXfLZAbaTIff95eQLq5J196Om8fNNB\r
+jY9AL46w4JLtSNH95bH8NGuegQ4SMhskXBZb2D4LTpxmAktgglWlhcFemlp7omsR\r
+lwJufU4B7EcLL1OxlUb9CEvHUsG96zyVT65b1f5xVtf5tTwJctT9KfFThy1KDBcc\r
+TVuJC86j+Z/pEf/3s1tes6iYFjXz5UVV1Pdlp6SDVP5xUi6IaKQ5Pp+H36jKaz1S\r
+F+s2nhc34P/IZB+nx/qLt1EgAsN+zT7NmyQCuN4lum2ntGX0NwP7p1OKlxnFNGWi\r
+YDVaAsAjQOY4w4fVB0yWAg5MslvVtCb+pgCKiZX1rHb6P5fBxjWSU08jRFerSmaa\r
+Dgh4S1MMFHK5T1qcKJiM\r
+=f7Sb\r
+-----END PGP SIGNATURE-----\r
+--=-=-=--\r