Mark an import done only once its contacts are removed
Assisted-by: GLM-5.3 via pi
change qqmkzktsoukmxkuurkouxprwlouynrtr
commit 62cc1789ca1bcdd2e430136fda2e6bbf0f2e890a
author Alpha Chen <alpha@kejadlen.dev>
date
parent xrvrtnrx
diff --git a/tasks/import.rake b/tasks/import.rake
index 3623593..580f178 100644
--- a/tasks/import.rake
+++ b/tasks/import.rake
@@ -90,13 +90,13 @@ namespace :import do
     # One line per plan, as far along as it is: the fraction counts
     # everything past “planned”, because from “landed” on the card is
     # on the host — which is the state a glance wants. The marker is
-    # ✅ once nothing is left for import:execute to carry — every
-    # contact imported or beyond — and ⏳ until then, so it can never
-    # disagree with the next lines below. The plan names are the
-    # directories', copy-pasteable into PLAN=.
+    # ✅ only once every contact is off the Mac — removed, the last
+    # status — and ⏳ until then, so it can never disagree with the
+    # next lines below. The plan names are the directories',
+    # copy-pasteable into PLAN=.
     plans.each do |plan|
       done = plan.contacts.size - plan.with_status(nil).size
-      marker = ImportTasks::TO_LAND.call(plan) ? "⏳" : "✅"
+      marker = ImportTasks::TO_LAND.call(plan) || ImportTasks::TO_LEAVE.call(plan) ? "⏳" : "✅"
       puts "#{marker} #{plan.dir.basename}  #{done}/#{plan.contacts.size} contacts"
     end
 
diff --git a/test/tasks/test_import.rb b/test/tasks/test_import.rb
index 60cd55c..a46224b 100644
--- a/test/tasks/test_import.rb
+++ b/test/tasks/test_import.rb
@@ -18,8 +18,11 @@ class ImportStatusTaskTest < Minitest::Test
     Dir.mktmpdir do |root|
       root = Pathname.new(root)
       imports = root / "data" / "imports"
-      # A plan mid-flight — one contact through to the Mac-cleanup step,
-      # one past it — and one freshly built with everything still to do.
+      # A plan carried all the way off the Mac, one mid-flight — one
+      # contact through to the Mac-cleanup step, one past it — and one
+      # freshly built with everything still to do.
+      through = Plan.write(imports / "macos-20260831T000000Z", source: "macos", created_at: Time.utc(2026, 8, 31), entries: [entry("qxqmqmqmqmqm"), entry("zzzzzzzzzzzz")])
+      through.contacts.each { it.status or through.record(it.id, "removed") }
       underway = Plan.write(imports / "macos-20260901T000000Z", source: "macos", created_at: Time.utc(2026, 9, 1), entries: [entry("kmnuqmzxylru"), entry("vmnlryyvktux")])
       underway.record("kmnuqmzxylru", "imported")
       underway.record("vmnlryyvktux", "removed")
@@ -27,7 +30,8 @@ class ImportStatusTaskTest < Minitest::Test
 
       out, = run_task(root)
 
-      assert_includes out, "✅ macos-20260901T000000Z  2/2 contacts\n"
+      assert_includes out, "✅ macos-20260831T000000Z  2/2 contacts\n"
+      assert_includes out, "⏳ macos-20260901T000000Z  2/2 contacts\n"
       assert_includes out, "⏳ macos-20260916T180412Z  0/1 contacts\n"
       assert_includes out, "next: import:execute would land macos-20260916T180412Z\n"
       assert_includes out, "next: import:macos:remove would clear macos-20260901T000000Z\n"