From 94ed43c7a5262972b79a7c811c0d6bca01f6ebcb Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Sat, 31 Oct 2026 07:07:40 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(dashboard):=20read=20a=20reg?= =?UTF-8?q?istered=20contributor's=20PR=20as=20their=20clanker=20in=20the?= =?UTF-8?q?=20Activity=20Monitor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tracker's author-kind rules lacked pkg/authorkind rule 6 (contributor registry โ†’ clanker), so a relay PR with no author/ label or attribution trailer read as an inferred person while the stage engine, which does consult the registry, adopted it as a clanker's. Overlay the registry on inferred kinds for PR and issue rows (labels and the App login still win) with author_kind_source "registry"; the claimant, row icon, tooltip and pill holder all follow that one value. Fixes hivecommons/hive#16015 Signed-off-by: Andrew Anderson --- ...cker-registered-contributor-author-kind.md | 1 + src/docs/dashboard.md | 2 +- src/pkg/dashboard/stage_tracker.go | 25 +++++++- src/pkg/dashboard/stage_tracker_build.go | 2 + src/pkg/dashboard/stage_tracker_test.go | 60 +++++++++++++++++++ .../dashboard/stage_tracker_ui_rows_test.go | 5 ++ .../static-src/js/tracker-row-strip.js | 5 +- src/pkg/dashboard/static/index.html | 5 +- 8 files changed, 100 insertions(+), 5 deletions(-) create mode 100644 changelog.d/fixed-tracker-registered-contributor-author-kind.md diff --git a/changelog.d/fixed-tracker-registered-contributor-author-kind.md b/changelog.d/fixed-tracker-registered-contributor-author-kind.md new file mode 100644 index 0000000000..aec16d488f --- /dev/null +++ b/changelog.d/fixed-tracker-registered-contributor-author-kind.md @@ -0,0 +1 @@ +- Activity Monitor: a PR or issue by a registered contributor-hub clanker owner now reads as a clanker (author_kind_source `registry`) instead of an inferred person, so the row icon, its tooltip and the stage pill's holder ("@login's clanker") agree with the stage engine that adopts such PRs. diff --git a/src/docs/dashboard.md b/src/docs/dashboard.md index 711f5598f6..696653bb28 100644 --- a/src/docs/dashboard.md +++ b/src/docs/dashboard.md @@ -572,7 +572,7 @@ The **Hive activity monitor** section (sidebar, Dashboard group; expanded by def **Sounds (opt-in).** The speaker chip at the right end of the toolbar (๐Ÿ”‡ off / ๐Ÿ”Š on; default off, remembered per browser under the `localStorage` key `hive.tracker.sound`) enables two short sounds, both synthesised in the browser with the Web Audio API (no audio file, no network request). The **merge zap** โ€” just under half a second of bug-zapper arc: a ~4 ms high-voltage "snap", then a sputtering electric sizzle (bright noise and a 240 Hz square chopped by a 120 Hz mains pulse train, dropping out and re-striking at random) that holds ~80 ms and dies away, high-passed at 700 Hz โ€” plays when a pull request the tab was already showing merges while the page is open. The trigger compares tracker payloads: a PR counts as merged when its stage reaches the โœ“ cap or when its key appears in the payload's `recently_merged` list (the hive's `pr_merged` audit entries of the last 30 minutes โ€” sweep, queue, relay and human merges the PR poller observed alike โ€” which is how a PR that simply dropped out of the open list is told apart from one closed unmerged). Entries that name the repo by its configured short name are qualified to the `owner/name` the rows carry, and a PR that drops off the list a poll before its audit entry lands is still remembered as open until `recently_merged` settles it, so the two never have to arrive in the same payload. It never fires on the first load, for rows that were already merged, for issues, or for a PR it has already zapped; several merges in one refresh play at most two zaps. The **new-item buzz** โ€” a quieter 0.18 s sawtooth near 120 Hz with a ~30 Hz tremolo through a lowpass โ€” plays when an issue or pull request appears on the list that the previous payload did not have; it never fires on the first populated payload, buzzes once per item, and plays at most two buzzes per refresh. Nothing plays while the tab is hidden. Turning the chip on plays one zap then one buzz so you can hear both. The audio context is created on a user gesture and resumed if the browser suspended it; if the autoplay policy still holds it suspended when a sound is due, that sound is skipped and the next click or key press re-arms it. Detection runs over the union of every configured repo's rows, keyed `owner/name/kind#number`, so the sounds fire for each repo the hive governs. Either sound can be replaced from the card's โš™ settings modal with a user-supplied file (WAV or anything `decodeAudioData` accepts, capped at 4 MB) stored in the browser's IndexedDB (`hive-tracker-sounds`); a stored file that fails to decode falls back to the built-in voice. The modal also carries the **Play sounds** master toggle and a 0โ€“100 **Volume** slider (`localStorage` key `hive.tracker.sound.volume`) that scales the master gain of both built-in and uploaded sounds. Closed issues are not an event the tracker payload carries, so nothing plays for them. -The endpoint returns `stages` (the stage table with `short`, `branch_from`, configured dwell and `falls_to` โ€” the lower same-kind stages a move to which is a regression per the stage engine, so the event line says "fell back to" only for those; 015 โ†’ 010 triage accepted, 085 โ†’ 080 decision made and 072 โ†’ 070 author resuming read "moved to"), `items` (one per open issue/PR represented by the status snapshot, including actionable and held items plus display-only non-actionable issues, drafts, and exempt PRs: `labels`, `created_at`, `updated_at`, `bucket`, `bucket_reason`, stage, `stage_since`, humanised `reason`/`caption`, `actor`, `modifiers`, `author_kind` + `author_kind_source`, `lane`, `tier`, `linked_pr`, `linked_prs` (number, title, url, author, author kind, stage, `stage_since`, `caption` and `modifiers` of each open covering PR โ€” enough to draw the nested sub-row without a second lookup), `nested_under` (on a PR: the issue it is listed under), nudge info and the last eight `history` hops from the stage store) and `author_kind_labels`. It answers `{"status":"initializing"}` until the first scan. +The endpoint returns `stages` (the stage table with `short`, `branch_from`, configured dwell and `falls_to` โ€” the lower same-kind stages a move to which is a regression per the stage engine, so the event line says "fell back to" only for those; 015 โ†’ 010 triage accepted, 085 โ†’ 080 decision made and 072 โ†’ 070 author resuming read "moved to"), `items` (one per open issue/PR represented by the status snapshot, including actionable and held items plus display-only non-actionable issues, drafts, and exempt PRs: `labels`, `created_at`, `updated_at`, `bucket`, `bucket_reason`, stage, `stage_since`, humanised `reason`/`caption`, `actor`, `modifiers`, `author_kind` + `author_kind_source` (`label`, `inferred`, or `registry` โ€” the author has a contributor-hub profile on this hive, so their clanker pushed it; the row icon, tooltip and claimant all read this one value), `lane`, `tier`, `linked_pr`, `linked_prs` (number, title, url, author, author kind, stage, `stage_since`, `caption` and `modifiers` of each open covering PR โ€” enough to draw the nested sub-row without a second lookup), `nested_under` (on a PR: the issue it is listed under), nudge info and the last eight `history` hops from the stage store) and `author_kind_labels`. It answers `{"status":"initializing"}` until the first scan. ## PR review and link signals diff --git a/src/pkg/dashboard/stage_tracker.go b/src/pkg/dashboard/stage_tracker.go index 81b9c888f5..53f7136df3 100644 --- a/src/pkg/dashboard/stage_tracker.go +++ b/src/pkg/dashboard/stage_tracker.go @@ -304,7 +304,8 @@ type StageTrackerItem struct { BucketReason string `json:"bucket_reason,omitempty"` // AuthorKind is human / clanker / hive ("" = unknown) and // AuthorKindSource says whether it came from an author/ label - // ("label") or was inferred from the PR's hive markers ("inferred"). + // ("label"), was inferred from the PR's hive markers ("inferred") or + // from the author's contributor-hub registration ("registry"). AuthorKind string `json:"author_kind,omitempty"` AuthorKindSource string `json:"author_kind_source,omitempty"` // Tier is the author/ admission label without its prefix. @@ -886,9 +887,29 @@ const ( authorKindLabelPfx = "author/" authorKindSrcLabel = "label" authorKindSrcInfer = "inferred" - botLoginSuffix = "[bot]" + // authorKindSrcRegistry: the author has a contributor-hub profile on + // this hive, so its connected clanker pushed the item (authorkind rule + // "registry", the same one the stage engine applies). + authorKindSrcRegistry = "registry" + botLoginSuffix = "[bot]" ) +// stageTrackerRegistryAuthorKind overlays the contributor-hub registry on +// an inferred author kind, mirroring pkg/authorkind rule 6 (RelayKnown โ†’ +// Clanker) so the tracker row and its claimant agree with the stage +// engine's own classification (hivecommons/hive#16015). An author/ +// label and a hive (App-authored) verdict are stronger and stand; a +// registered contributor's login otherwise reads clanker, source registry. +func stageTrackerRegistryAuthorKind(kind, source, author string, isClankerOwner func(string) bool) (string, string) { + if source == authorKindSrcLabel || kind == authorKindHive || isClankerOwner == nil { + return kind, source + } + if author = strings.TrimSpace(author); author == "" || !isClankerOwner(author) { + return kind, source + } + return authorKindClanker, authorKindSrcRegistry +} + // stageTrackerBranchFrom says which main segment a detour stage hangs off. // The PR strip collapses 050 and 060 into one "CI / Review" chevron (060 is // pre-admission: approved, CI still pending or red), so review-side detours diff --git a/src/pkg/dashboard/stage_tracker_build.go b/src/pkg/dashboard/stage_tracker_build.go index b1a71f8d06..a77175f644 100644 --- a/src/pkg/dashboard/stage_tracker_build.go +++ b/src/pkg/dashboard/stage_tracker_build.go @@ -301,6 +301,7 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto } else if strings.HasSuffix(strings.ToLower(issue.Author), botLoginSuffix) { it.AuthorKind, it.AuthorKindSource = authorKindHive, authorKindSrcInfer } + it.AuthorKind, it.AuthorKindSource = stageTrackerRegistryAuthorKind(it.AuthorKind, it.AuthorKindSource, it.Author, isClankerOwner) if l, ok := config.FirstOriginLabel(issue.Labels); ok { it.Origin = config.OriginSourceOf(l) } else { @@ -374,6 +375,7 @@ func (s *Server) buildStageTracker(status *StatusPayload, store *stagelabels.Sto it.BaseRef = pr.BaseRef it.ciRed = strings.EqualFold(pr.CIStatus, "failure") || len(pr.FailingChecks) > 0 it.AuthorKind, it.AuthorKindSource = stageTrackerAuthorKind(pr.Labels, pr.Author, pr.AppAuthored, pr.HiveAttributed) + it.AuthorKind, it.AuthorKindSource = stageTrackerRegistryAuthorKind(it.AuthorKind, it.AuthorKindSource, it.Author, isClankerOwner) if it.AuthorKindSource == authorKindSrcLabel { resp.AuthorKindLabels = true } diff --git a/src/pkg/dashboard/stage_tracker_test.go b/src/pkg/dashboard/stage_tracker_test.go index d0fcaec7c9..a4ea892e98 100644 --- a/src/pkg/dashboard/stage_tracker_test.go +++ b/src/pkg/dashboard/stage_tracker_test.go @@ -1174,3 +1174,63 @@ func TestStageTrackerEnrichSoftLinks(t *testing.T) { t.Fatalf("issues GETs in one rebuild = %d, want the cap %d", n, stageTrackerLinkLookups) } } + +// hivecommons/hive#16015: the row's author kind and its claimant come from +// one source of truth. A login with a contributor-hub profile is a clanker +// owner (pkg/authorkind rule "registry", the one the stage engine applies +// when it adopts), so the tracker must not read it as a person just because +// the PR carries no author/ label or hive marker. +func TestStageTrackerRegistryAuthorKind(t *testing.T) { + owner := func(login string) bool { return strings.EqualFold(login, "karibhou") } + cases := []struct { + kind, src, author string + owner func(string) bool + wantKind, wantSrc string + }{ + {authorKindHuman, authorKindSrcInfer, "Karibhou", owner, authorKindClanker, authorKindSrcRegistry}, + {authorKindHuman, authorKindSrcInfer, "pat", owner, authorKindHuman, authorKindSrcInfer}, + {authorKindHuman, authorKindSrcLabel, "karibhou", owner, authorKindHuman, authorKindSrcLabel}, + {authorKindHive, authorKindSrcInfer, "karibhou", owner, authorKindHive, authorKindSrcInfer}, + {"", "", "karibhou", owner, authorKindClanker, authorKindSrcRegistry}, + {authorKindHuman, authorKindSrcInfer, "karibhou", nil, authorKindHuman, authorKindSrcInfer}, + {authorKindHuman, authorKindSrcInfer, "", owner, authorKindHuman, authorKindSrcInfer}, + } + for _, c := range cases { + k, src := stageTrackerRegistryAuthorKind(c.kind, c.src, c.author, c.owner) + if k != c.wantKind || src != c.wantSrc { + t.Errorf("%q/%q/%q: got %q/%q want %q/%q", c.kind, c.src, c.author, k, src, c.wantKind, c.wantSrc) + } + } +} + +func TestStageTrackerRegisteredContributorIsClanker(t *testing.T) { + setupContributeEnv(t) + if err := saveContributorProfile(&ContributorProfile{GitHubUsername: "Karibhou", ContributorID: "c-karibhou", TrustTier: "trusted"}); err != nil { + t.Fatal(err) + } + now := time.Date(2026, 10, 21, 18, 49, 0, 0, time.UTC) + s, store := stageTrackerFixture(t, now) + s.statusMu.RLock() + status := s.status + s.statusMu.RUnlock() + resp := s.buildStageTracker(status, store, now) + + pr101 := trackerItem(t, resp, "pr", 101) + if pr101.AuthorKind != authorKindClanker || pr101.AuthorKindSource != authorKindSrcRegistry { + t.Fatalf("pr101 by registered contributor: kind=%q src=%q, want clanker/registry", pr101.AuthorKind, pr101.AuthorKindSource) + } + if pr101.Claimant == nil || pr101.Claimant.Kind != claimantKindClanker || pr101.Claimant.Login != "karibhou" { + t.Fatalf("pr101 claimant = %+v, want the contributor's clanker", pr101.Claimant) + } + if issue7 := trackerItem(t, resp, "issue", 7); issue7.AuthorKind != authorKindClanker || issue7.AuthorKindSource != authorKindSrcRegistry { + t.Fatalf("issue7 by registered contributor: kind=%q src=%q", issue7.AuthorKind, issue7.AuthorKindSource) + } + // Labels and the App's own login outrank the registry. + if pr102 := trackerItem(t, resp, "pr", 102); pr102.AuthorKind != authorKindHive || pr102.AuthorKindSource != authorKindSrcLabel { + t.Fatalf("pr102: kind=%q src=%q", pr102.AuthorKind, pr102.AuthorKindSource) + } + // A hive-attributed relay PR keeps its marker-inferred source. + if pr103 := trackerItem(t, resp, "pr", 103); pr103.AuthorKind != authorKindClanker || pr103.AuthorKindSource != authorKindSrcInfer { + t.Fatalf("pr103: kind=%q src=%q", pr103.AuthorKind, pr103.AuthorKindSource) + } +} diff --git a/src/pkg/dashboard/stage_tracker_ui_rows_test.go b/src/pkg/dashboard/stage_tracker_ui_rows_test.go index c3383fe467..2924a3622d 100644 --- a/src/pkg/dashboard/stage_tracker_ui_rows_test.go +++ b/src/pkg/dashboard/stage_tracker_ui_rows_test.go @@ -356,6 +356,11 @@ assert.strictEqual(stageTrackerTrailText({ history: [] }), ''); assert.strictEqual(stageTrackerTrailText({}), ''); assert.strictEqual(stageTrackerTrailText({ history: [{ number: 0 }, { number: 10 }] }), 'Open โ†’ Actionable', '000 reads as Open'); assert.ok(!stageTrackerTooltip({ kind: 'pr', number: 1, stage: 50, history: [{ number: 999 }, { number: 998 }] }, now).includes('Trail:'), 'no Trail clause when nothing can be named'); +// hivecommons/hive#16015: a registered contributor's PR reads as their clanker, +// and the tooltip says the registry decided it; an inferred kind still says so. +assert.ok(stageTrackerTooltip({ kind: 'pr', number: 15998, stage: 74, author: 'Karibhou', author_kind: 'clanker', author_kind_source: 'registry' }, now).includes('Author: @Karibhou (agent, registered contributor)'), 'registry source named in the tooltip'); +assert.ok(stageTrackerTooltip({ kind: 'pr', number: 1, stage: 50, author: 'pat', author_kind: 'human', author_kind_source: 'inferred' }, now).includes('Author: @pat (person, inferred)'), 'inferred source still named'); +assert.ok(stageTrackerTooltip({ kind: 'pr', number: 1, stage: 50, author: 'pat', author_kind: 'human', author_kind_source: 'label' }, now).includes('Author: @pat (person)'), 'label source says nothing'); const savedStages = _stageTracker; _stageTracker = null; assert.strictEqual(stageTrackerTrailText(live14787), 'review-pending โ†’ needs-author โ†’ review-pending โ†’ needs-decision', 'the slug stands in before the stage table loads'); diff --git a/src/pkg/dashboard/static-src/js/tracker-row-strip.js b/src/pkg/dashboard/static-src/js/tracker-row-strip.js index e9d5400707..3bae2483c2 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row-strip.js +++ b/src/pkg/dashboard/static-src/js/tracker-row-strip.js @@ -209,6 +209,9 @@ const ak = item.author_kind || ''; // Plain words for author_kind in hover text (hivecommons/hive#15394). const akPlain = { human: 'person', clanker: 'agent', hive: 'hive', bot: 'bot' }; + // How the kind was read: author/ label (said nothing), hive + // markers, or the author's contributor-hub profile (hivecommons/hive#16015). + const akSource = { inferred: ', inferred', registry: ', registered contributor' }[item.author_kind_source] || ''; const mods = Array.isArray(item.modifiers) ? item.modifiers : []; const sinceMs = Date.parse(item.stage_since || ''); const trail = stageTrackerTrailText(item); @@ -216,7 +219,7 @@ const lines = openHeld ? [stageTrackerHeadline(item) + (item.caption || item.reason ? ' ยท ' + (item.caption || item.reason) : '') + (item.repo ? ' ยท ' + item.repo : '')] : [stageTrackerHeadline(item), item.caption || item.reason || '', item.repo || '']; - if (item.author || ak) lines.push('Author: ' + (item.author ? '@' + item.author : '') + (ak ? ' (' + (akPlain[ak] || ak) + (item.author_kind_source === 'inferred' ? ', inferred' : '') + ')' : '') + (item.tier ? ' ยท ' + item.tier : '')); + if (item.author || ak) lines.push('Author: ' + (item.author ? '@' + item.author : '') + (ak ? ' (' + (akPlain[ak] || ak) + akSource + ')' : '') + (item.tier ? ' ยท ' + item.tier : '')); if (item.origin) lines.push('Origin: origin/' + item.origin); if (item.kind === 'issue' && Array.isArray(item.linked_prs) && item.linked_prs.length) lines.push('Covering PR: ' + item.linked_prs.map(lp => Number(lp.number) || 0).sort((x, y) => x - y).map(n => '#' + n).join(', ')); else if (item.kind === 'issue' && item.linked_pr) lines.push('Covering PR: #' + item.linked_pr + (typeof stageTrackerLineageClause === 'function' ? stageTrackerLineageClause(item) : '')); diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 51a950591b..8ac51ebef6 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -17241,6 +17241,9 @@

Where to get help

const ak = item.author_kind || ''; // Plain words for author_kind in hover text (hivecommons/hive#15394). const akPlain = { human: 'person', clanker: 'agent', hive: 'hive', bot: 'bot' }; + // How the kind was read: author/ label (said nothing), hive + // markers, or the author's contributor-hub profile (hivecommons/hive#16015). + const akSource = { inferred: ', inferred', registry: ', registered contributor' }[item.author_kind_source] || ''; const mods = Array.isArray(item.modifiers) ? item.modifiers : []; const sinceMs = Date.parse(item.stage_since || ''); const trail = stageTrackerTrailText(item); @@ -17248,7 +17251,7 @@

Where to get help

const lines = openHeld ? [stageTrackerHeadline(item) + (item.caption || item.reason ? ' ยท ' + (item.caption || item.reason) : '') + (item.repo ? ' ยท ' + item.repo : '')] : [stageTrackerHeadline(item), item.caption || item.reason || '', item.repo || '']; - if (item.author || ak) lines.push('Author: ' + (item.author ? '@' + item.author : '') + (ak ? ' (' + (akPlain[ak] || ak) + (item.author_kind_source === 'inferred' ? ', inferred' : '') + ')' : '') + (item.tier ? ' ยท ' + item.tier : '')); + if (item.author || ak) lines.push('Author: ' + (item.author ? '@' + item.author : '') + (ak ? ' (' + (akPlain[ak] || ak) + akSource + ')' : '') + (item.tier ? ' ยท ' + item.tier : '')); if (item.origin) lines.push('Origin: origin/' + item.origin); if (item.kind === 'issue' && Array.isArray(item.linked_prs) && item.linked_prs.length) lines.push('Covering PR: ' + item.linked_prs.map(lp => Number(lp.number) || 0).sort((x, y) => x - y).map(n => '#' + n).join(', ')); else if (item.kind === 'issue' && item.linked_pr) lines.push('Covering PR: #' + item.linked_pr + (typeof stageTrackerLineageClause === 'function' ? stageTrackerLineageClause(item) : ''));