Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/added-15797-tracker-push-detail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Stage tracker: the "pushed" pill on a CI / Review row now drops once the PR head moves past the pushed commit (hivecommons/hive#15797).
12 changes: 11 additions & 1 deletion src/pkg/dashboard/stage_tracker_push.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func stageTrackerPushFor(it StageTrackerItem, stage stagelabels.Stage, rec stage
return nil
}
login := strings.TrimSpace(it.Author)
if rec.PushedSinceWaiting() && stageTrackerPushSettling(stage, rec) {
if rec.PushedSinceWaiting() && stageTrackerPushOnHead(it, rec) && stageTrackerPushSettling(stage, rec) {
at := rec.LastPushAt
if at.After(now) {
at = now
Expand Down Expand Up @@ -167,3 +167,13 @@ func (s *Server) stageTrackerWaitingPushStale() time.Duration {
}
return (*config.Config)(nil).StageTrackerWaitingPushStale()
}

// stageTrackerPushOnHead reports whether the row's head is still the pushed
// one; once the head moves on, the push is old news (hivecommons/hive#15797).
// A row that carries no head cannot say, so the push stands; so does one
// whose listed head is the one the enumerate last booked — the webhook
// re-read books the push ahead of the list, which still shows the head
// the author pushed over.
func stageTrackerPushOnHead(it StageTrackerItem, rec stagelabels.Record) bool {
return it.Head == "" || strings.EqualFold(it.Head, rec.LastPushSha) || strings.EqualFold(it.Head, rec.ActivityHead)
}
2 changes: 2 additions & 0 deletions src/pkg/dashboard/stage_tracker_push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ func TestStageTrackerPushFor(t *testing.T) {
{name: "pushed, re-staged to 050, checks running", it: it, stage: stagelabels.ReviewPending, rec: stagelabels.Record{Stage: stagelabels.ReviewPending, Reason: "ci-pending", ActivityHead: "bbb2222", LastPushAt: pushedAt, LastPushSha: "bbb2222", WaitingOnHive: true}, hasRec: true, state: "pushed", since: pushedAt, sha: "bbb2222", url: "https://github.com/hivecommons/hive/commit/bbb2222", next: "re-review"},
{name: "pushed on an adopted row, hive working it", it: it, stage: stagelabels.AdoptedByHive, rec: stagelabels.Record{Stage: stagelabels.AdoptedByHive, Reason: "adopted:ci-red", ActivityHead: "bbb2222", LastPushAt: pushedAt, LastPushSha: "bbb2222"}, hasRec: true, state: "pushed", since: pushedAt, sha: "bbb2222", url: "https://github.com/hivecommons/hive/commit/bbb2222", next: "ci"},
{name: "pushed, enumerate has not seen the head yet", it: it, stage: stagelabels.Reviewed, rec: stagelabels.Record{Stage: stagelabels.Reviewed, Reason: "approved:ci-pending", ActivityHead: "aaa1111", LastPushAt: pushedAt, LastPushSha: "bbb2222"}, hasRec: true, state: "pushed", since: pushedAt, sha: "bbb2222", url: "https://github.com/hivecommons/hive/commit/bbb2222", next: "ci"},
{name: "pushed, then the head moved on: the pill goes", it: StageTrackerItem{Kind: "pr", Repo: "hivecommons/hive", Number: 42, Author: "zoe", Head: "ccc3333", URL: "https://github.com/hivecommons/hive/pull/42"}, stage: stagelabels.ReviewPending, rec: stagelabels.Record{Stage: stagelabels.ReviewPending, Reason: "ci-pending", ActivityHead: "bbb2222", LastPushAt: pushedAt, LastPushSha: "bbb2222", WaitingOnHive: true}, hasRec: true, wantNil: true},
{name: "pushed, the list still shows the head pushed over", it: StageTrackerItem{Kind: "pr", Repo: "hivecommons/hive", Number: 42, Author: "zoe", Head: "aaa1111", URL: "https://github.com/hivecommons/hive/pull/42"}, stage: stagelabels.NeedsAuthor, rec: pushed, hasRec: true, state: "pushed", since: pushedAt, sha: "bbb2222", url: "https://github.com/hivecommons/hive/commit/bbb2222", next: "re-review"},
{name: "pushed head settled: the pill goes", it: it, stage: stagelabels.Reviewed, rec: stagelabels.Record{Stage: stagelabels.Reviewed, Reason: "approved", ActivityHead: "bbb2222", LastPushAt: pushedAt, LastPushSha: "bbb2222"}, hasRec: true, wantNil: true},
{name: "push before the wait began is history", it: it, stage: stagelabels.NeedsAuthor, rec: stagelabels.Record{Stage: stagelabels.NeedsAuthor, WaitingPushSince: now.Add(-10 * time.Minute), LastPushAt: now.Add(-20 * time.Minute), LastPushSha: "aaa1111"}, hasRec: true, stale: 4 * time.Hour, state: "waiting", since: now.Add(-10 * time.Minute)},
{name: "no commit link without a PR URL", it: StageTrackerItem{Kind: "pr", Number: 42, Author: "zoe", Head: "bbb2222"}, stage: stagelabels.NeedsAuthor, rec: pushed, hasRec: true, state: "pushed", since: pushedAt, sha: "bbb2222", next: "re-review"},
Expand Down
Loading