fix(cdn): route Ubuntu 26.04 to resolute (#173)

## Motivation

The generic `https://cran.rpkgs.com/` repository falls back to upstream CRAN on Ubuntu 26.04 because the edge router does not recognize its release version.

This causes Resolute users to download and compile source packages even when matching binaries exist.

## Changes

- Map Ubuntu 26.04 user agents to the `resolute` repository slot.
- Cover ARM64 Ubuntu 26.04 routing with an edge middleware regression test.

## Verification

- `just edge-test`, 1 test with 15 steps passed.
- Confirmed the current live generic route redirects the Resolute user agent to upstream CRAN.
- Confirmed the explicit `amd64/resolute/latest` repository installs `rlang` as a binary in `reg.devxy.io/r/r-ubuntu:4.6-resolute`.

Reviewed-on: #173
This commit is contained in:
Patrick Schratz 2026-08-30 12:19:52 +00:00 committed by Patrick Schratz
commit a8820e6e90
2 changed files with 10 additions and 0 deletions

View file

@ -18,6 +18,7 @@ const UNION_SLOTS = 'amd64/alpine324';
const UA_R45_MUSL = 'R (4.5.3 x86_64-pc-linux-musl x86_64 linux-musl)';
const UA_R46_MUSL = 'R (4.6.0 x86_64-pc-linux-musl x86_64 linux-musl)';
const UA_R45_ALPINE = 'R/4.5.3 R (4.5.3 x86_64-pc-linux-musl x86_64 linux-musl) Alpine Linux 3.24';
const UA_R45_RESOLUTE = 'R/4.5.3 (Ubuntu 26.04) (aarch64-unknown-linux-gnu aarch64 linux-gnu)';
const UA_R45_DARWIN = 'R (4.5.1 aarch64-apple-darwin20 aarch64 darwin20)';
const UA_CURL = 'curl/8.0.1';
@ -141,6 +142,14 @@ Deno.test('rpkgs-router', async (t) => {
assertEquals(res.location, `https://cran.rpkgs.com${SLOT}/4.5/PACKAGES.gz`);
});
await t.step('resolves Ubuntu 26.04 to the resolute slot', async () => {
const res = await probe('/src/contrib/PACKAGES.gz', UA_R45_RESOLUTE);
assertEquals(
res.location,
'https://cran.rpkgs.com/arm64/resolute/latest/src/contrib/PACKAGES.gz',
);
});
await t.step('sends an unidentifiable distro to CRAN', async () => {
const res = await probe('/src/contrib/PACKAGES.gz', UA_R45_MUSL);
assertEquals(res.location, 'https://cran.r-project.org/src/contrib/PACKAGES.gz');

View file

@ -59,6 +59,7 @@ const RHEL_REGEX = /(almalinux|rocky)[^\d]*(\d+)/i;
const UBUNTU_REGEX = /Ubuntu ([\d.]+)/i;
const UBUNTU_CODENAMES: Record<string, string> = {
'26.04': 'resolute',
'24.04': 'noble',
'22.04': 'jammy',
};