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/fixed-returned-to-clanker-owner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Activity Monitor: "Returned to" rows now name the clanker's owner (`@login's clanker`) even when an issue is drawn through its covering PR, instead of the issue author (the hive App bot); rows the supersession sweep found superseded say "Superseded by #N · decide" and the "Close as superseded by…" prompt is prefilled with that PR.
13 changes: 7 additions & 6 deletions src/pkg/dashboard/stage_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -1598,11 +1598,12 @@ func adoptedWorkCaption(reason string) string {
}

// stageTrackerReturnedToHiveCaption rewrites a 072 caption for a
// clanker-authored PR so it names whose hive the PR went back to and who
// sent it: "Returned to @thatguywob's hive — @clubanderson requested
// changes" (hivecommons/hive#15159). The human has already acted and
// nothing is owed by a maintainer, so the "@x must act" tail goes; the
// contributor's hive is the actor.
// clanker-authored PR so it names whose clanker the PR went back to and
// who sent it: "Returned to @thatguywob's clanker — @clubanderson
// requested changes" (hivecommons/hive#15159). The human has already acted
// and nothing is owed by a maintainer, so the "@x must act" tail goes; the
// contributor's clanker is the actor. author is the person the clanker
// acts for (the PR's GitHub author), never the hive App's bot login.
func stageTrackerReturnedToHiveCaption(caption, author string, requesters []string) string {
who := strings.TrimSpace(author)
if who == "" {
Expand All @@ -1618,7 +1619,7 @@ func stageTrackerReturnedToHiveCaption(caption, author string, requesters []stri
if by := mentionLogins(requesters); by != "" {
rest = strings.Replace(rest, " — a maintainer requested changes", " — "+by+" requested changes", 1)
}
return head + "'s hive" + rest
return head + "'s clanker" + rest
}

// mentionLogins is "@a", "@a and @b" or "@a, @b and @c" for the given
Expand Down
14 changes: 7 additions & 7 deletions src/pkg/dashboard/stage_tracker_adoption_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,20 +377,20 @@ func TestStageTrackerAdoptionPersonAuthoredSaysNotAdopted(t *testing.T) {
}
}

// hivecommons/hive#15159: a clanker-authored 072 row names whose hive the
// PR went back to and who sent it; the "@x must act" tail — a person's
// hivecommons/hive#15159: a clanker-authored 072 row names whose clanker
// the PR went back to and who sent it; the "@x must act" tail — a person's
// turn — goes.
func TestStageTrackerReturnedToHiveCaption(t *testing.T) {
cases := []struct {
caption string
requesters []string
want string
}{
{"Returned to @thatguywob — a maintainer requested changes — @thatguywob must act", []string{"clubanderson"}, "Returned to @thatguywob's hive — @clubanderson requested changes"},
{"Returned to @thatguywob — a maintainer requested changes — @thatguywob must act", nil, "Returned to @thatguywob's hive — a maintainer requested changes"},
{"Returned to @thatguywob — a maintainer requested changes — @thatguywob must act (2 nudges sent)", []string{"a", "b"}, "Returned to @thatguywob's hive — @a and @b requested changes (2 nudges sent)"},
{"Returned to @thatguywob — review swarm requested changes — @thatguywob must act", []string{"clubanderson"}, "Returned to @thatguywob's hive — review swarm requested changes"},
{"Returned to @thatguywob — review swarm requested changes — waiting on @thatguywob (offline 2h)", nil, "Returned to @thatguywob's hive — review swarm requested changes — waiting on @thatguywob (offline 2h)"},
{"Returned to @thatguywob — a maintainer requested changes — @thatguywob must act", []string{"clubanderson"}, "Returned to @thatguywob's clanker — @clubanderson requested changes"},
{"Returned to @thatguywob — a maintainer requested changes — @thatguywob must act", nil, "Returned to @thatguywob's clanker — a maintainer requested changes"},
{"Returned to @thatguywob — a maintainer requested changes — @thatguywob must act (2 nudges sent)", []string{"a", "b"}, "Returned to @thatguywob's clanker — @a and @b requested changes (2 nudges sent)"},
{"Returned to @thatguywob — review swarm requested changes — @thatguywob must act", []string{"clubanderson"}, "Returned to @thatguywob's clanker — review swarm requested changes"},
{"Returned to @thatguywob — review swarm requested changes — waiting on @thatguywob (offline 2h)", nil, "Returned to @thatguywob's clanker — review swarm requested changes — waiting on @thatguywob (offline 2h)"},
{"Returned to contributor", nil, "Returned to contributor"},
}
for _, tc := range cases {
Expand Down
16 changes: 8 additions & 8 deletions src/pkg/dashboard/stage_tracker_presence.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const human = { repo: 'hivecommons/hive', number: 15000, kind: 'pr', stage: 71,
presence: { login: 'zoe', state: 'unknown', kind: 'human', since: iso(NOW - 40 * MIN), next: 'wait' } };

test('online clanker: robot head + filled dot, "hive is waiting for them", last seen in words', () => {
assert.strictEqual(api.tip(online14989, NOW), "Waiting on @Danathar's hive (clanker · online, last seen 2 min ago) — hive is waiting for them");
assert.strictEqual(api.tip(online14989, NOW), "Waiting on @Danathar's clanker (online, last seen 2 min ago) — hive is waiting for them");
const dot = api.dot(online14989, NOW);
assert.match(dot, /class="ham-presence ham-presence-online ham-presence-clanker"/);
assert.ok(dot.includes(api.icons.clanker), 'draws the robot head');
Expand All @@ -79,19 +79,19 @@ test('online clanker: robot head + filled dot, "hive is waiting for them", last
assert.match(dot, /data-ham-presence="online"/);
// The online grace still projects an adopt-at: the tooltip says so after the wait.
const graced = Object.assign({}, online14989, { presence: Object.assign({}, online14989.presence, { adopt_at: iso(NOW + 2 * HOUR) }) });
assert.strictEqual(api.tip(graced, NOW), "Waiting on @Danathar's hive (clanker · online, last seen 2 min ago) — hive is waiting for them; adopts at 16:32 UTC (in 2h) if nothing moves");
assert.strictEqual(api.tip(graced, NOW), "Waiting on @Danathar's clanker (online, last seen 2 min ago) — hive is waiting for them; adopts at 16:32 UTC (in 2h) if nothing moves");
});

test('offline clanker: filled square, offline span, adopt-at clock with countdown', () => {
assert.strictEqual(api.tip(offline14524, NOW), "Waiting on @hanthor's hive (clanker · offline 26h) — hive will adopt at 15:10 UTC (in 38m)");
assert.strictEqual(api.tip(offline14524, NOW), "Waiting on @hanthor's clanker (offline 26h) — hive will adopt at 15:10 UTC (in 38m)");
assert.match(api.dot(offline14524, NOW), /ham-presence-offline/);
assert.match(api.dot(offline14524, NOW), /aria-label="@hanthor: clanker offline — hive will adopt at 15:10 UTC \(in 38m\)"/);
// Past due.
const due = Object.assign({}, offline14524, { presence: Object.assign({}, offline14524.presence, { adopt_at: iso(NOW - MIN) }) });
assert.strictEqual(api.tip(due, NOW), "Waiting on @hanthor's hive (clanker · offline 26h) — hive will adopt due now");
assert.strictEqual(api.tip(due, NOW), "Waiting on @hanthor's clanker (offline 26h) — hive will adopt due now");
// Held (maintainer_policy ask): no adopt_at, next=wait — the dot does not promise an adoption the text denies.
const held = Object.assign({}, offline14524, { presence: Object.assign({}, offline14524.presence, { next: 'wait', adopt_at: '' }) });
assert.strictEqual(api.tip(held, NOW), "Waiting on @hanthor's hive (clanker · offline 26h) — hive is waiting for them");
assert.strictEqual(api.tip(held, NOW), "Waiting on @hanthor's clanker (offline 26h) — hive is waiting for them");
// Long absences read in days.
const days = Object.assign({}, offline14524, { presence: Object.assign({}, offline14524.presence, { since: iso(NOW - 80 * HOUR), last_seen: iso(NOW - 80 * HOUR) }) });
assert.match(api.tip(days, NOW), /offline 3d\) — /);
Expand All @@ -112,14 +112,14 @@ test('human: the person glyph and the handle only — no dot, no "(human · no c
assert.ok(!chip.includes('no clanker'));
// An unregistered clanker (another hive's PR) is unknown too — robot head + hollow ring — and adoption's clock runs.
const foreign = { presence: { login: 'bot-x', state: 'unknown', kind: 'clanker', since: iso(NOW - 10 * MIN), next: 'adopt', adopt_at: iso(NOW + 5 * MIN) } };
assert.strictEqual(api.tip(foreign, NOW), "Waiting on @bot-x's hive (clanker · not registered here) — hive will adopt at 14:37 UTC (in 5m)");
assert.strictEqual(api.tip(foreign, NOW), "Waiting on @bot-x's clanker (not registered here) — hive will adopt at 14:37 UTC (in 5m)");
assert.match(flat(api.dot(foreign, NOW)), /class="ham-presence ham-presence-unknown ham-presence-clanker"[^>]*><svg [^>]*><\/svg><i class="ham-presence-dot"><\/i><\/span>$/);
});

test('the indicator sits inside the adoption pill just before the @login and its line joins the tooltip', () => {
const chip = api.adoptionChip(offline14524);
assert.match(chip, /^<span class="ham-badge ham-badge-adoption" title="waiting on @hanthor \(offline 26h, 2 nudges\) · Waiting on @hanthor's hive \(clanker · offline 26h\) — hive will adopt at 15:10 UTC \(in 38m\)"/);
assert.match(chip, /aria-label="Adoption — waiting on @hanthor \(offline 26h, 2 nudges\) · Waiting on @hanthor's hive \(clanker · offline 26h\)/);
assert.match(chip, /^<span class="ham-badge ham-badge-adoption" title="waiting on @hanthor \(offline 26h, 2 nudges\) · Waiting on @hanthor's clanker \(offline 26h\) — hive will adopt at 15:10 UTC \(in 38m\)"/);
assert.match(chip, /aria-label="Adoption — waiting on @hanthor \(offline 26h, 2 nudges\) · Waiting on @hanthor's clanker \(offline 26h\)/);
assert.match(flat(chip), />waiting on <span class="ham-presence ham-presence-offline ham-presence-clanker"[^>]*><svg [^>]*><\/svg><i class="ham-presence-dot"><\/i><\/span>@hanthor<\/span>$/);
// A 071 row has no adoption line: the muted waiting pill carries the dot instead, never both.
assert.strictEqual(api.chip(offline14524), '', 'no second pill beside the adoption one');
Expand Down
14 changes: 7 additions & 7 deletions src/pkg/dashboard/stage_tracker_presence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ const ask = { kind: 'pr', repo: 'hivecommons/hive', number: 14524, stage: 72, au
decision_needed: { question: '@hanthor maintains this repository and has been offline for 26h; adopt the PR?', asked_by: 'the hive', since: iso(NOW - 26 * HOUR), blocker: 'maintainer_policy is ask', options: [{ action: 'decide:adopt', label: 'Adopt (hive takes over)', enabled: true }] },
presence: { login: 'hanthor', state: 'offline', kind: 'clanker', since: iso(NOW - 26 * HOUR), last_seen: iso(NOW - 26 * HOUR), next: 'wait' } };

assert.strictEqual(stageTrackerPresenceTip(online, NOW), "Waiting on @Danathar's hive (clanker · online, last seen 2 min ago) — hive is waiting for them");
assert.match(stageTrackerPresenceTip(offline, NOW), /^Waiting on @hanthor's hive \(clanker · offline 26h\) — hive will adopt at \S+ .*\(in 38m\)$/);
assert.strictEqual(stageTrackerPresenceTip(online, NOW), "Waiting on @Danathar's clanker (online, last seen 2 min ago) — hive is waiting for them");
assert.match(stageTrackerPresenceTip(offline, NOW), /^Waiting on @hanthor's clanker \(offline 26h\) — hive will adopt at \S+ .*\(in 38m\)$/);
assert.strictEqual(stageTrackerPresenceTip(human, NOW), 'Waiting on @zoe (human) — waiting for a human reply');
assert.strictEqual(stageTrackerPresenceTip(ask, NOW), "Waiting on @hanthor's hive (clanker · offline 26h) — hive is waiting for them", 'held adoption promises no adopt-at');
assert.strictEqual(stageTrackerPresenceTip(ask, NOW), "Waiting on @hanthor's clanker (offline 26h) — hive is waiting for them", 'held adoption promises no adopt-at');

// Kind glyph + state class + aria per state; role=img so it reads out.
for (const [item, state, kind, word] of [[online, 'online', 'clanker', 'clanker online'], [offline, 'offline', 'clanker', 'clanker offline'], [human, 'unknown', 'human', 'human']]) {
Expand All @@ -289,23 +289,23 @@ assert.ok(!stageTrackerPresenceDotHtml(human, NOW).includes(STAGE_TRACKER_ICONS.
// Inside the adoption pill, before the @login; the presence line joins the title and aria-label.
const chip = stageTrackerAdoptionChipHtml(offline);
assert.ok(/>waiting on <span class="ham-presence ham-presence-offline ham-presence-clanker"[^>]*><svg [^>]*><\/svg><i class="ham-presence-dot"><\/i><\/span>@hanthor<\/span>$/.test(chip.replace(/<svg ([^>]*)>[\s\S]*?<\/svg>/, '<svg $1></svg>')), chip);
assert.ok(chip.includes("title=\"waiting on @hanthor (offline 26h, 2 nudges) · Waiting on @hanthor&#39;s hive (clanker · offline 26h)"), chip);
assert.ok(chip.includes("aria-label=\"Adoption — waiting on @hanthor (offline 26h, 2 nudges) · Waiting on @hanthor&#39;s hive (clanker"), chip);
assert.ok(chip.includes("title=\"waiting on @hanthor (offline 26h, 2 nudges) · Waiting on @hanthor&#39;s clanker (offline 26h)"), chip);
assert.ok(chip.includes("aria-label=\"Adoption — waiting on @hanthor (offline 26h, 2 nudges) · Waiting on @hanthor&#39;s clanker ("), chip);
assert.strictEqual(stageTrackerPresenceChipHtml(offline), '', 'one pill, not two');
// The "adopt?" trigger carries the dot in front of its word.
const trig = stageTrackerAdoptionChipHtml(ask);
assert.ok(/<button [^>]*ham-decision-trigger[^>]*><span class="ham-presence ham-presence-offline ham-presence-clanker"[^>]*>[\s\S]*<\/span>adopt\?<\/button>$/.test(trig), trig);
// No adoption line (071, a human): the muted waiting pill carries it.
const w = stageTrackerPresenceChipHtml(online);
assert.ok(/^<span class="ham-badge ham-badge-waiting" title="Waiting on @Danathar&#39;s hive \(clanker · online, last seen 2 min ago\) — hive is waiting for them" aria-label="Waiting on @Danathar&#39;s hive \(clanker[^"]*">waiting on <span class="ham-presence ham-presence-online ham-presence-clanker"[^>]*>[\s\S]*<i class="ham-presence-dot"><\/i><\/span>@Danathar<\/span>$/.test(w), w);
assert.ok(/^<span class="ham-badge ham-badge-waiting" title="Waiting on @Danathar&#39;s clanker \(online, last seen 2 min ago\) — hive is waiting for them" aria-label="Waiting on @Danathar&#39;s clanker \([^"]*">waiting on <span class="ham-presence ham-presence-online ham-presence-clanker"[^>]*>[\s\S]*<i class="ham-presence-dot"><\/i><\/span>@Danathar<\/span>$/.test(w), w);
// A human: the person glyph and the handle, nothing else — no dot, no "(human · no clanker)" qualifier.
const hw = stageTrackerPresenceChipHtml(human);
assert.ok(/^<span class="ham-badge ham-badge-waiting" title="Waiting on @zoe \(human\) — waiting for a human reply" aria-label="Waiting on @zoe \(human\) — waiting for a human reply">waiting on <span class="ham-presence ham-presence-unknown ham-presence-human"[^>]*><svg [^>]*>[\s\S]*<\/svg><\/span>@zoe<\/span>$/.test(hw), hw);
assert.ok(!hw.includes('no clanker') && !hw.includes('ham-presence-dot'), hw);
assert.strictEqual(stageTrackerPresenceChipHtml({ kind: 'pr', stage: 71 }), '');
// The Needs-human popover names the presence under the question.
const pop = stageTrackerDecisionPopHtml(ask, [], NOW, '');
assert.ok(/<p class="ham-decision-presence"><span class="ham-presence ham-presence-offline ham-presence-clanker"[^>]*>[\s\S]*?<\/span>Waiting on @hanthor&#39;s hive \(clanker · offline 26h\) — hive is waiting for them<\/p>/.test(pop), pop);
assert.ok(/<p class="ham-decision-presence"><span class="ham-presence ham-presence-offline ham-presence-clanker"[^>]*>[\s\S]*?<\/span>Waiting on @hanthor&#39;s clanker \(offline 26h\) — hive is waiting for them<\/p>/.test(pop), pop);
assert.ok(!stageTrackerDecisionPopHtml(Object.assign({}, ask, { presence: null }), [], NOW, '').includes('ham-decision-presence'));
// Sub-rows and the popover's nested-PR lookup carry the field.
`,
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/dashboard/stage_tracker_rework_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ assert.match(stageTrackerReworkTip(working, NOW), /^@Danathar's clanker picked u
assert.match(stageTrackerReworkTip(pushed, NOW), /^@Danathar pushed a new head 1 min ago \(.*\) · re-review pending$/);
// The pill keeps its class, dot and login; title and aria carry the rework line after the presence line.
const chip = stageTrackerPresenceChipHtml(acked);
assert.ok(/^<span class="ham-badge ham-badge-waiting" title="Waiting on @Danathar&#39;s hive \(clanker · online, last seen 2 min ago\) — hive is waiting for them · @Danathar acknowledged · activity on the PR 20 min ago[^"]*" aria-label="Waiting on @Danathar&#39;s hive[^"]*acknowledged[^"]*">waiting on <span class="ham-presence ham-presence-online ham-presence-clanker"[^>]*>[\s\S]*<\/span>@Danathar · acknowledged<\/span>$/.test(chip), chip);
assert.ok(/^<span class="ham-badge ham-badge-waiting" title="Waiting on @Danathar&#39;s clanker \(online, last seen 2 min ago\) — hive is waiting for them · @Danathar acknowledged · activity on the PR 20 min ago[^"]*" aria-label="Waiting on @Danathar&#39;s clanker[^"]*acknowledged[^"]*">waiting on <span class="ham-presence ham-presence-online ham-presence-clanker"[^>]*>[\s\S]*<\/span>@Danathar · acknowledged<\/span>$/.test(chip), chip);
// Same on the 072 adoption pill.
const adopt = Object.assign({}, working, { stage: 72, adoption: { author: 'Danathar', due: false, nudges: 1, author_online: true, author_registered: true, policy: 'adopt', text: 'waiting on @Danathar (online, 1 nudge)' } });
const achip = stageTrackerAdoptionChipHtml(adopt);
Expand Down
8 changes: 8 additions & 0 deletions src/pkg/dashboard/stage_tracker_row_actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func stageTrackerRowActionsPreamble(t *testing.T, html string) string {
jsFunc(t, html, "stageTrackerDelegateTargets"),
jsFunc(t, html, "stageTrackerDecideOptions"),
jsFunc(t, html, "stageTrackerSupersederOptions"),
jsFunc(t, html, "stageTrackerSupersederDefault"),
jsFunc(t, html, "stageTrackerSupersederValid"),
jsFunc(t, html, "stageTrackerTriageNeeded"),
jsFunc(t, html, "stageTrackerTriageNewState"),
Expand Down Expand Up @@ -312,6 +313,13 @@ assert.strictEqual(stageTrackerSupersederValid('o/r#457', [tgt]), true);
assert.strictEqual(stageTrackerSupersederValid('https://github.com/o/r/pull/457', [tgt]), true);
assert.strictEqual(typeof stageTrackerSupersederValid('458', [tgt]), 'string', 'self-supersession is refused');
assert.strictEqual(typeof stageTrackerSupersederValid('nope', [tgt]), 'string');
// The prompt prefills the sweep's finding (hive's hive #15303 → #15304), the
// lone sibling when there is no finding, and nothing otherwise.
assert.strictEqual(stageTrackerSupersederDefault([{ repo: 'o/r', number: 458, superseded: { reason: 'superseded', closer_pr: 457, closer_repo: 'r' } }]), 'o/r#457');
assert.strictEqual(stageTrackerSupersederDefault([{ repo: 'o/r', number: 458, superseded: { closer_pr: 457, closer_repo: 'o/other' } }]), 'o/other#457');
assert.strictEqual(stageTrackerSupersederDefault([{ repo: 'o/r', number: 458, superseded: true, siblings: [457] }]), 'o/r#457');
assert.strictEqual(stageTrackerSupersederDefault([{ repo: 'o/r', number: 458, siblings: [1, 2] }]), '');
assert.strictEqual(stageTrackerSupersederDefault([{ repo: 'o/r', number: 458, superseded: { closer_pr: 457 } }, { repo: 'o/r', number: 459 }]), '', 'bulk selections are not prefilled');

// A reader: hold/decide disabled with the reason; needs-human needs merger.
as = stageTrackerRowActions(parked, { user: false, canHold: false, canHuman: false });
Expand Down
Loading
Loading