From 8a1e535d8be3a6340d1b546a114f0e2134baea0c Mon Sep 17 00:00:00 2001 From: pat-s Date: Thu, 16 Jul 2026 08:05:55 +0000 Subject: [PATCH] fix(local): make the trial-build gate detect non-throwing build failures The gate reported "3/3 passed" while all three builds actually failed (their rstan dependency would not compile). Root cause: bincraft::build_binary_package() catches build failures internally and RETURNS "error" for the failed tag instead of throwing, so the gate's tryCatch never fired and every failed build looked like a pass -- a false green that would let broken registry entries merge. Inspect the return value: a tag is a pass only if the (flattened) result is non-empty and contains no "error" sentinel; a thrown error still counts as failure. Verified the verdict logic against error/skipped/TRUE/list/NULL/mixed. --- local/trial-build-registry.R | 39 +++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/local/trial-build-registry.R b/local/trial-build-registry.R index 0749bf7..9708408 100644 --- a/local/trial-build-registry.R +++ b/local/trial-build-registry.R @@ -117,23 +117,34 @@ results <- vapply( pkgs, function(pkg) { cat(sprintf("\n=== trial build: %s ===\n", pkg)) - tryCatch( - { - bincraft::build_binary_package( - pkg, - tag_limit = 1L, - patches = patches_dir, - archive = FALSE, - upload = FALSE, - store_build_metadata = FALSE - ) - TRUE - }, + # bincraft::build_binary_package() catches build failures internally and + # RETURNS "error" for the failed tag rather than throwing, so a green gate + # must inspect the return value -- checking only for a thrown exception + # reports a broken build as passing. + res <- tryCatch( + bincraft::build_binary_package( + pkg, + tag_limit = 1L, + patches = patches_dir, + archive = FALSE, + upload = FALSE, + store_build_metadata = FALSE + ), error = function(e) { - cat(sprintf("FAILED %s: %s\n", pkg, conditionMessage(e))) - FALSE + cat(sprintf("FAILED %s (threw): %s\n", pkg, conditionMessage(e))) + "error" } ) + flat <- as.character(unlist(res)) + ok <- length(flat) > 0L && !("error" %in% flat) + if (!ok) { + cat(sprintf( + "FAILED %s: build did not succeed (result: %s)\n", + pkg, + if (length(flat) > 0L) toString(flat) else "" + )) + } + ok }, logical(1L) ) -- 2.54.0