Skip to content

Conversation

@a-klos
Copy link
Member

@a-klos a-klos commented Feb 10, 2026

This pull request introduces several improvements and new features to the admin API library, focusing on enhanced document upload management, especially regarding cancellation and cleanup of in-progress uploads. The changes also include OpenAPI spec refinements, new abstract methods for upload cancellation, and corresponding implementation in the file uploader logic.

Key changes include:

API and OpenAPI Specification Enhancements

  • Updated openapi.yaml to OpenAPI 3.0.2, added detailed endpoint descriptions, improved schema examples, clarified required fields, and refined the structure for better documentation and validation. [1] [2]
  • Added .openapi-generator-ignore entries to prevent overwriting hand-maintained source files during code generation.

Upload Cancellation Support

  • Added cancel_upload abstract methods to both FileUploader and SourceUploader base classes, enabling a standard interface for upload cancellation by document identification. [1] [2]
  • Updated the delete_document endpoint logic to request cancellation of any in-progress file or source uploads before deleting the document, ensuring best-effort cleanup and preventing inconsistent states. [1] [2] [3]

File Uploader Implementation Updates

  • Implemented cancel_upload in DefaultFileUploader to mark uploads as cancelled in the key-value store and log the action, supporting both namespaced and non-namespaced document IDs.
  • Introduced UploadCancelledError exception to signal when a running upload is cancelled.
  • Improved upload task management: now tracks run IDs, ensures proper cleanup in case of errors or failed task starts, and integrates cancellation logic into the upload lifecycle.

These changes collectively make document deletion safer and more robust, improve API clarity, and lay the groundwork for better handling of concurrent or cancelled uploads.

- Introduced `cancel_upload` method in `FileUploader` and `SourceUploader` abstract classes.
- Implemented cancellation logic in `DefaultFileUploader` and `DefaultSourceUploader`.
- Updated `AdminApi` to request cancellation of uploads before document deletion.
- Enhanced `FileStatusKeyValueStore` to manage active and cancelled runs with Redis.
- Added tests to verify cancellation behavior during uploads and document deletions.
- Modified frontend to allow deletion of documents in PROCESSING state.
@a-klos a-klos merged commit f0bbe77 into main Feb 10, 2026
10 checks passed
@a-klos
Copy link
Member Author

a-klos commented Feb 10, 2026

fixed issue: #48

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.

2 participants