self-review (no-mistakes)

This commit is contained in:
Igor Loskutov
2025-12-16 22:59:56 -05:00
parent 67420d2ec4
commit 298abe8656
3 changed files with 8 additions and 6 deletions

View File

@@ -11,6 +11,7 @@ from typing import Literal, Union, assert_never
import celery
from celery.result import AsyncResult
from hatchet_sdk.clients.rest.exceptions import ApiException
from hatchet_sdk.clients.rest.models import V1TaskStatus
from reflector.db.recordings import recordings_controller
@@ -124,8 +125,8 @@ async def validate_transcript_for_processing(
return ValidationAlreadyScheduled(
detail="Hatchet workflow already running"
)
except Exception:
# If we can't get status, allow processing (workflow might be gone)
except ApiException:
# Workflow might be gone (404) or API issue - allow processing
pass
return ValidationOk(
@@ -244,8 +245,8 @@ async def dispatch_transcript_processing(
workflow_id=transcript.workflow_run_id,
)
return None
except Exception:
# If we can't get status, proceed with new workflow
except ApiException:
# Workflow might be gone (404) or API issue - proceed with new workflow
pass
workflow_id = await HatchetClientManager.start_workflow(

View File

@@ -109,7 +109,7 @@ async def process_transcript(
status = await HatchetClientManager.get_workflow_run_status(
transcript.workflow_run_id
)
print(f" Status: {status}", file=sys.stderr)
print(f" Status: {status.value}", file=sys.stderr)
if status == V1TaskStatus.COMPLETED:
print("Workflow completed successfully", file=sys.stderr)

View File

@@ -11,6 +11,7 @@ These tests verify:
from unittest.mock import AsyncMock, patch
import pytest
from hatchet_sdk.clients.rest.exceptions import ApiException
from hatchet_sdk.clients.rest.models import V1TaskStatus
from reflector.db.transcripts import Transcript
@@ -194,7 +195,7 @@ async def test_hatchet_validation_allows_when_status_check_fails():
) as mock_hatchet:
# Status check fails (workflow might be deleted)
mock_hatchet.get_workflow_run_status = AsyncMock(
side_effect=Exception("Workflow not found")
side_effect=ApiException("Workflow not found")
)
with patch(