feat(local): detect dependency-cascade failures generally, not just RcppParallel (#128)

## Why (from the #127 trial-build gate)

The gate did its job: 0/3 passed, merge blocked. The log showed *why* -- BFpack, BayesERtools, GMLTM all fail while building their shared dependency **`rstan`**, not in their own code:

```
Failed to build source package rstan.
  .../StanHeaders/include/stan/math/prim/core/init_threadpool_tbb.hpp:9:10:
  fatal error: tbb/tbb_stddef.h: No such file or directory
```

So the per-package `-DTBB_INTERFACE_NEW` makevars entries the classifier proposed are useless for these packages -- they're blocked on `rstan` (which already has a registry entry). This is the **same dependency cascade** the RcppParallel `applies_to` guard catches, but `tbb-stddef-removed` is a generic signature with no such pin, so ~73 Stan packages kept getting proposed.

## What

Generalise cascade detection beyond the RcppParallel special case:

- `failing_dependency(error_text, package)` -- when the log names a **different** package as the one that failed to compile (`Failed to build source package X`, `compilation failed for package 'X'`, `dependency 'X' ... not available`), that package is the real cause.
- `build_triage_report()` now blocks any package whose **every** failing build is such a cascade: reported as `blocked_on` that dependency, never proposed a bogus per-package entry. A package that fails in its **own** compilation is still proposed.
- The `applies_to` (RcppParallel) and data-driven (rstan) cases are unified into one `blocked_packages` / `blocked_on` model; the report, proposer, and `blocked_summary` count the actually-blocked packages, and the blocked note shows even when a group also has genuine proposals.

## Effect

Next auto-apply run will stop proposing the rstan-blocked Stan packages (and any future dependency cascade) and surface them as "blocked on rstan" instead. Fixing `rstan` once clears the whole cluster.

## Verification

- New tests: `failing_dependency` (cascade vs own-compile vs none), and an end-to-end split where BFpack/GMLTM (blocked on rstan) are not proposed while an own-compile package still is.
- Full suite: 112 tests pass; all pre-commit hooks pass.

Refs #120, #127. (Separate follow-ups: fixing rstan's build itself, and quieting the gate's metadata-DB retry storm -- both root-caused to bincraft.)

Reviewed-on: #128
This commit is contained in:
Patrick Schratz 2026-07-16 08:23:54 +00:00 committed by Patrick Schratz
commit f9d399fac0

View file

@ -160,17 +160,22 @@ unclassified_summary <- function(report, max_groups = 30L, max_pkgs = 15L) {
)
}
# Groups blocked on a dependency (a package-specific fix pinned via `applies_to`
# whose dependents merely carry its error): report the dependency + how many
# dependents wait on it, so fixing it once is recognised as clearing the batch.
# 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) !is.null(g$blocked_on), report)
bl <- Filter(
function(g) length(g$blocked_packages %||% character(0L)) > 0L,
report
)
lapply(bl, function(g) {
pkgs <- g$blocked_packages
list(
blocked_on = g$blocked_on,
n_packages = length(g$packages),
packages = utils::head(g$packages, max_pkgs),
packages_truncated = length(g$packages) > max_pkgs
n_packages = length(pkgs),
packages = utils::head(pkgs, max_pkgs),
packages_truncated = length(pkgs) > max_pkgs
)
})
}