Skip to content

Onboarding backup import still buffers the entire ZIP in memory #944

Open

Description

@tadelv

Problem

Issue #555 moved backup export/import/sync to bounded-memory streaming, including the native import path. However, the onboarding backup restore path still bypasses that transport.

In lib/src/onboarding_feature/steps/import_step.dart, _onZipSelected() currently does:

final bytes = await File(filePath).readAsBytes();
...
request.add(bytes);

This loads the complete selected backup ZIP into memory before POSTing it to /api/v1/data/import.

By contrast, Settings > Data Management uses BackupTransferService.uploadZip(...), which streams the file and is aligned with #555.

This was noticed while triaging #918; it is not the cause of #918's too_many_entries rejection, but it is an inconsistency with the bounded-memory guarantees introduced by #555.

Expected behavior

All native Decaid backup-import entry points should use the same bounded-memory/streaming transport. Onboarding should not materialize a complete backup archive in a List<int> / Uint8List.

Suggested implementation

  • Reuse BackupTransferService.uploadZip(...) from the onboarding ZIP-import path instead of manually reading the file and constructing an HttpClient request.
  • Preserve current onboarding behavior:
    • POST to /api/v1/data/import?onConflict=skip;
    • convert the response through BackupImportResponse;
    • call persistenceController.notifyShotsChanged();
    • display the existing ImportResultView.
  • Keep error handling consistent with the Settings import path where practical.
  • Do not change the server-side archive limits or ZIP validation as part of this issue.

Acceptance criteria

  • Onboarding ZIP restore no longer calls File.readAsBytes() for the backup archive.
  • The selected ZIP is streamed/file-backed end-to-end using the existing backup transfer abstraction.
  • Existing conflict semantics remain onConflict=skip.
  • Existing successful and failed import UI behavior is preserved.
  • Add focused coverage proving the onboarding path does not regress to whole-file buffering.
  • flutter analyze and relevant tests pass.

Context

Activity

  1. added this to the 0.9.2 milestone on Oct 1, 2026
  2. added
    bugSomething isn't working
    ready-for-agentFully specified, ready for an AFK agent
    on Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions