fix(tasks): skip duplicate check when reprocessing and enable retry from failed pipeline step

- Add file_id parameter to process_document to skip duplicate hash check on reprocess
- Pass file_id from reprocess_single_file and bulk_reprocess_files endpoints
- Extend retry-subtask endpoint to support pipeline steps (process_document,
  process_with_azure_document_intelligence, extract_metadata_with_gpt,
  embed_metadata_into_pdf) in addition to upload tasks
- Add retry button for failed main pipeline steps in file detail UI
- Add comprehensive tests for reprocessing and pipeline step retry

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-10 21:09:53 +00:00
parent 7c074c2755
commit 11c7d15a90
6 changed files with 484 additions and 58 deletions
+8 -2
View File
@@ -2,10 +2,12 @@
Tests for bulk file operations (delete and reprocess).
"""
from unittest.mock import MagicMock, patch
import pytest
from fastapi.testclient import TestClient
from app.models import FileRecord, ProcessingLog
from unittest.mock import patch, MagicMock
@pytest.mark.integration
@@ -94,7 +96,7 @@ class TestBulkOperations:
@patch("app.api.files.process_document")
def test_bulk_reprocess_success(self, mock_process_document, client: TestClient, db_session):
"""Test bulk reprocessing of files."""
"""Test bulk reprocessing of files passes file_id to skip duplicate check."""
# Setup mock
mock_task = MagicMock()
mock_task.id = "test-task-id"
@@ -125,6 +127,10 @@ class TestBulkOperations:
assert len(data["processed_files"]) == 2
assert len(data["task_ids"]) == 2
# Verify that file_id was passed to skip duplicate check
for call_args in mock_process_document.delay.call_args_list:
assert "file_id" in call_args.kwargs or len(call_args.args) > 1
@patch("app.api.files.process_document")
def test_bulk_reprocess_missing_files(self, mock_process_document, client: TestClient, db_session):
"""Test bulk reprocessing when some local files are missing."""