feat(local): aggregate blocked-on-dependency reporting by dependency
With cascade detection live, a run surfaced ~30 root-cause dependencies, but the "blocked on a dependency" list repeated the same dependency once per fingerprint group (rstan x4, lpsymphony x4, salso x2, ...), burying the priority. Aggregate across all groups by the dependency each dependent waits on: expose `blocked_map` (package -> dependency) from build_triage_report, and add `blocked_by_dependency()` which dedupes dependents and ranks dependencies by how many they block. One line per dependency, sorted by impact, in the proposer and tracker (log + issue). Replaces the per-group `blocked_summary`.
This commit is contained in:
parent
118a92889f
commit
1b57d45c80
1 changed files with 68 additions and 39 deletions
|
|
@ -160,24 +160,38 @@ unclassified_summary <- function(report, max_groups = 30L, max_pkgs = 15L) {
|
|||
)
|
||||
}
|
||||
|
||||
# Groups with packages blocked on a dependency (a package-specific fix pinned
|
||||
# via `applies_to`, or a data-driven cascade where the package fails building a
|
||||
# dependency): report the dependency + how many dependents wait on it, so fixing
|
||||
# it once is recognised as clearing the batch.
|
||||
blocked_summary <- function(report, max_pkgs = 15L) {
|
||||
bl <- Filter(
|
||||
function(g) length(g$blocked_packages %||% character(0L)) > 0L,
|
||||
report
|
||||
)
|
||||
lapply(bl, function(g) {
|
||||
pkgs <- g$blocked_packages
|
||||
# Aggregate blocked packages across ALL groups by the dependency they wait on,
|
||||
# so one dependency (RcppParallel, rstan, sf, ...) is a single line -- deduped
|
||||
# and ranked by how many distinct dependents it blocks -- instead of repeating
|
||||
# once per fingerprint group. Reads each group's `blocked_map` (package -> the
|
||||
# dependency it is blocked on). Returns records sorted by dependent count desc,
|
||||
# each with up to `max_pkgs` example dependents.
|
||||
blocked_by_dependency <- function(report, max_pkgs = 15L) {
|
||||
acc <- list() # dependency -> character vector of dependent packages
|
||||
for (g in report) {
|
||||
bm <- g$blocked_map
|
||||
if (is.null(bm) || length(bm) == 0L) {
|
||||
next
|
||||
}
|
||||
for (pkg in names(bm)) {
|
||||
for (dep in as.character(unlist(bm[[pkg]]))) {
|
||||
acc[[dep]] <- unique(c(acc[[dep]], pkg))
|
||||
}
|
||||
}
|
||||
}
|
||||
if (length(acc) == 0L) {
|
||||
return(list())
|
||||
}
|
||||
out <- lapply(names(acc), function(dep) {
|
||||
pkgs <- acc[[dep]]
|
||||
list(
|
||||
blocked_on = g$blocked_on,
|
||||
dependency = dep,
|
||||
n_packages = length(pkgs),
|
||||
packages = utils::head(pkgs, max_pkgs),
|
||||
packages_truncated = length(pkgs) > max_pkgs
|
||||
)
|
||||
})
|
||||
out[order(-vapply(out, function(x) x$n_packages, integer(1L)))]
|
||||
}
|
||||
|
||||
# Does a registry entry's `platforms` apply to a build on `os` (e.g.
|
||||
|
|
|
|||
Loading…
Reference in a new issue