Expand description
fz auth import (issue #650): loads a JSONL of users into a running
venture’s auth-core module over its admin API.
The migration path this serves is the one every venture eventually
walks: a system of record already holds the users, and moving them in
must not lose the password verifier or the verified email. The server
half — POST <target>/v1/auth-core/admin/users/import, behind
Authorization: Bearer <ADMIN_TOKEN> — validates every user and
reports one result per user; this command reads the file, aborts on a
local defect before sending anything, batches what is left, and
writes a report.
§Dry run by default
Without --apply the request carries "dry_run": true, so the server
validates and reports without writing. --apply is the one thing that
writes.
§The report carries no user data
The report JSONL holds exactly the server’s per-user verdict —
external_provider, external_id, status, sub, reason — and
never an email or a password hash. The file this command reads is the
only place those appear, and it is never echoed: the summary counts
statuses, and the admin token is read from the environment and never
printed.
§Exit code
Non-zero when a batch cannot be sent or the server answers a non-2xx
(the run stops at the first such batch, so the report describes a
prefix only). A run that completes printing conflict or invalid
results still exits zero: those are the server having answered, and
a conflict is a fact to act on, not a transport failure to retry. The
counts are printed either way.
Structs§
- Import
Options - Everything
runneeds, assembled by the dispatcher so the token is read from the environment exactly once and travels no further than the request header.
Constants§
- DEFAULT_
BATCH_ SIZE - Users per request, when
--batch-sizeis not given. - IMPORT_
PATH - The
auth-coreadmin route, relative to the venture’s base URL. - MAX_
BATCH_ SIZE - The server refuses a request carrying more than this, so a larger
--batch-sizeis a local error rather than an HTTP 4xx.
Functions§
- run
fz auth import: parse, validate, batch, send, report.