From ea23fb2b95f6fa30048492e65f6b19d4bf206e4b Mon Sep 17 00:00:00 2001 From: onkar717 Date: Fri, 30 Oct 2026 14:43:42 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20never-policy=20072=20row?= =?UTF-8?q?=20stops=20promising=20adoption=20it=20can't=20back?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The engine only reads a contributor's repository permission once adoption is due (adoptContributorPR gates maintainerHoldsAdoption behind the due check), so a stage/072 row under maintainer_policy: never had no AdoptionBlocked record before that moment and nothing to tell it apart, in the dashboard's own data, from a row the hive will truly auto-adopt. The tracker read "hive adopts it in Nm" right up to the due moment for a maintainer's own PR, then flipped to "not adopted: maintainer_policy is never". stageTrackerAdoptionText now names the exception for the never policy's auto-adopt countdown instead of promising an outcome it cannot back for every author: "… unless the author maintains this repository". Hive-Run: hivecommons/hive#15692 Hive-Plan: review-backlog-correctness Hive-Spec: issue-15692#stage_tracker_adoption_never_policy_text Signed-off-by: onkar717 --- .../fixed-15692-never-adopt-countdown.md | 1 + src/docs/labels-and-control-signals.md | 6 +++- src/pkg/dashboard/stage_tracker_adoption.go | 9 ++++++ .../dashboard/stage_tracker_adoption_test.go | 32 +++++++++++++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 changelog.d/fixed-15692-never-adopt-countdown.md diff --git a/changelog.d/fixed-15692-never-adopt-countdown.md b/changelog.d/fixed-15692-never-adopt-countdown.md new file mode 100644 index 0000000000..98887b43f0 --- /dev/null +++ b/changelog.d/fixed-15692-never-adopt-countdown.md @@ -0,0 +1 @@ +- A stage/072 row under `maintainer_policy: never` no longer claims `hive adopts it in Nm` right up to the due moment for a maintainer's own PR, only to flip to `not adopted: maintainer_policy is never`: 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`) instead of promising an outcome it cannot back for every author. diff --git a/src/docs/labels-and-control-signals.md b/src/docs/labels-and-control-signals.md index 7cefcc16a6..4724f5f9c5 100644 --- a/src/docs/labels-and-control-signals.md +++ b/src/docs/labels-and-control-signals.md @@ -1931,7 +1931,11 @@ When a contributor-agent PR goes red the hive does not just relabel it (a human- tracker's 072 pill reads `… — hive adopts it in 3m unless a new head lands` while the clock runs and `… — hive adopts it on the next sweep` once it has. **Adopt now** stays as the override for a clock that has - not run out yet. + not run out yet. Under `maintainer_policy: never` the engine has not + read the author's repository permission yet at this point — it only + does so once due — so the pill cannot promise that outcome for every + author; it names the exception instead: `… unless the author maintains + this repository` (hivecommons/hive#15692). A PR carrying `hold`, `do-not-merge` or `do-not-merge/hold` is never adopted (a human parked it; one log line, the stage stays 072). A PR whose diff trips the contributor lane's diff fences — it touches diff --git a/src/pkg/dashboard/stage_tracker_adoption.go b/src/pkg/dashboard/stage_tracker_adoption.go index 44430b8925..306aad9e59 100644 --- a/src/pkg/dashboard/stage_tracker_adoption.go +++ b/src/pkg/dashboard/stage_tracker_adoption.go @@ -214,6 +214,15 @@ func stageTrackerAdoptionText(author string, a StageTrackerAdoption, now time.Ti text += " — not adopted: a maintainer approved this head; the hive merges it as-is" case a.BlockedBy != "": text += " — not adopted: " + a.BlockedBy + case a.Policy == config.AdoptionMaintainerPolicyNever && a.AutoDue: + // The engine has not read the author's repository permission yet + // (it only does so once due): under never, a maintainer's head + // never reaches this moment at all, so the row cannot promise + // adoption the way the non-never case below does + // (hivecommons/hive#15692). + text += " — hive adopts it on the next sweep unless the author maintains this repository" + case a.Policy == config.AdoptionMaintainerPolicyNever && a.AutoAdoptAt != nil && a.AutoAdoptAt.After(now): + text += " — hive adopts it in " + stageTrackerShortDuration(max(a.AutoAdoptAt.Sub(now), time.Minute)) + " unless a new head lands or the author maintains this repository" case a.AutoDue: text += " — hive adopts it on the next sweep" case a.AutoAdoptAt != nil && a.AutoAdoptAt.After(now): diff --git a/src/pkg/dashboard/stage_tracker_adoption_test.go b/src/pkg/dashboard/stage_tracker_adoption_test.go index 071036df24..9a66a19cb3 100644 --- a/src/pkg/dashboard/stage_tracker_adoption_test.go +++ b/src/pkg/dashboard/stage_tracker_adoption_test.go @@ -110,6 +110,38 @@ func TestStageTrackerAdoptionNeverSaysSo(t *testing.T) { } } +// hivecommons/hive#15692: the engine only reads the author's repository +// permission once adoption is due (automerge_contributor_adopt.go), so a +// never-policy row that has not reached that moment yet has no +// AdoptionBlocked record — nothing distinguishes it, in the dashboard's +// own data, from a row the hive will truly auto-adopt. Before this fix the +// row read "hive adopts it in Nm" right up to the due moment, then flipped +// to "not adopted: maintainer_policy is never" for a maintainer's PR. The +// row now names the exception instead of promising an outcome it cannot +// back for every author. +func TestStageTrackerAdoptionNeverHedgesBeforeDue(t *testing.T) { + now := time.Date(2026, 10, 28, 16, 0, 0, 0, time.UTC) + s, store, status := adoptionFixture(t, now, config.AdoptionMaintainerPolicyNever, 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 != "never" || !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" { + t.Fatalf("text = %q", a.Text) + } + // Nudged 13 minutes ago, offline: the pending countdown carries the + // same hedge. + 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" { + 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