Skip to content

check-meta: wrap maintainers attribute to include team members#402991

Merged
winterqt merged 2 commits intoNixOS:masterfrom
SigmaSquadron:push-trqvyxvzpntx
May 7, 2025
Merged

check-meta: wrap maintainers attribute to include team members#402991
winterqt merged 2 commits intoNixOS:masterfrom
SigmaSquadron:push-trqvyxvzpntx

Conversation

@SigmaSquadron
Copy link
Contributor

@SigmaSquadron SigmaSquadron commented Apr 30, 2025

This is a work-around that resolves the issues that spawned from #400458 by adding the team members from teams declared in meta.teams to meta.maintainers, effectively restoring the original behaviour of the maintainers attribute, and thus allowing downstreams to keep consuming meta.maintainers without any extra changes to support meta.teams.

Follow-up to #394797.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: GNOME GNOME desktop environment and its underlying platform 6.topic: haskell General-purpose, statically typed, purely functional programming language 6.topic: kernel The Linux kernel 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 6.topic: golang Go is a high-level general purpose programming language that is statically typed and compiled. 6.topic: vim Advanced text editor 6.topic: erlang General-purpose, concurrent, functional high-level programming language 6.topic: ocaml OCaml is a general-purpose, high-level, multi-paradigm programming language. 6.topic: xfce The Xfce Desktop Environment 6.topic: fetch Fetchers (e.g. fetchgit, fetchsvn, ...) 6.topic: stdenv Standard environment 6.topic: pantheon The Pantheon desktop environment 6.topic: testing Tooling for automated testing of packages and modules 6.topic: cinnamon Desktop environment 6.topic: java Including JDK, tooling, other languages, other VMs 6.topic: R R is a programming language for statistical computing and data visualization. 6.topic: LXQt The Lightweight Qt Desktop Environment 6.topic: Lumina DE The Lumina Desktop Environment 6.topic: Enlightenment DE The Enlightenment Desktop Environment 6.topic: cuda Parallel computing platform and API 6.topic: mate The MATE Desktop Environment 6.topic: vscode A free and versatile code editor that supports almost every major programming language. 6.topic: zig Zig is an imperative, general-purpose, statically typed, compiled system programming language. 6.topic: jupyter Interactive computing tooling: kernels, notebook, jupyterlab 6.topic: rocm ROCm is an Advanced Micro Devices software stack for graphics processing unit programming. 6.topic: php PHP is a general-purpose scripting language geared towards web development. 6.topic: k3s Kubernates distribution (https://k3s.io/) 6.topic: deepin 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related labels Apr 30, 2025
@numinit
Copy link
Contributor

numinit commented May 1, 2025

We should remove this consumer that was added in #394797: https://github.com/NixOS/nixpkgs/blob/master/ci/eval/compare/maintainers.nix#L58

Apart from that, we can close the Repology and s.n.o. PRs, since the behavior is now compatible with both of them.

Copy link
Contributor

@numinit numinit left a comment

Choose a reason for hiding this comment

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

Is the hasNoMaintainers predicate in check-meta now redundant, or do we still need to check both maintainers and teams?

@RossComputerGuy
Copy link
Member

I think leave it, I don't think it passes through in this state.

@SigmaSquadron
Copy link
Contributor Author

We should remove this consumer that was added in #394797: https://github.com/NixOS/nixpkgs/blob/master/ci/eval/compare/maintainers.nix#L58

Apart from that, we can close the Repology and s.n.o. PRs, since the behavior is now compatible with both of them.

I was hoping this workaround would be temporary, until all consumers of meta.maintainers adopt the new teams attribute.

@RossComputerGuy
Copy link
Member

That's what I was thinking as well.

@numinit
Copy link
Contributor

numinit commented May 1, 2025

OK. Regardless we should just make sure that we don't duplicate pings, because it will (in the current state).

Long term I definitely agree with s.n.o listing teams. However, I don't think Repology much cares. The maintainers attribute is an external API contract that we have effectively created with them to display maintainers, so "maintainers are just inclusive of members of all teams" is the way to avoid breaking it. And we should generally try to avoid breaking external API contracts.

Speaking of which, we may want to also deduplicate maintainers in the eval in case someone is on more than one team maintaining something.

@SigmaSquadron
Copy link
Contributor Author

We could wrap everything with lib.unique. It may slow down eval though; I'm not sure how efficient that function is.

@numinit
Copy link
Contributor

numinit commented May 1, 2025

Fair point. It is likely not necessary since that is a N^2. (I think what we can easily dedup is more important anyway, like the eval script, since currently I think it's adding teams to maintainers which already take the teams into account?)

@numinit
Copy link
Contributor

numinit commented May 4, 2025

We should remove this consumer that was added in #394797: https://github.com/NixOS/nixpkgs/blob/master/ci/eval/compare/maintainers.nix#L58

I think this still applies. At present it'd be concatenating maintainers (which are inclusive of teams) with all the teams. meta.maintainers or [ ] is likely sufficient.

@mweinelt
Copy link
Member

mweinelt commented May 6, 2025

It's been a week. I'm not getting repology notifications for a number of packages any more. This is breaking my workflow.

I think I've been patient, when you decided against a revert and for inheriting team members into maintainer. Frankly, this is how it should've been from the start.

But can we please get on with this?

SigmaSquadron and others added 2 commits May 5, 2025 23:40
This is a work-around that resolves the issues that spawned from NixOS#400458 by adding the team members from teams declared in `meta.teams` to `meta.maintainers`, effectively restoring the original behaviour of the `maintainers` attribute, and thus allowing downstreams to keep consuming `meta.maintainers` without any extra changes to support `meta.teams`.

Follow-up to NixOS#394797.

Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
We need to pass through the maintainers and teams positions from the
original meta so pings work correctly, since check-meta clobbers the
original attribute positions in them.

Tested with `maintainers/scripts/get-maintainer-pings-between.sh` on a
handful of major packages maintained by both individuals and teams.
@numinit
Copy link
Contributor

numinit commented May 6, 2025

Did some prodding at it tonight to make sure this does not break anything that depends on it (notably, maintainer pings). Also added a comment asking to please not break this again since it is an external API and Repology depends on it.

Comment on lines +610 to +612
maintainers =
attrs.meta.maintainers or [ ]
++ concatMap (team: team.members or [ ]) attrs.meta.teams or [ ];
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add this? Unsure if it's common enough to be worth the complexity, though... probably not.

Suggested change
maintainers =
attrs.meta.maintainers or [ ]
++ concatMap (team: team.members or [ ]) attrs.meta.teams or [ ];
maintainers =
lib.unique (attrs.meta.maintainers or [ ]
++ concatMap (team: team.members or [ ]) attrs.meta.teams or [ ]);

Copy link
Contributor

Choose a reason for hiding this comment

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

I saw it come up in a couple of the places I tried. Another idea is a listToAttrs, but that'll probably be slightly heavier on memory since we'll just throw out the attrset anyway. May be worth a shot, though, since it's not N^2 at least?

Copy link
Member

Choose a reason for hiding this comment

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

I mean, we could always just punt it back onto the consumer -- we already had this potential duplication pre-meta.teams, so it wouldn't be a change, just a nicety.

Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed that this change introduced duplication in the qgis package: team.members seem to be first added to qgis.unwrapped and then again in the main derivation because qgis inherits its meta.

Copy link
Contributor

@numinit numinit Jun 25, 2025

Choose a reason for hiding this comment

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

Now that Nix has tracing support, it'll be interesting to use it to test dedup while computing meta. It's what I was mostly missing here.

Comment on lines +65 to +66
((drv.meta or { }).maintainersPosition or null)
((drv.meta or { }).teamsPosition or null)
Copy link
Member

Choose a reason for hiding this comment

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

Why not

Suggested change
((drv.meta or { }).maintainersPosition or null)
((drv.meta or { }).teamsPosition or null)
(builtins.unsafeGetAttrPos "maintainers" (drv.meta or { }))
(builtins.unsafeGetAttrPos "teams" (drv.meta or { }))

? Ideally we wouldn't add (slight!) extra eval overhead just for CI scripts (which AFAIU check-meta will do).

Copy link
Contributor

Choose a reason for hiding this comment

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

The new maintainers attribute was actually clobbering the original one's position, so it would return check-meta.nix every time rather than the real declaring file. I needed a way to pull the location of the original maintainers (pre-teams concatenation) out of there, and just did the same with teams. If it's written this way, it'll return a position pointing to check-meta.nix.

check-meta.nix is a little counterintuitive, but it's a bunch of // attrset updates that both prefers certain things in the meta and overrides other things in it. Maintainers is written as one of the overrides so I made sure we're holding onto the original.

Copy link
Member

@winterqt winterqt left a comment

Choose a reason for hiding this comment

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

Thanks! :)

@nixpkgs-ci
Copy link
Contributor

nixpkgs-ci bot commented May 7, 2025

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

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

git fetch origin release-24.11
git worktree add -d .worktree/backport-402991-to-release-24.11 origin/release-24.11
cd .worktree/backport-402991-to-release-24.11
git switch --create backport-402991-to-release-24.11
git cherry-pick -x d807892d1f42210129f9fc18f81e5f828150cf4d 92bd743239823dc7c80572539528398f722a9278

@winterqt
Copy link
Member

winterqt commented May 7, 2025

(Why remove from the stdenv board?)

Also, I didn't know we backported this change to 24.11. oof.

@SigmaSquadron
Copy link
Contributor Author

I removed it from Stdenv and CUDA because this isn't part of their projects. The projects are added automatically if we touch certain files during treewides.

We also didn't backport this; it was another mishap caused by changing files in the ci/ directory.

@winterqt
Copy link
Member

winterqt commented May 7, 2025

Makes sense.

Ah, right, forgot about that. Sorry!

@numinit
Copy link
Contributor

numinit commented May 7, 2025

Thanks for the work and the merge, y'all.

@wolfgangwalther
Copy link
Contributor

We also didn't backport this; it was another mishap caused by changing files in the ci/ directory.

The idea for the automated backport label whenever you touch ci/ (except OWNERS) is, that we don't want a diff between stable and unstable for the workflows/ and ci/ folders. This will allow us to easily backport other changes related to CI whenever they come up, without hitting conflicts.

Thus, I opened #405159 to do just that.

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: stdenv Standard environment 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

9 participants