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>
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user