From b9c2a28bd219bdfca440d18520d849a629589f47 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Sirois Date: Thu, 19 Mar 2026 17:36:12 +0100 Subject: [PATCH] fix(ci): improve regression error message with query preview, formatted costs, and link Co-Authored-By: Claude Opus 4.6 --- src/main.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main.ts b/src/main.ts index 5330dbe..d34543e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -11,6 +11,7 @@ import { fetchPreviousRun, postToSiteApi, } from "./reporters/site-api.ts"; +import { formatCost, queryPreview } from "./reporters/github/github.ts"; import { DEFAULT_CONFIG, fetchAnalyzerConfig } from "./config.ts"; async function runInCI( @@ -95,10 +96,14 @@ async function runInCI( // Block PR if regressions exceed thresholds if (reportContext.comparison && reportContext.comparison.regressed.length > 0) { - const messages = reportContext.comparison.regressed.map( - (q) => - ` - ${q.hash}: cost ${q.previousCost} → ${q.currentCost} (+${q.regressionPercentage.toFixed(1)}%)`, - ); + const messages = reportContext.comparison.regressed.map((q) => { + const preview = queryPreview(q.formattedQuery); + const cost = `cost ${formatCost(q.previousCost)} → ${formatCost(q.currentCost)} (+${q.regressionPercentage.toFixed(1)}%)`; + const link = reportContext.runUrl + ? `\n ${reportContext.runUrl}/${q.hash}` + : ""; + return ` - ${preview}: ${cost}${link}`; + }); core.setFailed( `${reportContext.comparison.regressed.length} untriaged regression(s) beyond threshold:\n${messages.join("\n")}`, );