fix(upgrade): Keep lockfile if no pkgs change #1671
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed Changes
It's possible for the catalog server to resolve the same package version and derivation from a different page and revision of nixpkgs.
In these cases the packages haven't actually changed and we would tell the user that they haven't been upgraded, however we were still updating the lockfile with the new
page
,rev
,rev_count
, andlocked_url
.Prevent this from happening by returning the existing lockfile. We currently still trigger a build on it though, in part because an existing test expects a noop upgrade to generate a lockfile and the outer function doesn't know whether the lockfile has changed.
A side-effect of this is that the test can't compare the raw lockfile contents because it appears to originally be written out in pretty-print format and then written in compact format, so we have to parse it with
jq
to do the comparison.I did experiment with making this a unit test instead of an integration test, in part because the mock manipulation feels quite fragile, but the round-trip behaviour wasn't as clear and it likely wouldn't have highlighted the oddities above.
I also considered moving the mock manipulation into
test_data
but decided against it because it's clearer inline to understand the one test that uses it.Release Notes
N/A, part of catalog release.