From 9c96d05c695f59a55cd994dae24a6cfac934c1a4 Mon Sep 17 00:00:00 2001 From: Damien Chomat Date: Tue, 10 Feb 2026 22:46:51 +0100 Subject: [PATCH] fix: /PUT state not following spec with 409 - Conflict --- .../lrs/pedestal/routes/documents.cljc | 46 ++++++++++--------- src/test/com/yetanalytics/lrs_test.clj | 40 ++++++++++++++++ 2 files changed, 64 insertions(+), 22 deletions(-) diff --git a/src/main/com/yetanalytics/lrs/pedestal/routes/documents.cljc b/src/main/com/yetanalytics/lrs/pedestal/routes/documents.cljc index ef76b19..cd67e66 100644 --- a/src/main/com/yetanalytics/lrs/pedestal/routes/documents.cljc +++ b/src/main/com/yetanalytics/lrs/pedestal/routes/documents.cljc @@ -306,17 +306,18 @@ lrs ctx auth-identity params))] - (if (and (or - ;; In 2.0, no headers ok for no doc - (= "2.0.0" - (:com.yetanalytics.lrs/version ctx)) - ;; prior tests seem to want this for everything but - ;; profiles - (not (#{:xapi.activities.profile.PUT.request/params - :xapi.agents.profile.PUT.request/params} - params-type))) - (not (:error doc-res)) - (nil? (:document doc-res))) + (if (and (not (:error doc-res)) + (or + ;; State resources are exempt from concurrency + ;; header requirements in all xAPI versions + (= :xapi.activities.state.PUT.request/params + params-type) + (and (nil? (:document doc-res)) + (or (= "2.0.0" + (:com.yetanalytics.lrs/version ctx)) + (not (#{:xapi.activities.profile.PUT.request/params + :xapi.agents.profile.PUT.request/params} + params-type)))))) (put-response ctx (a/