From d896f2761d3e3f426e5d2d8f45033bf88f78f93d Mon Sep 17 00:00:00 2001 From: kitos Date: Wed, 3 Jun 2026 09:08:40 +0200 Subject: [PATCH] fix(tempo): enforce 1-min minimum and ceiling rounding for worklogs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- backend/app/services/tempo_service.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend/app/services/tempo_service.py b/backend/app/services/tempo_service.py index a0acd21..7a1b1f4 100644 --- a/backend/app/services/tempo_service.py +++ b/backend/app/services/tempo_service.py @@ -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(