feat(phase-1/m2.2): desktop Import/Export — the phone bridge has a UI

Phase 1 M2 task 2 (tools/DESKTOP_PHASE_PLAN.md §4): :desktopApp can now
speak the phone's backup format through the extracted bridge.

- New BackupActions.kt: top-bar overflow menu (Import from file… /
  Export plain / Export encrypted). Import = AWT FileDialog ->
  BackupBridge.preview -> passphrase dialog on INCDBK1 (wrong passphrase
  stays open for retry) -> BackupPreview confirm dialog -> import.
  Export = save-picker -> exportPlain / passphrase + exportEncrypted.
  All heavy bridge calls run on Dispatchers.IO; results via Snackbar.
- Same package-level BackupBridge calls Android's BackupManager shim
  makes — format shared by construction, not reimplementation. Android's
  PassphraseDialog.kt deliberately NOT ported (M4 moves the real one to
  common code).
- :desktopApp gains implementation(:core:backup).
- Scripted headless path for CI: --backup-import/--backup-export drive
  the identical bridge calls without dialog clicking.

Verification passed: :desktopApp:run --args="--data-dir /tmp/...
--backup-import <real phone export> --backup-export /tmp/m2t4-exp.json
--exit-after 8" (preview 27 / imported 27 / exported 27, clean exit) +
:core:data-jvm:backupSmoke on the DESKTOP-written export (all PASS) +
python cross-check: notes (createdAt,updatedAt,content) and attachment
Base64 identical phone->desktop->phone + assembleDebug +
:core:data-jvm:smoke + :desktopApp:run --self-test — all green.
Output recorded in DESKTOP_FEASIBILITY.md (incl. one unreproduced
first-run exit hang to watch in M5).
This commit is contained in:
Incido Developer committed 2026-10-05 19:23:47 +13:00
1 parent 8facbe718b
commit cf0e74b68d
4 files changed
+385

No files matched your search

+39
View File
@@ -332,4 +332,43 @@ pre-existing on Android, noted for task 3. After the fix, full suite green:
`:spike:data-jvm:run` — and the ObjectBox generator kept printing
`ID model file unchanged`.
**M2 task 2 — desktop Import/Export UI: DONE.** `:desktopApp` gained the
`:core:backup` dependency, a top-bar overflow menu (Import from file… /
Export plain / Export encrypted, `BackupActions.kt`) with Material3
passphrase + confirm dialogs, and AWT `FileDialog` (native GTK under
XWayland) driven on the IO dispatcher. Every flow ends in the same
`BackupBridge` calls the Android shim makes — the format is shared by
construction. The confirm dialog reuses `BackupPreview` counts and plainly
states that duplicates persist until task 3.
Scripted verification (`--backup-import/--backup-export`, the same bridge
calls as the menu, no dialog clicking):
```
./gradlew :desktopApp:run --args="--data-dir /tmp/incido-m2-import4 --backup-import <real phone export> --backup-export /tmp/m2t4-exp.json --exit-after 8"
BACKUP preview notes=27 attachments=1 app=0.4.0.0
BACKUP imported=27 (same calls as the Import… menu)
RENDER notes=27 selected=1
BACKUP exported=27 notes to /tmp/m2t4-exp.json → exits cleanly
:core:data-jvm:backupSmoke on the DESKTOP-written file: all PASS
python cross-check phone file vs desktop export: notes (createdAt,
updatedAt, content) identical = True; attachment Base64 identical = True
```
That closes the **phone → desktop → phone half of task 4** for plain
format: byte-identical notes + attachment through the real app. Remaining
task 4 items: encrypted file in each direction via the UI, and the
phone-side re-import check on a device.
One anomaly worth recording: the very first scripted run hung post-export
(no thread dump obtainable; ~0.8% CPU, idle). Three subsequent identical
runs exited in 10s; the classic `--self-test --exit-after` path was also
re-verified green. Unreproduced — keep an eye on it during M5 (the trap
list already has an exit-time AWT/`exitProcess` quirk).
Full suite green after the change: `assembleDebug`, `:core:data-jvm:smoke`,
`backupSmoke`, `:desktopApp:run --self-test`.