diff --git a/scripts/verify-r-minor-routing.sh b/scripts/verify-r-minor-routing.sh index 28acd92..cad6c38 100755 --- a/scripts/verify-r-minor-routing.sh +++ b/scripts/verify-r-minor-routing.sh @@ -48,6 +48,11 @@ SAMPLE=${SAMPLE:-5} # one R minor carries fewer per-minor binaries for the others; until that gap # closes, "full coverage for ABI-sensitive packages" is not a claim we can make. PARITY_TOLERANCE=${PARITY_TOLERANCE:-25} +# Largest share (percent) of per-minor entries that may be source fallbacks +# rather than binaries. A source fallback resolves with HTTP 200 and installs +# correctly, but it compiles on the client: routing to it is not the binary +# service we advertise. Entries without a `Built:` field are source fallbacks. +SOURCE_FALLBACK_TOLERANCE=${SOURCE_FALLBACK_TOLERANCE:-10} LIVE=0 for arg in "$@"; do @@ -108,6 +113,19 @@ pkg_names() { gunzip -c "$1" 2>/dev/null | awk '/^Package:/ {print $2}' | sort -u } +# " " for a per-minor index: how many entries carry a +# Path: field, and how many of those lack a Built: field (i.e. are sources). +fallback_counts() { + gunzip -c "$1" 2>/dev/null | awk ' + /^Package:/ { pkg = $2; path = ""; built = "" } + /^Path:/ { path = $2 } + /^Built:/ { built = $2 } + /^$/ { if (pkg != "" && path != "") { n++; if (built == "") s++ } pkg = "" } + END { if (pkg != "" && path != "") { n++; if (built == "") s++ } + printf "%d %d\n", n, s } + ' +} + # " " pairs for entries that carry a Path: field. path_entries() { gunzip -c "$1" 2>/dev/null | awk ' @@ -176,6 +194,19 @@ for arch in $ARCHES; do ok "$slot R $minor index: $minor_count packages, union holds" fi + # A per-minor entry that is a source fallback resolves fine but makes the + # client compile. Routing to a slot that is mostly fallbacks does not + # deliver the binaries we advertise. + read -r steered fallbacks <<< "$(fallback_counts "$minor_file")" + if [ "${steered:-0}" -gt 0 ]; then + pct=$((fallbacks * 100 / steered)) + if [ "$pct" -gt "$SOURCE_FALLBACK_TOLERANCE" ]; then + bad "$slot R $minor: $fallbacks/$steered per-minor entries are source fallbacks (${pct}%), not binaries" + else + ok "$slot R $minor: $((steered - fallbacks))/$steered per-minor entries are binaries" + fi + fi + # Path: entries steer to per-minor binaries; they must resolve. if [ "$SAMPLE" -gt 0 ]; then path_entries "$minor_file" > "$minor_file.paths"