fix(import): Fail when there are no rows to import - #144
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
Original prompt from sheldon
|
|
1bfe10b to
82674c3
Compare
An export that produced nothing flowed straight through import, which reported "0 users created" and exited 0 — reading as a successful migration. Both import commands now exit non-zero when the input has no data rows, with --allow-empty to opt back into the no-op. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
A package carrying only SSO metadata CSVs (custom attribute mappings or proxy routes) was classified as empty. Track those rows in the plan and exclude them from the empty check. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
countCSVRows read every row before the importer parsed the file again. The guard only needs to know whether one data row exists. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
82674c3 to
4ece77d
Compare
🤖 I have created a release *beep* *boop* --- ## [2.6.0](v2.5.1...v2.6.0) (2026-09-10) ### Features * import SSO connections and fix migration rate limiting ([#141](#141)) ([8987809](8987809)) ### Bug Fixes * **auth0:** Download bulk export job as bytes ([#143](#143)) ([ab6f67e](ab6f67e)) * **import:** Fail when there are no rows to import ([#144](#144)) ([c221314](c221314)) * **templates:** Emit a users template the validator accepts ([#145](#145)) ([1ba723a](1ba723a)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Description
An export that silently produced nothing (see #143) flowed straight into
import, which reported "0 users created" and exited 0. Nothing distinguished that from a real migration, so the failure was only noticed much later.Both import entrypoints now refuse empty input:
importexits 1 when--csvhas no data rows.importPackage()throws when every entity CSV in the package is header-only, including the SSO handoff metadata CSVs (sso/custom_attribute_mappings.csv,sso/proxy_routes.csv), which the plan previously didn't track at all — so a handoff-only package still imports.--allow-emptyon both commands (allowEmptyonimportPackage()) opts back into the old no-op, for callers that legitimately run against a possibly-empty file.Note this is a change in exit-code behavior for anyone scripting around an empty CSV: what used to exit 0 now exits 1 without the new flag.
--planis unaffected — it still reportsTotal rows: 0and returns, since planning an empty file is a reasonable thing to ask for.Checklist
npm run lint,npm run typecheck,npm run build, andnpm testlocally.Link to Devin session: https://app.devin.ai/sessions/c4fc166fd5b24121aefd9b336f281e03
Open in Devin Desktop: https://app.devin.ai/desktop/session/c4fc166fd5b24121aefd9b336f281e03?variant=devin