fix(tempo,evidence): fix SystemExit crash + evidence not shown in frontend
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
tempo: tempoapiclient raises SystemExit (BaseException) on API errors like
'User is invalid' 400 responses; except Exception never catches it, killing
the uvicorn worker and causing a 500. Wrap create_worklog() to intercept
BaseException and re-raise as RuntimeError so callers can catch it safely.
evidence: TestOut schema was missing red_evidences / blue_evidences fields.
The ORM model has evidences loaded via joinedload but they were never
serialized into the API response. Add both fields to TestOut and override
model_validate to split Test.evidences by team, injecting the backend-proxy
download_url for each one (/api/v1/evidence/{id}/file).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -70,15 +70,27 @@ def log_worklog(
|
||||
time_spent_seconds: int,
|
||||
description: str,
|
||||
) -> dict:
|
||||
"""Create a worklog entry in Tempo using *user*'s personal token."""
|
||||
"""Create a worklog entry in Tempo using *user*'s personal token.
|
||||
|
||||
Note: tempoapiclient raises SystemExit (not Exception) on API errors, so
|
||||
we intercept BaseException and re-raise as RuntimeError to keep it non-fatal.
|
||||
"""
|
||||
tempo = get_user_tempo_client(user)
|
||||
return tempo.create_worklog(
|
||||
accountId=author_account_id,
|
||||
issueId=jira_issue_id,
|
||||
dateFrom=date,
|
||||
timeSpentSeconds=time_spent_seconds,
|
||||
description=description,
|
||||
)
|
||||
try:
|
||||
return tempo.create_worklog(
|
||||
accountId=author_account_id,
|
||||
issueId=jira_issue_id,
|
||||
dateFrom=date,
|
||||
timeSpentSeconds=time_spent_seconds,
|
||||
description=description,
|
||||
)
|
||||
except Exception:
|
||||
raise
|
||||
except BaseException as exc:
|
||||
# tempoapiclient raises SystemExit on HTTP errors (e.g. 400 Bad Request).
|
||||
# SystemExit is a BaseException, not Exception, so convert it so callers
|
||||
# can catch it with the usual `except Exception` pattern.
|
||||
raise RuntimeError(f"Tempo API error: {exc}") from exc
|
||||
|
||||
|
||||
def auto_log_test_worklog(
|
||||
|
||||
Reference in New Issue
Block a user