From 4fdb1b8d85c43d51d7a703675e199fba4e121626 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 27 Feb 2026 16:39:32 +0000 Subject: [PATCH] fix: address code review feedback - restrict terminal step check to success only, add test assertions Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com> --- app/utils/file_status.py | 2 +- app/utils/step_manager.py | 2 +- tests/test_step_manager.py | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/utils/file_status.py b/app/utils/file_status.py index ab39c21d..75c84526 100644 --- a/app/utils/file_status.py +++ b/app/utils/file_status.py @@ -160,7 +160,7 @@ def get_files_processing_status(db: Session, file_ids: List[int]) -> Dict[int, D status = "completed" else: status = "pending" - elif terminal_step is not None and terminal_step.status in ("success", "skipped"): + elif terminal_step is not None and terminal_step.status == "success": # Terminal step succeeded but some intermediate steps are # still "pending" (dynamic pipeline artifacts). The file # is effectively complete. diff --git a/app/utils/step_manager.py b/app/utils/step_manager.py index e663d18e..9e4449a3 100644 --- a/app/utils/step_manager.py +++ b/app/utils/step_manager.py @@ -271,7 +271,7 @@ def get_file_overall_status(db: Session, file_id: int) -> Dict: status = "completed" else: status = "pending" - elif terminal_step_obj is not None and terminal_step_obj.status in ("success", "skipped"): + elif terminal_step_obj is not None and terminal_step_obj.status == "success": # The terminal step succeeded but some intermediate steps are still # "pending" (e.g. check_for_duplicates logged without file_id, or # extract_text not marked when OCR path was taken). The pipeline diff --git a/tests/test_step_manager.py b/tests/test_step_manager.py index 3611a990..2c3cdb47 100644 --- a/tests/test_step_manager.py +++ b/tests/test_step_manager.py @@ -339,6 +339,8 @@ class TestStepManager: # Terminal step hasn't run yet, so file should remain pending assert status["status"] == "pending" + assert status["has_errors"] is False + assert status["completed_steps"] == 3 def test_get_file_overall_status_failed(self, db_session: Session): """Test overall status for a file with failed steps."""