From a910c51c57747427abc4fb7ea4cea70ba66bb702 Mon Sep 17 00:00:00 2001 From: JSONbored <49853598+JSONbored@users.noreply.github.com> Date: Mon, 20 Jul 2026 00:04:47 -0700 Subject: [PATCH] fix(ci): switch fetch-test-timing.mjs to Codecov's test-analytics endpoint test-results/ is deprecated -- confirmed live, running test-timing-refresh.yml via workflow_dispatch returned a 301 pointing at test-analytics/ instead ("This endpoint has been deprecated. Please use /test-analytics/ instead."). Verified via Codecov's own live OpenAPI schema that the replacement returns the identical PaginatedTestrunList wrapper and Testrun field shape, so this is a pure URL fix -- nothing else in the aggregation logic needed to change. --- scripts/fetch-test-timing.mjs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/fetch-test-timing.mjs b/scripts/fetch-test-timing.mjs index a907f8af0e..15a83f5e6b 100644 --- a/scripts/fetch-test-timing.mjs +++ b/scripts/fetch-test-timing.mjs @@ -14,6 +14,13 @@ // existing CODECOV_TOKEN secret -- that one is an upload-only token and doesn't authenticate this read // API. Codecov's docs don't publish a numeric rate limit for this endpoint, so this is deliberately run // on a schedule (test-timing-refresh.yml), not per-PR. +// +// Uses /test-analytics/, not /test-results/: the latter is now deprecated (confirmed by actually +// running this script -- Codecov returns a 301 with "This endpoint has been deprecated. Please use +// /test-analytics/ instead."). Verified via Codecov's live OpenAPI schema (api.codecov.io/api/v2/schema/) +// that /test-analytics/ returns the identical PaginatedTestrunList wrapper and Testrun field shape +// (filename, duration_seconds, commit_sha, etc.) -- a URL rename, not a schema change, so nothing else +// in this file needed to change. import { writeFileSync } from "node:fs"; @@ -47,7 +54,7 @@ async function fetchWithRetry(url, maxAttempts = 4) { async function fetchAllTestRuns() { const rows = []; - let url = `https://api.codecov.io/api/v2/gh/${owner}/repos/${repoName}/test-results/?branch=main&page_size=100`; + let url = `https://api.codecov.io/api/v2/gh/${owner}/repos/${repoName}/test-analytics/?branch=main&page_size=100`; let pages = 0; while (url && pages < MAX_PAGES) { const body = await fetchWithRetry(url);