SPB Git

Repository Public

AUDIT-iOS.md 15.1 KB 142 lines markdown

1<!--2SP Drive iOS3File: docs/next/AUDIT-iOS.md4Author: Simon-Pierre Boucher5Contact: contact@spboucher.ai6-->7# SP Drive iOS / iPadOS — audit before 2.0, and where phase 1 leaves each feature89Audit date: 2026-11-19. Baseline = `main` at `570dd46` (1.0.0 (1), on TestFlight). Everything below was read in the code or10observed by re-running the suites; nothing was measured on a real device (**simulator only**, iOS 27.0 simulators11« SPDrive iPhone » and « SPDrive iPad », Xcode 27.2). The backend used is the throw-away instance on m5ma:866312(branch `native-clients`, commit `7bd8972`), never production.1314## 1. Baseline, re-run on `main` before any change1516| Suite | How | Result on `main` |17|---|---|---|18| Engine (`KitTests`, Mac, real backend) | `Scripts/build.sh core` | **12 / 12 passed** (17.6 s) |19| App-hosted (`Tests`, simulator iPhone) | `Scripts/build.sh test` | **6 / 6 passed** (File Provider through the file system + 5 WebAuthn/name tests) |20| Interface (`UITests`, simulator iPhone) | `Scripts/build.sh uitest` | **3 / 4 passed** — `testExplorerEndToEnd` fails on `main` at « share URL shown » (line 188) on the iOS 27 simulator; it ran 561 s, most of it in the « app not idle » waits on context menus. The three others pass (sign-in screens, trash/restore/search, Files app location). |21| Interface, iPad | not re-run on `main` (the iPhone run alone took 12 min) | — |2223The failing baseline test is a pre-existing state of `main` on this simulator, not a regression of 2.0. See §4 for where it stands after phase 1.2425### Baseline measurements (cheap, repeatable)2627| Measure | Method | `main` (1.0) | `next` (2.0 phase 1) |28|---|---|---|---|29| Read a 1,000-item folder from the SQLite mirror | `Tests/PerfTests.swift`, median of 7 `store.children(of:)` calls, Debug build, simulator | 3.7 ms | 3.4 ms |30| Render the explorer on that folder (create the screen → first laid-out, committed frame) | same test, `UIHostingController` in a `UIWindow`, median of 7 | 213.5 ms (201–231) | 228.6 ms (214–253) |31| Cold launch to first frame | `UITests/LaunchPerfTests.swift`, `XCTApplicationLaunchMetric`, 5 iterations, iPhone simulator | 0.757 s (0.722–0.804) | 0.742 s (0.715–0.779) |3233The same two test files were copied, unmodified, into a worktree of `main` to take the left column. Debug builds on a simulator on34a Mac that was busy with other work: these numbers compare the two versions with each other; they say nothing about a real iPhone.3536## 2. Feature by feature (state of `main`, then what phase 1 changed)3738Legend — **Impl.**: in the code. **Tested**: by which suite. ◐ = partly. ✘ = absent.3940| Feature | `main`: implemented | `main`: tested (how) | Incomplete / missing on `main` | After phase 1 |41|---|---|---|---|---|42| Browse (list, grid, sort, filter) | yes (`FolderScreen`) | UI `testExplorerEndToEnd` (list, grid) | rows were plain; no per-item « unavailable offline » state; name truncated at large text sizes | cards with real previews, rows reflow at large sizes, eight explicit states, zoom transitions; UI `NextUITests.testAppearanceMatrix` (screenshots) |43| Folder operations (create, rename, move, duplicate, trash) | yes, through the journal | engine `treeOperations…`, `duplicateNames…`; UI create + rename + trash | duplicate needs the server (stated) | unchanged logic; bottom sheet + keyboard shortcuts added |44| Uploads | resumable, 8 MiB blocks, per-block and whole-file SHA-256 | engine `uploadThenDownload…`, `largeFile…` | no Wi-Fi-only enforcement in the engine (a preference existed, wired as « concurrency 0 »); no jitter | policy engine, request-level enforcement, adaptive concurrency, jittered backoff: engine tests §3 |45| Downloads | Range resume, verified before install | engine `largeFile…`, `corruptedDownload…` | a download finished by the system while the app was dead was thrown away and fetched again (race at launch between the replay of results and the requeue) | fixed and tested (`downloadFinishedWhileTheAppWasDead…`) |46| Search | local index (offline) + server by name | engine `localSearch…`; UI `testTrashRestoreAndSearch` | no content search, no semantic search (2.0 server features) | unchanged — phase 2 (`SPDriveNext`) |47| Favourites | yes | engine + UI | — | also offline through the journal (tested) |48| Tags | **missing** (no tag in the 1.0 API used by the app) | — | — | still missing: needs 2.0 endpoints (collections/tags) — phase 2 |49| Versions | list, download, restore, delete (`ItemDetailsView`) | engine (versions counted in conflict tests); no UI test | no UI test of restore | PDF annotation creates versions (tested); restore still without UI test |50| Trash | yes, restore, purge online only | engine + UI | — | unchanged |51| Sharing (links) | full editor | UI creates a link (the step that fails on `main`) | « shared with me » does not exist in 1.0 | unchanged — shared-with-me is phase 2 |52| Portals (deposit links) | full editor, submissions | **not tested** by any suite | no automated test | unchanged, still untested |53| Storage screen | quota, offline bytes, cache, largest files | no test | no server-side breakdown | unchanged — `storage/overview` is phase 2; a storage widget was added |54| Devices (sessions) | list + revoke (`AccountScreen`) | no test | — | unchanged; the client now sends `X-SPD-Client` (2.0 contract §2) |55| Notifications | local only, five families | no test | no push (documented) | unchanged; the change listener has a `notify` hook for the 2.0 event stream |56| Offline | pin file/folder, journal, replay after restart | engine `offlineWork…`, `pinnedFolder…` | pins not re-evaluated when items move in or out of a pinned folder while offline; no summary of what a pin covers | `enforcePinConsistency`, `pinStatus`, tests `selectiveOffline…`, `offlineFirst…` |57| Conflicts | never overwritten; three choices; list in « Problèmes » | engine `concurrentEdits…`, `editHereDeletedThere…` | no side-by-side view: the user chose without seeing dates, sizes or previews | `ConflictSheet` + `conflictSides`; engine test + UI test on a real conflict |58| Files app (File Provider) | replicated extension | hosted `FileProviderTests` (through the file system) + UI `testFilesAppShowsSPDriveLocation` | never observed on a device | untouched; both tests re-run after the changes (§4) |59| Share extension | files, images, videos; direct upload, parked when offline | **not tested** | a Safari page was offered as nothing useful (`public.url` treated as data); a file whose upload finished just before the extension was stopped could be sent twice; ignored « Wi-Fi only » | `ShareIntake` (web page → `.webloc`, PDF when offered, text → `.txt`), park-first inbox with upload-session bookkeeping, Wi-Fi-only respected; logic tested on the Mac with real `NSItemProvider`s — the extension's own UI is still not automated |60| Scanner | VisionKit camera → PDF of images (PDFKit) | **not tested** (no camera in the simulator) | no OCR, no choice of destination, no name | `ScanPipeline` (JPEG pages, optional on-device OCR text layer), review sheet; pipeline unit-tested with generated pages, review sheet UI-tested with the same pages; **the camera itself: device only** |61| Background transfers | background `URLSession`, relaunch handler | engine restart test with the in-process driver | relaunch-for-events never observed; the race above | recovery ordered and tested with a scripted driver; real background relaunch **still device only** (§6) |62| iPad layout | sidebar + one stack, six shortcuts | UI tests have iPad branches | no inspector, no multiple windows, no hover, drops only on folder rows | inspector column, secondary windows, 15 shortcuts + ⌘/ sheet, hover effects, drops on sidebar sections |63| Dark mode / Dynamic Type / VoiceOver | system colours; fixed one-line names | none | names truncated at XXXL; states announced by icon only in some places | tokens, reflowing rows, spoken state on every item, custom actions; screenshot matrix |64| English | **missing** (French only) | — | — | see README « Reste à faire » — string catalog status stated there |6566## 3. What the new engine tests prove (all against m5ma:8663, `Scripts/build.sh core`)6768| Policy / behaviour | Test (`KitTests/EngineNextTests.swift`) |69|---|---|70| Decision matrix (Wi-Fi only, Low Data Mode, Low Power Mode, battery, charging, unknown battery) | `policyMatrix` (pure) |71| Backoff: exponential, capped at 60 s, jitter in [step/2, step] | `backoffGrowsIsCappedAndJittered` (pure) + `retriesBackOffExponentially…` (three injected timeouts wait ≥ 3.5 s) |72| Adaptive concurrency 1–6 by throughput and error rate | `adaptiveConcurrencyFollowsThroughputAndErrors` (pure) + the same integration test (three timeouts halve the limit; being offline does not count) |73| Wi-Fi only on a cellular path, one-time exemption, request flags | `wifiOnlyHoldsTransfersOnCellularAndReleasesThemOnWiFi` |74| A running transfer leaves the network when the path becomes cellular, keeps its server session | `runningTransferGoesBackToTheQueueWhenThePathBecomesCellular` |75| Low Data Mode / Low Power Mode / low battery hold background work only; opening a held file promotes it | `lowDataModeLowPowerModeAndBatteryHoldBackgroundWorkOnly` |76| User-initiated first, including pre-emption of a background transfer | `userInitiatedTransferTakesTheSlotOfABackgroundOne` |77| Crash-safe: download finished while the app was dead is adopted, zero bytes fetched again | `downloadFinishedWhileTheAppWasDeadIsAdoptedNotFetchedAgain` |78| Crash-safe: upload killed after block 1 of 3 continues in the same server session, 2 blocks sent | `uploadInterruptedByACrashResumesFromTheServersOffset` |79| Selective offline consistent when items move, nested pins, unpin | `selectiveOfflineStaysConsistentWhenItemsMove` |80| Offline-first: browse, search, open pinned, rename/move/create/favourite/upload, reconnect | `offlineFirstBrowseEditQueueThenReconnect` |81| Conflict described on both sides, never overwritten, keep-mine keeps history, remote deletion | `conflictIsDescribedOnBothSidesAndNeverOverwrittenSilently` |82| Events listener: hints, polling fallback, reconnection with growing capped delays, no-source mode | `changeListenerUsesHintsFallsBackToPollingAndReconnects` (the source is a stand-in: the real SSE stream arrives in phase 2) |8384## 4. Suites after phase 18586See `docs/TESTS.md` for the up-to-date table (counts and dates of the last runs).8788## 5. Cold launch8990`main`: 0.757 s average (5 launches, 3.7 % relative standard deviation). `next`: 0.742 s on the iPhone simulator (2.8 %),910.756 s on the iPad simulator (0.3 %). Within noise of each other: the widget extension, the new shells and the policy wiring add92nothing measurable to the launch. `testExplorerEndToEnd`, which failed on `main`, passes on `next` (iPhone and iPad); the93step that failed (share-link sheet) was not deliberately changed, so this is recorded as an observation, not as a fix.9495## 6. Background transfers: what is verified and what iOS does not guarantee9697Kept: one background `URLSession` (`ai.spboucher.spdrive.ios.transfers`), block uploads from files, downloads with resume data,98`application(_:handleEventsForBackgroundURLSession:)` → `BackgroundSession.setSystemCompletion` → `AppModel.start()`.99100Verified in phase 1 (with a scripted driver that behaves like the system: results delivered at start, no active task):101102- results of steps that finished while the process was not running are handled **before** the queue is read again, and are adopted;103- transfers recorded as running that the system no longer holds go back to the queue with their partial file / server session;104  with the real background session this happens after a 2-second grace period, because late results may still arrive;105- requests carry `allowsExpensiveNetworkAccess` / `allowsCellularAccess` / `allowsConstrainedNetworkAccess` from the policy, so the106  system itself refuses an excluded path while the app is suspended.107108Not verified (needs a real device, and cannot be forced): the system actually relaunching the app for session events; a transfer109continuing across a device lock, a reboot, or a force-quit.110111What iOS does not guarantee, and the app does not promise:112113- **when** a background transfer runs — the system schedules it by battery, network, thermal state and how often the app is used;114- that the app is relaunched at all after the user force-quits it from the app switcher (background sessions are cancelled then);115- that a block upload survives a long suspension: the server-side session stays open, the block is sent again from the server's offset;116- `BGAppRefreshTask` / `BGProcessingTask` timing — they are requests, not appointments;117- continuous progress reporting while suspended: the transfer centre shows the state at the last moment the app ran (the widget118  says « tel que l’app l’a vu en dernier » for the same reason);119- uploads are chunked through the API between blocks: after each block the app must run briefly to hand over the next one. If iOS120  does not wake the app, the upload pauses between two blocks and continues at the next launch. This is a consequence of the121  resumable protocol (one request per block) and is the main limit of background uploads in this design.122123## 7. After phase 2 (2026-11-19, 2.0 backend)124125Rows of §2 that changed since phase 1:126127| Feature | After phase 2 | Tested by |128|---|---|---|129| Search | names + content with highlighted passages; « by meaning » toggle | engine `contentSearchTags…` (content hit, snippet runs); UI `Next2UITests.testSearchAsk…` |130| Tags | create / apply / delete on a file | engine (same test); UI (same test, tag created in the app and checked on the server) |131| Versions | timeline, restore keeps every version, compare | engine (restore: 3 versions, same hash as the restored one); UI (text diff summary) |132| Sharing | members and roles, workspace name, shared-with-me by role, QR code | engine `grantsGiveExactlyTheirRole…` (viewer 403 on write, uploader lists nothing, revoked → 404); UI `testMembersSharedWithMe…` |133| Storage | server-side overview, drill-down, duplicates | engine (overview, folder, exact duplicates call); UI (overview screen) |134| Devices | platform and app version from `X-SPD-Client` | engine `serverAnnounces…`; UI (« SP Drive 2.0.0 » on the current device) |135| Notifications / changes | server event stream, polling fallback | engine `eventStreamBringsAChange…` (live stream, unreachable stream, stream cut while live) |136| SP Drive AI | ask, citations, picker, consent, suggestions | engine `askAnswersFromRetrievedPassages…` — **fake model**; UI (answer, citation, creator vs route) |137| Collections, activity | new | engine + UI (same tests) |138| Transfers | bandwidth cap | engine `bandwidthCapPacesUploadsAndDownloads` |139| Widgets | rendering looked at | UI `SystemUITests.testWidgetOnTheHomeScreen` (small « Récents » widget added to the simulator's home screen, capture `140`/`141`) |140| Share extension | exercised from Photos | UI `SystemUITests.testShareExtensionFromPhotos` (photo sent, verified on the server; captures `150`/`151`) |141| A 1.0 server | no 2.0 control shown | UI `Next2UITests.testA1ServerShowsNoNextControl` (capabilities forced to 1.0 in the app; the real 1.0 backend was not started again for this) |142
Files main
Menu

Theme