importer: top-level subcommands (import / validate-config / acceptance / fetch) — a misread flag must not launch a multi-hour full import #129
Labels
No labels
blocked
claude-wip
map-report
map:is
map:se
needs-review
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
art/ismap#129
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Scope: the
importer/importerCLI — its flag surface,docs/importer-cli.md, and the incident that makes the current shape dangerous.What happened (issue #113, 2026-08-15)
A worker wanted a cheap config sanity check after editing
conf/fimap.yamland ran:-validateis not a validation mode — it is a full-import modifier: "after each table is written, check ST_IsValid and log any invalid geometries". The command parsed as "run the complete Finland import, with geometry checks": every staging table, every layer, every zoom, ~3h12m of postgres at ~98% CPU on the cover cascade before the driver killed it. The change being checked touched three layers.The help output is the trap:
importer -hprints 17 flat flags in one list. There is no "this is a mode, this is a modifier" structure, and the-validatedescription sat below the 30-line truncation the worker used.-halso does not say thatimporter <config>alone means "full import of the whole country".Why the current shape is a footgun
-validate,-ensure,-refetchchange what an already-destructive default (importer conf/fimap.yaml= full import) does, so a flag added to inspect can instead modify. The failure mode is invisible until hours are gone — nothing prints a confirmation of what mode is about to run.-acceptance-only,-geotorget-fetch,-geotorget-list,-lastkajen-fetch,-lastkajen-list,-trafiklab-fetchare six different programs hiding behind-flagspelling; a typo (-validatefor a config check) lands in the one remaining verb, "import everything".importer <config>with no flags is the multi-hour full import; the help never says so in one line.-check-queriesguard would be another mode bolted onto the same list.Proposed shape (top-level subcommands, flags become modifiers)
Key properties to preserve:
importerwith no verb printshelp(the current-h), never starts work.import) should state its blast radius before doing it, at least in help and ideally in a startup line ("full import of — N layers, M zooms" vs "layers a,b,c only").-validateagain (that gap is what caused this).make import*), and it is in this repo.Decisions needed
validate-configmay beconfig-check).docs/importer-cli.mdgains a mode table; the acceptance-tests section stays.Notes
-layer places,railways,stations(the per-layer path, minutes not hours); this issue is the CLI-shape fix so the same misread cannot happen to anyone.-check-queriesguard) slots naturally into the subcommand shape. #114 (stagingwhere:) is unaffected but its docs change touches the same file.Some decisions:
config-checksounds better.Result is in #141 — #141; the review note is the PR description.