fix(local): route multi-signature packages to human triage in the proposer
A package whose failing builds match more than one auto-proposable signature (e.g. some logs hit `tbb-stddef-removed` and others `rcppparallel-bundled-tbb`) produced two candidate registry entries with the same package/platforms/versions key, so the candidate set failed `validate-patches.R` with "ambiguous duplicate entries" and the whole proposer run aborted. Add a pure `dedupe_candidates()` that keeps a package only when it maps to a single signature and routes genuinely ambiguous packages (conflicting fix tiers) to human triage instead of guessing between them. The proposer prints the skipped packages and proceeds with the unambiguous candidates.
This commit is contained in:
parent
77508f8fc5
commit
ec64fb6db8
1 changed files with 80 additions and 1 deletions
|
|
@ -6,6 +6,37 @@
|
|||
# Kept free of DB/HTTP/clock so it can be sourced by the proposer, the tracker
|
||||
# entrypoint, and the unit tests. Timestamps are passed in by callers.
|
||||
|
||||
# Split proposal candidates into the ones safe to emit and the ambiguous ones.
|
||||
# A candidate is a list with at least `package` and `signature`. A package that
|
||||
# maps to more than one distinct auto-proposable signature is genuinely
|
||||
# ambiguous (two conflicting fix tiers, e.g. makevars vs source patch): emitting
|
||||
# both would create colliding registry entries, so those are routed to human
|
||||
# triage instead of guessed at. Returns list(keep = ..., ambiguous = ...), where
|
||||
# `ambiguous` is a named list of package -> the distinct signatures seen.
|
||||
dedupe_candidates <- function(candidates) {
|
||||
if (length(candidates) == 0L) {
|
||||
return(list(keep = list(), ambiguous = list()))
|
||||
}
|
||||
pkgs <- vapply(candidates, function(c) as.character(c$package), character(1L))
|
||||
by_pkg <- split(candidates, pkgs)
|
||||
keep <- list()
|
||||
ambiguous <- list()
|
||||
for (pkg in names(by_pkg)) {
|
||||
cs <- by_pkg[[pkg]]
|
||||
sigs <- unique(vapply(
|
||||
cs,
|
||||
function(c) as.character(c$signature),
|
||||
character(1L)
|
||||
))
|
||||
if (length(sigs) == 1L) {
|
||||
keep[[length(keep) + 1L]] <- cs[[1L]] # one signature -> take the first
|
||||
} else {
|
||||
ambiguous[[pkg]] <- sigs
|
||||
}
|
||||
}
|
||||
list(keep = keep, ambiguous = ambiguous)
|
||||
}
|
||||
|
||||
# Stable identity of a ledger record: one proposal per (package, signature).
|
||||
ledger_key <- function(record) {
|
||||
paste0(
|
||||
|
|
|
|||
Loading…
Reference in a new issue