import: carry an email labelled in Contacts
Contacts hangs a label off a group and writes the mail inside;
the allowlist held no spelling for it, so the whole plan died.
It carries now; the label goes the way an address's went —
no EMAIL ever kept a type, so nothing extra's spent.

Assisted-by: Claude Opus 5 via Claude Code
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
change xwnmlkmstsnwxvyquokszkpxryoollnp
commit 7e25feece15208c4da0eab4693b07eb6eb2485b1
author Alpha Chen <alpha@kejadlen.dev>
date
parent kqswrvlt
diff --git a/lib/pro_tacts/import/macos.rb b/lib/pro_tacts/import/macos.rb
index ffc4df6..5a8b459 100644
--- a/lib/pro_tacts/import/macos.rb
+++ b/lib/pro_tacts/import/macos.rb
@@ -303,7 +303,12 @@ module ProTacts
           "TEL;type=HOME;type=VOICE",
           "TEL;type=IPHONE;type=CELL;type=VOICE"
         ],
-        "EMAIL" => ["EMAIL;type=INTERNET", "EMAIL;type=INTERNET;type=HOME", "EMAIL;type=INTERNET;type=WORK"],
+        "EMAIL" => [
+          "EMAIL;type=INTERNET",
+          "EMAIL;type=INTERNET;type=HOME",
+          "EMAIL;type=INTERNET;type=WORK",
+          "item#.EMAIL;type=INTERNET"
+        ],
         "ADR" => ["item#.ADR;type=HOME"],
         "X-ABRELATEDNAMES" => ["item#.X-ABRELATEDNAMES"]
       }.freeze #: Hash[String, Array[String]]
diff --git a/test/pro_tacts/import/test_macos.rb b/test/pro_tacts/import/test_macos.rb
index 6c0968d..4a28044 100644
--- a/test/pro_tacts/import/test_macos.rb
+++ b/test/pro_tacts/import/test_macos.rb
@@ -131,6 +131,22 @@ class ImportMacosTest < Minitest::Test
     end
   end
 
+  # An address is carried under its group already; an email labelled in
+  # Contacts is the same shape, and its label goes where an address's
+  # does. Nothing is lost that an unlabelled row would have kept: an
+  # imported EMAIL line carries no type either (Admin::CardForm).
+  def test_a_labelled_email_is_carried_and_its_label_dropped
+    in_tmpdir do |dir|
+      lines = [
+        "item1.EMAIL;type=INTERNET;type=pref:ada@example.com",
+        "item1.X-ABLabel:_$!<Home>!$_"
+      ]
+      plan = Macos.plan(dir, [record("A:ABPerson", lines:)], created_at: CREATED_AT)
+
+      assert_equal ["ada@example.com"], plan.card(plan.contacts.first.id).emails
+    end
+  end
+
   def test_a_second_address_under_another_item_number_is_one_form
     in_tmpdir do |dir|
       lines = [