Repository navigation
lib/tests/strings.sh: accept Nix and Lix error wording - #574183
Conversation
rhendric
left a comment
There was a problem hiding this comment.
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?
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.
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.
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.
8b9eaac to
355f7e1
Compare
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. 🙂
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.
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
left a comment
There was a problem hiding this comment.
Haven't tested manually but looks good and more test coverage more better.
|
Given the approval, I will merge this, if the CI changes prove problematic, feel free to revert these bits. Thank you for your understanding. |
|
Backport failed for 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 |
|
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. |
Things done
This:
@rhendric I believe you introduced the specific wording to CppNix. I'd appreciate if you could find the time to review the aforementioned changes.