fix(local): route multi-signature packages to human triage in the proposer (#119)
All checks were successful
ci/crow/manual/weekly-patch-proposals Pipeline was successful
ci/crow/cron/process-updates/15 Pipeline was successful
ci/crow/cron/process-updates/11 Pipeline was successful
ci/crow/cron/process-updates/16 Pipeline was successful
ci/crow/cron/process-updates/18 Pipeline was successful
All checks were successful
ci/crow/manual/weekly-patch-proposals Pipeline was successful
ci/crow/cron/process-updates/15 Pipeline was successful
ci/crow/cron/process-updates/11 Pipeline was successful
ci/crow/cron/process-updates/16 Pipeline was successful
ci/crow/cron/process-updates/18 Pipeline was successful
## Problem A live `propose-patches.R --open-issue` run aborted with: ``` Patch registry validation FAILED: - ambiguous duplicate entries: hmmTMB|ubuntu-2604|*, imt|ubuntu-2604|*, refundBayes|ubuntu-2604|* Error: Candidate registry failed validation; not writing or proposing. ``` Root cause: a package whose failing builds match **more than one** auto-proposable signature (e.g. some logs hit `tbb-stddef-removed`, others `rcppparallel-bundled-tbb`) landed in two separate signature groups, so the proposer emitted two candidate entries with the same `package|platforms|versions` key. The validator's ambiguous-duplicate check then failed the whole candidate set, aborting the run — so even the unambiguous candidates (e.g. `vacalibration`) never got proposed. ## Fix Add a pure, tested `dedupe_candidates()` that: - keeps a package's candidate only when it maps to a **single** signature (collapsing an accidental repeat under the same signature), and - routes a package that maps to **multiple** signatures (conflicting fix tiers -- makevars vs source patch) to **human triage** instead of guessing between them. The proposer prints the skipped ambiguous packages and proceeds with the clean candidates, so one ambiguous package no longer blocks the rest. This matches the issue #115 guardrail: don't auto-pick when the fix is ambiguous. ## Verification - New unit tests in `test-proposal-tracking-lib.R` cover the single-signature, multi-signature (conflict), duplicate-under-one-signature, and empty cases. - Reproduced the original failure end-to-end with a stubbed DB (`hmmTMB` ambiguous + `vacalibration` clean): `hmmTMB` is now listed under "Ambiguous -> human triage", `vacalibration` is proposed, and the candidate registry validates (`Patch registry OK`). - Full suite: 78 tests pass; all pre-commit hooks pass. Reviewed-on: #119
This commit is contained in:
parent
77508f8fc5
commit
f1dd661213
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