Skip to content

lib/tests/strings.sh: accept Nix and Lix error wording - #574183

Merged
RaitoBezarius merged 3 commits into
NixOS:masterfrom
RaitoBezarius:lix-lib-tests
Oct 22, 2026
Merged

RaitoBezarius merged 3 commits into
NixOS:masterfrom
RaitoBezarius:lix-lib-tests

Conversation

@RaitoBezarius

Copy link
Copy Markdown
Member

Things done

This:

  • fixes coupling to CppNix for the libtests (regressed in c5ba1a0)
  • adds Lix to the CI tests to prevent this to happen again
  • add the Lix maintenance team as code owners only for notification purpose

@rhendric I believe you introduced the specific wording to CppNix. I'd appreciate if you could find the time to review the aforementioned changes.

@nixpkgs-ci
nixpkgs-ci Bot requested review from a team, hsjobeki, infinisil, llakala and philiptaron October 14, 2026 22:59
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 6.topic: lib The Nixpkgs function library 6.topic: continuous integration Affects continuous integration (CI) in Nixpkgs, including Ofborg and GitHub Actions labels Oct 14, 2026
@nixpkgs-ci nixpkgs-ci Bot added 6.topic: policy discussion Discuss policies to work in and around Nixpkgs backport release-26.05 Backport PR automatically labels Oct 14, 2026

@rhendric rhendric left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should remove the regex altogether; the fact that Nix fails is more important than the error message it emits, and that would make the test more future-proof.

If writing unit tests that check error conditions requires one to verify those tests under both Nix and CppLix, I'm going to be marginally less likely to write such tests. But as long as we (NixOS/nixpkgs) consider CppLix to be supported as a ‘tier-one’ implementation, we may as well enforce it.

I question the wisdom of continuing this support, but that's a much bigger conversation, and we probably haven't yet encountered enough pebbles like this to offset the value of having an alternate implementation our infra can flip to when it's useful to us. Someone should be accumulating these pebbles, though. Not sure who; maybe @NixOS/nixpkgs-ci?

Comment thread ci/OWNERS Resolved
Comment thread lib/tests/strings.sh Resolved
@RaitoBezarius

Copy link
Copy Markdown
Member Author

Perhaps we should remove the regex altogether; the fact that Nix fails is more important than the error message it emits, and that would make the test more future-proof.

Agreed, I will pursue @xokdvium's suggestion here, as I didn't author the code, I did not want to assume your intent here in the test code.

If writing unit tests that check error conditions requires one to verify those tests under both Nix and CppLix, I'm going to be marginally less likely to write such tests. But as long as we (NixOS/nixpkgs) consider CppLix to be supported as a ‘tier-one’ implementation, we may as well enforce it.

I also don't think that test authors should have to verify errors paths under two (or more) implementations by hand and I think it's a loss you would stop writing tests for that. I believe putting more than one implementation in CI make the conditions easier to write because you stop chasing what needs to be run to write it and it helps knowing when the conditions is too depend on a specific message.

On the bigger question of whether this PR is a proxy for "is Lix a tier one" implementation, I think you are getting the wrong impression here. This brittleness is symmetric with CppNix itself, that is, past versions of CppNix which are supported are broken by this change. The fix proposed here stands on its own.

If adding Lix to the CI is contentious, I'm happy to split it into another PR and leave the call to the nixpkgs-ci team; I surmise this would improve the quality of the tests because it brings diversity and will help making tests more robust including for previous CppNix versions.

I question the wisdom of continuing this support, but that's a much bigger conversation, and we probably haven't yet encountered enough pebbles like this to offset the value of having an alternate implementation our infra can flip to when it's useful to us. Someone should be accumulating these pebbles, though. Not sure who; maybe @NixOS/nixpkgs-ci?

On the pebbles, rather than leaving it to an unnamed "someone" or to the nixpkgs-ci team, I'm happy to own it if someone is willing to walk me through what does it entail. As proven by this PR, I opened the cleanup, and if we want it, a small guard (wrt to CI costs) so the next wording change is caught by CI instead of our downstream CI.

Finally and interestingly, I think what you are questioning here is the nixpkgs' decades-scale reproducibility promise, whether we (@NixOS/nixpkgs) are willing to depend on a single evaluator's continued buildability and stable semantics, or want a second implementation as a hedge. Back when I was maintainer of CppNix in Nixpkgs, we did not have this choice.

I think I'm curious about @xokdvium opinions on this last topic given his involvement in CppNix.

The test asserted the exact stderr of `nix-instantiate` when coercing a
missing path. That wording is implementation-defined and subject to
change: it differs between CppNix and Lix, and it can change between CppNix
releases too.

Only check that evaluation fails and that the error names the missing
path.
The lib tests exercise things like `nix-instantiate` and their error
messages. Therefore, they can regress when the wording is too coupled to
a specific version or implementation.

Given that Lix is already easy to reach out in nixpkgs and
`lib/tests/test-with-nix.nix` is consumed by Lix's own CI, we propose to
run the suite under `pkgs.lix` too.

The default `lib-tests` output stays Nix-only because it is part of the
release tarball closure; `lib-tests-lix` is a separate CI job and not
part of the release tarball closure.

As far as I can tell:

- that extra test takes ~55s on my system under Lix in the sandbox. Over
  a faster builder, it takes ~20s.
- this is a new *step* in an existing job, no new checkout, no new
  install or whatever, so no extra setup cost.
- the symlink join do not cause rebuild of the nix-unit things and so
  on. pkgs.lix is substituted and not rebuilt.
- the existing lib-tests are already doing 2 runs of testWithNix, Lix is
  a 3rd.

If this proves to be a problem for CI performance, we can always revert
the long part (fileset) and decrease even further the cost of this
additional minute check.
The lib-test harness and the tests that assert on the Nix implementation
have consequences on Lix's own CI. Make the Lix maintainers code owners
of them so that they are notified of changes, and add @xokdvium, who
asked to be notified as well.

This does not claim any "technical" ownership of these changes, it's
just a manner to be notified of these changes.
@rhendric

rhendric commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

I also don't think that test authors should have to verify errors paths under two (or more) implementations by hand and I think it's a loss you would stop writing tests for that.

Mostly what I was reacting to was the inclusion of error messages from implementations other than the official one. I like the solution you and @xokdvium settled on; this one doesn't make me marginally less likely to do anything good. 🙂

If adding Lix to the CI is contentious

I don't contend it, at least. This is an issue for nixpkgs-ci to approve or disapprove. I'll only note that any change that could cause a PR to raise an error in CI that would not be found locally without running an unofficial Nix clone is a change that does impose some cost on contributors (the cost of resubmitting one's PR to comply), and noble as the thought is, that particular cost isn't one that the CppLix maintainers in Nixpkgs can shoulder. Determining whether that cost is acceptable is out of scope for me, as long as someone is doing the weighing and this isn't a diffusion of responsibility thing.

Finally and interestingly, I think what you are questioning here is the nixpkgs' decades-scale reproducibility promise, whether we (@NixOS/nixpkgs) are willing to depend on a single evaluator's continued buildability and stable semantics, or want a second implementation as a hedge. Back when I was maintainer of CppNix in Nixpkgs, we did not have this choice.

Your history with Nixpkgs predates mine, I believe. So all of this I hold very lightly. But in my mind to date, the reproducibility promise applied to evaluation of Nixpkgs on ancient evaluators, not to being able to execute the unit tests or other CI infrastructure on same. (Reasonable counterargument: how does one verify this promise without running the tests? Perhaps this is not a distinction worth drawing. Still, this is the first time I can remember a concern being raised about whether Nixpkgs's shell script unit tests specifically can be executed with a decade-old Nix.)

Regardless, a policy of, ‘Let's not couple tightly to specific Nix error messages, for a variety of good reasons, only one of which is specific to CppLix users,’ seems to make everyone happy here, so that's the primary lesson I'm taking away from this.

@xokdvium xokdvium left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't tested manually but looks good and more test coverage more better.

@nixpkgs-ci nixpkgs-ci Bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Oct 18, 2026
@RaitoBezarius

Copy link
Copy Markdown
Member Author

Given the approval, I will merge this, if the CI changes prove problematic, feel free to revert these bits. Thank you for your understanding.

@RaitoBezarius
RaitoBezarius added this pull request to the merge queue Oct 22, 2026
Merged via the queue into NixOS:master with commit be40b5a Oct 22, 2026
75 of 77 checks passed
@RaitoBezarius
RaitoBezarius deleted the lix-lib-tests branch October 22, 2026 01:13
@nixpkgs-ci

nixpkgs-ci Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Backport failed for release-26.05, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release-26.05
git worktree add -d .worktree/backport-574183-to-release-26.05 origin/release-26.05
cd .worktree/backport-574183-to-release-26.05
git switch --create backport-574183-to-release-26.05
git cherry-pick -x 48cb3699170f4839affdca23f0e7bd4abea532cd db996807d1c139566b8549183cc8cf0375e5ceea 355f7e1e06e3e6bb25398a0a1e7f4155d9d600ea

@philiptaron

Copy link
Copy Markdown
Contributor

I'm coming late here, but strongly support a more general assertion instead of a tight one. We have no need to Hyrum's law our way into ossification.

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

Labels

6.topic: continuous integration Affects continuous integration (CI) in Nixpkgs, including Ofborg and GitHub Actions 6.topic: lib The Nixpkgs function library 6.topic: policy discussion Discuss policies to work in and around Nixpkgs 8.has: failed backport 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person. backport release-26.05 Backport PR automatically

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants