fix(tempo): enforce 1-min minimum and ceiling rounding for worklogs
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled

Tempo rejects durations under 60 seconds ('Duration must be at least
one minute'). Now:
  - Always send ≥ 60 s (1 minute minimum)
  - Round UP to nearest whole minute (math.ceil)
  - 2 s → 60 s, 3m20s (200s) → 240 s, 5m00s (300s) → 300 s
This commit is contained in:
kitos
2026-06-03 09:08:40 +02:00
parent 2bbc65993c
commit d896f2761d

View File

@@ -164,6 +164,14 @@ def auto_log_test_worklog(
)
return None
# Tempo requires whole minutes. Always round UP to the nearest minute
# and enforce a minimum of 60 seconds (1 minute).
# 2 seconds → 60 s (1 min, minimum)
# 3 min 20 s (200s) → 240 s (4 min, ceiling)
# 5 min 0 s (300s) → 300 s (5 min, exact)
import math
duration_seconds = max(60, math.ceil(duration_seconds / 60) * 60)
# Per-user token required
if not has_tempo_configured(user):
logger.debug(