From b144f5a9234bd5ba856beaf07e01fcb6ec394797 Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Tue, 20 Oct 2026 15:12:23 +0200 Subject: [PATCH 1/3] acc: shrink the regression report comment Co-authored-by: Isaac --- .github/workflows/regression-report.yml | 14 ++++++++++++-- acceptance/regression_test.go | 16 ++++++++++++++-- acceptance/regression_unit_test.go | 17 +++++++++++++++++ 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/.github/workflows/regression-report.yml b/.github/workflows/regression-report.yml index ba27b20a4ff..4c5770873a7 100644 --- a/.github/workflows/regression-report.yml +++ b/.github/workflows/regression-report.yml @@ -91,11 +91,21 @@ jobs: const runUrl = `${context.serverUrl}/${owner}/${repo}/actions/runs/${context.runId}`; const commitUrl = `${context.serverUrl}/${owner}/${repo}/commit/${sha}`; - // Comments are limited to 65536 characters; the artifact holds the full report. + // Comments are limited to 65536 characters; the artifact holds the full report. The table + // comes first, then one
block per failure: drop whole blocks that do not fit, + // as cutting one in the middle would leave its markup open. const MAX_REPORT = 60000; let report = fs.readFileSync(path, 'utf8'); if (report.length > MAX_REPORT) { - report = report.slice(0, MAX_REPORT) + `\n\n_Report truncated, see the full report in the [run](${runUrl})._\n`; + const [head, ...blocks] = report.split('
\n'); + let kept = head; + let shown = 0; + for (const block of blocks) { + if (kept.length + block.length > MAX_REPORT) break; + kept += '
\n' + block; + shown++; + } + report = kept + `_${blocks.length - shown} more failure details omitted, see the full report in the [run](${runUrl})._\n`; } const body = `${MARKER}\nCommit: [\`${sha.slice(0, 9)}\`](${commitUrl}) | [Workflow run](${runUrl})\n\n${report}`; diff --git a/acceptance/regression_test.go b/acceptance/regression_test.go index 69523dbd4b1..ebf360cb7a5 100644 --- a/acceptance/regression_test.go +++ b/acceptance/regression_test.go @@ -99,6 +99,9 @@ var ( // " --- FAIL: TestAccept/foo (0.10s)" resultLineRE = regexp.MustCompile(`^\s*--- (PASS|FAIL|SKIP): (\S+) `) + + // The temp dir of a test, e.g. "/tmp/TestAcceptfoo123456"; the random suffix differs on every run. + tmpDirRE = regexp.MustCompile(`/TestAccept[^/\s]*`) ) // parseTestOutput parses the output of a test binary run with -test.v into results by test name. @@ -266,10 +269,19 @@ func renderDetails(b *strings.Builder, test string, columns []regrColumn) { marks[i] = c.Title + " " + statusMark(c.status(test)) } fmt.Fprintf(b, "
\n%s: %s\n\n", test, strings.Join(marks, " | ")) + // A new test commonly fails the same way on main and on the release, which would print the + // same long diff twice. + firstWith := map[string]string{} for _, c := range failed { - output := truncateLines(strings.Join(c.Results[test].Output, "\n"), regrDetailLines) + output := strings.TrimSpace(strings.Join(c.Results[test].Output, "\n")) + key := tmpDirRE.ReplaceAllString(output, "/TestAccept") + if first, ok := firstWith[key]; ok { + fmt.Fprintf(b, "**%s:** same output as %s\n\n", c.Title, first) + continue + } + firstWith[key] = c.Title // The longer fence keeps backticks in the output from ending the block. - fmt.Fprintf(b, "**%s:**\n````\n%s\n````\n\n", c.Title, strings.TrimSpace(output)) + fmt.Fprintf(b, "**%s:**\n````\n%s\n````\n\n", c.Title, truncateLines(output, regrDetailLines)) } b.WriteString("
\n\n") } diff --git a/acceptance/regression_unit_test.go b/acceptance/regression_unit_test.go index e4d121e4708..8a5900ce10c 100644 --- a/acceptance/regression_unit_test.go +++ b/acceptance/regression_unit_test.go @@ -1,6 +1,7 @@ package acceptance_test import ( + "strings" "testing" "github.com/stretchr/testify/assert" @@ -66,3 +67,19 @@ func TestRenderRegressionReport(t *testing.T) { assert.Contains(t, report, "**main (abc):**\n````\nmain failure\n````") assert.Contains(t, report, "failing=1") } + +func TestRenderRegressionReportDedupesIdenticalFailures(t *testing.T) { + failure := func(tmp string) *testResult { + return &testResult{Status: statusFail, Output: []string{"Messages: output.txt vs /tmp/TestAcceptfoo" + tmp + "/002/output.txt", "diff"}} + } + test := "TestAccept/bundle/a" + columns := []regrColumn{ + {Title: "branch", Results: map[string]*testResult{test: {Status: statusPass}}}, + {Title: "main (abc)", Category: catRegression, Results: map[string]*testResult{test: failure("111")}}, + {Title: "latest (v1)", Category: catUnreleased, Results: map[string]*testResult{test: failure("222")}}, + } + + report := renderRegressionReport("Selected 1", columns) + assert.Equal(t, 1, strings.Count(report, "\ndiff\n")) + assert.Contains(t, report, "**latest (v1):** same output as main (abc)") +} From 75f4087e336b19ddbc7574daab5eea566e16f33b Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Tue, 20 Oct 2026 15:39:42 +0200 Subject: [PATCH 2/3] tmp: touch selftest/basic to trigger the regression-report Co-authored-by: Isaac --- acceptance/selftest/basic/script | 1 + 1 file changed, 1 insertion(+) diff --git a/acceptance/selftest/basic/script b/acceptance/selftest/basic/script index 546d4a4b80e..417f076de39 100644 --- a/acceptance/selftest/basic/script +++ b/acceptance/selftest/basic/script @@ -36,3 +36,4 @@ trace $CLI --version touch ignored_file.txt mkdir ignored_dir touch ignored_dir/hello.txt +# tmp: trigger the regression-report From 482e90f1bd8bf0e9f12099ccb7b598fe41d6d5af Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Tue, 20 Oct 2026 15:48:59 +0200 Subject: [PATCH 3/3] Revert "tmp: touch selftest/basic to trigger the regression-report" This reverts commit 75f4087e336b19ddbc7574daab5eea566e16f33b. --- acceptance/selftest/basic/script | 1 - 1 file changed, 1 deletion(-) diff --git a/acceptance/selftest/basic/script b/acceptance/selftest/basic/script index 417f076de39..546d4a4b80e 100644 --- a/acceptance/selftest/basic/script +++ b/acceptance/selftest/basic/script @@ -36,4 +36,3 @@ trace $CLI --version touch ignored_file.txt mkdir ignored_dir touch ignored_dir/hello.txt -# tmp: trigger the regression-report