Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / CROSS_PLATFORM_STATUS.md
| 1 | # EverySync Cross-Platform Status |
| 2 | |
| 3 | Single source of truth for the shared-core + system-sink + shell program |
| 4 | (Phases 1–3). Relay contract and invariants are restated here verbatim so no |
| 5 | target re-derives them. |
| 6 | |
| 7 | ## Phase table |
| 8 | |
| 9 | | Phase | Scope | Status | |
| 10 | |-------|-------|--------| |
| 11 | | 1 — core | Shared KMP sync brain (`library/everysync-core`): relay merge, vault policy, DTOs, iCal/vCard formats, PQC transport surface | DONE (`6eb6023d2`, `5ff387959`, `82a121367`) | |
| 12 | | 1D — bindings | Platform actuals: OkHttp (Android/JVM), Darwin (Apple), JNI/JNA PQC, secure stores, scheduler | DONE | |
| 13 | | 2 — desktop providers | JVM `sinks/` over EDS `libecal`/`libebook` (Linux, file-backed + JNA stub) and read-only `AppointmentStore`/`ContactStore` + Notes-view todos (Windows v1); KDBX round-trip + todos-in-Notes + EDS sink tests green (`6cbdeaaab`); pre-existing `NoteSync.syncChannel` log-fold bug fixed in the same commit | DONE (device runs open: native EDS link, Windows store wiring, live-relay per target) | |
| 14 | | 2c/3b — system sinks (this change) | `sinks/SystemSinks.kt` interface docs: `CalendarSystemSink`, `ContactsSystemSink`, `TodoSystemSink` over existing `SyncSink<T>` | DONE | |
| 15 | | 3 — Apple providers | Swift shells + `Shared/` IPC/crypto/scheduler + `XCFramework/` build spec (cinterop `.def`, ref header, build script, iOS-actuals notes) + sink bindings (`EKReminder`/`CNContactStore`/`EKEvent`) + E2E checklist (`5c3d6ef20`); Kotlin `iosMain` actuals + `xcodebuild` + simulator conformance need a Mac | DONE (Mac-side work open) | |
| 16 | | live-relay | scripted `LiveRelayConformanceTest` runner + sign-off table (`595d3d714`); staging `POST /personal/*` returns 404 (routes undeployed) — 6 local steps PASS, 6 relay steps BLOCKED with exact evidence | PARTIAL (needs relay redeploy, then re-run) | |
| 17 | |
| 18 | ## Relay contract |
| 19 | |
| 20 | - Base `https://api.maproj.org/personal`, WS `wss://api.maproj.org/personal/ws`. |
| 21 | - Endpoints: `POST /register | /getkey | /append | /pull`. |
| 22 | - Channels: `<type>:<vaultId>` records, `members:`, `keys:`, `owner:`, `title:`, `inbox:<device>`, `notes-blobs:<vaultId>`. |
| 23 | - The relay is an untrusted append-only log: records are never rewritten, only appended; authority is client-side (owner-signed roster/epochs/transfers); vault keys never user-visible. |
| 24 | |
| 25 | ## Invariants (verbatim) |
| 26 | |
| 27 | 1. A failed pull returns null = abort, never empty. Folding a failure as empty reads every baseline-present id as deleted. |
| 28 | 2. A failed local read surfaces as failure (`LocalReadException` / `listLocalOk == false`), never as an empty list. An empty list means "provably holds nothing locally". |
| 29 | 3. Only explicit tombstones delete; absence without a tombstone resurrects (soft-delete types) or quarantines — never deletes. |
| 30 | 4. `remoteOut` appends to the relay BEFORE persisting locally. |
| 31 | 5. Passwords hard-delete (no tombstone rows); notes/todos soft-delete (tombstone rows persist and propagate); calendar/contacts soft-delete via provider `DELETED` flags. |
| 32 | 6. Passwords vaults never grant VIEWER. |
| 33 | |
| 34 | ## Sink mapping summary |
| 35 | |
| 36 | - `CalendarSystemSink : SyncSink<RemoteEvent>` — `RemoteEvent` <-> iCal VEVENT (`core.format.ICalendar`; UID + RECURRENCE-ID identity; RRULE verbatim, duration-instead-of-end for masters). Android: `_SYNC_ID`/`SYNC_DATA1`/`SYNC_DATA2` + `CALLER_IS_SYNCADAPTER` + `DIRTY`/`DELETED`. Apple: `EKEvent`. Linux: `libecal`. Windows: `AppointmentStore` read-only v1. |
| 37 | - `ContactsSystemSink : SyncSink<RemoteContact>` — `RemoteContact` <-> vCard (`core.format.VCard`; shared `PhoneKind`/`EmailKind`/`PostalKind` ints). Android: `SOURCE_ID`/`SYNC1`/`SYNC2` + `CALLER_IS_SYNCADAPTER` + `DIRTY`/`DELETED`. Apple: `CNContactStore`. Linux: `libebook`. Windows: `ContactStore` read-only v1. |
| 38 | - `TodoSystemSink : SyncSink<RemoteTodo>` — `RemoteTodo` JSON on `todos:<vaultId>` <-> native reminder (`EKReminder` / `libecal` todo / Notes-view row). `notes` + `createdAt` must persist (envelope + hash inputs); tombstones are real rows; `position` is ordering-only. |
| 39 | |
| 40 | ## Drift fixes applied |
| 41 | |
| 42 | - Todo `notes`/`createdAt`: persisted in the envelope AND the merge hash (`TodoKind.canonical`); native stores must persist both or LWW on those fields never converges. |
| 43 | - Passwords KDoc: `RemotePassword` documents the native vault-field mirror (no KDBX mapping) and the password/passkey halves; `PasswordKind`/`EntryMapper` document hard-delete + tombstone-marker semantics. |
| 44 | |
| 45 | ## Verification matrix |
| 46 | |
| 47 | - Slices: `:library:everysync-core:compileKotlinJvm`, `:library:everysync-core:lint` (no Gradle run in this change per scope). |
| 48 | - Tests (existing, must stay green): `RelayConformanceTest`, `SharedTransportTest`, `SyncDigestTest`, `TodoKindTest` (commonTest, 25 tests) + `JvmPqcVectorConformanceTest` (jvmTest, 6 tests). |
| 49 | - Live-relay checklist: register → getkey → append → pull round-trip against `https://api.maproj.org/personal`; null-pull abort; tombstone propagation per type; re-enable repopulation after purge. |
| 50 | |
| 51 | ## Next steps |
| 52 | |
| 53 | 1. Desktop providers (`desktop/`): implement `sinks/` over EDS (Linux) and read-only stores + Notes-view todos (Windows v1). |
| 54 | 2. Apple providers (`apple/`): implement `sinks/` over EventKit + `CNContactStore`. |
| 55 | 3. Live-relay pass per target using the checklist above. |