From 98cfdcf196ae42bfb34ce9ad1f5f1f0cdc37d766 Mon Sep 17 00:00:00 2001 From: Danathar Date: Thu, 5 Nov 2026 17:52:23 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(park-recheck):=20a=20park=20?= =?UTF-8?q?with=20options=20waits=20on=20what=20the=20options=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit projectbluefin/server#614 parked on #583 (both options merge it) and listed #584 and #588 among the PRs its red prow check touched. The re-check reported those two merging as "the park reason names it" and called the park out of date while #583 was still open. When a park's lettered options (each option line and the lines under it) name references, only those count as named refs; the rest of the text is evidence. Parks without options, or whose options name nothing, keep every named reference. PRs that refer to the issue still count as before. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar --- changelog.d/fixed-park-recheck-option-refs.md | 1 + src/docs/maintainer-commands.md | 5 +- src/pkg/github/issue_park_recheck.go | 28 ++++++++ .../github/issue_park_recheck_options_test.go | 71 +++++++++++++++++++ 4 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 changelog.d/fixed-park-recheck-option-refs.md create mode 100644 src/pkg/github/issue_park_recheck_options_test.go diff --git a/changelog.d/fixed-park-recheck-option-refs.md b/changelog.d/fixed-park-recheck-option-refs.md new file mode 100644 index 0000000000..07f9fd903b --- /dev/null +++ b/changelog.d/fixed-park-recheck-option-refs.md @@ -0,0 +1 @@ +- The park re-check no longer calls a decision park out of date because a PR its evidence merely lists merged. projectbluefin/server#614 parked on #583 (both options merge it) and listed #584 and #588 among the PRs its red check touched; the re-check reported those two merging as "the park reason names it" while #583 was still open. When a park's lettered options name references, only those count; a park without options, or with options that name none, keeps every named reference. diff --git a/src/docs/maintainer-commands.md b/src/docs/maintainer-commands.md index 2305dd8c94..a823c62e91 100644 --- a/src/docs/maintainer-commands.md +++ b/src/docs/maintainer-commands.md @@ -112,7 +112,10 @@ When, after the park began, a PR or issue the park text names merged or closed, or a PR that refers to the issue ("Refs #N", a closing keyword, "part of", …, a list of at most 10 references) merged, Hive posts one note (``) listing what changed, and edits it in place as -more moves. When such a PR closed unmerged because the hive adopted it, Hive +more moves. When the park offers lettered options that name references, only +those references count as what the park waits on; the rest of its text is +evidence. projectbluefin/server#614 parked on #583, which both options merge, +and the PRs listed only as also red (#584, #588) no longer trigger the note. When such a PR closed unmerged because the hive adopted it, Hive follows it to the hive's copy (the App PR whose body says `Supersedes #N`) and lists the copy too if it merged or closed unmerged; when a person closed the copy, the note quotes the first paragraph of their closing comment (at diff --git a/src/pkg/github/issue_park_recheck.go b/src/pkg/github/issue_park_recheck.go index cfe3b45cbf..b94d513948 100644 --- a/src/pkg/github/issue_park_recheck.go +++ b/src/pkg/github/issue_park_recheck.go @@ -178,6 +178,9 @@ func (c *Client) recheckParkedIssue(ctx context.Context, owner, repo string, iss refs := parkRefsFromTimeline(events) text := c.parkText(issue, comments, start) named := parkNamedRefs(text, owner+"/"+repo, number) + if acted := parkOptionRefs(text, owner+"/"+repo, number); len(acted) > 0 { + named = acted + } lookups := 0 for _, key := range named { if _, ok := refs[key]; ok || lookups >= parkRecheckMaxNamedLookups { @@ -392,6 +395,31 @@ func parkNamedRefs(text, issueRepo string, number int) []string { return out } +// parkOptionRefs returns the references the park's lettered options name: +// each option line and the lines under it, up to a blank line or the next +// option. A park that offers options waits on what they act on; the rest of +// its text is evidence. projectbluefin/server#614 parked on #583 (both +// options merge it) and listed #584 and #588 among the PRs its red check +// touched; the re-check reported those two merging as "the park reason names +// it" while #583 was still open. nil when the park lists no options, so a +// park without options keeps every named reference. +func parkOptionRefs(text, issueRepo string, number int) []string { + var block []string + inOption := false + for _, line := range strings.Split(text, "\n") { + switch { + case unparkOptionLetter(line) != "": + inOption = true + block = append(block, line) + case strings.TrimSpace(line) == "": + inOption = false + case inOption: + block = append(block, line) + } + } + return parkNamedRefs(strings.Join(block, "\n"), issueRepo, number) +} + func parkRefKey(repo string, n int) string { return strings.ToLower(strings.TrimSpace(repo)) + "#" + strconv.Itoa(n) } diff --git a/src/pkg/github/issue_park_recheck_options_test.go b/src/pkg/github/issue_park_recheck_options_test.go new file mode 100644 index 0000000000..4688945758 --- /dev/null +++ b/src/pkg/github/issue_park_recheck_options_test.go @@ -0,0 +1,71 @@ +package github + +import ( + "strings" + "testing" + "time" +) + +// projectbluefin/server#614 parked on #583 (both options merge it); #584 and +// #588 appear only in the evidence ("red on `main` and on PRs #583, #584, +// #588, #594, #613"). The re-check reported #584 and #588 merging as "the +// park reason names it" while #583 stayed open. +const park614 = "**Summary:** prow keeps failing because it tries to merge #583, which edits the build automation.\n\n" + + "- Check: `prow / prow`, red on `main` (cron) and on PRs #583, #584, #588, #594, #613.\n" + + "- Separately, #588's last red run was `HttpError: Service Unavailable` (a GitHub 503), not this cause.\n\n" + + "Option A: Add the `workflow` scope to the token prow uses for merges, then let the cron merge #583.\n" + + "Option B: Merge #583 by hand once; the cron stops retrying it.\n\n" + + "Recommended: B, because it unblocks today." + +func TestParkRecheckOptionsNameWhatTheParkWaitsOn(t *testing.T) { + t.Run("collateral PRs merge, the option's PR is open: no note", func(t *testing.T) { + f := prParkedIssue(614, park614) + f.timeline = append(f.timeline, + prCrossRef("org/repo", 584, true, "closed", parkT0.Add(16*24*time.Hour), parkT0.Add(16*24*time.Hour), "chore: bump"), + prCrossRef("org/repo", 588, true, "closed", parkT0.Add(16*24*time.Hour), parkT0.Add(16*24*time.Hour), "fix: retry"), + prCrossRef("org/repo", 583, true, "open", time.Time{}, time.Time{}, "ci: build.yml")) + recheck(t, f) + if len(f.posted) != 0 { + t.Fatalf("posted %q, want no note while #583 is open", f.posted) + } + }) + t.Run("the option's PR merges: note names it", func(t *testing.T) { + f := prParkedIssue(614, park614) + f.timeline = append(f.timeline, + prCrossRef("org/repo", 588, true, "closed", parkT0.Add(16*24*time.Hour), parkT0.Add(16*24*time.Hour), "fix: retry"), + prCrossRef("org/repo", 583, true, "closed", parkT0.Add(17*24*time.Hour), parkT0.Add(17*24*time.Hour), "ci: build.yml")) + recheck(t, f) + if len(f.posted) != 1 { + t.Fatalf("posted %q", f.posted) + } + wantNote(t, f.posted[0], "- #583 merged on 2026-10-20 (the park reason names it).") + if strings.Contains(f.posted[0], "#588") { + t.Fatalf("collateral #588 listed:\n%s", f.posted[0]) + } + }) +} + +// Options that name no reference leave every named reference in play. +func TestParkRecheckOptionsWithoutRefsKeepNamedRefs(t *testing.T) { + f := prParkedIssue(13, "Open PR #722 finishes most of the gate.\n\nOption A: wait for it\nOption B: close this issue") + f.timeline = append(f.timeline, prCrossRef("org/repo", 722, true, "closed", parkT0.Add(21*24*time.Hour), time.Time{}, "ci: gate")) + recheck(t, f) + if len(f.posted) != 1 { + t.Fatalf("posted %q", f.posted) + } + wantNote(t, f.posted[0], "- #722 was closed without merging") +} + +func TestParkOptionRefs(t *testing.T) { + if got := parkOptionRefs(park614, "org/repo", 614); len(got) != 1 || got[0] != "org/repo#583" { + t.Fatalf("option refs = %v, want only #583", got) + } + // An option's own continuation lines count; a blank line ends it. + text := "**A. Pin the tag.**\nWait for #12 to land.\n\nSee also #99.\n**B. Drop it.**" + if got := parkOptionRefs(text, "org/repo", 1); len(got) != 1 || got[0] != "org/repo#12" { + t.Fatalf("option refs = %v, want #12 from the continuation line", got) + } + if got := parkOptionRefs("Waits on #12 and #13.", "org/repo", 1); got != nil { + t.Fatalf("no options: %v, want nil (every named ref counts)", got) + } +}