tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 2da424432f7037d7a863f279c934f243f303b72e
parent 9a8f2f85655ff0c26e7ef05a906f1fb5c9e79f89
Author: Florian Quèze <florian@queze.net>
Date:   Thu,  6 Nov 2025 15:20:25 +0000

Bug 1997886 - When generating xpcshell timing JSON files, ignore previous artifacts if they don't contain enough processed jobs, r=ahal.

Differential Revision: https://phabricator.services.mozilla.com/D271047

Diffstat:
Mtesting/timings/fetch-xpcshell-data.js | 44++++++++++++++++++++++++++++++++------------
1 file changed, 32 insertions(+), 12 deletions(-)

diff --git a/testing/timings/fetch-xpcshell-data.js b/testing/timings/fetch-xpcshell-data.js @@ -1041,13 +1041,25 @@ async function processDateData(targetDate, forceRefetch = false) { return; } + // Fetch jobs list first (needed for verification) + let jobs; + try { + jobs = await fetchXpcshellData(targetDate); + if (jobs.length === 0) { + console.log(`No jobs found for ${targetDate}.`); + return; + } + } catch (error) { + console.error(`Error fetching jobs for ${targetDate}:`, error); + return; + } + // Try to fetch from previous run if available and not forcing refetch if ( !forceRefetch && previousRunData && previousRunData.dates.has(targetDate) ) { - console.log(`Fetching ${targetDate} from previous run...`); try { const [timings, resources] = await Promise.all([ fetchJson(`${previousRunData.artifactsUrl}/${timingsFilename}`), @@ -1055,14 +1067,28 @@ async function processDateData(targetDate, forceRefetch = false) { ]); if (timings && resources) { - saveJsonFile(timings, timingsPath); - saveJsonFile(resources, resourcesPath); - return; + const expectedJobCount = jobs.length; + const actualProcessedCount = timings.metadata?.processedJobCount; + + if (actualProcessedCount < expectedJobCount) { + const missingJobs = expectedJobCount - actualProcessedCount; + console.log( + `Ignoring artifact from previous run: missing ${missingJobs} jobs (expected ${expectedJobCount}, got ${actualProcessedCount})` + ); + } else { + console.log(`Fetched valid artifact from previous run.`); + saveJsonFile(timings, timingsPath); + saveJsonFile(resources, resourcesPath); + return; + } + } else { + console.log( + `Error fetching artifact from previous run: artifact not found` + ); } - console.log(` Failed to fetch from previous run, will regenerate`); } catch (error) { console.log( - ` Error fetching from previous run: ${error.message}, will regenerate` + `Error fetching artifact from previous run: ${error.message}` ); } } @@ -1072,12 +1098,6 @@ async function processDateData(targetDate, forceRefetch = false) { } try { - const jobs = await fetchXpcshellData(targetDate); - if (jobs.length === 0) { - console.log(`No jobs found for ${targetDate}.`); - return; - } - // Calculate start of day timestamp for relative time calculation const startOfDay = new Date(targetDate + "T00:00:00.000Z"); const startTime = Math.floor(startOfDay.getTime() / 1000); // Convert to seconds