---
phase: 05-cloud-storage-backends
plan: 12
status: complete
completed: 2026-05-30
---

# Plan 05-12 Summary — UAT Gap Closure

## What Was Built

Closed 3 UAT gaps from Phase 5 testing:

**Task 1 — Pre-flight config validation in oauth_initiate (backend/api/cloud.py)**
- Added config checks before entering OAuth library code for both providers
- `GET /api/cloud/oauth/initiate/google_drive` with empty `GOOGLE_CLIENT_ID`/`SECRET` → 400 with env-var hint
- `GET /api/cloud/oauth/initiate/onedrive` with empty `ONEDRIVE_CLIENT_ID`/`SECRET` → 400 with env-var hint
- Existing MSAL / google-auth flows unchanged when credentials are present
- Added 2 new tests in `backend/tests/test_cloud.py`; fixed 2 existing tests that needed credential monkeypatching

**Task 2 — 502 fallback in stream_document_content + celery-worker volume mount**
- Added broad `except Exception → 502` clause after the existing `except CloudConnectionError → 503` in `stream_document_content`
- Cloud backend runtime errors now return a user-friendly "Cloud backend unreachable" message instead of an opaque 500
- Added `volumes: - ./backend:/app` to celery-worker in `docker-compose.yml` — code changes now reflected via `docker compose restart celery-worker` without a full rebuild
- Added 1 new test `test_stream_document_content_cloud_backend_error` in `backend/tests/test_documents.py`

**Task 3 — Upload hint in CloudStorageView (frontend/src/views/CloudStorageView.vue)**
- Added `<p>` hint below the connections list: "To upload files, navigate into a cloud folder first."
- Hint only visible when `connections.length > 0` (not on empty state)
- No DropZone added (no cloud folder context available at this level)

## Key Files Modified

- `backend/api/cloud.py` — pre-flight config checks in oauth_initiate
- `backend/api/documents.py` — broad 502 except-clause in stream_document_content
- `docker-compose.yml` — volume mount for celery-worker
- `frontend/src/views/CloudStorageView.vue` — upload hint paragraph
- `backend/tests/test_cloud.py` — 2 new pre-flight tests; 2 existing tests patched
- `backend/tests/test_documents.py` — 1 new 502 path test

## Test Results

- `pytest tests/test_cloud.py::test_oauth_initiate_google_drive_not_configured` ✅ PASS
- `pytest tests/test_cloud.py::test_oauth_initiate_onedrive_not_configured` ✅ PASS
- `pytest tests/test_documents.py::test_stream_document_content_cloud_backend_error` ✅ PASS
- `pytest -v` — 293 passed, 1 pre-existing failure (test_extract_docx / missing module), 5 skipped, 24 xfailed
- `npm run build` — ✅ clean exit

## Self-Check: PASSED

All acceptance criteria met. Zero new test failures introduced.
