From 540e188796bfdb9580218f3be979a372023c27e7 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sat, 30 Aug 2025 15:24:13 +0200 Subject: [PATCH 1/4] ci/eval/compare: ping maintainers of removed packages This change pings maintainers of actually removed packages, aka where the package's expression is deleted. This will not ping maintainers of packages that become invisible, because a (transitive) dependency of them is marked as insecure or broken. --- ci/eval/compare/default.nix | 2 ++ ci/eval/compare/maintainers.nix | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ci/eval/compare/default.nix b/ci/eval/compare/default.nix index 9060d357d662..b338d8f82d6d 100644 --- a/ci/eval/compare/default.nix +++ b/ci/eval/compare/default.nix @@ -78,6 +78,7 @@ let diffAttrs = builtins.fromJSON (builtins.readFile "${combinedDir}/combined-diff.json"); rebuildsPackagePlatformAttrs = convertToPackagePlatformAttrs diffAttrs.rebuilds; + removedPackagePlatformAttrs = convertToPackagePlatformAttrs diffAttrs.removed; changed-paths = let @@ -117,6 +118,7 @@ let maintainers = callPackage ./maintainers.nix { } { changedattrs = lib.attrNames (lib.groupBy (a: a.name) rebuildsPackagePlatformAttrs); changedpathsjson = touchedFilesJson; + removedattrs = lib.attrNames (lib.groupBy (a: a.name) removedPackagePlatformAttrs); inherit byName; }; in diff --git a/ci/eval/compare/maintainers.nix b/ci/eval/compare/maintainers.nix index 43ae050acba4..6c4be96dddbf 100644 --- a/ci/eval/compare/maintainers.nix +++ b/ci/eval/compare/maintainers.nix @@ -5,6 +5,7 @@ { changedattrs, changedpathsjson, + removedattrs, byName ? false, }: let @@ -24,7 +25,7 @@ let enrichedAttrs = builtins.map (name: { path = lib.splitString "." name; name = name; - }) changedattrs; + }) (changedattrs ++ removedattrs); validPackageAttributes = builtins.filter ( pkg: From 0753aa45805ec81f120a6d059979623ad3581416 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sat, 30 Aug 2025 15:31:12 +0200 Subject: [PATCH 2/4] ci/eval/compare: remove package validity check This should not be necessary anymore, because packages that fail to evaluate should already be filtered out by the attrpath generation step in main eval. --- ci/eval/compare/maintainers.nix | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/ci/eval/compare/maintainers.nix b/ci/eval/compare/maintainers.nix index 6c4be96dddbf..ec3dc2dcc837 100644 --- a/ci/eval/compare/maintainers.nix +++ b/ci/eval/compare/maintainers.nix @@ -27,25 +27,9 @@ let name = name; }) (changedattrs ++ removedattrs); - validPackageAttributes = builtins.filter ( - pkg: - if (lib.attrsets.hasAttrByPath pkg.path pkgs) then - ( - let - value = lib.attrsets.attrByPath pkg.path null pkgs; - in - if (builtins.tryEval value).success then - if value != null then true else builtins.trace "${pkg.name} exists but is null" false - else - builtins.trace "Failed to access ${pkg.name} even though it exists" false - ) - else - builtins.trace "Failed to locate ${pkg.name}." false - ) enrichedAttrs; - attrsWithPackages = builtins.map ( pkg: pkg // { package = lib.attrsets.attrByPath pkg.path null pkgs; } - ) validPackageAttributes; + ) enrichedAttrs; attrsWithMaintainers = builtins.map ( pkg: From e88dd3a8b278ffe22b7de999183220beeda05a54 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sat, 30 Aug 2025 15:43:47 +0200 Subject: [PATCH 3/4] ci/eval/compare: only check changed attrpaths It makes no sense to check newly added attrpaths for maintainers on the target branch - by definition these attrpaths won't exist, yet. We can avoid falling back to `null` for these etc. --- ci/eval/compare/default.nix | 3 ++- ci/eval/compare/maintainers.nix | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ci/eval/compare/default.nix b/ci/eval/compare/default.nix index b338d8f82d6d..cfd9b78510d0 100644 --- a/ci/eval/compare/default.nix +++ b/ci/eval/compare/default.nix @@ -77,6 +77,7 @@ let # - values: lists of `packagePlatformPath`s diffAttrs = builtins.fromJSON (builtins.readFile "${combinedDir}/combined-diff.json"); + changedPackagePlatformAttrs = convertToPackagePlatformAttrs diffAttrs.changed; rebuildsPackagePlatformAttrs = convertToPackagePlatformAttrs diffAttrs.rebuilds; removedPackagePlatformAttrs = convertToPackagePlatformAttrs diffAttrs.removed; @@ -116,7 +117,7 @@ let ); maintainers = callPackage ./maintainers.nix { } { - changedattrs = lib.attrNames (lib.groupBy (a: a.name) rebuildsPackagePlatformAttrs); + changedattrs = lib.attrNames (lib.groupBy (a: a.name) changedPackagePlatformAttrs); changedpathsjson = touchedFilesJson; removedattrs = lib.attrNames (lib.groupBy (a: a.name) removedPackagePlatformAttrs); inherit byName; diff --git a/ci/eval/compare/maintainers.nix b/ci/eval/compare/maintainers.nix index ec3dc2dcc837..00a47e7c494d 100644 --- a/ci/eval/compare/maintainers.nix +++ b/ci/eval/compare/maintainers.nix @@ -28,7 +28,7 @@ let }) (changedattrs ++ removedattrs); attrsWithPackages = builtins.map ( - pkg: pkg // { package = lib.attrsets.attrByPath pkg.path null pkgs; } + pkg: pkg // { package = lib.getAttrFromPath pkg.path pkgs; } ) enrichedAttrs; attrsWithMaintainers = builtins.map ( From 4126ef7e00fe76fb543d5235f1e5fe33dc3e50e2 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sat, 30 Aug 2025 15:37:59 +0200 Subject: [PATCH 4/4] ci/eval/compare: refactor Simplification after the last step. --- ci/eval/compare/maintainers.nix | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/ci/eval/compare/maintainers.nix b/ci/eval/compare/maintainers.nix index 00a47e7c494d..bc1cfb5a3cfb 100644 --- a/ci/eval/compare/maintainers.nix +++ b/ci/eval/compare/maintainers.nix @@ -22,27 +22,18 @@ let anyMatchingFiles = files: builtins.any anyMatchingFile files; - enrichedAttrs = builtins.map (name: { - path = lib.splitString "." name; - name = name; - }) (changedattrs ++ removedattrs); - - attrsWithPackages = builtins.map ( - pkg: pkg // { package = lib.getAttrFromPath pkg.path pkgs; } - ) enrichedAttrs; - attrsWithMaintainers = builtins.map ( - pkg: + name: let - meta = pkg.package.meta or { }; + package = lib.getAttrFromPath (lib.splitString "." name) pkgs; in - pkg - // { + { + inherit name package; # TODO: Refactor this so we can ping entire teams instead of the individual members. # Note that this will require keeping track of GH team IDs in "maintainers/teams.nix". - maintainers = meta.maintainers or [ ]; + maintainers = package.meta.maintainers or [ ]; } - ) attrsWithPackages; + ) (changedattrs ++ removedattrs); relevantFilenames = drv: