|
329 | 329 | (is (= (str "Superseded-by: " bug-mid) (:command entry)))))) |
330 | 330 | (finally (close-and-cleanup! setup)))))) |
331 | 331 |
|
| 332 | +(deftest conflicting-closure-commands-apply-neither |
| 333 | + (testing "Superseded-by: and Duplicate-of: in one email contradict |
| 334 | + each other: neither applies (the winning close-reason would |
| 335 | + otherwise be arbitrated by closure-relation-rows order, an |
| 336 | + implementation detail the email does not control)." |
| 337 | + (let [{:keys [conn] :as setup} (fresh-conn)] |
| 338 | + (try |
| 339 | + (let [old-mid "<patch-old-c@x>" |
| 340 | + sup-mid "<patch-sup@x>" |
| 341 | + dup-mid "<patch-dup-c@x>" |
| 342 | + old-email (mk-email! conn old-mid "alice@x" #inst "2026-04-01") |
| 343 | + old-eid (mk-report! conn old-mid old-email :patch) |
| 344 | + sup-email (mk-email! conn sup-mid "alice@x" #inst "2026-04-02") |
| 345 | + _sup-eid (mk-report! conn sup-mid sup-email :patch) |
| 346 | + dup-email (mk-email! conn dup-mid "alice@x" #inst "2026-04-03") |
| 347 | + _dup-eid (mk-report! conn dup-mid dup-email :patch) |
| 348 | + cmd-eid (mk-email! conn "<cmd-conflict@x>" "alice@x" #inst "2026-04-04") |
| 349 | + cmd-email {:db/id cmd-eid |
| 350 | + :email/author-address "alice@x" |
| 351 | + :email/date-sent #inst "2026-04-04" |
| 352 | + :email/body-text (str "Superseded-by: " sup-mid "\n" |
| 353 | + "Duplicate-of: " dup-mid "\n")}] |
| 354 | + (commands/apply-commands! conn old-eid :patch cmd-email |
| 355 | + {} {} :direct nil) |
| 356 | + (let [after (d/pull (d/db conn) |
| 357 | + [:report/closed :report/close-reason] old-eid) |
| 358 | + rels (get-relations (d/db conn) old-eid)] |
| 359 | + (is (nil? (:report/closed after)) "report stays open") |
| 360 | + (is (nil? (:report/close-reason after)) "no close-reason") |
| 361 | + (is (empty? rels) "no relation posed"))) |
| 362 | + (finally (close-and-cleanup! setup)))))) |
| 363 | + |
332 | 364 | ;; --------------------------------------------------------------------------- |
333 | 365 | ;; Phase 4 (partial): Duplicate-of directive |
334 | 366 | ;; --------------------------------------------------------------------------- |
|
0 commit comments