Fork me on GitHub
#calva
<
2023-09-20
>
pez07:09:17

Dear Calva friends: Calva’s CI pipeline is broken. Which means we don’t get any new Calva versions released right now. There is a crash in our jack-in integration tests. Even using the same Calva code that passed the tests two days ago. The tests run fine on my laptop, so it seems to be some combo of moving parts that causes the issue. One moving part is the version of VS Code used. We always use bleeding edge VS Code Insiders for this, to catch upcoming issues early. Which is what we might have caught here, unless it is a temporary error that the VS Code team will fix (I doubt this, and am certainly not ready to bet on it). At the same time there are users reporting jack-in/connection failures out there, so I start to wonder if it is related. Anyway, right now I am out of ideas on how to deal with this. I can “fix” the pipeline by disabling the test in question, but as you can probably figure, I really don’t want to go that path. If anyone wants to help figuring this out, please, please feel welcome to! 🙏 ❤️ calva

❤️ 1
Tobias Karlsson09:09:19

I'll try and help out tonight.

🙏 1
❤️ 1
calva 1
pez11:09:09

A big problem here is that I can’t reproduce it on my own machines. I’ve tried on a Windows machine, a Linux box (Fedora 38), and my Mac. The integration tests pass on all of them. Now putting debug logs into the code and push to CI. It takes 5-7 minutes to see any result. Pretty far from an interactive programming experience!

Bob B15:09:32

would it be possible to link to the failure? with a starting point, I can at least see if I can re-create

simonacca15:09:16

I also just started looking into this

simonacca15:09:21

The first few errors seems to happen because vscode can't talk to dbus... this makes sense as there's no dbus daemon in the image (`cimg/clojure:1.11-browsers`) and there doesn't seem to be any provision to connect to a bus outside of docker. Unclear whether it's just the latest vscode that requires this dbus connection or whether there was some previous workaround that doesn't work anymore

pez16:09:06

Thanks for having a look, @U74MQ2347! Indeed, the dbus error is always there. 😃

pez16:09:58

@U013JFLRFS8 see the link that @U74MQ2347 pasted.

pez16:09:03

Anyone: You can probably see a successful run if you build Calva locally and run the integration tests, • Building Calva locally: With the Calva repo open in VS Code, Run Build Task (`ctrl/cmd+alt+b`) • Run integration tests: npm run integration-test

👍 1
Bob B16:09:35

possibly related, seems like the same error and this report of recurrence is from 4 days ago, so the timing seems to line up pretty decently: <https://github.com/microsoft/vscode/issues/188676#issuecomment-1725627276>

👀 2
Bob B16:09:11

although I don't totally get why a local run succeeds if this is related

simonacca16:09:27

I couldn't get the integration test to run locally (build pipeline works nicely, it's just that nixos requires specially built vscode binaries :face_with_rolling_eyes: ) so I wrote a https://github.com/simonacca/calva/blob/build-in-docker/Dockerfile that does just enough to build run the integration tests with the same images that circleCI uses. There the tests fail (in a very similar manner as it does in circleCI) on ~50% of the runs. • build with DOCKER_BUILDKIT=1 docker build --tag calva-ci-integration --target test-integration . • run with docker run -ti --net host -e DISPLAY=:0 --rm --ipc=host calva-ci-integration

pez17:09:01

That’s great, @U74MQ2347! Can you file a PR with that Dockerfile and the instructions? Maybe in the scripts folder, scripts/build-and-test, say.

👍 1
pez17:09:39

That looks very related, @U013JFLRFS8. Maybe a temporary fix is to use the regular Code, instead of Insiders…

Bob B17:09:35

it might be worth at least trying w/ regular once to isolate that variable I don't want to pretend I'm some devops expert, but I wonder if it's worth thinking about tweaking the strategy of the integration tests. I think using the insiders version definitely has the value prop of catching issues before they pop up in stable, but the trade-off there feels like if an issue does pop up, it's not necessarily clear if it's in the calva code or the 'integration API' (vscode). I'll throw out two ideas, just spitballing: • CI builds run integration tests against both stable and insiders - idk if there's a way to fork the workflow, or maybe just run against stable, and if that passes, run against insiders so there's always a point of comparison • CI builds run against stable, and a scheduled build (if that's possible to setup) runs dev against insiders - my thinking behind this is that a) there's still sort of a point of comparison, and b) changes to the insiders build might happen at a different pace, so if e.g dev hasn't changed but the integration tests with insiders start failing, that's likely a signal that something has changed at the integration boundary (rather than a change to calva 'breaking')

Bob B17:09:38

just as a really left-field thought, if calva were to do a scheduled build, it might even be possible to use nightlies of vscode (assuming they publish nightlies), and then, for example, if that issue report is fixed on nightly but not yet on the insider build, this current issue might have popped up and then gone away

pez18:09:27

Here’s an issue where we can collect clues and discuss: https://github.com/BetterThanTomorrow/calva/issues/2317

pez18:09:31

I think the idea about using both stable and Insiders has merits. The drawback is that the pipeline is complicated enough as it is. I’m not sure what to do with the canary signal if it isn’t allowed to break the build like it does today. Over four years and 400 Calva versions this is the first time we’ve run into troubles with using Insiders only. Maybe just having a fallback prepared to easily switch to stable to get out some urgent upgrade of Calva is fine.

💯 1
simonacca10:09:26

@U0ETXRFEW https://github.com/BetterThanTomorrow/calva/pull/2320's the PR. While cleaning it up this morning I re-run the integration tests and now everything passes 100% of the time... maybe this is the case on circleCI as well now?

pez10:09:40

Your PR failed at CI, so there’s that. 😃 Thanks a ton for this help! 🙏 (The failure is the integration test we are talking about so has nothing to do with your PR, in case that wasn’t clear.) I have seen one build pass CI the latest days. So it seems it is flaky also there.

🤪 1
Ksenia Busquet13:09:41

Hi all 😊 need some help with passing the environment variables during calva jack in, I'm trying to do it like this, and it doesn't seem to work..

Ksenia Busquet13:09:56

The desired result is MITRA_MOCK=false

pez14:09:01

Does just "MITRA_MOCK": false, work?

Ksenia Busquet14:09:09

It seems not to be working.. I am running unit tests and there is a part that should only be run when the mock is false, and it is not entering the tests

pez15:09:44

Hmmm, if I have this config:

"calva.jackInEnv": {
    "IS_FOO": true
  },
After jack-in, I get:
(System/getenv "IS_FOO") => "true"
So, maybe in your case there, you are testing against "false" (as a string)?

Ksenia Busquet11:09:56

Actually the System/getenv returns "true", so it doesn't change it at all..

Ksenia Busquet11:09:21

Can it have to do with the way I'm connecting to REPL? I'm running a docker container and using the generic type with the container port to do the jack in

pez12:09:12

Can you describe in a bit more detail how you connect? Sounds like maybe you are not using a jack-in command? But, yes, the environment will only update for the process starting the repl, and I don’t see how it would automatically be picked up inside a docker container.

Ksenia Busquet12:09:52

So first I start the docker container with REPL like this and then I choose "Connect to a running REPL" - > Generic - > Port 32000 P. S. And yes, I just saw that I'm not using the jack in 😂 do you know if there's a way to still pass the env variable with this setup? :thinking_face:

pez12:09:47

To get an env variable in there you’ll need to start the process with that variable set. One way to do it is to use https://calva.io/connect-sequences/#custom-command-line that starts the docker container and add the environment variable there. (Or start the container like you do today, adding the environment variable to it, would work too.)

pez12:09:31

(Jack-in is not a good name, btw, but we’re sort of stuck with it… 😃 )

1
Ksenia Busquet13:09:49

Thanks so much for your help, somehow I got it to work changing the docker command line command overriding just one env variable, tried to do it with custom connect sequence, but somehow the container stops by itself after a minute 😅 anyway, happy that it's working haha

pez16:09:49

Great that you got something that works! I’m a bit curious about why the container doesn’t survive when started via jack-in, though. Did you get any error messages when it died??

Dustin Getz17:09:45

How can I make CLJ repl the default not CLJS in a calva REPL connect sequence

pez18:09:20

I don’t think you can. The connect sequence ends when the cljs repl is connected and will leave things there. You might get away using the runCommands command and stringing the jack-in and toggle connection commands together, but I’m not sure the promise chain is unbroken all the way to support that.