import: the in-flight plans directory is active/
Pairs with done/ as the two states a plan directory names.
Assisted-by: GLM-5.3 via pi
diff --git a/docs/plans/2026-09-19-import-under-data-import.md b/docs/plans/2026-09-19-import-under-data-import.md
index f9fc27e..f480c92 100644
--- a/docs/plans/2026-09-19-import-under-data-import.md
+++ b/docs/plans/2026-09-19-import-under-data-import.md
@@ -8,18 +8,19 @@ and the last step of an import stopped being named for its action.
```
data/import/
├── config.yml # standing data between plans (ProTacts::Import::Config)
-├── plans/ # the plans in flight
+├── active/ # the plans in flight
└── done/ # plans filed away, every contact off this Mac
```
Before, plans lived in `data/imports` beside nothing. Everything the
-tasks keep now sits under the one directory, plans active under
-`plans/` and finished under `done/`. A machine with plans in the old
-place moves them once by hand:
+tasks keep now sits under the one directory, plans in flight under
+`active/` and finished under `done/` — the two states a plan's
+directory names. A machine with plans in the old place moves them
+once by hand:
```bash
-mkdir -p data/import/plans data/import/done
-mv data/imports/* data/import/plans/
+mkdir -p data/import/active data/import/done
+mv data/imports/* data/import/active/
```
## Finalizing, not removing
@@ -39,7 +40,7 @@ still finishes and files away; nothing is rewritten on disk.
A plan whose every contact is done is finished (`Plan#done?`). The
finalize task files one away into `done/` as its last step, and the
-status read sweeps any a dead run left in `plans/` before listing —
+status read sweeps any a dead run left in `active/` before listing —
so what status lists is what still has work, and the finished plans
are out of the way but kept, with their cards and sources, for as
long as `data/` is.
diff --git a/tasks/import.rake b/tasks/import.rake
index 413d87d..7ece2cf 100644
--- a/tasks/import.rake
+++ b/tasks/import.rake
@@ -10,9 +10,10 @@ require "pathname"
# which rake redefines noisily when a file is loaded twice.
module ImportTasks
# All the import collateral under data/import: the standing
- # configuration in config.yml beside the plans, active under plans/
- # and filed away under done/ once every contact is off this Mac.
- PLANS = Pathname.new("data/import/plans")
+ # configuration in config.yml beside the plans, in flight under
+ # active/ and filed away under done/ once every contact is off this
+ # Mac — the two states a plan's directory names.
+ ACTIVE = Pathname.new("data/import/active")
DONE = Pathname.new("data/import/done")
# Where the import tasks keep their standing data between plans:
@@ -28,18 +29,18 @@ module ImportTasks
# The plan PLAN names, or the oldest one still waiting for this step:
# plans are carried in the order they were built, so the next one to
# take further is the oldest that has not been. A PLAN that is not a
- # directory is read as a plan's name under PLANS, the way the
+ # directory is read as a plan's name under ACTIVE, the way the
# directories there are named.
def self.plan(waiting, step)
named = ENV.fetch("PLAN", nil)&.then { Pathname.new(it) }
- named = PLANS / named if named && !named.directory?
+ named = ACTIVE / named if named && !named.directory?
if named
abort "#{named} holds no plan.yml" unless (named / "plan.yml").file?
return ProTacts::Import::Plan.read(named)
end
- ProTacts::Import::Plan.all(PLANS).find(&waiting) ||
- abort("no plan in #{PLANS} is waiting #{step}: run rake import:macos:plan, or name one in PLAN")
+ ProTacts::Import::Plan.all(ACTIVE).find(&waiting) ||
+ abort("no plan in #{ACTIVE} is waiting #{step}: run rake import:macos:plan, or name one in PLAN")
end
# A finished plan's final state: moved under DONE, nothing left to
@@ -53,12 +54,12 @@ end
namespace :import do
namespace :macos do
- desc "Plan importing this Mac's iCloud contacts into data/import/plans (LIMIT=n for the first n)"
+ desc "Plan importing this Mac's iCloud contacts into data/import/active (LIMIT=n for the first n)"
task :plan do
require "pro_tacts/import/macos"
created_at = Time.now.utc
- dir = ImportTasks::PLANS / "macos-#{created_at.strftime("%Y%m%dT%H%M%SZ")}"
+ dir = ImportTasks::ACTIVE / "macos-#{created_at.strftime("%Y%m%dT%H%M%SZ")}"
limit = ENV.fetch("LIMIT", nil)&.then { Integer(it) }
records = ProTacts::Import::Macos.read(limit:)
@@ -106,15 +107,15 @@ namespace :import do
require "pro_tacts/import/plan"
# A finished plan files away; this sweeps any a dead run left in
- # plans/, so what is listed is what still has work — which is also
+ # active/, so what is listed is what still has work — which is also
# why nothing here is ever finished: the sweep took it.
- ProTacts::Import::Plan.all(ImportTasks::PLANS).each do |plan|
+ ProTacts::Import::Plan.all(ImportTasks::ACTIVE).each do |plan|
ImportTasks.file_away(plan) if plan.done?
end
- plans = ProTacts::Import::Plan.all(ImportTasks::PLANS)
+ plans = ProTacts::Import::Plan.all(ImportTasks::ACTIVE)
if plans.empty?
- puts "no plans in #{ImportTasks::PLANS}; run rake import:macos:plan"
+ puts "no plans in #{ImportTasks::ACTIVE}; run rake import:macos:plan"
next
end
@@ -134,7 +135,7 @@ namespace :import do
puts "next: import:macos:finalize would finish #{finalizing.dir.basename}" if finalizing
end
- desc "Land the oldest plan in data/import/plans still to land, or the one in PLAN, on the pro-tacts at HOST, a base URL such as https://contacts"
+ desc "Land the oldest plan in data/import/active still to land, or the one in PLAN, on the pro-tacts at HOST, a base URL such as https://contacts"
task :execute do
require "net/http"
require "uri"
diff --git a/test/tasks/test_import.rb b/test/tasks/test_import.rb
index d5d30c3..6d1bb16 100644
--- a/test/tasks/test_import.rb
+++ b/test/tasks/test_import.rb
@@ -17,7 +17,7 @@ class ImportStatusTaskTest < Minitest::Test
def test_status_counts_each_plans_contacts_and_files_finished_plans_away
Dir.mktmpdir do |root|
root = Pathname.new(root)
- plans = root / "data" / "import" / "plans"
+ plans = root / "data" / "import" / "active"
# A plan carried all the way off the Mac — done, so swept into
# done/ rather than listed — one mid-flight with a contact through
# to the finalizing step and one past it, and one freshly built
@@ -45,7 +45,7 @@ class ImportStatusTaskTest < Minitest::Test
Dir.mktmpdir do |root|
out, = run_task(Pathname.new(root))
- assert_includes out, "no plans in data/import/plans; run rake import:macos:plan"
+ assert_includes out, "no plans in data/import/active; run rake import:macos:plan"
end
end