fix(tempo): fix EU base URL, trailing space in account ID, and tempo_synced tracking

Root causes found for Tempo worklogs never reaching Tempo:
1. Wrong API region: workspace is on api.eu.tempo.io/4 but code used api.tempo.io/4
   → Tempo returned "User is invalid" (400) for all POST /worklogs
2. Trailing space in jira_account_id stored in DB (now stripped with .strip())
3. tempo_synced field was never updated even on success (now set from Tempo response)

Fix: add tempo.base_url system_config key (admin-configurable without redeploy),
fall back to TEMPO_BASE_URL env-var, then global default. DB already updated with
https://api.eu.tempo.io/4 for this workspace.
This commit is contained in:
kitos
2026-05-28 12:48:22 +02:00
parent c0a0e1aa00
commit 18df271d07
3 changed files with 48 additions and 5 deletions
@@ -368,7 +368,11 @@ def _create_phase_worklog(
# duration so the Tempo entry is identical to the Aegis worklog.
try:
from app.services.tempo_service import auto_log_test_worklog
auto_log_test_worklog(db, test, user, activity_type, duration_seconds)
tempo_result = auto_log_test_worklog(db, test, user, activity_type, duration_seconds)
if tempo_result and isinstance(tempo_result, dict):
wl.tempo_synced = datetime.utcnow()
wl.tempo_worklog_id = str(tempo_result.get("tempoWorklogId", ""))
db.flush()
except Exception as e:
logger.warning("Tempo sync failed for worklog: %s", e, exc_info=True)