feat(desktop): align file stack with live API — listing, folders, upload, download (#207) #211

Merged
amiryahaya merged 1 commit from feat/desk-file-alignment into main 2026-11-16 19:29:02 +01:00
Owner

PR-D1a of the #207 align-then-adorn campaign (desktop half of dev-plan task 7.1 contract unification). Server contract PR #210 landed first — this is the client side.

Listing: real routes (root via GET /folders/root/contents; subfolders via GET /folders/{id}/files + /children + GET /folders/{id}), private serde DTOs mapped into the stable FileListResponse envelope — no UI churn. FileItem now carries level + the DEK-wrap triple.

Upload: the dead /files/upload-init/presigned/confirm flow replaced with multipart POST /api/folders/{folderId}/files — container streams as ref-counted Bytes (no 5 GB copy on retry), optional level_id override (F-CLS1), the 201 (with level) mapped to FileItem. The TS pre-encryption pass is deleted — its key args were silently ignored by Rust; Rust is the single crypto authority.

Download: GET /files/{id}/download raw stream (per-request 600s timeout, streamed size cap preserving the #20-sweep discipline); the TS decrypt-after-download pass is deleted; Rust decrypts in-command from the listed row metadata (DownloadMeta).

Folder keys: create_folder sends server field names (wrapped_kek / kem_ciphertext + owner duplicates) and unwraps the {data} envelope; folder-KEK resolution lives in services/folder_keys.rs — decapsulates the DTO string-column wraps, with a documented transitional fallback to derive_folder_kek for keyless folders (dev-plan 2.5 replaces it). Root GUID is resolved server-side (no literal "root" in GUID-constrained routes).

rename_item now hits PATCH /files/{id} or PATCH /folders/{id} with {name} — the old PUT /files/{id} call silently renamed nothing.

Tests: 7 Rust serde contract tests reusing #210's pinned JSON; tauri + fileStore vitest suites aligned to the new invoke shapes; cargo 68 green, vitest 1306 green, tsc clean.

Review: dual-pass done. Pass 2 found the timeout regression (fixed: per-request override), the streaming-cap gap (fixed), and rename hitting UpdateFile (fixed). Tracked follow-ups recorded on #207: move_item + storage-info dead routes, get_preview dead call (7.8).

Known accepted gaps (documented on #207): SQLite cache untouched (dead in live flow — user decision); sharing flow = next PR (D1b); E2EE chunked rows not downloadable yet (no DEK triple).

Related: #207, #158, #210.

PR-D1a of the #207 align-then-adorn campaign (desktop half of dev-plan task 7.1 contract unification). Server contract PR #210 landed first — this is the client side. **Listing**: real routes (root via GET /folders/root/contents; subfolders via GET /folders/{id}/files + /children + GET /folders/{id}), private serde DTOs mapped into the stable FileListResponse envelope — no UI churn. FileItem now carries level + the DEK-wrap triple. **Upload**: the dead /files/upload-init/presigned/confirm flow replaced with multipart POST /api/folders/{folderId}/files — container streams as ref-counted Bytes (no 5 GB copy on retry), optional level_id override (F-CLS1), the 201 (with level) mapped to FileItem. The TS pre-encryption pass is deleted — its key args were silently ignored by Rust; Rust is the single crypto authority. **Download**: GET /files/{id}/download raw stream (per-request 600s timeout, streamed size cap preserving the #20-sweep discipline); the TS decrypt-after-download pass is deleted; Rust decrypts in-command from the listed row metadata (DownloadMeta). **Folder keys**: create_folder sends server field names (wrapped_kek / kem_ciphertext + owner duplicates) and unwraps the {data} envelope; folder-KEK resolution lives in services/folder_keys.rs — decapsulates the DTO string-column wraps, with a documented transitional fallback to derive_folder_kek for keyless folders (dev-plan 2.5 replaces it). Root GUID is resolved server-side (no literal "root" in GUID-constrained routes). **rename_item** now hits PATCH /files/{id} or PATCH /folders/{id} with {name} — the old PUT /files/{id} call silently renamed nothing. **Tests**: 7 Rust serde contract tests reusing #210's pinned JSON; tauri + fileStore vitest suites aligned to the new invoke shapes; cargo 68 green, vitest 1306 green, tsc clean. **Review**: dual-pass done. Pass 2 found the timeout regression (fixed: per-request override), the streaming-cap gap (fixed), and rename hitting UpdateFile (fixed). Tracked follow-ups recorded on #207: move_item + storage-info dead routes, get_preview dead call (7.8). Known accepted gaps (documented on #207): SQLite cache untouched (dead in live flow — user decision); sharing flow = next PR (D1b); E2EE chunked rows not downloadable yet (no DEK triple). Related: #207, #158, #210.
feat(desktop): align file stack with live API — listing, folders, upload, download (#207)
Some checks failed
Security CI / security-scan (pull_request) Failing after 29s
Desktop CI / lint-and-test (pull_request) Successful in 3m1s
319c6386b8
D1a of the #207 align-then-adorn campaign (desktop half of dev-plan
task 7.1's contract unification):

Listing: list_files now speaks the real routes — root via
GET /folders/root/contents, subfolders via GET /folders/{id}/files +
/children (merged into the stable FileListResponse envelope, so the UI
contract is unchanged). Server DTOs parsed into private serde structs
(pinned by ContractPinningTests) and mapped into FileItem, which now
carries level + the DEK-wrap triple.

Upload: the dead /files/upload/init → presigned → /confirm flow is
replaced with multipart POST /api/folders/{folderId}/files — container
bytes stream as ref-counted Bytes (no 5 GB copy on retry), DEK wrap in
encrypted_file_key, nonce split into its own field, optional level_id
override (F-CLS1). The 201 (now with level) maps to FileItem. The TS
store's pre-encryption pass is deleted — its key args were silently
ignored by the Rust command; Rust is the single crypto authority.

Download: GET /files/{id}/download streams raw bytes via a new
api_client.get_raw; the TS-side decrypt-after-download pass is deleted
(getFileMetadata/decryptFile were dead-end calls); the Rust command
takes the listed row's metadata and decrypts in-command.

Folder keys: create_folder sends the server's field names (wrapped_kek,
kem_ciphertext + owner duplicates) and unwraps the {data} envelope;
get_folder_key decapsulates the DTO string-column wraps (the desktop's
own material round-trips) with a documented transitional fallback to
derive_folder_kek for keyless folders (the auto-created tenant root) —
replaced by proper folder-key distribution in dev-plan 2.5 (KEY-06).

Root GUID resolution happens server-side in the service (None →
GET /folders/root) — no more literal "root" in GUID-constrained routes.

Tests: 7 new Rust serde contract tests reuse the S1 pinned JSON text;
tauri/fileStore vitest suites updated to the aligned invoke shapes
(52/54 store tests, 62 service tests, full suite 1317 green);
typecheck clean.
amiryahaya force-pushed feat/desk-file-alignment from 319c6386b8
Some checks failed
Security CI / security-scan (pull_request) Failing after 29s
Desktop CI / lint-and-test (pull_request) Successful in 3m1s
to ff3912f838
Some checks failed
Security CI / security-scan (pull_request) Failing after 1m0s
Desktop CI / lint-and-test (pull_request) Successful in 16m48s
2026-11-16 16:53:27 +01:00
Compare
amiryahaya force-pushed feat/desk-file-alignment from ff3912f838
Some checks failed
Security CI / security-scan (pull_request) Failing after 1m0s
Desktop CI / lint-and-test (pull_request) Successful in 16m48s
to 67d500af0d
All checks were successful
Security CI / security-scan (pull_request) Successful in 4m14s
Desktop CI / lint-and-test (pull_request) Successful in 14m27s
2026-11-16 18:16:41 +01:00
Compare
Sign in to join this conversation.
No description provided.