SPB Git

Repository Public

AUDIT-iOS.md 15.1 KB

# SP Drive iOS / iPadOS — audit before 2.0, and where phase 1 leaves each feature

Audit date: 2026-11-19. Baseline = main at 570dd46 (1.0.0 (1), on TestFlight). Everything below was read in the code or observed by re-running the suites; nothing was measured on a real device (simulator only, iOS 27.0 simulators « SPDrive iPhone » and « SPDrive iPad », Xcode 27.2). The backend used is the throw-away instance on m5ma:8663 (branch native-clients, commit 7bd8972), never production.

# 1. Baseline, re-run on main before any change

Suite How Result on main
Engine (KitTests, Mac, real backend) Scripts/build.sh core 12 / 12 passed (17.6 s)
App-hosted (Tests, simulator iPhone) Scripts/build.sh test 6 / 6 passed (File Provider through the file system + 5 WebAuthn/name tests)
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).
Interface, iPad not re-run on main (the iPhone run alone took 12 min) —

The 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.

# Baseline measurements (cheap, repeatable)

Measure Method main (1.0) next (2.0 phase 1)
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
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)
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)

The same two test files were copied, unmodified, into a worktree of main to take the left column. Debug builds on a simulator on a Mac that was busy with other work: these numbers compare the two versions with each other; they say nothing about a real iPhone.

# 2. Feature by feature (state of main, then what phase 1 changed)

Legend — Impl.: in the code. Tested: by which suite. ◐ = partly. ✘ = absent.

Feature main: implemented main: tested (how) Incomplete / missing on main After phase 1
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)
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
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
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…)
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)
Favourites yes engine + UI — also offline through the journal (tested)
Tags missing (no tag in the 1.0 API used by the app) — — still missing: needs 2.0 endpoints (collections/tags) — phase 2
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
Trash yes, restore, purge online only engine + UI — unchanged
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
Portals (deposit links) full editor, submissions not tested by any suite no automated test unchanged, still untested
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
Devices (sessions) list + revoke (AccountScreen) no test — unchanged; the client now sends X-SPD-Client (2.0 contract §2)
Notifications local only, five families no test no push (documented) unchanged; the change listener has a notify hook for the 2.0 event stream
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…
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
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)
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 NSItemProviders — the extension's own UI is still not automated
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
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)
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
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
English missing (French only) — — see README « Reste à faire » — string catalog status stated there

# 3. What the new engine tests prove (all against m5ma:8663, Scripts/build.sh core)

Policy / behaviour Test (KitTests/EngineNextTests.swift)
Decision matrix (Wi-Fi only, Low Data Mode, Low Power Mode, battery, charging, unknown battery) policyMatrix (pure)
Backoff: exponential, capped at 60 s, jitter in [step/2, step] backoffGrowsIsCappedAndJittered (pure) + retriesBackOffExponentially… (three injected timeouts wait ≥ 3.5 s)
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)
Wi-Fi only on a cellular path, one-time exemption, request flags wifiOnlyHoldsTransfersOnCellularAndReleasesThemOnWiFi
A running transfer leaves the network when the path becomes cellular, keeps its server session runningTransferGoesBackToTheQueueWhenThePathBecomesCellular
Low Data Mode / Low Power Mode / low battery hold background work only; opening a held file promotes it lowDataModeLowPowerModeAndBatteryHoldBackgroundWorkOnly
User-initiated first, including pre-emption of a background transfer userInitiatedTransferTakesTheSlotOfABackgroundOne
Crash-safe: download finished while the app was dead is adopted, zero bytes fetched again downloadFinishedWhileTheAppWasDeadIsAdoptedNotFetchedAgain
Crash-safe: upload killed after block 1 of 3 continues in the same server session, 2 blocks sent uploadInterruptedByACrashResumesFromTheServersOffset
Selective offline consistent when items move, nested pins, unpin selectiveOfflineStaysConsistentWhenItemsMove
Offline-first: browse, search, open pinned, rename/move/create/favourite/upload, reconnect offlineFirstBrowseEditQueueThenReconnect
Conflict described on both sides, never overwritten, keep-mine keeps history, remote deletion conflictIsDescribedOnBothSidesAndNeverOverwrittenSilently
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)

# 4. Suites after phase 1

See docs/TESTS.md for the up-to-date table (counts and dates of the last runs).

# 5. Cold launch

main: 0.757 s average (5 launches, 3.7 % relative standard deviation). next: 0.742 s on the iPhone simulator (2.8 %), 0.756 s on the iPad simulator (0.3 %). Within noise of each other: the widget extension, the new shells and the policy wiring add nothing measurable to the launch. testExplorerEndToEnd, which failed on main, passes on next (iPhone and iPad); the step that failed (share-link sheet) was not deliberately changed, so this is recorded as an observation, not as a fix.

# 6. Background transfers: what is verified and what iOS does not guarantee

Kept: one background URLSession (ai.spboucher.spdrive.ios.transfers), block uploads from files, downloads with resume data, application(_:handleEventsForBackgroundURLSession:) → BackgroundSession.setSystemCompletion → AppModel.start().

Verified in phase 1 (with a scripted driver that behaves like the system: results delivered at start, no active task):

  • results of steps that finished while the process was not running are handled before the queue is read again, and are adopted;
  • transfers recorded as running that the system no longer holds go back to the queue with their partial file / server session; with the real background session this happens after a 2-second grace period, because late results may still arrive;
  • requests carry allowsExpensiveNetworkAccess / allowsCellularAccess / allowsConstrainedNetworkAccess from the policy, so the system itself refuses an excluded path while the app is suspended.

Not verified (needs a real device, and cannot be forced): the system actually relaunching the app for session events; a transfer continuing across a device lock, a reboot, or a force-quit.

What iOS does not guarantee, and the app does not promise:

  • when a background transfer runs — the system schedules it by battery, network, thermal state and how often the app is used;
  • that the app is relaunched at all after the user force-quits it from the app switcher (background sessions are cancelled then);
  • that a block upload survives a long suspension: the server-side session stays open, the block is sent again from the server's offset;
  • BGAppRefreshTask / BGProcessingTask timing — they are requests, not appointments;
  • continuous progress reporting while suspended: the transfer centre shows the state at the last moment the app ran (the widget says « tel que l’app l’a vu en dernier » for the same reason);
  • uploads are chunked through the API between blocks: after each block the app must run briefly to hand over the next one. If iOS does not wake the app, the upload pauses between two blocks and continues at the next launch. This is a consequence of the resumable protocol (one request per block) and is the main limit of background uploads in this design.

# 7. After phase 2 (2026-11-19, 2.0 backend)

Rows of §2 that changed since phase 1:

Feature After phase 2 Tested by
Search names + content with highlighted passages; « by meaning » toggle engine contentSearchTags… (content hit, snippet runs); UI Next2UITests.testSearchAsk…
Tags create / apply / delete on a file engine (same test); UI (same test, tag created in the app and checked on the server)
Versions timeline, restore keeps every version, compare engine (restore: 3 versions, same hash as the restored one); UI (text diff summary)
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…
Storage server-side overview, drill-down, duplicates engine (overview, folder, exact duplicates call); UI (overview screen)
Devices platform and app version from X-SPD-Client engine serverAnnounces…; UI (« SP Drive 2.0.0 » on the current device)
Notifications / changes server event stream, polling fallback engine eventStreamBringsAChange… (live stream, unreachable stream, stream cut while live)
SP Drive AI ask, citations, picker, consent, suggestions engine askAnswersFromRetrievedPassages… — fake model; UI (answer, citation, creator vs route)
Collections, activity new engine + UI (same tests)
Transfers bandwidth cap engine bandwidthCapPacesUploadsAndDownloads
Widgets rendering looked at UI SystemUITests.testWidgetOnTheHomeScreen (small « Récents » widget added to the simulator's home screen, capture 140/141)
Share extension exercised from Photos UI SystemUITests.testShareExtensionFromPhotos (photo sent, verified on the server; captures 150/151)
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)
Files main
Menu

Theme