import: carry a main number and drop X-APPLE-SUBLOCALITY
The main line rings; type=pref ranks it but names no kind at all,
so the suffix comes off the form and both spellings make the call.
Sublocality goes out the door the subadministrative went;
no field here for either one, the source keeps every line it sent.

Assisted-by: Claude Opus 5 via Claude Code
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
change olksqkvpmnkznnqxpnonztklnxtsywqu
commit 63fd057e431fa683b629f017fdbc7181fa36fa47
author Alpha Chen <alpha@kejadlen.dev>
date
parent qqmkzkts
diff --git a/lib/pro_tacts/import/macos.rb b/lib/pro_tacts/import/macos.rb
index 04982c8..314aeda 100644
--- a/lib/pro_tacts/import/macos.rb
+++ b/lib/pro_tacts/import/macos.rb
@@ -302,6 +302,7 @@ module ProTacts
           "TEL;type=CELL;type=VOICE",
           "TEL;type=HOME;type=VOICE",
           "TEL;type=IPHONE;type=CELL;type=VOICE",
+          "TEL;type=MAIN",
           "TEL;type=WORK;type=VOICE",
           "item#.TEL"
         ],
@@ -329,7 +330,10 @@ module ProTacts
       # Properties read and thrown away, whatever form they take: this
       # address book has no field for any of them, and a card's `source`
       # still holds the line.
-      DROPPED = %w[IMPP ORG TITLE URL X-SOCIALPROFILE X-APPLE-SUBADMINISTRATIVEAREA X-AIM].freeze #: Array[String]
+      DROPPED = %w[
+        IMPP ORG TITLE URL X-SOCIALPROFILE
+        X-APPLE-SUBADMINISTRATIVEAREA X-APPLE-SUBLOCALITY X-AIM
+      ].freeze #: Array[String]
 
       # Properties that say something about the line sharing their group
       # rather than about the contact: a label, and the country code
diff --git a/test/pro_tacts/import/test_macos.rb b/test/pro_tacts/import/test_macos.rb
index 7827dc8..3136bae 100644
--- a/test/pro_tacts/import/test_macos.rb
+++ b/test/pro_tacts/import/test_macos.rb
@@ -174,6 +174,22 @@ class ImportMacosTest < Minitest::Test
     end
   end
 
+  # The main number, with the rank Contacts gives it: `type=pref` names
+  # no kind and comes off the form, so the allowlist holds the spelling
+  # without it and both arrive under the one entry.
+  def test_a_main_number_is_a_phone_ranked_or_not
+    in_tmpdir do |dir|
+      records = [
+        record("A:ABPerson", lines: ["TEL;type=MAIN;type=pref:+12532189075"]),
+        record("B:ABPerson", lines: ["TEL;type=MAIN:(206) 651-4359"])
+      ]
+      plan = Macos.plan(dir, records, created_at: CREATED_AT)
+
+      assert_equal [["+12532189075"], ["(206) 651-4359"]],
+        plan.contacts.map { plan.card(it.id).phones }
+    end
+  end
+
   # Where someone works has no field in this address book; the source
   # keeps the lines the card drops.
   def test_a_job_title_and_an_organization_are_dropped
@@ -241,6 +257,7 @@ class ImportMacosTest < Minitest::Test
         "IMPP;X-SERVICE-TYPE=Skype;type=HOME;type=pref:skype:ada",
         "X-SOCIALPROFILE;type=twitter:https://twitter.com/ada",
         "item1.X-APPLE-SUBADMINISTRATIVEAREA:Middlesex",
+        "item1.X-APPLE-SUBLOCALITY:Marylebone",
         "X-AIM;type=HOME;type=pref:ada",
         "item2.URL;type=pref:https://example.com",
         "item2.X-ABLabel:_$!<HomePage>!$_",
@@ -411,7 +428,6 @@ class ImportMacosTest < Minitest::Test
   def test_a_line_in_any_other_form_is_refused_under_that_form
     in_tmpdir do |dir|
       records = [
-        record("A:ABPerson", lines: ["TEL;type=MAIN:+12532189075"]),
         record("C:ABPerson", lines: ["item1.TEL;type=CELL;type=VOICE;type=pref:+12532189075"]),
         record("D:ABPerson", lines: ["TEL;type=CELL;type=VOICE;type=pref:ext. 4"]),
         record("E:ABPerson", name: ["N:Lovelace;Ada;;;", "FN;CHARSET=utf-8:Ada Lovelace"])
@@ -427,8 +443,6 @@ class ImportMacosTest < Minitest::Test
             E:ABPerson: "FN;CHARSET=utf-8:Ada Lovelace"
           TEL value: 1
             D:ABPerson: "TEL;type=CELL;type=VOICE;type=pref:ext. 4"
-          TEL;type=MAIN: 1
-            A:ABPerson: "TEL;type=MAIN:+12532189075"
           item#.TEL;type=CELL;type=VOICE: 1
             C:ABPerson: "item1.TEL;type=CELL;type=VOICE;type=pref:+12532189075"
       MESSAGE