QA Batch (15 Oct): Smarter Downloads, Document Activity Log, Client Badges & Reliable PDF Preview
Executive summary
A QA batch promotion bundling several document and mail improvements: single-file vs. zip downloads now behave intelligently (including handling of nested zip archives), document detail pages show a live activity/audit log loaded from the API, folder selectors display client/subclient name badges for clearer routing, and PDF previews now render through a more reliable browser viewer. It also includes internal refactors of the document viewer and resolution-center layouts. This change reached the QA/testing environment.
Why this was needed
Downloading was previously done by opening file URLs directly in the browser, which gave no progress feedback, could zip a single file unnecessarily, and didn't cleanly handle archives that contained other archives. Document detail pages also lacked a visible history of who changed what, folder pickers gave no client context (making misrouting easy in multi-client setups), and the prior PDF preview embed was inconsistent across browsers.
Client / user impact
- Selecting one file downloads that file directly; multiple files are bundled into a single well-named zip, with loading state and clear success/error messages.
- Nested zips are unpacked and reorganized into a clean folder structure containing only PDFs, with duplicate file/folder names automatically de-duplicated.
- Document detail pages now display a paginated activity log (action, user, timestamp) that loads more entries as you scroll.
- Folder/move-to dropdowns show a client or subclient name badge next to each folder, reducing misrouting in multi-client accounts.
- PDF previews load more reliably across browsers and hide the extra viewer controls.
Technical scope
Bundled feature PRs (per commits): #601 folder client badges, #604 document activity logs, #602 mail/document download improvements.
- Downloads (
download.mutations.ts, +250/-43): added single-file direct download vs. zip-for-many logic, nested-zip extraction, PDF-only filtering, filename/folder sanitization (path-traversal guards), andensureUniqueFileName/ensureUniqueFolderNamede-duplication; centralized user-facing messages. - Activity log: new
getDocumentActivityservice hitting/v1/activity-logs/Document/{id}, auseGetDocumentActivityinfinite query,activity-log.tsconstants, andDocumentActivityLog/Responsetypes; rewireddocument-activity.tsx(+325/-31). - Client badges: new
folderBadge.ts(deriveFolderBadgeLabel, subclient-then-client priority) wired intomultiple-selector.tsxvia abadgeLabeloption key. - PDF preview:
PDFViewerCorenow embeds via Google Docs gview (docs.google.com/gview?embedded=true&url=...). - Refactors: extracted
DocumentDetailsTabs+use-document-viewerhook +document-viewer.tsconstants; newDocumentPreviewPanel; slimmedMetadataTabandResolutionDetailsTab; removed individual download fromBatchActions. - Docs:
.gemini/styleguide.mdandAGENTS.mdcoding-standard updates (non-functional).
Risk & mitigation
Moderate, mitigated by the QA gate. The biggest dependency is the PDF preview switch to the Google Docs viewer, which routes the signed file URL through a third-party Google endpoint and requires the document to be publicly fetchable by Google; this can fail for access-restricted/large files and has data-handling implications worth confirming with stakeholders. The download rework changes core behavior across mail, document, batch, and resolution-center surfaces, and the activity log depends on the backend /v1/activity-logs endpoint returning the expected paginated shape. Refactors are large but behavior-preserving.
QA validation focus
- Download a single file (verify direct download, correct name, no zip) and multiple files (verify one zip, correct naming, loading + success/error toasts).
- Download a selection containing zip archives; confirm nested PDFs are extracted into folders with no name collisions and non-PDFs excluded.
- Open a document's activity tab; confirm logs load, scroll-to-load-more works, and timestamps/users render correctly.
- Open folder/move-to selectors across clients; verify the client/subclient badge shows the right label.
- Preview PDFs of varying size and access level; confirm they render reliably and behave for restricted files.
- Regression-check document detail, resolution-center (document & mail), and batch detail pages after the layout refactors.