leiningen

Tanner Emerson 2025-08-19T17:53:09.889199Z

Would someone be able to help us track down what we believe is in issue with the way #inst is being interpreted?

gaverhae 2025-08-20T11:23:46.568939Z

Last time I had a weird bug like that, it was because I had inadvertently modified a jar file under ~/.m2 (using Vim -> jump to definition on a library function opens up the JAR, saving modifies the zip file in-place), so I'd try rm -rf ~/.m2/repository and see if that fixes it.

👀 1
gaverhae 2025-08-20T11:26:28.632209Z

(Or mv ~/.m2/repository ~/m2-backup or the like if you want to be able to investigate further.)

Tanner Emerson 2025-08-20T13:18:16.770589Z

Clearing my ~/.m2/repository and rerunning the repl worked. I am almost certain it was vim jump to definition as I regularly peek. I need to be much more careful when doing so. Unfortunately, I didn’t backup as I got to fixated on your first message. 🤦

Tanner Emerson 2025-08-20T13:22:54.413249Z

Thank you so much everyone for jumping in to help, I greatly appreciate it!

gaverhae 2025-08-20T13:24:17.563309Z

Opening to peek, and sometimes even changing the code and eval-ing the new version, are very powerful and useful tools. But, yeah, the habit of :wq! for closing a file can be a bit of a hindrance here.

Tanner Emerson 2025-08-19T17:53:30.270749Z

On my laptop

$ lein repl
Warning: environ value /opt/homebrew/opt/openjdk/libexec/openjdk.jdk/Contents/Home for key :java-home has been overwritten with /opt/homebrew/Cellar/openjdk/24.0.2/libexec/openjdk.jdk/Contents/Home
INFO  2025-08-19 11:45:59,627-0600 [main] org.eclipse.jetty.util.log: Logging initialized @11935ms to org.eclipse.jetty.util.log.Slf4jLog
nREPL server started on port 56432 on host 127.0.0.1 - 
REPL-y 0.5.1, nREPL 1.0.0
Clojure 1.11.1
OpenJDK 64-Bit Server VM 24.0.2
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

smarts.core=> (def a #inst "2024-10-10T00:00:01.000Z")
#'smarts.core/a
smarts.core=> (= a #inst "2024-10-10T00:00:01.000Z")
false

Tanner Emerson 2025-08-19T17:53:37.690849Z

On my coworkers laptop

$ lein repl
Warning: environ value /opt/homebrew/opt/openjdk/libexec/openjdk.jdk/Contents/Home for key :java-home has been overwritten with /opt/homebrew/Cellar/openjdk/24.0.2/libexec/openjdk.jdk/Contents/Home
INFO  2025-08-19 10:32:07,426-0700 [main] org.eclipse.jetty.util.log: Logging initialized @6525ms to org.eclipse.jetty.util.log.Slf4jLog
nREPL server started on port 50151 on host 127.0.0.1 - 
REPL-y 0.5.1, nREPL 1.0.0
Clojure 1.11.1
OpenJDK 64-Bit Server VM 24.0.2
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

smarts.core=> (def a #inst "2024-10-10T00:00:01.000Z")
#'smarts.core/a
smarts.core=> (= a #inst "2024-10-10T00:00:01.000Z")
true

Tanner Emerson 2025-08-19T17:54:00.830349Z

Tanner Emerson 2025-08-19T17:55:15.829389Z

This irregularity is causing issues with my ability to run our unit tests 😬

dpsutton 2025-08-19T17:57:10.072329Z

what is (type a) on each machine?

👀 1
Tanner Emerson 2025-08-19T17:57:12.104929Z

Just tried the same thing with clj

$ clj
Clojure 1.11.1
user=>  (def a #inst "2024-10-10T00:00:01.000Z")
#'user/a
user=> a
#inst "2024-10-10T00:00:01.000-00:00"
user=> (= a #inst "2024-10-10T00:00:01.000Z")
true
user=>

dpsutton 2025-08-19T17:57:53.605649Z

wild hunch: there’s something in the profiles.clj that adds something that helpfully installs some kind of java-time class for the #inst reader tag

Tanner Emerson 2025-08-19T18:00:10.952639Z

On both machines

smarts.core=> (type a)
java.util.Date

dpsutton 2025-08-19T18:06:08.246429Z

i’d try to start removing layers

(let [a (clojure.instant/read-instant-date "2024-10-10T00:00:01.000Z")
      b (clojure.instant/read-instant-date "2024-10-10T00:00:01.000Z")]
  (= a b))
true
then what about comparing manually constructed j.u.dates? is it clojure or the jvm? if the jvm, is it possibly down to some weird timezone issues?

Alex Miller (Clojure team) 2025-08-19T18:08:38.384209Z

I would definitely compare your System properties in the two contexts

Alex Miller (Clojure team) 2025-08-19T18:10:21.339559Z

user.timezone

Alex Miller (Clojure team) 2025-08-19T18:12:15.408989Z

check if *data-readers* has any extra bindings

Alex Miller (Clojure team) 2025-08-19T18:16:33.116649Z

something like (pprint (bean #inst "2024-10-10T00:00:01.000-00:00")) might help reveal the underlying fields better too.

Tanner Emerson 2025-08-19T18:16:52.435319Z

Here is some **perhaps interesting context

smarts.core=> (def a #inst "2024-10-10T00:00:01.000Z")
#'smarts.core/a
smarts.core=> (clojure.test/is (= a #inst "2024-10-10T00:00:01.000Z"))

FAIL in () (form-init18247573092840804319.clj:1)
expected: (= a Wed)
  actual: (not (= #inst "2024-10-10T00:00:01.000-00:00" Wed))
false

dpsutton 2025-08-19T18:17:52.685329Z

where did Wed come from

dpsutton 2025-08-19T18:19:24.021909Z

recreate the (= a #inst) thing and then throw each one through bean and see if you get anything?

(bean (clojure.instant/read-instant-date "2024-10-10T00:00:01.000Z"))
{:day 4,
 :date 10,
 :time 1728518401000,
 :month 9,
 :seconds 1,
 :year 124,
 :class java.util.Date,
 :timezoneOffset 0,
 :hours 0,
 :minutes 0}

Tanner Emerson 2025-08-19T18:19:34.587939Z

I got the same result for

(let [a (clojure.instant/read-instant-date "2024-10-10T00:00:01.000Z")
      b (clojure.instant/read-instant-date "2024-10-10T00:00:01.000Z")]
  (= a b))
Our data-readers match my bean
smarts.core=> (pprint (bean #inst "2024-10-10T00:00:01.000-00:00"))
{:class clojure.lang.Symbol, :name "Wed", :namespace nil}
my coworkers bean
smarts.core=> (pprint (bean #inst "2024-10-10T00:00:01.000-00:00"))
{:day 3,
 :date 9,
 :time 1728518401000,
 :month 9,
 :seconds 1,
 :year 124,
 :class java.util.Date,
 :timezoneOffset 420,
 :hours 17,
 :minutes 0}

Tanner Emerson 2025-08-19T18:23:15.631099Z

smarts.core=> (clojure.test/is (= (bean a) (bean #inst "2024-10-10T00:00:01.000-00:00")))

FAIL in () (form-init18247573092840804319.clj:1)
expected: (= (bean a) (bean Wed))
  actual: (not (= {:day 3, :date 9, :time 1728518401000, :month 9, :seconds 1, :year 124, :class java.util.Date, :timezoneOffset 360, :hours 18, :minutes 0} 
                  {:class clojure.lang.Symbol, :name "Wed", :namespace nil}))
false
smarts.core=>

dpsutton 2025-08-19T18:24:25.699249Z

well thats really weird

2025-08-19T19:17:49.403659Z

you can put a breakpoint on java.util.Date equals method with IntelliJ if you have it around and check from there

dpsutton 2025-08-19T19:18:35.635839Z

{:class clojure.lang.Symbol, :name "Wed", :namespace nil} i think that’s too late in the process. Whatever is going on here seems very strange to me

2025-08-19T19:20:15.501439Z

what is the difference between your (.getTime a) and (.getTime #inst "2024-10-10T00:00:01.000Z")

Tanner Emerson 2025-08-19T19:20:28.693449Z

fwiw, I just created a new empty lein project and the type correctly resolves to Date

inst-test.core=> (type #inst "2024-10-10T00:00:01.000-00:00")
java.util.Date
as opposed to
smarts.core=> (type #inst "2024-10-10T00:00:01.000-00:00")
clojure.lang.Symbol

2025-08-19T19:21:41.556329Z

oh, I missed that

dpsutton 2025-08-19T19:22:30.887289Z

smarts.core=> (type a)
java.util.Date
so you are getting the type is a Symbol. This pushes me back to someone is messing with your data-readers like Alex said above

Tanner Emerson 2025-08-19T19:43:20.295109Z

Given the troubleshooting we have gone through here, I think this succinctly captures the behavior I am seeing.

smarts.core=> (def a #inst "2024")
#'smarts.core/a
smarts.core=> (type a)
java.util.Date
smarts.core=> (type #inst "2024")
clojure.lang.Symbol
Thank you all for the help. I will circle back if/when I find something.

dpsutton 2025-08-19T19:43:57.189829Z

can you give the output of evaluating *data-readers* ?

Tanner Emerson 2025-08-19T19:45:13.280359Z

{cheshire/json #'cheshire.core/generate-string, clj-time/date-time #'clj-time.coerce/from-string}

2025-08-19T19:46:44.277089Z

Sounds like neepl middle somewhere is doing something funky

2025-08-19T19:47:23.162989Z

Like call str on a Date object, then calling read on the result, which is producing the symbol Wed

Alex Miller (Clojure team) 2025-08-19T19:47:31.163589Z

maybe look at ~/.lein/profiles.clj ?

Tanner Emerson 2025-08-19T19:48:47.327229Z

➜  ~ cat ~/.lein/profiles.clj
{:user {:plugins []}}

2025-08-19T19:49:05.672419Z

user=> (str (java.util.Date.))
"Tue Aug 19 12:48:01 PDT 2025"
user=> (read-string (str (java.util.Date.)))
Tue
user=>

💯 1
2025-08-19T19:50:30.441549Z

Do you have a custom print method defined for java.util.Date?

dpsutton 2025-08-19T19:52:34.821019Z

(get (methods print-method) java.util.Date)
#object[clojure.tools.reader.default_data_readers$fn__4647 0x201fc361 "clojure.tools.reader.default_data_readers$fn__4647@201fc361"]

dpsutton 2025-08-19T19:52:49.742159Z

and similarly for (get (methods print-dup) java.util.Date) (that’s an excellent idea)

dpsutton 2025-08-19T19:53:19.302039Z

(read-string (str #inst "2024-10-10"))
Wed
that’s super good sleuthing

dpsutton 2025-08-19T19:54:44.350929Z

if you do (require 'clojure.instant :reload) does it fix it?

dpsutton 2025-08-19T19:55:11.200059Z

hoping to restore these

(defmethod print-method java.util.Date
  [^java.util.Date d, ^java.io.Writer w]
  (print-date d w))

(defmethod print-dup java.util.Date
  [^java.util.Date d, ^java.io.Writer w]
  (print-date d w))

Tanner Emerson 2025-08-19T20:02:21.068089Z

=> (get (methods print-dup) java.util.Date)
#object[clojure.tools.reader.default_data_readers$eval13682$fn__13683 0x5278403 "clojure.tools.reader.default_data_readers$eval13682$fn__13683@5278403"]
=> (get (methods print-method) java.util.Date)
#object[clojure.tools.reader.default_data_readers$eval13678$fn__13679 0x6a317923 "clojure.tools.reader.default_data_readers$eval13678$fn__13679@6a317923"]

Tanner Emerson 2025-08-19T20:03:23.025159Z

The reload did not fix it

2025-08-19T20:04:19.220549Z

try #=(java.util.Date.)

2025-08-19T20:05:06.061059Z

(constructs a Date in the reader without using a data reader)

Tanner Emerson 2025-08-19T20:05:36.874119Z

=> #=(java.util.Date.)
#inst "2025-08-19T20:05:11.868-00:00"

2025-08-19T20:06:06.359669Z

and what if you call type on it

Tanner Emerson 2025-08-19T20:06:24.886769Z

=> (type #=(java.util.Date.))
clojure.lang.Symbol

2025-08-19T20:06:55.446689Z

fascinating

Alex Miller (Clojure team) 2025-08-19T20:07:03.163409Z

clearly, clojure.tools.reader.default_data_readers$eval13682$fn__13683 is not the original

dpsutton 2025-08-19T20:07:09.925159Z

(yeah saw that after)

dpsutton 2025-08-19T20:07:17.137549Z

possible there’s another java util Date class on the classpath?

Alex Miller (Clojure team) 2025-08-19T20:07:30.986039Z

you can't (easily) shadow that

Alex Miller (Clojure team) 2025-08-19T20:08:24.449819Z

there are definitely custom printers installed there from clojure.tools.reader

2025-08-19T20:12:20.092959Z

but the repl at least is printing correctly as an inst literal

Alex Miller (Clojure team) 2025-08-19T20:14:04.114509Z

yes, I'm not sure that's everything (the tools.reader printers just mostly copy the core ones) but I'd try to figure out how that's happening

2025-08-19T20:16:35.740069Z

(deftype Foo []
  Object
  (toString [_] (throw (Exception.))))

(type #=(user.Foo.))
might be interesting to look at, shouldn't result in an exception, if it does the stacktrace might tell you were the call to toString is coming from (might not if it is Date specific)