feat(ios): 7.1 wire-contract migration slice 1 — real routes, server-shaped models, desktop-format key wraps (#223) #230

Merged
amiryahaya merged 1 commit from feat/ios-wire-contract-slice1 into main 2026-11-19 08:58:59 +01:00
Owner

First slice of the iOS file-stack migration onto the pinned contract (golden fixtures, PR #229). Survey (recorded in #223) found the iOS file stack on ghost endpoints for most surfaces: non-root listing 404s, GET /files/{id} blocking all downloads, multipart field mismatches (always-400), File Provider extension on a nonexistent base URL, and plaintext-fallback uploads.

Server

  • NEW GET /api/files/{id} (FileDto) — access rules mirror DownloadFile exactly (uploader | folder owner | active file-/folder-level share; CLS-06 clearance re-check; cross-tenant 404); declared TenantScoped in the SEC-03 authz matrix. GetFileTests (3): owner 200 + shape, cross-tenant 404, shared-folder recipient 200.

iOS

  • Listing composes the real routes (/folders/{id} + /children + /files, {data} unwrapped); root keeps /folders/root/contents
  • Models decode the REAL FileDto/FolderDto: mime_type/content_type fallback, inserted_at/created_at fallback, is_folder defaulted, legacy folder pair optional; fractional-seconds-capable date parsing (server emits .162ms timestamps — bare ISO8601 silently degraded every row to 1970)
  • Upload: multipart fields corrected (encryption_algorithm, no key_nonce; root resolves /folders/root); DEK wrap now base64(keyNonce ‖ wrappedDEK) — the desktop wrap format, so the server's single-slot encrypted_file_key round-trips (download splits the 12-byte prefix)
  • GET /files/{id} metadata now drives the download flow (the ghost that blocked every download)
  • File Provider extension: base URL fixed (api*.failsulit.app/v1 never existed), real routes + envelope unwraps, PATCH rename (PUT was the chunk-complete state machine — a silent no-op), same folded key wrap
  • Ghost ops (move/copy/search) throw NotSupportedByServer or filter client-side (task 7.4 scope)

Test infrastructure

  • project.yml gains schemes with test targets — the generated TestAction had ZERO testables, so CI's xcodebuild test was vacuously green forever; iOS unit tests will run in CI for the first time
  • ModelTests fixtures rewritten to real server shapes (mirroring the goldens); never-compiled legacy test breaks fixed (delegate conformance +2 methods, keychain mock type drift)

Review: dual-pass (ponytail + correctness). Fixed: FP patch verb (was still PUT — silent rename no-op), flat rename-response decodes, fractional-seconds dates, algorithm key → encryption_algorithm, uploaded_by_id fallback, dead search removal. Deferred with rationale: shared FileAccess authz-helper extraction (verbatim duplication kept so the security-critical path diff stays minimal — tracked in #222 scope), M2 ciphertext-cache-on-auth-failure (pre-existing pattern), M3 same-tenant 403-vs-404 oracle (pre-existing stance).

Verification: server suite 1102 green (incl. GetFileTests + authz-matrix row); iOS app + FP + test targets compile (build-for-testing succeeded); iOS test EXECUTION blocked locally by a simulator service-hub limitation (freshly created device won't bless) — CI runners will execute them for the first time.

First slice of the iOS file-stack migration onto the pinned contract (golden fixtures, PR #229). Survey (recorded in #223) found the iOS file stack on ghost endpoints for most surfaces: non-root listing 404s, GET /files/{id} blocking all downloads, multipart field mismatches (always-400), File Provider extension on a nonexistent base URL, and plaintext-fallback uploads. **Server** - NEW `GET /api/files/{id}` (FileDto) — access rules mirror DownloadFile exactly (uploader | folder owner | active file-/folder-level share; CLS-06 clearance re-check; cross-tenant 404); declared TenantScoped in the SEC-03 authz matrix. GetFileTests (3): owner 200 + shape, cross-tenant 404, shared-folder recipient 200. **iOS** - Listing composes the real routes (`/folders/{id}` + `/children` + `/files`, `{data}` unwrapped); root keeps `/folders/root/contents` - Models decode the REAL FileDto/FolderDto: mime_type/content_type fallback, inserted_at/created_at fallback, is_folder defaulted, legacy folder pair optional; fractional-seconds-capable date parsing (server emits .162ms timestamps — bare ISO8601 silently degraded every row to 1970) - Upload: multipart fields corrected (encryption_algorithm, no key_nonce; root resolves /folders/root); DEK wrap now base64(keyNonce ‖ wrappedDEK) — the desktop wrap format, so the server's single-slot encrypted_file_key round-trips (download splits the 12-byte prefix) - GET /files/{id} metadata now drives the download flow (the ghost that blocked every download) - File Provider extension: base URL fixed (api*.failsulit.app/v1 never existed), real routes + envelope unwraps, PATCH rename (PUT was the chunk-complete state machine — a silent no-op), same folded key wrap - Ghost ops (move/copy/search) throw NotSupportedByServer or filter client-side (task 7.4 scope) **Test infrastructure** - project.yml gains schemes with test targets — the generated TestAction had ZERO testables, so CI's `xcodebuild test` was vacuously green forever; iOS unit tests will run in CI for the first time - ModelTests fixtures rewritten to real server shapes (mirroring the goldens); never-compiled legacy test breaks fixed (delegate conformance +2 methods, keychain mock type drift) **Review**: dual-pass (ponytail + correctness). Fixed: FP patch verb (was still PUT — silent rename no-op), flat rename-response decodes, fractional-seconds dates, algorithm key → encryption_algorithm, uploaded_by_id fallback, dead search removal. Deferred with rationale: shared FileAccess authz-helper extraction (verbatim duplication kept so the security-critical path diff stays minimal — tracked in #222 scope), M2 ciphertext-cache-on-auth-failure (pre-existing pattern), M3 same-tenant 403-vs-404 oracle (pre-existing stance). **Verification**: server suite 1102 green (incl. GetFileTests + authz-matrix row); iOS app + FP + test targets compile (build-for-testing succeeded); iOS test EXECUTION blocked locally by a simulator service-hub limitation (freshly created device won't bless) — CI runners will execute them for the first time.
feat(ios): 7.1 wire-contract migration slice 1 — real routes, server-shaped models, desktop-format key wraps (#223)
All checks were successful
Security CI / security-scan (pull_request) Successful in 2m32s
API CI / migrations (pull_request) Successful in 8m35s
API CI / build-and-test (pull_request) Successful in 14m21s
1dce02f6df
First slice of the iOS file-stack migration onto the pinned contract
(golden fixtures, PR #229). Survey found: ghost routes for every non-root
listing, GET /files/{id} blocking all downloads, wrong multipart field
names (400s), FP extension on a nonexistent base URL, and local-only
folder keys.

- Server: GET /api/files/{id} (FileDto) — access rules mirror
  DownloadFile (uploader/folder-owner/file-or-folder share, CLS-06
  re-check, cross-tenant 404). iOS download flow's prerequisite.
- FileRepositoryImpl: listing composes /folders/{id} + /children + /files
  ({data} unwrapped); root keeps /folders/root/contents; getFile uses the
  new endpoint; upload multipart fields corrected (drop key_nonce,
  algorithm → encryption_algorithm, root via /folders/root); the DEK wrap
  is now base64(keyNonce ‖ wrappedDEK) — the desktop wrap format, so
  server-side single-slot encrypted_file_key round-trips.
- Models: FileItem/Folder decode the REAL FileDto/FolderDto
  (mime_type/content_type fallback, inserted_at/created_at fallback,
  is_folder defaulted, legacy pair optional on FolderDto vs
  root-contents rows); encode(to:) added.
- Ghosts: move/copy/moveFolder now throw NotSupportedByServer (task 7.4);
  search becomes client-side filtering over the current listing.
- File Provider extension: base URL fixed (api*.failsulit.app/v1 never
  existed — every FP request failed), real routes + {data} unwraps,
  PATCH rename (PUT was the chunk-complete state machine), same folded
  key-wrap format.
- FailSulitTests target now actually RUNS: project.yml gains schemes with
  test targets (the generated TestAction had zero testables — CI's
  xcodebuild test was vacuously green forever); ModelTests fixtures
  rewritten to the real server shapes; pre-existing never-compiled test
  breaks fixed (mock delegate conformance, keychain mock types).
- KeychainManager note: LoginViewModel/DeepLink tests construct the real
  KeychainManager (the InvitationMockKeychainManager type drifted).

Verified: iOS app + extension + test targets all compile
(build-for-testing succeeds); server GetFileTests 3/3; ModelTests
execution blocked by a local simulator service-hub limitation (freshly
created device won't bless) — CI's runners execute them.
Sign in to join this conversation.
No description provided.