Skip to content

feat: implement bulk document management and fix upload pipeline#526

Open
riyapetle wants to merge 6 commits into
param20h:devfrom
riyapetle:RiyaCommits
Open

feat: implement bulk document management and fix upload pipeline#526
riyapetle wants to merge 6 commits into
param20h:devfrom
riyapetle:RiyaCommits

Conversation

@riyapetle

Copy link
Copy Markdown

🚀 Overview
This PR introduces a highly requested Bulk Document Management feature, including a new Recycle Bin (Trash) system for safe recovery of deleted files. It also resolves critical backend issues related to background task ingestion, dependency conflicts, and development hot-reloading that were causing document uploads to hang and crash.

✨ Features & Enhancements

  1. Bulk Document Operations (Frontend & Backend)
    Checkbox Selection: Added interactive checkboxes alongside documents in the DocumentSidebar, visible on hover.
    Bulk Action Bar: Implemented a slide-up Bulk Actions Bar that dynamically appears when documents are selected, allowing for multi-select deletion.
    New API Endpoints: Added /bulk-delete, /restore, and /permanent-delete POST endpoints to the FastAPI backend to handle arrays of document IDs securely.
  2. Recycle Bin / Soft Deletes
    Active vs Trash Views: Built a toggle tab in the sidebar allowing users to seamlessly switch between "Active" documents and the "Recycle Bin".
    Safe Restoration: Added functionality to restore soft-deleted documents back to the Active view.
    Permanent Deletion: Added permanent deletion actions that safely remove the file from the disk and purge the associated vector embeddings from ChromaDB.
    🐛 Bug Fixes
  3. Fixed "502 Bad Gateway" Upload Crashes
    Dependency Conflict: Resolved an underlying conflict between python-magic and python-magic-bin on Windows which caused the backend Python process to crash silently during MIME-type validation.
    Uvicorn Hot-Reload Loop: Updated the Makefile dev-backend command to use --reload-dir app instead of an ambiguous exclude glob. This prevents Uvicorn from infinitely restarting mid-upload when files are written to the ./data/uploads/ directory.
  4. Fixed Infinite Upload Loading Times
    Bypassed Celery for Local Dev: Removed the blocking process_document.delay() Celery queue check during uploads. By routing directly to FastAPI's built-in BackgroundTasks, uploads now instantly return a 202 Accepted response while processing happens asynchronously.
  5. Fixed 404 Routing Conflicts
    Route Precedence: Repositioned the GET /trash endpoint above the GET /{document_id} wildcard route in documents.py to prevent FastAPI from mistaking "trash" for a document ID.
    🧪 How to Test
    Launch both the Next.js frontend and the FastAPI backend.
    Upload multiple PDF files (notice how fast it uploads now without timing out).
    Hover over documents in the sidebar and check the boxes.
    Click Delete on the Bulk Actions bar to soft-delete them.
    Toggle to the Recycle Bin tab at the top of the sidebar.
    Select documents in the Trash and verify that you can Restore them or delete them Forever.
Screenshot 2026-06-08 003630 Screenshot 2026-06-08 003644

closes #422

@riyapetle riyapetle requested a review from param20h as a code owner June 7, 2026 19:17
param20h
param20h previously approved these changes Jun 7, 2026
@param20h

param20h commented Jun 7, 2026

Copy link
Copy Markdown
Owner

CI checks chck them and update @riyapetle

@riyapetle

Copy link
Copy Markdown
Author

Hey @param20h, I have fixed the TypeScript/linting errors and pushed the updates. Could you please approve the workflows to run the CI checks again?

param20h
param20h previously approved these changes Jun 11, 2026
@param20h

Copy link
Copy Markdown
Owner

solveee

param20h
param20h previously approved these changes Jun 11, 2026
@param20h

Copy link
Copy Markdown
Owner

ci chcks failing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(ui): Implement multi-select soft deletion and restoration of documents

2 participants