Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC 0088] Nixpkgs Breaking Change Policy #88

Merged
merged 7 commits into from
Nov 17, 2021
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 156 additions & 0 deletions rfcs/0088-nixpkgs-breaking-change-policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
---
feature: nixpkgs-breaking-change-policy
start-date: 2020-09-24
author: Kevin Cox
co-authors: (TBD)
shepherd-team: @blaggacao, @jonringer, @nrdxp
edolstra marked this conversation as resolved.
Show resolved Hide resolved
shepherd-leader: @blaggacao
related-issues: (TBD)
---

# Summary

This defines a policy for how to manage nixpkgs changes that break dependent
derivations or tests. It specifies timeframes and procedures so that
maintainers of dependencies and dependents can know what to expect from each
other when making breaking changes.

While this policy should be followed as much as possible once accepted it is
primarily focused on getting agreement such that tools can be built that make
implementing this policy very easy. See the [Future Work section](#future-work)
for examples of the tools that will be built.

The direct intended result of this RFC is:

- Maintainers of dependencies have a clear framework for handling changes that
break dependants.
- Maintainers of dependants have a clear framework for how dependency breacking
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- Maintainers of dependants have a clear framework for how dependency breacking
- Maintainers of dependants have a clear framework for how dependency breaking

changes will be handled.
- NixOS channels will very rarely (ideally never) stall due to build or test
failures.

This document is only focused on changes to derivation builds and tests it
**does not** aim to make any opinion on changes that can break user machines or
kevincox marked this conversation as resolved.
Show resolved Hide resolved
configurations. (While this is an interesting topic it is harder to put
concrete rules on due to the difficulty of identifying these breakages. In
order to be covered by this policy please but tests on your packages.)
kevincox marked this conversation as resolved.
Show resolved Hide resolved

# Motivation

Right now the procedure for making breaking changes varies widely by maintainer
and is largely tribal knowledge. There are a wide variety of approaches ranging
from:

- After testing to confirm that a change is correct, merge and notify
dependents that they need to update their packages.
- Merge to `staging`, notify dependents then eventually merge to `master`.
- Gather a large number of fixes in the PR branch then merge to `staging` or
`master` once most or all dependencies are fixed.

This adhoc nature has a number of downsides:

- Change authors need to put effort into deciding how to handle each particular
change.
- Maintainers of dependant packages don't know what to expect and have a hard
time keeping up with upstream breakages.
- Merges to `master` or `staging` can result in broken channels which block all
updates including security updates.

This aims to provide a uniform approach so that everyone involved knows what to
expect and to allow further workflows including automation to be build on top
of these procedures.

## Past Discussions

https://discourse.nixos.org/t/please-fix-all-packages-which-were-broken-by-the-qt-wrapping-changes/6444

# Detailed design

## Goals

The following procedure will be used for making breaking changes. It has a few
primary goals:

- Avoid putting more burden than necessary on the dependency maintainer. If the
maintainers of core derivations face toil proportionally to the number of
transitive dependencies they will quickly become overloaded. These
maintainers are arguably the most critical to Nixpkgs and their load needs
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
maintainers are arguably the most critical to Nixpkgs and their load needs
maintainers are arguably the most critical to Nixpkgs and their load needs

to be kept manageable.
- Avoid unnecessarily breaking packages for any period of time. There are a
number of users on the `*-unstable` channels and it is annoying if packages
in their configuration get broken.
- Avoid breaking the `master` branch as much as possible. The `master` branch
is used by the `*-unstable` channels and breaking this branch means that no
updates can be pushed. This includes critical security updates as well as
regular feature updates.

## Procedure

The target branch for a merge is not affected by this policy. It will be
picked, as it is today, according to
https://nixos.org/manual/nixpkgs/stable/#submitting-changes-commit-policy.

1. The maintainer will prepare a PR with their intended changes.
2. The maintainer should test a sample of dependent derivations to ensure that
their change is not unnecessarily or unintentionally breaking. (Example: Ensure
that a critical output file was not forgotten) Note that sometimes it **is**
necessary to break all dependent packages, and the maintainer is not required
to avoid this.
1. A sample of at least 100 packages or 3h of build time is recommend as a guideline.
Copy link

Choose a reason for hiding this comment

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

This may be a bit too demanding (for potato hardware like mine), but I guess it's ok for a guideline.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm okay with committers and active contributors to use my server: https://github.com/jonringer/server-configuration . If you're worried about compute. Since I'm not opening this up to the general public, it's not a solution, just a mitigation; but the offer is there.

Obviously, this is guideline is meant "within expectations" of a user's ability. Having some sort nixpkgs-review does make it a lot easier for reviewers to merge.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is why we added the time limit and called it a guideline. The idea is even if you only own a potato we hope that you can spare 3h of your potato or find someone else to do so for big changes. If you think 3h is still to muck to ask I'd be happy to consider other thresholds, it was picked mostly arbitrarily to provide a rough target.

2. The sample should include as many `passthru.tests` tests as is feasible.
3. The maintainer will get the PR reviewed and approved.
1. It is **recommended but not required** to have some maintainers of
dependent packages involved in the review to review if the breakage is
justified.
4. The maintainer will contact the maintainers of all dependent, broken
packages (herein called sub-maintainers).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
packages (herein called sub-maintainers).
packages (herein called sub-maintainers).
1. The sub-maintainers will be contacted preferably by the `github` field,
followed by the `email` field of [maintainer-list.nix
](https://github.com/NixOS/nixpkgs/blob/master/maintainers/maintainer-list.nix).
If neither of those fields are set than contacting the maintainer is not
required and the package should be marked as broken after 7 days.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we wait? Or remove this maintainer from the blocking list right away? What is the odds that they randomly notice that we are breaking their package?

1. The sub-maintainers will be provided a link to the PR with the breaking
changes as well as any context that will help them resolve the breakages.
2. The sub-maintainers are expected to update the derivations that they
maintain within 7 days.
kevincox marked this conversation as resolved.
Show resolved Hide resolved
1. These changes should be merged to the target branch following the regular
nixpkgs PR process if they are backwards compatible. Otherwise they
will be merged into the branch of the breaking PR.
5. The maintainer must provide a grace period of at least 7 days from when the
sub-maintainers were notified.
6. The maintainer must merge the target branch into their PR branch.
7. The maintainer must mark all still-broken packages as
Copy link

Choose a reason for hiding this comment

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

It's not clear to me if "still-broken" packages refers to all the packages or just those in the sample.
In any case, marking many broken packages (even if <100) for every PR seems like a lot of work: it would be good if this could be facilitated by a tool like nixpkgs-review.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Eventually it should be all packages. My not-so-secret goal is that one day every single package will be considered "channel blocking" unless it is marked broken, basically meaning that there are no unintentional breakages.

It is expected that tooling will manage this. This policy is not going to be enforced until we have made it reasonably easy to comply. This RFC is a first step to agree agree upon a policy first, then we can build up the tooling to implement the policy.

[broken](https://nixos.org/manual/nixpkgs/stable/#sec-standard-meta-attributes).
8. The maintainer can now merge to the target branch.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe there should be someone with commit access assigned to managing this process if the maintainer of the derivation that causes the breakage doesn't have commit access, so we can guarantee these relatively strict time frames.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am slightly hesitant to giving special privileges to changes that require dependent updates but maybe this is justified as packages with more dependents are likely more important.

I am also hesitant to put the full burden of merging these changes on an individual.

I guess this is blocking if this policy puts additional difficulties to getting the change merged. But as I see the additional burden is on the author/maintainer, not on the actual process of getting it merged.


This procedure should not result in a failing channel build in the target
branch at any point. In particular NixOS channel constituents are considered
blocking and are an exception to the 7 day breakage rule.

# Drawbacks

This delays the merge of "core" derivations as the author needs to wait for
sub-packages to be tested and possibly fixed up to the 7 day threshold.

# Alternatives

## Shorter grace period

A shorter grace period allows maintainers to move more quickly but requires
maintainers of defendant derivations to jump to action quickly which is not
always possible for volunteer driven work. For example if a maintainer is on
vacation they can't be expected to respond in a couple of days.

## Longer grace period

A longer grace period would give derivation maintainers more time to react to
changes in dependencies and provide more time to search for replacement
maintainers if the original maintainer has abandoned the derivation. The 7 day
number was mostly arbitrary and can easily be changed in the future. A longer
grace period would also result in more packages being fixed before the breaking
change is shipped, which results in less breakage for end-users.

# Unresolved questions

None.

# Future work
- Create a tool for automatically notifying maintainers of broken dependents
kevincox marked this conversation as resolved.
Show resolved Hide resolved
- Create a tool for automatically marking broken packages as broken.
kevincox marked this conversation as resolved.
Show resolved Hide resolved
- [This is a milestone on the way to implemented a queue-based merge process
for nixpkgs.](https://paper.dropbox.com/doc/MTSY8xKH6y1xDEwavyDNW)