From 2445c86c66f3b61f9d8456e4ce8042f9595fa121 Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Fri, 30 Oct 2026 09:26:50 -0400 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20fix:=20ask-policy=20072=20ro?= =?UTF-8?q?w=20stops=20promising=20adoption=20before=20due?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- ...xed-15742-ask-policy-adoption-countdown.md | 1 + src/pkg/dashboard/stage_tracker_adoption.go | 13 +++++++---- .../dashboard/stage_tracker_adoption_test.go | 23 +++++++++++++++++++ 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 changelog.d/fixed-15742-ask-policy-adoption-countdown.md diff --git a/changelog.d/fixed-15742-ask-policy-adoption-countdown.md b/changelog.d/fixed-15742-ask-policy-adoption-countdown.md new file mode 100644 index 0000000000..f6705d9ab7 --- /dev/null +++ b/changelog.d/fixed-15742-ask-policy-adoption-countdown.md @@ -0,0 +1 @@ +- A stage/072 row under `maintainer_policy: ask` no longer claims `hive adopts it in Nm` right up to the due moment for a maintainer's own PR, only to flip to `adopt?`: the engine does not read the author's repository permission until adoption is due, so the tracker names the exception (`unless the author maintains this repository, then it asks`), the same hedge `never` got in #15738. diff --git a/src/pkg/dashboard/stage_tracker_adoption.go b/src/pkg/dashboard/stage_tracker_adoption.go index 3fdfacf454..e3ead89f17 100644 --- a/src/pkg/dashboard/stage_tracker_adoption.go +++ b/src/pkg/dashboard/stage_tracker_adoption.go @@ -224,16 +224,21 @@ func stageTrackerAdoptionText(author string, a StageTrackerAdoption, now time.Ti } // stageTrackerAdoptionNeverHedge qualifies the auto-adopt countdown under -// maintainer_policy: never. The engine has not read the author's repository +// maintainer_policy: never and ask. The engine has not read the author's repository // permission yet (it only does so once due), so a maintainer's head never // reaches the promised moment at all and the row cannot promise adoption for // every author the way it does under adopt (hivecommons/hive#15692). lead is // the conjunction that joins the clause to the text before it. func stageTrackerAdoptionNeverHedge(a StageTrackerAdoption, lead string) string { - if a.Policy != config.AdoptionMaintainerPolicyNever { - return "" + switch a.Policy { + case config.AdoptionMaintainerPolicyNever: + return lead + " the author maintains this repository" + case config.AdoptionMaintainerPolicyAsk: + // ask reads the permission at the same due moment and then asks + // the maintainer instead of adopting (hivecommons/hive#15742). + return lead + " the author maintains this repository, then it asks" } - return lead + " the author maintains this repository" + return "" } // stageTrackerAdoptionOfflineFor renders " 26h" for the time the author's diff --git a/src/pkg/dashboard/stage_tracker_adoption_test.go b/src/pkg/dashboard/stage_tracker_adoption_test.go index 9a66a19cb3..9449f182f2 100644 --- a/src/pkg/dashboard/stage_tracker_adoption_test.go +++ b/src/pkg/dashboard/stage_tracker_adoption_test.go @@ -142,6 +142,29 @@ func TestStageTrackerAdoptionNeverHedgesBeforeDue(t *testing.T) { } } +// hivecommons/hive#15742: ask reads the author's permission at the same due +// moment as never, so its countdown hedges too, saying what ask does. +func TestStageTrackerAdoptionAskHedgesBeforeDue(t *testing.T) { + now := time.Date(2026, 10, 28, 16, 0, 0, 0, time.UTC) + s, store, status := adoptionFixture(t, now, config.AdoptionMaintainerPolicyAsk, offlinePresence(now.Add(-3*time.Hour))) + a := trackerItem(t, s.buildStageTracker(status, store, now), "pr", 14524).Adoption + if a == nil || a.Due || a.BlockedBy != "" || a.Action != "" || a.Policy != "ask" || !a.AutoDue { + t.Fatalf("adoption = %+v", a) + } + if a.Text != "waiting on @hanthor (offline 3h, 2 nudges) — hive adopts it on the next sweep unless the author maintains this repository, then it asks" { + t.Fatalf("text = %q", a.Text) + } + store2 := stagelabels.NewStore("", func() time.Time { return now }) + key := stagelabels.Key("hivecommons/hive", 14524) + store2.Observe(key, stagelabels.ReturnedToContributor, "conflicting") + store2.MarkNudged(key, "feed", 1, false, now.Add(-13*time.Minute)) + s.stageStore = store2 + s.presenceLookup = offlinePresence(now.Add(-13 * time.Minute)) + if a = trackerItem(t, s.buildStageTracker(status, store2, now), "pr", 14524).Adoption; a == nil || a.AutoDue || a.AutoAdoptAt == nil || !a.AutoAdoptAt.Equal(now.Add(2*time.Minute)) || a.Text != "waiting on @hanthor (offline 13m, 1 nudge) — hive adopts it in 2m unless a new head lands or the author maintains this repository, then it asks" { + t.Fatalf("pending text = %+v", a) + } +} + // adopt (default): nothing is held, so the row reports the wait, the // nudges, the presence and — since the engine's own predicate // (automerge.AutoAdoption) is what the row reads — that the hive adopts From 578fa6d7ea5c6eb7ac649903cf414a9e54871cca Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Fri, 30 Oct 2026 15:11:55 -0400 Subject: [PATCH 2/2] test: cover the ask-policy adoption hedge branch Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- src/pkg/dashboard/stage_tracker_adoption_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/pkg/dashboard/stage_tracker_adoption_test.go b/src/pkg/dashboard/stage_tracker_adoption_test.go index 9449f182f2..b364b3a5e8 100644 --- a/src/pkg/dashboard/stage_tracker_adoption_test.go +++ b/src/pkg/dashboard/stage_tracker_adoption_test.go @@ -165,6 +165,19 @@ func TestStageTrackerAdoptionAskHedgesBeforeDue(t *testing.T) { } } +// hivecommons/hive#15742: the hedge clause per maintainer policy. +func TestStageTrackerAdoptionHedgeByPolicy(t *testing.T) { + for _, tc := range []struct{ policy, want string }{ + {config.AdoptionMaintainerPolicyNever, " unless the author maintains this repository"}, + {config.AdoptionMaintainerPolicyAsk, " unless the author maintains this repository, then it asks"}, + {config.AdoptionMaintainerPolicyAdopt, ""}, + } { + if got := stageTrackerAdoptionNeverHedge(StageTrackerAdoption{Policy: tc.policy}, " unless"); got != tc.want { + t.Errorf("policy %q: hedge = %q, want %q", tc.policy, got, tc.want) + } + } +} + // adopt (default): nothing is held, so the row reports the wait, the // nudges, the presence and — since the engine's own predicate // (automerge.AutoAdoption) is what the row reads — that the hive adopts