Skip to content

Diffing sets doesn’t deep-diff #53

Description

@philippamarkovics

When diffing a set, i.e.

(ddiff/diff
 #{{:db/id 17592186065894
    :test "1"}}
 #{{:db/id 17592186065894
    :test "2"}
   {:db/id 13194139559179
    :db/txInstant #inst "2025-05-20T07:41:40.877-00:00"}})

the result is:

#{{:+
   {:db/id 13194139559179,
    :db/txInstant #inst "2025-05-20T07:41:40.877000000-00:00"}}
  {:+ {:db/id 17592186065894, :test "2"}}
  {:- {:db/id 17592186065894, :test "1"}}}

I would expect the result to be similar to a vector, i.e.

(ddiff/diff
 [{:db/id 17592186065894
   :test "1"}]
 [{:db/id 17592186065894
   :test "2"}
  {:db/id 13194139559179
   :db/txInstant #inst "2025-05-20T07:41:40.877-00:00"}])

produces:

[{:db/id 17592186065894, :test {:- "1", :+ "2"}}
 {:+
  {:db/id 13194139559179,
   :db/txInstant #inst "2025-05-20T07:41:40.877000000-00:00"}}]

Digging deeper, it looks like there is bug with set diffing in general:

I.e.

(ddiff/diff #{{:id 123 :foo :bar}} #{{:id 123 :foo :baz}})

produces:

#{{:+ {:id 123, :foo :baz}} {:- {:id 123, :foo :bar}}}

where using a vector produces:

[{:id 123, :foo {:- :bar, :+ :baz}}]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions