clj-commons

slipset 2022-09-15T10:17:09.556089Z

Yeah, but that failure totally fine when building a PR.

slipset 2022-09-15T10:17:18.665569Z

Of course, it should perhaps not fail.

borkdude 2022-09-15T10:43:19.902859Z

@slipset I hate YAML, but I do care about the quality of clj-yaml because it is part of #babashka. Would you mind if I added myself to CODEOWNERS or would you rather review/merge PRs on your own, now that @marc-omorainis no longer very active in the Clojure community? Perhaps @lee is also open to this as a helpful companion.

borkdude 2022-09-16T09:45:21.117769Z

@grzm Awesome reply in that repo, I admire your patience

grzm 2022-09-16T13:17:30.628769Z

I'm cautiously optimistic. I don't see any indication that any PR wouldn't be rejected outright based on principle that things are just find as they currently are in 1.30, but then again I don't see any indication that it necessarily would be either. I can't tell whether he's sympathetic to any of the arguments I put forward.

borkdude 2022-09-16T13:18:20.639409Z

Given the 6 month release cadence I'd say we will fix it in clj-yaml anyhow?

grzm 2022-09-16T13:18:22.124269Z

So, now the question for me is whether to put the time in to learn the snakeyaml code well enough to make a reasonable PR. My immediate use-case can be avoided by switching to json. I do think it's a regression in the upstream library so ideally I'd provide the fix there for The Good of All™ (😆).

❤️ 1
grzm 2022-09-16T13:19:51.096189Z

Good point re: release cycle and fixing it for now. I was trying to figure out how that would be done in clj-yaml. I'm not sure how to override the provided emitter behavior. Maybe override the representer? I was looking a bit last night and it wasn't immediately obvious.

borkdude 2022-09-16T13:23:45.924649Z

I'd love to see it being fixed in snakeyaml

borkdude 2022-09-16T13:24:02.873509Z

you could find the commit that caused the regression to see how to fix it maybe?

Marc O'Morain 2022-09-16T13:24:14.303079Z

Does anyone want to write their own YAML parser ?

Marc O'Morain 2022-09-16T13:24:41.734819Z

Joking but also not joking.

borkdude 2022-09-16T13:24:45.189429Z

as a hobby?

Marc O'Morain 2022-09-16T13:26:00.619999Z

Yeah, but it depends on the scope. Writing a JSON parser is pretty easy. I've written a few in the past for fun. That wouldn't daunt me. Writing a YAML parser is probably a horrifically large task.

borkdude 2022-09-16T13:26:46.593199Z

I was referring to the gruff part before when I said as a hobby ;)

borkdude 2022-09-16T13:27:08.663419Z

I have considered it, but no

borkdude 2022-09-16T13:27:30.867899Z

The only reason I care about clj-commons/clj-yaml is that its part of bb and I don't want bb to behave wrong with respect to people's builds

borkdude 2022-09-16T13:27:46.102329Z

but I'm not that invested in yaml that I actually want to put that much time in it

borkdude 2022-09-16T13:29:16.732829Z

I mean, getting the first 80% right is probably easy. But then becoming spec-compliant with all the quirks is where it gets "fun"

Marc O'Morain 2022-09-16T13:30:50.223999Z

Oh yes. So many quirks I bet. The CircleCI Yaml loader has to check for things like loops, which are possible in YAML.

borkdude 2022-09-16T13:31:03.592449Z

clj-yaml supports those loops via lazy-seqs ;)

Marc O'Morain 2022-09-16T13:31:50.992079Z

We also had a bug where someone was able to create a map with two keys, both of which were null, with 2 values, which were also null.

Marc O'Morain 2022-09-15T10:52:48.901369Z

I also hate YAML 😅 I think Circle uses it because Travis uses it, because Rails uses it.

Marc O'Morain 2022-09-15T10:52:56.781389Z

So we can blame DHH really.

😂 1
borkdude 2022-09-15T10:55:19.526599Z

:)

borkdude 2022-09-15T10:55:42.920419Z

@marc-omorain Maybe it's time to update your profile description? :)

lread 2022-09-15T11:27:01.481289Z

Ya, sure I can lend a hand there. Sign me up!

borkdude 2022-09-15T11:31:09.181589Z

Thanks! ❤️ I've given you admin access and added you to https://github.com/clj-commons/clj-yaml/blob/master/.github/CODEOWNERS

lread 2022-09-15T11:44:30.760399Z

I find YAML annoying too. I tend to struggle when I have to use it but never really read any details about it. Thus thread just lead me to google which lead me to learn that you can use node anchors in YAML. Huh!

borkdude 2022-09-15T11:46:28.758879Z

@lee There are many "interesting" bits in YAML. I think the most pressing issue is this one now: https://github.com/clj-commons/clj-yaml/issues/35

borkdude 2022-09-15T11:47:20.148419Z

This caused a breaking change 😱

Marc O'Morain 2022-09-15T11:48:22.212309Z

The Snake YAML maintainer is a character.

lread 2022-09-15T11:48:34.272149Z

But...but... we don't have breaking changes in Clojure!?!

borkdude 2022-09-15T11:49:19.512659Z

@lee That's the thing: we could "fix" this in the clj-yaml lib. So the dilemma is: follow the (crazy) YAML 1.1 spec or protect people from this breaking change

Marc O'Morain 2022-09-15T11:49:33.381149Z

I submitted a patch to fix a NPE in SnakeYaml a few years back. He accepted the patch and said a new version would be released in 6 months time.

lread 2022-09-15T11:49:33.855999Z

Hey @marc-omorain? We miss ya!

Marc O'Morain 2022-09-15T11:49:48.082549Z

He only releases twice a year. 🤷

borkdude 2022-09-15T11:49:59.289169Z

Yeah, that guy...

borkdude 2022-09-15T11:50:18.634489Z

I think people who have invented YAML come from a different universe

lread 2022-09-15T11:57:30.324369Z

He seems maybe a bit on the gruff side.

slipset 2022-09-15T11:58:05.893829Z

Wouldn’t you be too if your hobby was to maintain a YAML parser?

borkdude 2022-09-15T11:58:39.484259Z

Maybe also a cultural difference...

lread 2022-09-15T12:00:07.466179Z

Ha! Probably @slipset!

lread 2022-09-15T12:05:02.974729Z

http://yaml.org lists other java implementations:

Java:
  - SnakeYAML Engine  # Java 8+ / YAML 1.2
  - SnakeYAML         # Java 5 / YAML 1.1
  - YamlBeans         # To/from JavaBeans. YAML 1.0/1.1
  - eo-yaml           # YAML 1.2 for Java 8. Packaged as a Module (Java 9+)
  - Chronicle-Wire    # Java Implementation
I see some discussion of SnakeYAML Engine... perhaps other projects are good and also more pleasant to work with?

borkdude 2022-09-15T12:06:13.256279Z

sure, but clj-yaml is built on snakeyaml, you can't easily change that. maybe we're able to get away with moving to snakeyml engine, don't know

lread 2022-09-15T12:18:42.039029Z

Ok, ramping up on yaml octals.... https://www.infoworld.com/article/3669238/7-yaml-gotchas-to-avoidand-how-to-avoid-them.html#toc-4

lread 2022-09-15T12:21:48.692219Z

So YAML 1.2 is a breaking change from YAML 1.1?

borkdude 2022-09-15T12:22:23.830219Z

of course, what did you expect, backwards compatibility with a minor version number update?

lread 2022-09-15T12:24:49.891339Z

Ha! Ok, weird reality.

borkdude 2022-09-15T12:27:12.529879Z

The changes might be for the better in 1.2 though and I don't think it will affect many programs: https://yaml.readthedocs.io/en/latest/pyyaml.html#defaulting-to-yaml-1-2-support

borkdude 2022-09-15T12:27:29.516979Z

but you never know of course

borkdude 2022-09-15T12:27:42.290879Z

I think many tools are stuck on 1.1

lread 2022-09-15T12:50:14.251539Z

I can ramp up on this issue if that helps. At the very least we'd have one more person who has a better understanding.

borkdude 2022-09-15T13:11:41.945309Z

@lee yes please! My preliminary proposal was to add an option to control the weird octal parsing

borkdude 2022-09-15T13:12:00.239419Z

this can be done using a custom Resolver, or so but I haven't really looked

lread 2022-09-15T13:52:28.863969Z

Ok, I'll take a look-see.

lread 2022-09-15T19:11:01.548089Z

I take back my “gruff” judgement, I think it was unfair.

borkdude 2022-09-15T19:18:57.540369Z

Well, I'm certainly a gruff sometimes, aren't we all on some days

❤️ 1
Marc O'Morain 2022-09-15T19:33:37.178629Z

> Wouldn’t you be too if your hobby was to maintain a YAML parser? This made me snort.

😄 3
lread 2022-09-15T21:41:29.094219Z

I think I was gruff to say he was gruff. simple_smile

grzm 2022-09-16T02:41:46.343259Z

For what it's worth, I actually don't care about parsing. I care about emitting.

grzm 2022-09-16T02:50:16.528879Z

cheers. this whole thing is hateful, so I appreciate the diligence and attention to detail.

lread 2022-09-16T02:51:02.911079Z

I think you made a good argument there btw!

grzm 2022-09-16T02:51:58.123809Z

(I think gmail broke for me, so I'm no longer receiving email updates to all of this wonderful discussion, so thanks for pointing me to these updates)

grzm 2022-09-16T02:52:27.581489Z

Does the resolver handle dumping as well?

lread 2022-09-16T02:54:17.353469Z

Don’t think so. My current understanding is that we could create a custom resolver to ignore octals. Have not tried it yet, I guess they would default to strings.

lread 2022-09-16T02:56:14.071049Z

Andrey said we might want to look at timestamps too, but I’m not sure why yet.

grzm 2022-09-16T02:58:53.406619Z

For my really limited use-case, I'm dumping values via snakeyaml/clj-yaml/babashka (YAML 1.1) and reading them using js-yaml (YAML 1.2) (in CDK). One of our AWS accounts has a leading zero. AWS account ids are number-like strings, so that one with a leading 0 is being emitted without quotes by clj-yaml and being read as a number in js-yaml, dropping the 0 (and being a number)

grzm 2022-09-16T02:59:20.430329Z

So, for me, the snakeyaml/clj-yaml resolver/parser never enters into the picture.

lread 2022-09-16T03:00:32.060329Z

Ah. So is js-yaml maybe using yaml 1.2?

grzm 2022-09-16T03:00:39.940809Z

It definitely is. And they noted the behavior difference in one of their updates.

lread 2022-09-16T03:01:50.669899Z

Hmm… that was a nasty booboo with the octals in yaml 1.1 spec. And breaking change in yaml 1.2 spec.

grzm 2022-09-16T03:03:26.988989Z

Yeah. Rich's Spec-u-lation talk really crystalized so much of those ideas for me back in the day. Hard for me to see things any other way at this point. Well, I can see it, I just can't bring myself to agree that it's a good idea to have breaking changes.

lread 2022-09-16T03:04:32.342179Z

Smart Fellah that Mr Hickey!

grzm 2022-09-16T03:04:41.124679Z

Hammocks all around.

2
slipset 2022-09-15T10:47:23.327629Z

Please do add yourself to the code owners. Would be much appreciated!

borkdude 2022-09-15T10:48:10.764029Z

done