From 381eec07e260489ee83ce6dfd3135096a29b0a37 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 16 Sep 2026 18:50:00 +0000 Subject: [PATCH] :bug: Fix flaky heartbeat throttle test on same-millisecond writes Submit and heartbeat can land in the same millisecond, which made the strict modified-at > created-at assertion fail intermittently. Backdate modified-at before the first heartbeat so the write is always observable, keeping the strict comparison. AI-assisted-by: muse-spark-1.3-contributor --- backend/test/backend_tests/jobs_test.clj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/test/backend_tests/jobs_test.clj b/backend/test/backend_tests/jobs_test.clj index db6c9f646e..8f51e5d523 100644 --- a/backend/test/backend_tests/jobs_test.clj +++ b/backend/test/backend_tests/jobs_test.clj @@ -256,6 +256,10 @@ ::jobs/params (make-params)})] (t/testing "first heartbeat writes" + ;; Backdate modified-at: submit and heartbeat can land in the same + ;; millisecond, which would make a strict > assertion flaky. + (th/db-update! :job {:modified-at (ct/in-past {:seconds 5})} + {:id job-id}) (jobs/heartbeat! cfg job-id) (let [row (jobs/get-job cfg job-id)] (t/is (> (inst-ms (:modified-at row)) (inst-ms (:created-at row))))))