From 611a70dff246945e7711bae88eeed153b43e46f8 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Fri, 4 Sep 2026 14:43:57 +0000 Subject: [PATCH] tools/bump: say which gates actually ran The body claimed the nix checks had run regardless of --gate, which is exactly the sort of thing a reviewer takes at face value. --- tools/bump/main.go | 5 +++-- tools/bump/pr.go | 3 ++- tools/bump/report.go | 27 ++++++++++++++++++++++----- tools/bump/report_test.go | 2 +- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/tools/bump/main.go b/tools/bump/main.go index 08adb000..08227191 100644 --- a/tools/bump/main.go +++ b/tools/bump/main.go @@ -29,7 +29,7 @@ import ( ) type runFlags struct { - DryRun bool `flag:"dry-run,default=false,Apply and report, but run no final gate and touch no remote"` + DryRun bool `flag:"dry-run,default=false,Rebuild the branch locally and report, but run no final gate and touch no remote"` NoPR bool `flag:"no-pr,default=false,Push nothing and open no pull request"` Areas string `flag:"areas,Comma-separated areas to run (default: all)"` Skip string `flag:"skip,Comma-separated areas to skip"` @@ -136,7 +136,7 @@ func cmdRun(ctx context.Context) error { return err } - body := renderBody(results, markerOf(results, tree, head)) + body := renderBody(results, markerOf(results, tree, head), gate) if err := writeStepSummary(body); err != nil { //nolint:noinlineerr return err @@ -165,6 +165,7 @@ func cmdRun(ctx context.Context) error { Branch: runCfg.Branch, Base: runCfg.Base, Title: "all: bump pinned versions", + Gate: gate, Force: runCfg.Force, }, results) } diff --git a/tools/bump/pr.go b/tools/bump/pr.go index b30ef715..a7f5e69e 100644 --- a/tools/bump/pr.go +++ b/tools/bump/pr.go @@ -81,6 +81,7 @@ type publishOptions struct { Branch string Base string Title string + Gate string Force bool } @@ -99,7 +100,7 @@ func publish(ctx context.Context, r *repo, opt publishOptions, results []result) } now := markerOf(results, tree, head) - body := renderBody(results, now) + body := renderBody(results, now, opt.Gate) pr, err := lookupPR(ctx, r, opt.Slug, opt.Branch) if err != nil { diff --git a/tools/bump/report.go b/tools/bump/report.go index 6a084867..1210ea5a 100644 --- a/tools/bump/report.go +++ b/tools/bump/report.go @@ -63,7 +63,7 @@ func markerOf(results []result, tree, head string) marker { // renderBody writes the pull request body. It leads with what landed and what // did not, because the point of the bot is that the reader can decide from the // body plus the checks without reproducing the run. -func renderBody(results []result, m marker) string { +func renderBody(results []result, m marker, gate string) string { var sb strings.Builder sb.WriteString("Automated version bump.\n\n") @@ -81,8 +81,8 @@ func renderBody(results []result, m marker) string { writeDetails(&sb, results) writeDropped(&sb, results) - sb.WriteString("\nThe integration matrix is left to this pull request's own CI; ") - sb.WriteString("the nix checks and the tailscale builder images were already run in the bump job.\n") + sb.WriteString("\n") + sb.WriteString(gateNote(gate)) sb.WriteString("\n") sb.WriteString(m.render()) sb.WriteString("\n") @@ -158,14 +158,31 @@ func writeLog(sb *strings.Builder, log string) { sb.WriteString("\n ```\n") } +// gateNote says what the bump job did and did not already run, so the reader +// knows how much of the green tick below is new information. +func gateNote(gate string) string { + switch gate { + case gateFull: + return "The nix checks and the tailscale builder images were already run in the bump job; " + + "the integration matrix is left to this pull request's own CI.\n" + case gateQuick: + return "Only `nix build .#checks..build` was run in the bump job; " + + "everything else is left to this pull request's own CI.\n" + default: + return "No gate was run in the bump job; every check below is the first one.\n" + } +} + // cell keeps a markdown table cell from breaking the table. func cell(s string) string { s = strings.ReplaceAll(s, "|", "\\|") s = strings.ReplaceAll(s, "\n", " ") const maxCell = 160 - if len(s) > maxCell { - s = s[:maxCell] + "…" + + runes := []rune(s) + if len(runes) > maxCell { + s = string(runes[:maxCell]) + "…" } if s == "" { diff --git a/tools/bump/report_test.go b/tools/bump/report_test.go index 5f4427dc..c731929c 100644 --- a/tools/bump/report_test.go +++ b/tools/bump/report_test.go @@ -26,7 +26,7 @@ func TestMarkerRoundTrip(t *testing.T) { } want := markerOf(results, "tree-sha", "head-sha") - body := renderBody(results, want) + body := renderBody(results, want, gateFull) got, ok := parseMarker(body) if !ok {