feat(phase-1/m2.1): :core:backup — codecs + stream-based BackupBridge

Phase 1 M2 task 1 (tools/DESKTOP_PHASE_PLAN.md §4): extract the backup
bridge from :composeApp into a plain kotlin("jvm") module so the desktop
build can import/export the phone file format.

- git mv BackupCodec / EncryptedBackupCodec / EncryptedKeyCodec into
  core/backup, keeping the org.incido.compose.data.backup package so the
  Android diff is file moves + one dependency line (no import churn).
- New BackupBridge: the four BackupManager operations over
  InputStream/OutputStream instead of Uri (incl. the v0.3.3.3 preview
  hotfix catches); BackupPreview moves with it, same package.
- BackupManager stays in :composeApp as a thin Uri -> stream SAF shim,
  public API unchanged. Dedupe = task 3, desktop picker UI = task 2.

Verification passed: ./gradlew :core:backup:build :core:data-jvm:smoke
:spike:data-jvm:run + assembleDebug + :desktopApp:run --args="--data-dir
/tmp/incido-desktop-smoke --self-test --exit-after 6" — all green; run
output recorded in tools/DESKTOP_FEASIBILITY.md (Phase 1 status).
This commit is contained in:
Incido Developer committed 2026-10-05 18:51:07 +13:00
1 parent b11c02e1b4
commit 7cc4eda90d
9 files changed
+262 -92

No files matched your search

+29
View File
@@ -266,3 +266,32 @@ Still synthetic in this build: the theme (Material 3 defaults, not Incido's)
and the screens (this is a two-pane stand-in). Both are replaced by the M4
`composeApp` commonMain conversion. Not yet wired: settings, encryption (M3),
backups (M2), packaging (M5).
**M2 task 1 — extract `:core:backup`: DONE.** New plain-`kotlin("jvm")`
module holding `BackupCodec.kt`, `EncryptedBackupCodec.kt` and
`EncryptedKeyCodec.kt` (`git mv` — the Android diff is the three moves plus
one dependency line) and a new `BackupBridge`: the four `BackupManager`
operations re-expressed over `InputStream`/`OutputStream` instead of `Uri`.
The package name `org.incido.compose.data.backup` was kept on purpose, so no
consumer import changed; `BackupManager` stays in `:composeApp` as a thin
`Uri → stream` SAF shim with an identical public API (`BackupPreview` moved
to the bridge file, same package). Dedupe is task 3, desktop picker UI is
task 2 — deliberately not here.
Verification (all after the move, from a clean state):
```
./gradlew :core:backup:build BUILD SUCCESSFUL (serializers generated in the new module)
./gradlew assembleDebug BUILD SUCCESSFUL — Android unchanged
./gradlew :core:data-jvm:smoke RESULT: M1a PASS — the shared data layer runs on the JVM
./gradlew :desktopApp:run --args="--data-dir /tmp/incido-desktop-smoke --self-test --exit-after 6"
SELFTEST wrote note id=1 → RENDER notes=1 selected=1
./gradlew :spike:data-jvm:run … recovery-key envelope (real codec) PASS — 84-byte envelope,
32-byte key round-tripped; wrong passphrase → AEADBadTagException
```
Housekeeping found on the way: `:core:data-jvm:smoke` does not clear
`build/data-jvm-smoke/`, and the script asserts on a fresh library — a
second consecutive run fails with "expected 1 note, got 2". Run it against
a deleted directory (worth fixing in a later milestone).