mudasobwa

mudasobwa

Creator of Cure

I want to share some concerns about storing mix.lock file in VCS for libraries. The current version of Library Guidelines page has zero mentions of mix.lock and the established community practice is to indeed version control mix.lock.

Which is meaningless and might be even harmful in some scenarios.

Consider the library A that depends on another library B. B occasionally introduces a breaking change in the minor updates. Even if A library has nightly builds turned on, it continues to be green because in mix.lock there is a previous version of B. All the projects, depending on A get broken, because they ignore A’s mix.lock.

Without mix.lock in the VCS, A library author would have been informed a night after B upgrade. With mix.lock file in VCS, they will be informed by a tornado of issues from A users days after.

A less exotic case might be also taken into account: A depends on B and C, then B and C start conflicting on D at some point, but A nightly builds are still all green, because there is mix.lock in VCS and A is never tried to compile against modern versions of B, C, and D.

This is all not expected in our great self-organized ecosystem, but things happen. Currently, I personally switch nightly build on and remove mix.lock from VCS. It makes me think I will, at least, be notified about issues with the latest dependencies consistency the very next night.

I think removing mix.lock from VCS for libraries is a good practice in any case and I think we might enforce/suggest it via Guidelines I linked above.

Thoughts? /cc @josevalim

Showing Posts 1 to 10

josevalim

josevalim

Creator of Elixir

The benefit of mix.lock is making builds reproducible. You don’t want contributors to jump into a library and then become unable to write a patch because they can’t get their tests to pass anyway.

If the goal is to catch bugs, then I recommend having additional builds on CI that remove the lock file before running. Then you get the best of both words.

mudasobwa

mudasobwa OP

Creator of Cure

Eh. Does not that mean that projects using that library cannot use that library because of, well, above?

Or, even worse, they can get it to compile, but tests were red in this env, if they were ever attempted?

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

If a new version of library A’s dependency B breaks A, and I’m some contributor trying to fix some other, unrelated bug in A, how does it benefit me or the owner or the owner of A that I’m stuck and can’t move forward?

If that were the only way to know about breaking updates to B then sure, but as Jose noted, this is solved with a CI setup that simply unlocks everything before running tests. Perhaps that suggestion is what is missing from the guides?

mudasobwa

mudasobwa OP

Creator of Cure

Seems like a best solution, yes. I would strongly appreciate putting it there to alarm future library owners, yes. Shall I provide a PR?

josevalim

josevalim

Creator of Elixir

A PR that recommends checking it under version control and running a separate build without it would be welcome, yes. :slight_smile:

mudasobwa

mudasobwa OP

Creator of Cure

On it.

dbern

dbern

FWIW, I’ve found the same issue, and in CI I’ve started deleting the mix.lock before getting deps and running tests. :+1: to removing it for libraries; regardless, I’m hopeful that this isn’t a common problem.

fmcgeough

fmcgeough

mix deps.get has a command line option --check-locked. This was added in mix version 15.0.0. The doc says “raises if there are pending changes to the lockfile”. CI should use this so that if a change occurs where mix needs to modify the mix.lock file it can raise an exception. I recommend 1) check in the mix.lock file; 2) add that option to your CI builds. This ensures that what is built in CI is what was built on dev boxes and you’d be notified of discrepancies.
mix deps.get options

lud

lud

If I understand correctly this makes your CI fail if there are possible updates to the dependencies, even if your CI ran otherwise fine with the latest updates (by deleting mix.lock in CI)?

Or do you not delete mix.lock and call mix deps.update --all in CI.

Because if you check in the mix.lock and just run mix deps.get --check-locked in CI then how can it fail?

Edit:

Well actually I don’t uderstant what raises if there are pending changes to the lockfile means. I though it was checking on git status but it seems that it’s supposed to do something else.

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

Let’s say someone makes a change to mix.exs to switch from version 1 to version 2 for a dependency. The lock file is now “out of date” as the version in the lock file is now incompatible with what’s in mix.exs.

In development that’s fine, and you just get deps to write a new lock file. but what if you developer forgets, and commits the new mix.exs version without pulling deps and writing a new lock file? This is the value of the option. In the CI you want this to raise instead of silently writing a lock file.

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 94592 917
New
cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
caslu
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
heathen
Quite interesting article Google brought me. Didn’t find any mentions about it here. What do you think in general? Would you use togethe...
New
maennchen
:warning: Security advisory: Decimal DoS vulnerability A vulnerability has been published for decimal where very large exponents can cau...
New
marciol
It would be helpful to have a list of companies worldwide that hire engineers without prior experience in Elixir. Often, it can be quite ...
New

Other Trending Topics Top

marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
Aludel - LLM Evaluation Workbench Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews