Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parse-map stop working when upgrade from 3.2.0 to 3.3.0 #289

Closed
zerg000000 opened this issue Oct 24, 2023 · 10 comments
Closed

parse-map stop working when upgrade from 3.2.0 to 3.3.0 #289

zerg000000 opened this issue Oct 24, 2023 · 10 comments
Assignees

Comments

@zerg000000
Copy link

zerg000000 commented Oct 24, 2023

in 3.2.0, it is using 3-arity enc/as-map, but in 3.3.0 it is now using as-map in taoensso.carmine which is 1-arity.

(defmacro parse-map [form & [kf vf]]

The code using parse-map works in 3.2.0 will failed in 3.3.0 with

(car/wcar {} (car/parse-map (car/hgetall "a") nil (fn [_ v] (parse-long v))))
;; => Wrong number of args (3) passed to: taoensso.carmine/as-map
@ptaoussanis ptaoussanis self-assigned this Oct 24, 2023
ptaoussanis added a commit that referenced this issue Oct 24, 2023
@ptaoussanis
Copy link
Member

@zerg000000 Hi Albert, thanks for the report and sorry about the trouble!

I've just pushed https://github.com/taoensso/carmine/releases/tag/v3.3.1 to Clojars with a hotfix 👍

@zerg000000
Copy link
Author

Thanks for your prompt reply!

@zerg000000
Copy link
Author

zerg000000 commented Oct 24, 2023

@ptaoussanis don't know what's getting wrong

(deftest test-as-map
  (is (= {:a 1 :b 2}
         (as-map ["a" "1" "b" "2"] 
                 (fn [k _] (keyword k)) 
                 (fn [_ v] (parse-long v)))))
  (is (= {"A" "1" "B" "2"}
         (as-map ["a" "1" "b" "2"] 
                 (fn [k _] (.toUpperCase k)))
         "keys should be converted to uppercase"))
  (is (= {:a 1 :b 2}
         (as-map ["a" "1" "b" "2"] :keywordize))
      "keys should be converted to keywords"))

FAIL in baba.processor-test/test-as-map (processor_test.clj:26)
Expected:
  {"A" "1", "B" "2"}
Actual:
  {"A" -"1" +"a", "B" -"2" +"b"}
  -{"A" "1", "B" "2"} +"keys should be converted to uppercase"

FAIL in baba.processor-test/test-as-map (processor_test.clj:30)
keys should be converted to keywords
Expected:
  {:a 1, :b 2}
Actual:
  {+"1" "a", +"2" "b", -:a 1, -:b 2}

ptaoussanis added a commit that referenced this issue Oct 24, 2023
@ptaoussanis
Copy link
Member

Ack, I had a stupid typo in the hotfix that I somehow missed 🤦

Should actually be fixed now in https://github.com/taoensso/carmine/releases/tag/v3.3.2, really sorry about!!

@dharrigan
Copy link

dharrigan commented Oct 24, 2023

Hi,

Just upgraded to 3.3.1 from 3.3.0 and I now get this:

class taoensso.carmine.protocol.Context cannot be cast to class taoensso.carmine.protocol.Context (taoensso.carmine.protocol.Context is in unnamed module of loader clojure.lang.DynamicClassLoader @2e95d163; taoensso.carmine.protocol.Context is in unnamed module of loader 'app'

Reverting to 3.3.0 for now.

Will try out 3.3.2

@ptaoussanis
Copy link
Member

ptaoussanis commented Oct 24, 2023

@dharrigan Hi David, that should be unrelated and sounds like you might have stale build artifacts. Please try running lein clean (or equivalent), or clearing out your project's target dir before retrying.

Edit to add for clarity: the typo in 3.3.1 shouldn't affect anyone that wasn't already broken by 3.3.0. I.e. the intended hotfix wasn't successful, but shouldn't introduce any other issues.

@dharrigan
Copy link

Interestingly, it builds from a clean CI environment each time.

However, will try. If it persists, I'll raise a separate issue.

-=david=-

@ptaoussanis
Copy link
Member

@dharrigan Fwiw I have seen various CI environments do build caching as a performance optimization. But yes, please do create a new issue in case you're still running into trouble!

@zerg000000
Copy link
Author

Thanks for the fix!

@dharrigan
Copy link

@ptaoussanis yup, seems like it was a build issue. Unable to reproduce. :-)

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

No branches or pull requests

3 participants