Skip to content

refactor(import): run every import source through one flow - #81

Merged
fullynocturnal merged 2 commits into
mainfrom
refactor/import-flow
Sep 19, 2026
Merged

fullynocturnal merged 2 commits into
mainfrom
refactor/import-flow

Conversation

@fullynocturnal

Copy link
Copy Markdown
Collaborator

Nine import sources each had their own screen and view model, and the flow behind them was the same in all nine: pick an input, preview it, choose what to bring across, submit, poll the job, report. They now share one. About 4,400 lines out, 1,300 in.

How it fits together

  • ImportSources.kt has an ImportSource entry per source holding everything that differs: what the user supplies (a file, an encrypted file and its passphrase, or a token), how the preview is fetched and read, the fixed options fields, and the few real quirks, such as PluralKit's live pull going to the credential endpoint and a Sheaf complete-backup zip submitting under its own source.
  • ImportViewModel and ImportScreen run the flow for whichever source the route names (settings/import/run/{source}).
  • ImportSourcePickerScreen replaces the nine rows in Settings > Data with one "Import data" row and a list to choose from.

Adding a source is now an entry in the registry rather than two new files and a new route. Onboarding's Simply Plural shortcut goes through the same flow.

One options builder

The nine hand-written request builders become buildOptionsJson. The tests pin what each of them had to get right on its own:

  • a category the export did not populate is still sent at its default, because the backend rejects unknown fields but expects the known ones;
  • the sources that send an explicit "member_ids": null (Prism, PluralSpace, Ampersand) still do, and the others still omit it;
  • a narrowed selection sends its ids;
  • fixed fields such as conflict_strategy go out alongside the toggles.

Checked

Nine import sources each had their own screen and view model, and the flow
behind them was the same in all nine: pick an input, preview it, choose what
to bring across, submit, poll the job, report. They now share one.

- ImportSources.kt has an ImportSource entry per source holding everything
  that differs: what the user supplies (a file, an encrypted file and its
  passphrase, or a token), how the preview is fetched and read, the fixed
  options fields, and the few real quirks, such as PluralKit's live pull
  going to the credential endpoint and a Sheaf complete-backup zip submitting
  under its own source.
- ImportViewModel and ImportScreen run the flow for whichever source the
  route names.
- ImportSourcePickerScreen replaces the nine rows in Settings > Data with one
  "Import data" row and a list to choose from.

Adding a source is now an entry in the registry rather than two new files
and a new route. Onboarding's Simply Plural shortcut goes through the same
flow.

**One options builder.** The nine hand-written request builders become
buildOptionsJson, and the tests pin what each of them had to get right on its
own: a category the export did not populate is still sent at its default,
because the backend rejects unknown fields but expects the known ones; the
sources that send an explicit null member_ids still do and the others still
omit it; a narrowed selection sends its ids; and fixed fields go out
alongside the toggles.
@fullynocturnal
fullynocturnal merged commit 09e7d48 into main Sep 19, 2026
1 check passed
@fullynocturnal
fullynocturnal deleted the refactor/import-flow branch September 19, 2026 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant